mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-27 03:53:33 +08:00
nxphlite-v3:Use ADC reading for VBUS
On this HW the VBUS detection is on the ADC. The ADC module reads the value and sets a global flag as well as publishing the value via uOrb.
This commit is contained in:
committed by
Daniel Agar
parent
57892805e2
commit
58a6e57452
@@ -416,7 +416,7 @@ __BEGIN_DECLS
|
||||
* this board support the ADC system_power interface, and therefore
|
||||
* provides the true logic GPIO BOARD_ADC_xxxx macros.
|
||||
*/
|
||||
#define BOARD_ADC_USB_CONNECTED board_read_VBUS_state()
|
||||
#define BOARD_ADC_USB_CONNECTED ADC_USB_VBUS_VALID /* VBUS valid is read on an ADC pin */
|
||||
#define BOARD_ADC_BRICK_VALID (1)
|
||||
#define BOARD_ADC_SERVO_VALID (1)
|
||||
#define BOARD_ADC_PERIPH_5V_OC (0)
|
||||
|
||||
@@ -115,6 +115,7 @@ __BEGIN_DECLS
|
||||
extern void led_init(void);
|
||||
extern void led_on(int led);
|
||||
extern void led_off(int led);
|
||||
extern bool g_board_usb_connected;
|
||||
__END_DECLS
|
||||
|
||||
/****************************************************************************
|
||||
@@ -139,7 +140,7 @@ __END_DECLS
|
||||
int board_read_VBUS_state(void)
|
||||
{
|
||||
// read * 36 ADC0_SE21 USB_VBUS_VALID
|
||||
return 0;
|
||||
return g_board_usb_connected ? 0 : 1;
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user