Added board_read_VBUS_state to board_common API

This commit is contained in:
David Sidrane
2017-09-29 10:13:51 -04:00
committed by Daniel Agar
parent 67abeaf182
commit 7a4c5c3475
2 changed files with 21 additions and 2 deletions
+19
View File
@@ -262,6 +262,25 @@
# define HW_VER_FMUV2MINI HW_VER_SIMPLE(HW_VER_FMUV2MINI_STATE)
#endif
/* Provide an interface for reading the connected state of VBUS */
/************************************************************************************
* Name: board_read_VBUS_state
*
* Description:
* All boards must provide a way to read the state of VBUS, this my be simple
* digital input on a GPIO. Or something more complicated like a Analong input
* or reading a bit from a USB controller register.
*
* Returns - 0 if connected.
*
************************************************************************************/
#if defined(GPIO_OTGFS_VBUS)
# define board_read_VBUS_state() (px4_arch_gpioread(GPIO_OTGFS_VBUS) ? 0 : 1)
#else
int board_read_VBUS_state(void);
#endif
/************************************************************************************
* Public Data
************************************************************************************/
+2 -2
View File
@@ -48,7 +48,7 @@
__EXPORT int usb_connected_main(int argc, char *argv[]);
static void print_usage()
static void print_usage(void)
{
PRINT_MODULE_DESCRIPTION("Utility to check if USB is connected. Was previously used in startup scripts.\n"
@@ -66,5 +66,5 @@ usb_connected_main(int argc, char *argv[])
return 0;
}
return px4_arch_gpioread(GPIO_OTGFS_VBUS) ? 0 : 1;
return board_read_VBUS_state();
}