diff options
Diffstat (limited to 'bootloader')
-rw-r--r-- | bootloader/samsung_yps3.c | 80 |
1 files changed, 48 insertions, 32 deletions
diff --git a/bootloader/samsung_yps3.c b/bootloader/samsung_yps3.c index ba9f2d70e5..511b6208a4 100644 --- a/bootloader/samsung_yps3.c +++ b/bootloader/samsung_yps3.c | |||
@@ -69,13 +69,6 @@ static inline void delay(unsigned int duration) | |||
69 | // forward declaration | 69 | // forward declaration |
70 | static int rds_decode(int line, struct si4700_dbg_info *nfo); | 70 | static int rds_decode(int line, struct si4700_dbg_info *nfo); |
71 | 71 | ||
72 | static int count = 0; | ||
73 | |||
74 | static void timer_callback(void) | ||
75 | { | ||
76 | count++; | ||
77 | } | ||
78 | |||
79 | void main(void) | 72 | void main(void) |
80 | { | 73 | { |
81 | char mystring[64]; | 74 | char mystring[64]; |
@@ -83,9 +76,10 @@ void main(void) | |||
83 | unsigned char read_data[16]; | 76 | unsigned char read_data[16]; |
84 | int i; | 77 | int i; |
85 | struct si4700_dbg_info si4700_info; | 78 | struct si4700_dbg_info si4700_info; |
79 | // unsigned int data; | ||
80 | int brightness = 0; | ||
81 | unsigned int button; | ||
86 | 82 | ||
87 | line = 1; | ||
88 | |||
89 | // enable all peripherals | 83 | // enable all peripherals |
90 | PWRCON = 0; | 84 | PWRCON = 0; |
91 | 85 | ||
@@ -119,22 +113,18 @@ void main(void) | |||
119 | fmradio_i2c_init(); | 113 | fmradio_i2c_init(); |
120 | adc_init(); | 114 | adc_init(); |
121 | _backlight_init(); | 115 | _backlight_init(); |
122 | 116 | ||
123 | timer_register(1, NULL, 3 * TIMER_FREQ, timer_callback); | ||
124 | |||
125 | // LED outputs | ||
126 | PCON3 = (PCON3 & ~(0x0000FF00)) | 0x00001100; | ||
127 | PDAT3 |= (1 << 2) | (1 << 3); | ||
128 | |||
129 | // FM power | 117 | // FM power |
130 | si4700_init(); | 118 | si4700_init(); |
131 | tuner_power(true); | 119 | tuner_power(true); |
132 | si4700_set(RADIO_SLEEP, 0); | 120 | si4700_set(RADIO_SLEEP, 0); |
133 | si4700_set(RADIO_MUTE, 0); | 121 | si4700_set(RADIO_MUTE, 0); |
134 | si4700_set(RADIO_FREQUENCY, 100700000); | 122 | si4700_set(RADIO_FREQUENCY, 100700000); |
135 | 123 | ||
136 | lcd_puts_scroll(0,0,"+++ this is a very very long line to test scrolling. ---"); | 124 | lcd_puts_scroll(0,0,"+++ this is a very very long line to test scrolling. ---"); |
137 | 125 | ||
126 | button_init_device(); | ||
127 | |||
138 | while (true) | 128 | while (true) |
139 | { | 129 | { |
140 | line = 1; | 130 | line = 1; |
@@ -198,28 +188,54 @@ void main(void) | |||
198 | lcd_puts(0, line++, mystring); | 188 | lcd_puts(0, line++, mystring); |
199 | #endif | 189 | #endif |
200 | 190 | ||
201 | #if 1 /* enable to see timer/counter info */ | 191 | #if 1 /* button lights controlled by keypad */ |
202 | snprintf(mystring, 64, "TIMER: %08X", count); | 192 | button = button_read_device(); |
203 | lcd_puts(0, line++, mystring); | 193 | if (button & (BUTTON_UP | BUTTON_DOWN | BUTTON_LEFT | BUTTON_RIGHT)) { |
204 | snprintf(mystring, 64, "current_tick: %08X", current_tick); | 194 | PDAT3 |= (1 << 3); |
205 | lcd_puts(0, line++, mystring); | 195 | } |
206 | snprintf(mystring, 64, "TIMER %04X %04X %04X", TDCON, TDPRE, TDDATA0); | 196 | else { |
207 | lcd_puts(0, line++, mystring); | 197 | PDAT3 &= ~(1 << 3); |
198 | } | ||
199 | if (button & (BUTTON_BACK | BUTTON_MENU)) { | ||
200 | PDAT3 |= (1 << 2); | ||
201 | } | ||
202 | else { | ||
203 | PDAT3 &= ~(1 << 2); | ||
204 | } | ||
205 | if (button & (BUTTON_SELECT)) { | ||
206 | PDAT4 |= (1 << 2); | ||
207 | } | ||
208 | else { | ||
209 | PDAT4 &= ~(1 << 2); | ||
210 | } | ||
208 | #endif | 211 | #endif |
209 | 212 | ||
210 | #if 1 /* enable this to control backlight brightness with the hold switch */ | 213 | #if 1 /* backlight brightness controlled by up/down keys */ |
211 | if (PDAT4 & (1 << 3)) { | 214 | if (button_read_device() & BUTTON_UP) { |
212 | _backlight_set_brightness(10); | 215 | if (brightness < MAX_BRIGHTNESS_SETTING) { |
213 | PDAT3 &= ~(1 << 4); | 216 | brightness++; |
217 | _backlight_set_brightness(brightness); | ||
218 | } | ||
214 | } | 219 | } |
215 | else { | 220 | else if (button_read_device() & BUTTON_DOWN) { |
216 | _backlight_set_brightness(15); | 221 | if (brightness > MIN_BRIGHTNESS_SETTING) { |
217 | PDAT3 |= (1 << 4); | 222 | brightness--; |
223 | _backlight_set_brightness(brightness); | ||
224 | } | ||
218 | } | 225 | } |
226 | snprintf(mystring, 64, "bright %3d", brightness); | ||
227 | lcd_puts(0, line++, mystring); | ||
228 | #endif | ||
229 | |||
230 | |||
231 | #if 1 /* button info */ | ||
232 | snprintf(mystring, 64, "BUTTONS %08X, %s", button_read_device(), | ||
233 | headphones_inserted() ? "HP" : "hp"); | ||
234 | lcd_puts(0, line++, mystring); | ||
219 | #endif | 235 | #endif |
220 | 236 | ||
221 | lcd_update(); | 237 | lcd_update(); |
222 | } | 238 | } |
223 | } | 239 | } |
224 | 240 | ||
225 | 241 | ||