summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/rtc/rtc_m41st84w.c2
-rw-r--r--firmware/target/sh/archos/fm_v2/backlight-target.h18
-rw-r--r--firmware/target/sh/archos/recorder/backlight-target.h18
3 files changed, 28 insertions, 10 deletions
diff --git a/firmware/drivers/rtc/rtc_m41st84w.c b/firmware/drivers/rtc/rtc_m41st84w.c
index 25ea1b5ec5..738fb201bf 100644
--- a/firmware/drivers/rtc/rtc_m41st84w.c
+++ b/firmware/drivers/rtc/rtc_m41st84w.c
@@ -38,8 +38,6 @@ void rtc_init(void)
rtc_check_alarm_started(false);
#endif
- rtc_write(0x13, 0x10); /* 32 kHz square wave */
-
/* Clear the Stop bit if it is set */
data = rtc_read(0x01);
if(data & 0x80)
diff --git a/firmware/target/sh/archos/fm_v2/backlight-target.h b/firmware/target/sh/archos/fm_v2/backlight-target.h
index f9da89b042..9eff09016a 100644
--- a/firmware/target/sh/archos/fm_v2/backlight-target.h
+++ b/firmware/target/sh/archos/fm_v2/backlight-target.h
@@ -28,14 +28,24 @@
static inline void _backlight_on(void)
{
- /* Enable square wave */
- rtc_write(0x0a, rtc_read(0x0a) | 0x40);
+ rtc_write(0x13, 0x10); /* 32 kHz square wave */
+ rtc_write(0x0a, rtc_read(0x0a) | 0x40); /* Enable square wave */
}
static inline void _backlight_off(void)
{
- /* Disable square wave */
- rtc_write(0x0a, rtc_read(0x0a) & ~0x40);
+ /* While on, backlight is flashing at 32 kHz. If the square wave output
+ is disabled while the backlight is lit, it will become constantly lit,
+ (brighter) and slowly fade. This resets the square wave counter and
+ results in the unlit state */
+ unsigned char rtc_0a = rtc_read(0x0a) & ~0x40;
+ rtc_write(0x0a, rtc_0a); /* Disable square wave */
+ rtc_write(0x13, 0xF0); /* 1 Hz square wave */
+ rtc_write(0x0a, rtc_0a | 0x40); /* Enable square wave */
+
+ /* When the square wave output is disabled in the unlit state,
+ the backlight stays off */
+ rtc_write(0x0a, rtc_0a);
}
#endif
diff --git a/firmware/target/sh/archos/recorder/backlight-target.h b/firmware/target/sh/archos/recorder/backlight-target.h
index f9da89b042..9eff09016a 100644
--- a/firmware/target/sh/archos/recorder/backlight-target.h
+++ b/firmware/target/sh/archos/recorder/backlight-target.h
@@ -28,14 +28,24 @@
static inline void _backlight_on(void)
{
- /* Enable square wave */
- rtc_write(0x0a, rtc_read(0x0a) | 0x40);
+ rtc_write(0x13, 0x10); /* 32 kHz square wave */
+ rtc_write(0x0a, rtc_read(0x0a) | 0x40); /* Enable square wave */
}
static inline void _backlight_off(void)
{
- /* Disable square wave */
- rtc_write(0x0a, rtc_read(0x0a) & ~0x40);
+ /* While on, backlight is flashing at 32 kHz. If the square wave output
+ is disabled while the backlight is lit, it will become constantly lit,
+ (brighter) and slowly fade. This resets the square wave counter and
+ results in the unlit state */
+ unsigned char rtc_0a = rtc_read(0x0a) & ~0x40;
+ rtc_write(0x0a, rtc_0a); /* Disable square wave */
+ rtc_write(0x13, 0xF0); /* 1 Hz square wave */
+ rtc_write(0x0a, rtc_0a | 0x40); /* Enable square wave */
+
+ /* When the square wave output is disabled in the unlit state,
+ the backlight stays off */
+ rtc_write(0x0a, rtc_0a);
}
#endif