diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/debug_menu.c | 44 | ||||
-rw-r--r-- | apps/recorder/radio.c | 5 |
2 files changed, 48 insertions, 1 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 5f22776a4b..78442dcf9c 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include "settings.h" | 42 | #include "settings.h" |
43 | #include "ata.h" | 43 | #include "ata.h" |
44 | #include "fat.h" | 44 | #include "fat.h" |
45 | #include "radio.h" | ||
45 | #ifdef HAVE_LCD_BITMAP | 46 | #ifdef HAVE_LCD_BITMAP |
46 | #include "widgets.h" | 47 | #include "widgets.h" |
47 | #include "peakmeter.h" | 48 | #include "peakmeter.h" |
@@ -1377,6 +1378,46 @@ bool dbg_save_roms(void) | |||
1377 | return false; | 1378 | return false; |
1378 | } | 1379 | } |
1379 | 1380 | ||
1381 | #ifdef HAVE_FMRADIO | ||
1382 | extern int debug_fm_detection; | ||
1383 | |||
1384 | bool dbg_fm_radio(void) | ||
1385 | { | ||
1386 | char buf[32]; | ||
1387 | int button; | ||
1388 | bool fm_detected; | ||
1389 | |||
1390 | #ifdef HAVE_LCD_BITMAP | ||
1391 | lcd_setmargins(0, 0); | ||
1392 | #endif | ||
1393 | |||
1394 | while(1) | ||
1395 | { | ||
1396 | lcd_clear_display(); | ||
1397 | fm_detected = radio_hardware_present(); | ||
1398 | |||
1399 | snprintf(buf, sizeof buf, "HW detected: %s", fm_detected?"yes":"no"); | ||
1400 | lcd_puts(0, 0, buf); | ||
1401 | snprintf(buf, sizeof buf, "Result: %08x", debug_fm_detection); | ||
1402 | lcd_puts(0, 1, buf); | ||
1403 | lcd_update(); | ||
1404 | |||
1405 | button = button_get(true); | ||
1406 | |||
1407 | switch(button) | ||
1408 | { | ||
1409 | #ifdef HAVE_RECORDER_KEYPAD | ||
1410 | case BUTTON_OFF: | ||
1411 | #else | ||
1412 | case BUTTON_STOP: | ||
1413 | #endif | ||
1414 | return false; | ||
1415 | } | ||
1416 | } | ||
1417 | return false; | ||
1418 | } | ||
1419 | #endif | ||
1420 | |||
1380 | bool debug_menu(void) | 1421 | bool debug_menu(void) |
1381 | { | 1422 | { |
1382 | int m; | 1423 | int m; |
@@ -1411,6 +1452,9 @@ bool debug_menu(void) | |||
1411 | #endif /* PM_DEBUG */ | 1452 | #endif /* PM_DEBUG */ |
1412 | #endif /* HAVE_LCD_BITMAP */ | 1453 | #endif /* HAVE_LCD_BITMAP */ |
1413 | { "View runtime", view_runtime }, | 1454 | { "View runtime", view_runtime }, |
1455 | #ifdef HAVE_FMRADIO | ||
1456 | { "FM Radio", dbg_fm_radio }, | ||
1457 | #endif | ||
1414 | }; | 1458 | }; |
1415 | 1459 | ||
1416 | m=menu_init( items, sizeof items / sizeof(struct menu_items) ); | 1460 | m=menu_init( items, sizeof items / sizeof(struct menu_items) ); |
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index 65b8beb164..819d2a5d5b 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c | |||
@@ -64,6 +64,8 @@ static struct fmstation presets[MAX_PRESETS]; | |||
64 | 64 | ||
65 | static char default_filename[] = "/.rockbox/fm-presets-default.fmr"; | 65 | static char default_filename[] = "/.rockbox/fm-presets-default.fmr"; |
66 | 66 | ||
67 | int debug_fm_detection; | ||
68 | |||
67 | void radio_load_presets(void); | 69 | void radio_load_presets(void); |
68 | bool radio_preset_select(void); | 70 | bool radio_preset_select(void); |
69 | bool radio_menu(void); | 71 | bool radio_menu(void); |
@@ -81,6 +83,7 @@ bool radio_hardware_present(void) | |||
81 | 83 | ||
82 | fmradio_set(2, 0x140885); /* 5kHz, 7.2MHz crystal, test mode 1 */ | 84 | fmradio_set(2, 0x140885); /* 5kHz, 7.2MHz crystal, test mode 1 */ |
83 | val = fmradio_read(0); | 85 | val = fmradio_read(0); |
86 | debug_fm_detection = val; | ||
84 | if(val == 0x140885) | 87 | if(val == 0x140885) |
85 | return true; | 88 | return true; |
86 | else | 89 | else |
@@ -554,7 +557,7 @@ void radio_load_presets(void) | |||
554 | if(fd >= 0) | 557 | if(fd >= 0) |
555 | { | 558 | { |
556 | i = 0; | 559 | i = 0; |
557 | while(!done) | 560 | while(!done && num_presets < MAX_PRESETS) |
558 | { | 561 | { |
559 | rc = read_line(fd, buf, 128); | 562 | rc = read_line(fd, buf, 128); |
560 | if(rc > 0) | 563 | if(rc > 0) |