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
This commit is contained in:
Jörg Hohensohn 2003-07-03 22:11:14 +00:00
parent 1c114ea028
commit d4735224bb
2 changed files with 15 additions and 4 deletions

View file

@ -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

View file

@ -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)