summaryrefslogtreecommitdiff
path: root/apps/plugins/oscilloscope.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/oscilloscope.c')
-rw-r--r--apps/plugins/oscilloscope.c69
1 files changed, 9 insertions, 60 deletions
diff --git a/apps/plugins/oscilloscope.c b/apps/plugins/oscilloscope.c
index b69d15daae..de85dc3950 100644
--- a/apps/plugins/oscilloscope.c
+++ b/apps/plugins/oscilloscope.c
@@ -24,6 +24,7 @@
24 24
25#ifdef HAVE_LCD_BITMAP /* and also not for the Player */ 25#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
26#if CONFIG_CODEC != SWCODEC /* only for MAS-targets */ 26#if CONFIG_CODEC != SWCODEC /* only for MAS-targets */
27#include "xlcd.h"
27 28
28PLUGIN_HEADER 29PLUGIN_HEADER
29 30
@@ -77,88 +78,34 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter);
77 78
78/* implementation */ 79/* implementation */
79 80
80void lcd_scroll_left(int count, bool black_border)
81{
82 int by;
83 unsigned filler;
84 unsigned char *ptr;
85
86 if ((unsigned) count >= LCD_WIDTH)
87 return;
88
89 filler = black_border ? 0xFF : 0;
90
91 for (by = 0; by < (LCD_HEIGHT/8); by++)
92 {
93 ptr = rb->lcd_framebuffer + MULU16(LCD_WIDTH, by);
94 asm volatile (
95 "mov %0,r1 \n" /* check if both source... */
96 "or %2,r1 \n" /* ...and offset are even */
97 "shlr r1 \n" /* -> lsb = 0 */
98 "bf .sl_start2 \n" /* -> copy word-wise */
99
100 "add #-1,%2 \n" /* copy byte-wise */
101 ".sl_loop1: \n"
102 "mov.b @%0+,r1 \n"
103 "mov.b r1,@(%2,%0) \n"
104 "cmp/hi %0,%1 \n"
105 "bt .sl_loop1 \n"
106
107 "bra .sl_end \n"
108 "nop \n"
109
110 ".sl_start2: \n" /* copy word-wise */
111 "add #-2,%2 \n"
112 ".sl_loop2: \n"
113 "mov.w @%0+,r1 \n"
114 "mov.w r1,@(%2,%0) \n"
115 "cmp/hi %0,%1 \n"
116 "bt .sl_loop2 \n"
117
118 ".sl_end: \n"
119 : /* outputs */
120 : /* inputs */
121 /* %0 */ "r"(ptr + count),
122 /* %1 */ "r"(ptr + LCD_WIDTH),
123 /* %2 */ "z"(-count)
124 : /* clobbers */
125 "r1"
126 );
127
128 rb->memset(ptr + LCD_WIDTH - count, filler, count);
129 }
130}
131
132void timer_isr(void) 81void timer_isr(void)
133{ 82{
134 static int last_left, last_right; 83 static int last_left, last_right;
135 bool full_update = false; 84 bool full_update = false;
136 85
137 if (new_val) 86 if (new_val)
138 { 87 {
139 if ((unsigned)x >= LCD_WIDTH) 88 if ((unsigned)x >= LCD_WIDTH)
140 { 89 {
141 if (scroll) 90 if (scroll)
142 { 91 {
143 lcd_scroll_left(1, false); 92 xlcd_scroll_left(1);
144 x = LCD_WIDTH-1; 93 x = LCD_WIDTH-1;
145 full_update = true; 94 full_update = true;
146 } 95 }
147 else 96 else
148 x = 0; 97 x = 0;
149 } 98 }
150 99
151 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); 100 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
152 rb->lcd_drawline(x, 0, x, LCD_HEIGHT-1); 101 rb->lcd_vline(x, 0, LCD_HEIGHT-1);
153 rb->lcd_set_drawmode(DRMODE_SOLID); 102 rb->lcd_set_drawmode(DRMODE_SOLID);
154 103
155 switch (draw_mode) 104 switch (draw_mode)
156 { 105 {
157 case DRAW_MODE_FILLED: 106 case DRAW_MODE_FILLED:
158 rb->lcd_drawline(x, LCD_HEIGHT/2+1, 107 rb->lcd_vline(x, LCD_HEIGHT/2+1, LCD_HEIGHT/2+1 + left_val);
159 x, LCD_HEIGHT/2+1 + left_val); 108 rb->lcd_vline(x, LCD_HEIGHT/2-1, LCD_HEIGHT/2-1 - right_val);
160 rb->lcd_drawline(x, LCD_HEIGHT/2-1,
161 x, LCD_HEIGHT/2-1 - right_val);
162 break; 109 break;
163 110
164 case DRAW_MODE_OUTLINE: 111 case DRAW_MODE_OUTLINE:
@@ -205,6 +152,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
205 152
206 (void)parameter; 153 (void)parameter;
207 rb = api; 154 rb = api;
155
156 xlcd_init(rb);
208 157
209 rb->timer_register(1, NULL, FREQ / 67, 1, timer_isr); 158 rb->timer_register(1, NULL, FREQ / 67, 1, timer_isr);
210 159