mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 04:53:33 +08:00
board_ctrl: Clean up usage of VBUS, nARMED from user/kernelspace
Move logic implemented in the header files to source files, this way it will be simpler to define which is compiled to kernel space and which to user space Also allows to remove some headers that pull in half the universe from the board definitions (which should just be pin definitions and no functionality)
This commit is contained in:
@@ -43,17 +43,13 @@
|
||||
* Included Files
|
||||
****************************************************************************************************/
|
||||
|
||||
#include <px4_platform/board_ctrl.h>
|
||||
#include <px4_platform_common/px4_config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <stm32_gpio.h>
|
||||
|
||||
#if !defined(CONFIG_BUILD_FLAT)
|
||||
#include <sys/boardctl.h>
|
||||
#include <px4_platform/board_ctrl.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************************************/
|
||||
@@ -229,20 +225,8 @@
|
||||
#define BOARD_INDICATE_EXTERNAL_LOCKOUT_STATE(enabled) px4_arch_configgpio((enabled) ? GPIO_nARMED : GPIO_nARMED_INIT)
|
||||
#define BOARD_GET_EXTERNAL_LOCKOUT_STATE() px4_arch_gpioread(GPIO_nARMED)
|
||||
#else
|
||||
static inline void board_indicate_external_lockout_state(bool enable)
|
||||
{
|
||||
platformioclockoutstate_t state = {enable};
|
||||
boardctl(PLATFORMIOCINDICATELOCKOUT, (uintptr_t)&state);
|
||||
}
|
||||
|
||||
static inline bool board_get_external_lockout_state(void)
|
||||
{
|
||||
platformioclockoutstate_t state = {false};
|
||||
boardctl(PLATFORMIOCGETLOCKOUT, (uintptr_t)&state);
|
||||
return state.enabled;
|
||||
}
|
||||
#define BOARD_INDICATE_EXTERNAL_LOCKOUT_STATE(enabled) board_indicate_external_lockout_state(enabled)
|
||||
#define BOARD_GET_EXTERNAL_LOCKOUT_STATE() board_get_external_lockout_state()
|
||||
#define BOARD_INDICATE_EXTERNAL_LOCKOUT_STATE(enabled) boardctrl_indicate_external_lockout_state(enabled)
|
||||
#define BOARD_GET_EXTERNAL_LOCKOUT_STATE() boardctrl_get_external_lockout_state()
|
||||
#endif
|
||||
|
||||
/* PWM
|
||||
|
||||
Reference in New Issue
Block a user