mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-28 02:36:37 +08:00
Use IOCTL for board_read_VBUS_state in NuttX protected builds
Direct gpio read is not possible from user side applications, so use boardctl interface instead. Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
This commit is contained in:
committed by
Beat Küng
parent
0cf3079401
commit
56c6120e83
@@ -143,5 +143,4 @@ int CONFIG_USER_ENTRYPOINT(int argc, char *argv[])
|
|||||||
return nsh_main(argc, argv);
|
return nsh_main(argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* !CONFIG_BUILD_FLAT && !__KERNEL__ */
|
#endif /* !CONFIG_BUILD_FLAT && !__KERNEL__ */
|
||||||
|
|||||||
@@ -502,7 +502,14 @@ static inline bool board_rc_invert_input(const char *device, bool invert) { retu
|
|||||||
*
|
*
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
#if defined(GPIO_OTGFS_VBUS)
|
#if defined(__PX4_NUTTX) && !defined(CONFIG_BUILD_FLAT)
|
||||||
|
inline static int board_read_VBUS_state(void)
|
||||||
|
{
|
||||||
|
platformiocvbusstate_t state = {false};
|
||||||
|
boardctl(PLATFORMIOCVBUSSTATE, (uintptr_t)&state);
|
||||||
|
return state.ret;
|
||||||
|
}
|
||||||
|
#elif defined(GPIO_OTGFS_VBUS)
|
||||||
# define board_read_VBUS_state() (px4_arch_gpioread(GPIO_OTGFS_VBUS) ? 0 : 1)
|
# define board_read_VBUS_state() (px4_arch_gpioread(GPIO_OTGFS_VBUS) ? 0 : 1)
|
||||||
#else
|
#else
|
||||||
int board_read_VBUS_state(void);
|
int board_read_VBUS_state(void);
|
||||||
|
|||||||
Reference in New Issue
Block a user