diff options
-rw-r--r-- | apps/recorder/radio.c | 5 | ||||
-rw-r--r-- | firmware/drivers/fmradio.c | 22 | ||||
-rw-r--r-- | firmware/export/fmradio.h | 4 | ||||
-rw-r--r-- | firmware/powermgmt.c | 6 |
4 files changed, 25 insertions, 12 deletions
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index dc286fb222..4f6fca4fa3 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c | |||
@@ -69,7 +69,8 @@ bool radio_screen(void) | |||
69 | lcd_clear_display(); | 69 | lcd_clear_display(); |
70 | lcd_setmargins(0, 8); | 70 | lcd_setmargins(0, 8); |
71 | status_draw(false); | 71 | status_draw(false); |
72 | 72 | fmradio_set_status(FMRADIO_PLAYING); | |
73 | |||
73 | /* Enable the Left and right A/D Converter */ | 74 | /* Enable the Left and right A/D Converter */ |
74 | mas_codec_writereg(0x0, 0xccc7); | 75 | mas_codec_writereg(0x0, 0xccc7); |
75 | 76 | ||
@@ -182,6 +183,8 @@ bool radio_screen(void) | |||
182 | break; | 183 | break; |
183 | } | 184 | } |
184 | } | 185 | } |
186 | |||
187 | fmradio_set_status(0); | ||
185 | return false; | 188 | return false; |
186 | } | 189 | } |
187 | #endif | 190 | #endif |
diff --git a/firmware/drivers/fmradio.c b/firmware/drivers/fmradio.c index 0d947f4480..14abb8e2b0 100644 --- a/firmware/drivers/fmradio.c +++ b/firmware/drivers/fmradio.c | |||
@@ -50,17 +50,7 @@ | |||
50 | /* delay loop */ | 50 | /* delay loop */ |
51 | #define DELAY do { int _x; for(_x=0;_x<10;_x++);} while (0) | 51 | #define DELAY do { int _x; for(_x=0;_x<10;_x++);} while (0) |
52 | 52 | ||
53 | static struct mutex fmradio_mtx; | 53 | static int fmstatus = 0; |
54 | |||
55 | void fmradio_begin(void) | ||
56 | { | ||
57 | mutex_lock(&fmradio_mtx); | ||
58 | } | ||
59 | |||
60 | void fmradio_end(void) | ||
61 | { | ||
62 | mutex_unlock(&fmradio_mtx); | ||
63 | } | ||
64 | 54 | ||
65 | int fmradio_read(int addr) | 55 | int fmradio_read(int addr) |
66 | { | 56 | { |
@@ -130,4 +120,14 @@ void fmradio_set(int addr, int data) | |||
130 | CE_LO; | 120 | CE_LO; |
131 | } | 121 | } |
132 | 122 | ||
123 | void fmradio_set_status(int status) | ||
124 | { | ||
125 | fmstatus = status; | ||
126 | } | ||
127 | |||
128 | int fmradio_get_status(void) | ||
129 | { | ||
130 | return fmstatus; | ||
131 | } | ||
132 | |||
133 | #endif | 133 | #endif |
diff --git a/firmware/export/fmradio.h b/firmware/export/fmradio.h index 2877501361..b5b239bde1 100644 --- a/firmware/export/fmradio.h +++ b/firmware/export/fmradio.h | |||
@@ -21,5 +21,9 @@ | |||
21 | 21 | ||
22 | extern int fmradio_read(int addr); | 22 | extern int fmradio_read(int addr); |
23 | extern void fmradio_set(int addr, int data); | 23 | extern void fmradio_set(int addr, int data); |
24 | extern void fmradio_set_status(int status); | ||
25 | extern int fmradio_get_status(void); | ||
26 | |||
27 | #define FMRADIO_PLAYING 1 | ||
24 | 28 | ||
25 | #endif | 29 | #endif |
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index e04e520ad1..00492bbcc6 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c | |||
@@ -34,6 +34,9 @@ | |||
34 | #include "usb.h" | 34 | #include "usb.h" |
35 | #include "powermgmt.h" | 35 | #include "powermgmt.h" |
36 | #include "backlight.h" | 36 | #include "backlight.h" |
37 | #ifdef HAVE_FMRADIO | ||
38 | #include "fmradio.h" | ||
39 | #endif | ||
37 | 40 | ||
38 | #ifdef SIMULATOR | 41 | #ifdef SIMULATOR |
39 | 42 | ||
@@ -299,6 +302,9 @@ static void handle_auto_poweroff(void) | |||
299 | charger_was_inserted = charger_is_inserted; | 302 | charger_was_inserted = charger_is_inserted; |
300 | 303 | ||
301 | if(timeout && | 304 | if(timeout && |
305 | #ifdef HAVE_FMRADIO | ||
306 | !fmradio_get_status() && | ||
307 | #endif | ||
302 | !usb_inserted() && | 308 | !usb_inserted() && |
303 | (mpeg_stat == 0 || | 309 | (mpeg_stat == 0 || |
304 | mpeg_stat == (MPEG_STATUS_PLAY | MPEG_STATUS_PAUSE))) | 310 | mpeg_stat == (MPEG_STATUS_PLAY | MPEG_STATUS_PAUSE))) |