diff options
author | Karl Kurbjun <kkurbjun@gmail.com> | 2009-05-04 04:14:52 +0000 |
---|---|---|
committer | Karl Kurbjun <kkurbjun@gmail.com> | 2009-05-04 04:14:52 +0000 |
commit | f9fae86de25a71e79571d8e692868be544ac1bfb (patch) | |
tree | 976a546750eddf10df7d65b98b84b24df8eb3b4f /firmware/target/arm/tms320dm320 | |
parent | ad031e903cc852379a8ecceff3d10d9e71bf6355 (diff) | |
download | rockbox-f9fae86de25a71e79571d8e692868be544ac1bfb.tar.gz rockbox-f9fae86de25a71e79571d8e692868be544ac1bfb.zip |
M:Robe 500: Add backlight cleanups and fix power management so that dangerous and shutoff voltages are taken care of, carge discharge curves are better modeled.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20849 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/tms320dm320')
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c | 9 | ||||
-rwxr-xr-x | firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c | 16 |
2 files changed, 16 insertions, 9 deletions
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c index 751a59da94..1596b83dc3 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c | |||
@@ -29,8 +29,6 @@ | |||
29 | #include "spi-target.h" | 29 | #include "spi-target.h" |
30 | #include "lcd-target.h" | 30 | #include "lcd-target.h" |
31 | 31 | ||
32 | int _backlight_brightness=DEFAULT_BRIGHTNESS_SETTING; | ||
33 | |||
34 | static void _backlight_write_brightness(int brightness) | 32 | static void _backlight_write_brightness(int brightness) |
35 | { | 33 | { |
36 | uint8_t bl_command[] = {0xa4, 0x00, brightness, 0xbb}; | 34 | uint8_t bl_command[] = {0xa4, 0x00, brightness, 0xbb}; |
@@ -41,7 +39,9 @@ void _backlight_on(void) | |||
41 | { | 39 | { |
42 | lcd_awake(); /* power on lcd + visible display */ | 40 | lcd_awake(); /* power on lcd + visible display */ |
43 | 41 | ||
44 | _backlight_write_brightness(_backlight_brightness); | 42 | #if !defined(CONFIG_BACKLIGHT_FADING) |
43 | _backlight_write_brightness(backlight_brightness); | ||
44 | #endif | ||
45 | } | 45 | } |
46 | 46 | ||
47 | void _backlight_off(void) | 47 | void _backlight_off(void) |
@@ -52,7 +52,6 @@ void _backlight_off(void) | |||
52 | /* Assumes that the backlight has been initialized */ | 52 | /* Assumes that the backlight has been initialized */ |
53 | void _backlight_set_brightness(int brightness) | 53 | void _backlight_set_brightness(int brightness) |
54 | { | 54 | { |
55 | _backlight_brightness=brightness; | ||
56 | _backlight_write_brightness(brightness); | 55 | _backlight_write_brightness(brightness); |
57 | } | 56 | } |
58 | 57 | ||
@@ -65,6 +64,6 @@ void __backlight_dim(bool dim_now) | |||
65 | 64 | ||
66 | bool _backlight_init(void) | 65 | bool _backlight_init(void) |
67 | { | 66 | { |
68 | _backlight_set_brightness(_backlight_brightness); | 67 | _backlight_set_brightness(backlight_brightness); |
69 | return true; | 68 | return true; |
70 | } | 69 | } |
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c index 60949b2c18..b81c34ac3b 100755 --- a/firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c | |||
@@ -25,29 +25,35 @@ | |||
25 | #include "tsc2100.h" | 25 | #include "tsc2100.h" |
26 | #include "kernel.h" | 26 | #include "kernel.h" |
27 | 27 | ||
28 | unsigned short current_bat2 = 3910; | ||
29 | unsigned short current_aux = 3910; | ||
28 | static unsigned short current_voltage = 3910; | 30 | static unsigned short current_voltage = 3910; |
29 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | 31 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = |
30 | { | 32 | { |
31 | 0 | 33 | 3450 |
32 | }; | 34 | }; |
33 | 35 | ||
34 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | 36 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = |
35 | { | 37 | { |
36 | 0 | 38 | 3400 |
37 | }; | 39 | }; |
38 | 40 | ||
41 | /* Right now these are linear translations, it would be good to model them | ||
42 | * appropriate to the actual battery curve. | ||
43 | */ | ||
44 | |||
39 | /* 6.10 format */ | 45 | /* 6.10 format */ |
40 | 46 | ||
41 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ | 47 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ |
42 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | 48 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = |
43 | { | 49 | { |
44 | { 375, 1125, 1500, 1875, 2250, 2625, 3000, 3375, 3750, 4500, 4950 }, | 50 | { 3400, 3300, 3600, 3700, 3800, 3900, 4000, 4100, 4200, 4300, 4400 }, |
45 | }; | 51 | }; |
46 | 52 | ||
47 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | 53 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ |
48 | const unsigned short percent_to_volt_charge[11] = | 54 | const unsigned short percent_to_volt_charge[11] = |
49 | { | 55 | { |
50 | 375, 1125, 1500, 1875, 2250, 2625, 3000, 3375, 3750, 4500, 4950, | 56 | 4000, 4105, 4210, 4315, 4420, 4525, 4630, 4735, 4840, 4945, 5050, |
51 | }; | 57 | }; |
52 | 58 | ||
53 | /* Returns battery voltage from ADC [millivolts] */ | 59 | /* Returns battery voltage from ADC [millivolts] */ |
@@ -59,6 +65,8 @@ unsigned int battery_adc_voltage(void) | |||
59 | 65 | ||
60 | if(tsc2100_read_volt(&bat1, &bat2, &aux)){ | 66 | if(tsc2100_read_volt(&bat1, &bat2, &aux)){ |
61 | current_voltage=((short)((int)(bat1<<10)/4096*6*2.5)); | 67 | current_voltage=((short)((int)(bat1<<10)/4096*6*2.5)); |
68 | current_bat2=((short)((int)(bat2<<10)/4096*6*2.5)); | ||
69 | current_aux=((short)((int)(aux<<10)/4096*6*2.5)); | ||
62 | } | 70 | } |
63 | 71 | ||
64 | if (TIME_BEFORE(last_tick+2*HZ, current_tick)) | 72 | if (TIME_BEFORE(last_tick+2*HZ, current_tick)) |