diff options
author | Bertrik Sikken <bertrik@sikken.nl> | 2009-08-02 16:43:58 +0000 |
---|---|---|
committer | Bertrik Sikken <bertrik@sikken.nl> | 2009-08-02 16:43:58 +0000 |
commit | ee0ab03286dc98fa3153f8ceca81cffb9fd2d375 (patch) | |
tree | c39936e39cae30038f69e6df5194b81ae38000f4 | |
parent | 322fae42992040a30416ddd1587fd96dbca0a5e7 (diff) | |
download | rockbox-ee0ab03286dc98fa3153f8ceca81cffb9fd2d375.tar.gz rockbox-ee0ab03286dc98fa3153f8ceca81cffb9fd2d375.zip |
Samsung YP-S3: update backlight brightness curve again (can't go all the way down to 1/256 brightness) and update yp-s3 bootloader demo.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22117 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | bootloader/samsung_yps3.c | 80 | ||||
-rw-r--r-- | firmware/target/arm/s5l8700/yps3/backlight-yps3.c | 6 |
2 files changed, 52 insertions, 34 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 | ||
diff --git a/firmware/target/arm/s5l8700/yps3/backlight-yps3.c b/firmware/target/arm/s5l8700/yps3/backlight-yps3.c index 1fdcc8347d..d543687825 100644 --- a/firmware/target/arm/s5l8700/yps3/backlight-yps3.c +++ b/firmware/target/arm/s5l8700/yps3/backlight-yps3.c | |||
@@ -37,9 +37,9 @@ | |||
37 | 37 | ||
38 | void _backlight_set_brightness(int brightness) | 38 | void _backlight_set_brightness(int brightness) |
39 | { | 39 | { |
40 | /* pwm = round(sqrt(2)**x), where brightness level x = 1..16 */ | 40 | /* pwm = round(16 * 16**(x/16)), where brightness level x = 1..16 */ |
41 | static const unsigned int logtable[] = | 41 | static const unsigned int logtable[] = |
42 | {1, 2, 3, 4, 6, 8, 11, 16, 23, 32, 45, 64, 91, 128, 181, 256}; | 42 | {19, 23, 27, 32, 38, 45, 54, 64, 76, 91, 108, 128, 152, 181, 215, 256}; |
43 | 43 | ||
44 | /* set PWM width */ | 44 | /* set PWM width */ |
45 | TADATA0 = logtable[brightness]; | 45 | TADATA0 = logtable[brightness]; |
@@ -77,6 +77,8 @@ bool _backlight_init(void) | |||
77 | /* Enable button LEDs: P3.2 (menu/back), P3.3 (cursor), P4.2 (middle) */ | 77 | /* Enable button LEDs: P3.2 (menu/back), P3.3 (cursor), P4.2 (middle) */ |
78 | PCON3 = (PCON3 & ~0x0000FF00) | 0x00001100; | 78 | PCON3 = (PCON3 & ~0x0000FF00) | 0x00001100; |
79 | PCON4 = (PCON4 & ~0x00000F00) | 0x00000100; | 79 | PCON4 = (PCON4 & ~0x00000F00) | 0x00000100; |
80 | PDAT3 &= ~(3 << 2); | ||
81 | PDAT4 &= ~(1 << 2); | ||
80 | 82 | ||
81 | /* enable timer clock */ | 83 | /* enable timer clock */ |
82 | PWRCON &= ~(1 << 4); | 84 | PWRCON &= ~(1 << 4); |