mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-05 06:48:53 +08:00
Added board_read_VBUS_state to board_common API
This commit is contained in:
committed by
Daniel Agar
parent
67abeaf182
commit
7a4c5c3475
@@ -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
|
||||
************************************************************************************/
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user