diff options
| author | Jörg Hohensohn <hohensoh@rockbox.org> | 2003-07-03 22:11:14 +0000 |
|---|---|---|
| committer | Jörg Hohensohn <hohensoh@rockbox.org> | 2003-07-03 22:11:14 +0000 |
| commit | d4735224bbb27fae62a852c882e6524c6fd716d6 (patch) | |
| tree | 192a338eb5b31ec6ee1e94218d5c5ab2c5ac8a67 | |
| parent | 1c114ea0287586a24adfb1ae8e72c7f3838b0482 (diff) | |
| download | rockbox-d4735224bbb27fae62a852c882e6524c6fd716d6.zip rockbox-d4735224bbb27fae62a852c882e6524c6fd716d6.tar.gz rockbox-d4735224bbb27fae62a852c882e6524c6fd716d6.tar.bz2 rockbox-d4735224bbb27fae62a852c882e6524c6fd716d6.tar.xz | |
I needed a function to return the physical USB detect
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3807 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | firmware/export/usb.h | 3 | ||||
| -rw-r--r-- | firmware/usb.c | 16 |
2 files changed, 15 insertions, 4 deletions
diff --git a/firmware/export/usb.h b/firmware/export/usb.h index 089b0f2..f1c2c64 100644 --- a/firmware/export/usb.h +++ b/firmware/export/usb.h @@ -26,6 +26,7 @@ void usb_start_monitoring(void); void usb_acknowledge(int id); void usb_wait_for_disconnect(struct event_queue *q); int usb_wait_for_disconnect_w_tmo(struct event_queue *q, int ticks); -bool usb_inserted(void); +bool usb_inserted(void); /* return the official value, what's been reported to the threads */ +bool usb_detect(void); /* return the raw hardware value */ #endif diff --git a/firmware/usb.c b/firmware/usb.c index 2cd5c9b..23edf7b 100644 --- a/firmware/usb.c +++ b/firmware/usb.c @@ -212,12 +212,10 @@ static void usb_thread(void) } } -static void usb_tick(void) +bool usb_detect(void) { bool current_status; - if(usb_monitor_enabled) - { #ifdef ARCHOS_RECORDER current_status = (adc_read(ADC_USB_POWER) > 500)?true:false; #else @@ -227,6 +225,18 @@ static void usb_tick(void) current_status = (PADR & 0x8000)?false:true; #endif #endif + + return current_status; +} + + +static void usb_tick(void) +{ + bool current_status; + + if(usb_monitor_enabled) + { + current_status = usb_detect(); /* Only report when the status has changed */ if(current_status != last_usb_status) |