mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 07:23:34 +08:00
delete drv_gpio.h, modules/gpio_led, and fmu GPIO ioctls
This commit is contained in:
committed by
Lorenz Meier
parent
c303e36ed0
commit
d4e06e517a
@@ -25,6 +25,3 @@ fi
|
|||||||
|
|
||||||
# Start FrSky telemetry on SERIAL4 (ttyS6, designated "SERIAL4/5" on the case)
|
# Start FrSky telemetry on SERIAL4 (ttyS6, designated "SERIAL4/5" on the case)
|
||||||
frsky_telemetry start -d /dev/ttyS6
|
frsky_telemetry start -d /dev/ttyS6
|
||||||
|
|
||||||
# GPIO LED
|
|
||||||
gpio_led start -p 6
|
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
#gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -305,30 +305,6 @@
|
|||||||
|
|
||||||
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
|
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
|
||||||
|
|
||||||
#define BOARD_FMU_GPIO_TAB { \
|
|
||||||
{GPIO_GPIO0_INPUT, GPIO_GPIO0_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO1_INPUT, GPIO_GPIO1_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO2_INPUT, GPIO_GPIO2_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO3_INPUT, GPIO_GPIO3_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO4_INPUT, GPIO_GPIO4_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO5_INPUT, GPIO_GPIO5_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO6_INPUT, GPIO_GPIO6_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO7_INPUT, GPIO_GPIO7_OUTPUT, 0}, }
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GPIO numbers.
|
|
||||||
*
|
|
||||||
* There are no alternate functions on this board.
|
|
||||||
*/
|
|
||||||
#define GPIO_SERVO_1 (1<<0) /**< servo 1 output */
|
|
||||||
#define GPIO_SERVO_2 (1<<1) /**< servo 2 output */
|
|
||||||
#define GPIO_SERVO_3 (1<<2) /**< servo 3 output */
|
|
||||||
#define GPIO_SERVO_4 (1<<3) /**< servo 4 output */
|
|
||||||
#define GPIO_SERVO_5 (1<<4) /**< servo 5 output */
|
|
||||||
#define GPIO_SERVO_6 (1<<5) /**< servo 6 output */
|
|
||||||
#define GPIO_SERVO_7 (1<<6) /**< servo 7 output */
|
|
||||||
#define GPIO_SERVO_8 (1<<7) /**< servo 8 output */
|
|
||||||
|
|
||||||
/* This board provides a DMA pool and APIs */
|
/* This board provides a DMA pool and APIs */
|
||||||
|
|
||||||
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
#gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
#gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -315,22 +315,6 @@ __BEGIN_DECLS
|
|||||||
|
|
||||||
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
|
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
|
||||||
|
|
||||||
#define BOARD_FMU_GPIO_TAB { \
|
|
||||||
{GPIO_GPIO0_INPUT, GPIO_GPIO0_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO1_INPUT, GPIO_GPIO1_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO2_INPUT, GPIO_GPIO2_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO3_INPUT, GPIO_GPIO3_OUTPUT, 0}, }
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GPIO numbers.
|
|
||||||
*
|
|
||||||
* There are no alternate functions on this board.
|
|
||||||
*/
|
|
||||||
# define GPIO_SERVO_1 (1<<0) /**< servo 1 output */
|
|
||||||
# define GPIO_SERVO_2 (1<<1) /**< servo 2 output */
|
|
||||||
# define GPIO_SERVO_3 (1<<2) /**< servo 3 output */
|
|
||||||
# define GPIO_SERVO_4 (1<<3) /**< servo 4 output */
|
|
||||||
|
|
||||||
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
||||||
|
|
||||||
/****************************************************************************************************
|
/****************************************************************************************************
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -215,34 +215,6 @@
|
|||||||
|
|
||||||
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
|
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
|
||||||
|
|
||||||
#define BOARD_FMU_GPIO_TAB { \
|
|
||||||
{GPIO_GPIO0_INPUT, GPIO_GPIO0_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO1_INPUT, GPIO_GPIO1_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO2_INPUT, GPIO_GPIO2_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO3_INPUT, GPIO_GPIO3_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO4_INPUT, GPIO_GPIO4_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO5_INPUT, GPIO_GPIO5_OUTPUT, 0}, \
|
|
||||||
{0, GPIO_VDD_3V3_SENSORS_EN, 0}, \
|
|
||||||
{GPIO_VDD_BRICK_VALID, 0, 0}, \
|
|
||||||
{GPIO_VDD_5V_PERIPH_OC, 0, 0}, }
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GPIO numbers.
|
|
||||||
*
|
|
||||||
* There are no alternate functions on this board.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define GPIO_SERVO_1 (1<<0) /**< servo 1 output */
|
|
||||||
#define GPIO_SERVO_2 (1<<1) /**< servo 2 output */
|
|
||||||
#define GPIO_SERVO_3 (1<<2) /**< servo 3 output */
|
|
||||||
#define GPIO_SERVO_4 (1<<3) /**< servo 4 output */
|
|
||||||
#define GPIO_SERVO_5 (1<<4) /**< servo 5 output */
|
|
||||||
#define GPIO_SERVO_6 (1<<5) /**< servo 6 output */
|
|
||||||
|
|
||||||
#define GPIO_3V3_SENSORS_EN (1<<6) /**< PE3 - VDD_3V3_SENSORS_EN */
|
|
||||||
#define GPIO_BRICK_VALID (1<<7) /**< PB5 - !VDD_BRICK_VALID */
|
|
||||||
#define GPIO_5V_PERIPH_OC (1<<8) /**< PE10 - !VDD_5V_PERIPH_OC */
|
|
||||||
|
|
||||||
/* This board provides a DMA pool and APIs */
|
/* This board provides a DMA pool and APIs */
|
||||||
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -349,31 +349,6 @@
|
|||||||
|
|
||||||
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
|
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
|
||||||
|
|
||||||
#define BOARD_FMU_GPIO_TAB { \
|
|
||||||
{GPIO_GPIO0_INPUT, GPIO_GPIO0_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO1_INPUT, GPIO_GPIO1_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO2_INPUT, GPIO_GPIO2_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO3_INPUT, GPIO_GPIO3_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO4_INPUT, GPIO_GPIO4_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO5_INPUT, GPIO_GPIO5_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO6_INPUT, GPIO_GPIO6_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO7_INPUT, GPIO_GPIO7_OUTPUT, 0}, \
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GPIO numbers.
|
|
||||||
*
|
|
||||||
* There are no alternate functions on this board.
|
|
||||||
*/
|
|
||||||
#define GPIO_SERVO_1 (1<<0) /**< servo 1 output */
|
|
||||||
#define GPIO_SERVO_2 (1<<1) /**< servo 2 output */
|
|
||||||
#define GPIO_SERVO_3 (1<<2) /**< servo 3 output */
|
|
||||||
#define GPIO_SERVO_4 (1<<3) /**< servo 4 output */
|
|
||||||
#define GPIO_SERVO_5 (1<<4) /**< servo 5 output */
|
|
||||||
#define GPIO_SERVO_6 (1<<5) /**< servo 6 output */
|
|
||||||
#define GPIO_SERVO_7 (1<<6) /**< servo 7 output */
|
|
||||||
#define GPIO_SERVO_8 (1<<7) /**< servo 8 output */
|
|
||||||
|
|
||||||
/* This board provides a DMA pool and APIs */
|
/* This board provides a DMA pool and APIs */
|
||||||
|
|
||||||
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
#gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
#gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ px4_add_board(
|
|||||||
#fw_pos_control_l1
|
#fw_pos_control_l1
|
||||||
#gnd_att_control
|
#gnd_att_control
|
||||||
#gnd_pos_control
|
#gnd_pos_control
|
||||||
#gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
#gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
#gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ px4_add_board(
|
|||||||
#fw_pos_control_l1
|
#fw_pos_control_l1
|
||||||
#gnd_att_control
|
#gnd_att_control
|
||||||
#gnd_pos_control
|
#gnd_pos_control
|
||||||
#gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
#landing_target_estimator
|
#landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -202,9 +202,6 @@
|
|||||||
|
|
||||||
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
|
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
|
||||||
|
|
||||||
#define BOARD_FMU_GPIO_TAB { \
|
|
||||||
{0, 0, 0}, }
|
|
||||||
|
|
||||||
/* This board provides a DMA pool and APIs */
|
/* This board provides a DMA pool and APIs */
|
||||||
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ px4_add_board(
|
|||||||
#fw_pos_control_l1
|
#fw_pos_control_l1
|
||||||
#gnd_att_control
|
#gnd_att_control
|
||||||
#gnd_pos_control
|
#gnd_pos_control
|
||||||
#gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ px4_add_board(
|
|||||||
#fw_pos_control_l1
|
#fw_pos_control_l1
|
||||||
#gnd_att_control
|
#gnd_att_control
|
||||||
#gnd_pos_control
|
#gnd_pos_control
|
||||||
#gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -421,38 +421,12 @@ __BEGIN_DECLS
|
|||||||
|
|
||||||
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
|
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
|
||||||
|
|
||||||
#define BOARD_FMU_GPIO_TAB { \
|
|
||||||
{GPIO_GPIO0_INPUT, GPIO_GPIO0_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO1_INPUT, GPIO_GPIO1_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO2_INPUT, GPIO_GPIO2_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO3_INPUT, GPIO_GPIO3_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO4_INPUT, GPIO_GPIO4_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO5_INPUT, GPIO_GPIO5_OUTPUT, 0}, \
|
|
||||||
{0, GPIO_TRI, 0}, \
|
|
||||||
{GPIO_ECH, 0, 0}, \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define BOARD_HAS_LED_PWM 1
|
#define BOARD_HAS_LED_PWM 1
|
||||||
|
|
||||||
#define LED_TIM3_CH1OUT /* PTD1 RGB_R */ PIN_FTM3_CH1_1
|
#define LED_TIM3_CH1OUT /* PTD1 RGB_R */ PIN_FTM3_CH1_1
|
||||||
#define LED_TIM3_CH5OUT /* PTC9 RGB_G */ PIN_FTM3_CH5_1
|
#define LED_TIM3_CH5OUT /* PTC9 RGB_G */ PIN_FTM3_CH5_1
|
||||||
#define LED_TIM3_CH4OUT /* PTC8 RGB_B */ PIN_FTM3_CH4_1
|
#define LED_TIM3_CH4OUT /* PTC8 RGB_B */ PIN_FTM3_CH4_1
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GPIO numbers.
|
|
||||||
*
|
|
||||||
* There are no alternate functions on this board.
|
|
||||||
*/
|
|
||||||
#define GPIO_SERVO_1 (1<<0) /**< servo 1 output */
|
|
||||||
#define GPIO_SERVO_2 (1<<1) /**< servo 2 output */
|
|
||||||
#define GPIO_SERVO_3 (1<<2) /**< servo 3 output */
|
|
||||||
#define GPIO_SERVO_4 (1<<3) /**< servo 4 output */
|
|
||||||
#define GPIO_SERVO_5 (1<<4) /**< servo 5 output */
|
|
||||||
#define GPIO_SERVO_6 (1<<5) /**< servo 6 output */
|
|
||||||
#define GPIO_SERVO_7 (1<<6) /**< servo 7 output U_TRI */
|
|
||||||
#define GPIO_SERVO_8 (1<<6) /**< servo 8 output U_ECH */
|
|
||||||
|
|
||||||
/* This board provides a DMA pool and APIs */
|
/* This board provides a DMA pool and APIs */
|
||||||
|
|
||||||
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ px4_add_board(
|
|||||||
#fw_pos_control_l1
|
#fw_pos_control_l1
|
||||||
#gnd_att_control
|
#gnd_att_control
|
||||||
#gnd_pos_control
|
#gnd_pos_control
|
||||||
#gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -254,22 +254,6 @@
|
|||||||
|
|
||||||
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
|
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
|
||||||
|
|
||||||
#define BOARD_FMU_GPIO_TAB { \
|
|
||||||
{GPIO_GPIO0_INPUT, GPIO_GPIO0_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO1_INPUT, GPIO_GPIO1_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO2_INPUT, GPIO_GPIO2_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO3_INPUT, GPIO_GPIO3_OUTPUT, 0}, }
|
|
||||||
|
|
||||||
/*
|
|
||||||
* PX4FMUv4 GPIO numbers.
|
|
||||||
*
|
|
||||||
* There are no alternate functions on this board.
|
|
||||||
*/
|
|
||||||
#define GPIO_SERVO_1 (1<<0) /**< servo 1 output */
|
|
||||||
#define GPIO_SERVO_2 (1<<1) /**< servo 2 output */
|
|
||||||
#define GPIO_SERVO_3 (1<<2) /**< servo 3 output */
|
|
||||||
#define GPIO_SERVO_4 (1<<3) /**< servo 4 output */
|
|
||||||
|
|
||||||
/* This board provides a DMA pool and APIs */
|
/* This board provides a DMA pool and APIs */
|
||||||
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ px4_add_board(
|
|||||||
#fw_pos_control_l1
|
#fw_pos_control_l1
|
||||||
#gnd_att_control
|
#gnd_att_control
|
||||||
#gnd_pos_control
|
#gnd_pos_control
|
||||||
#gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
#gnd_att_control
|
#gnd_att_control
|
||||||
#gnd_pos_control
|
#gnd_pos_control
|
||||||
#gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
#landing_target_estimator
|
#landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ px4_add_board(
|
|||||||
#fw_pos_control_l1
|
#fw_pos_control_l1
|
||||||
#gnd_att_control
|
#gnd_att_control
|
||||||
#gnd_pos_control
|
#gnd_pos_control
|
||||||
#gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -463,41 +463,6 @@
|
|||||||
|
|
||||||
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
|
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
|
||||||
|
|
||||||
#define BOARD_FMU_GPIO_TAB { \
|
|
||||||
{GPIO_GPIO0_INPUT, GPIO_GPIO0_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO1_INPUT, GPIO_GPIO1_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO2_INPUT, GPIO_GPIO2_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO3_INPUT, GPIO_GPIO3_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO4_INPUT, GPIO_GPIO4_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO5_INPUT, GPIO_GPIO5_OUTPUT, 0}, \
|
|
||||||
{0, GPIO_VDD_5V_PERIPH_EN, 0}, \
|
|
||||||
{0, GPIO_VDD_3V3_SENSORS_EN, 0}, \
|
|
||||||
{GPIO_VDD_BRICK_VALID, 0, 0}, \
|
|
||||||
{GPIO_VDD_SERVO_VALID, 0, 0}, \
|
|
||||||
{GPIO_VDD_USB_VALID, 0, 0}, \
|
|
||||||
{GPIO_VDD_5V_HIPOWER_OC, 0, 0}, \
|
|
||||||
{GPIO_VDD_5V_PERIPH_OC, 0, 0}, }
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GPIO numbers.
|
|
||||||
*
|
|
||||||
* There are no alternate functions on this board.
|
|
||||||
*/
|
|
||||||
#define GPIO_SERVO_1 (1<<0) /**< servo 1 output */
|
|
||||||
#define GPIO_SERVO_2 (1<<1) /**< servo 2 output */
|
|
||||||
#define GPIO_SERVO_3 (1<<2) /**< servo 3 output */
|
|
||||||
#define GPIO_SERVO_4 (1<<3) /**< servo 4 output */
|
|
||||||
#define GPIO_SERVO_5 (1<<4) /**< servo 5 output */
|
|
||||||
#define GPIO_SERVO_6 (1<<5) /**< servo 6 output */
|
|
||||||
|
|
||||||
#define GPIO_5V_PERIPH_EN (1<<6) /**< PA8 - !VDD_5V_PERIPH_EN */
|
|
||||||
#define GPIO_3V3_SENSORS_EN (1<<7) /**< PE3 - VDD_3V3_SENSORS_EN */
|
|
||||||
#define GPIO_BRICK_VALID (1<<8) /**< PB5 - !VDD_BRICK_VALID */
|
|
||||||
#define GPIO_SERVO_VALID (1<<9) /**< PB7 - !VDD_SERVO_VALID */
|
|
||||||
#define GPIO_USB_VALID (1<<10) /**< PC0 - !GPIO_VDD_USB_VALID */
|
|
||||||
#define GPIO_5V_HIPOWER_OC (1<<11) /**< PE10 - !VDD_5V_HIPOWER_OC */
|
|
||||||
#define GPIO_5V_PERIPH_OC (1<<12) /**< PE10 - !VDD_5V_PERIPH_OC */
|
|
||||||
|
|
||||||
/* This board provides a DMA pool and APIs */
|
/* This board provides a DMA pool and APIs */
|
||||||
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ px4_add_board(
|
|||||||
#fw_pos_control_l1
|
#fw_pos_control_l1
|
||||||
#gnd_att_control
|
#gnd_att_control
|
||||||
#gnd_pos_control
|
#gnd_pos_control
|
||||||
#gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -463,41 +463,6 @@
|
|||||||
|
|
||||||
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
|
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
|
||||||
|
|
||||||
#define BOARD_FMU_GPIO_TAB { \
|
|
||||||
{GPIO_GPIO0_INPUT, GPIO_GPIO0_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO1_INPUT, GPIO_GPIO1_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO2_INPUT, GPIO_GPIO2_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO3_INPUT, GPIO_GPIO3_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO4_INPUT, GPIO_GPIO4_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO5_INPUT, GPIO_GPIO5_OUTPUT, 0}, \
|
|
||||||
{0, GPIO_VDD_5V_PERIPH_EN, 0}, \
|
|
||||||
{0, GPIO_VDD_3V3_SENSORS_EN, 0}, \
|
|
||||||
{GPIO_VDD_BRICK_VALID, 0, 0}, \
|
|
||||||
{GPIO_VDD_SERVO_VALID, 0, 0}, \
|
|
||||||
{GPIO_VDD_USB_VALID, 0, 0}, \
|
|
||||||
{GPIO_VDD_5V_HIPOWER_OC, 0, 0}, \
|
|
||||||
{GPIO_VDD_5V_PERIPH_OC, 0, 0}, }
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GPIO numbers.
|
|
||||||
*
|
|
||||||
* There are no alternate functions on this board.
|
|
||||||
*/
|
|
||||||
#define GPIO_SERVO_1 (1<<0) /**< servo 1 output */
|
|
||||||
#define GPIO_SERVO_2 (1<<1) /**< servo 2 output */
|
|
||||||
#define GPIO_SERVO_3 (1<<2) /**< servo 3 output */
|
|
||||||
#define GPIO_SERVO_4 (1<<3) /**< servo 4 output */
|
|
||||||
#define GPIO_SERVO_5 (1<<4) /**< servo 5 output */
|
|
||||||
#define GPIO_SERVO_6 (1<<5) /**< servo 6 output */
|
|
||||||
|
|
||||||
#define GPIO_5V_PERIPH_EN (1<<6) /**< PA8 - !VDD_5V_PERIPH_EN */
|
|
||||||
#define GPIO_3V3_SENSORS_EN (1<<7) /**< PE3 - VDD_3V3_SENSORS_EN */
|
|
||||||
#define GPIO_BRICK_VALID (1<<8) /**< PB5 - !VDD_BRICK_VALID */
|
|
||||||
#define GPIO_SERVO_VALID (1<<9) /**< PB7 - !VDD_SERVO_VALID */
|
|
||||||
#define GPIO_USB_VALID (1<<10) /**< PC0 - !GPIO_VDD_USB_VALID */
|
|
||||||
#define GPIO_5V_HIPOWER_OC (1<<11) /**< PE10 - !VDD_5V_HIPOWER_OC */
|
|
||||||
#define GPIO_5V_PERIPH_OC (1<<12) /**< PE10 - !VDD_5V_PERIPH_OC */
|
|
||||||
|
|
||||||
/* This board provides a DMA pool and APIs */
|
/* This board provides a DMA pool and APIs */
|
||||||
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -320,32 +320,6 @@
|
|||||||
|
|
||||||
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
|
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
|
||||||
|
|
||||||
#define BOARD_FMU_GPIO_TAB { \
|
|
||||||
{GPIO_GPIO0_INPUT, GPIO_GPIO0_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO1_INPUT, GPIO_GPIO1_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO2_INPUT, GPIO_GPIO2_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO3_INPUT, GPIO_GPIO3_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO4_INPUT, GPIO_GPIO4_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO5_INPUT, GPIO_GPIO5_OUTPUT, 0}, \
|
|
||||||
{0, GPIO_VDD_3V3_SENSORS_EN, 0}, \
|
|
||||||
{GPIO_VDD_BRICK_VALID, 0, 0}, \
|
|
||||||
{GPIO_VDD_USB_VALID, 0, 0}, }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PX4FMUv4 GPIO numbers.
|
|
||||||
* There are no alternate functions on this board.
|
|
||||||
*/
|
|
||||||
#define GPIO_SERVO_1 (1<<0) /**< servo 1 output */
|
|
||||||
#define GPIO_SERVO_2 (1<<1) /**< servo 2 output */
|
|
||||||
#define GPIO_SERVO_3 (1<<2) /**< servo 3 output */
|
|
||||||
#define GPIO_SERVO_4 (1<<3) /**< servo 4 output */
|
|
||||||
#define GPIO_SERVO_5 (1<<4) /**< servo 5 output */
|
|
||||||
#define GPIO_SERVO_6 (1<<5) /**< servo 6 output */
|
|
||||||
|
|
||||||
#define GPIO_3V3_SENSORS_EN (1<<7) /**< PE3 - VDD_3V3_SENSORS_EN */
|
|
||||||
#define GPIO_BRICK_VALID (1<<8) /**< PB5 - !VDD_BRICK_VALID */
|
|
||||||
#define GPIO_USB_VALID (1<<9) /**< PC0 - !GPIO_VDD_USB_VALID */
|
|
||||||
|
|
||||||
/* This board provides a DMA pool and APIs. */
|
/* This board provides a DMA pool and APIs. */
|
||||||
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -332,45 +332,6 @@
|
|||||||
|
|
||||||
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
|
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
|
||||||
|
|
||||||
#define BOARD_FMU_GPIO_TAB { \
|
|
||||||
{GPIO_GPIO0_INPUT, GPIO_GPIO0_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO1_INPUT, GPIO_GPIO1_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO2_INPUT, GPIO_GPIO2_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO3_INPUT, GPIO_GPIO3_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO4_INPUT, GPIO_GPIO4_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO5_INPUT, GPIO_GPIO5_OUTPUT, 0}, \
|
|
||||||
{0, GPIO_VDD_3V3_SENSORS_EN, 0}, \
|
|
||||||
{0, GPIO_VDD_3V3_PERIPH_EN, 0}, \
|
|
||||||
{GPIO_nVDD_BRICK1_VALID, 0, 0}, \
|
|
||||||
{GPIO_nVDD_BRICK2_VALID, 0, 0}, \
|
|
||||||
{GPIO_nVDD_USB_VALID, 0, 0}, \
|
|
||||||
{GPIO_VDD_5V_HIPOWER_OC, 0, 0}, \
|
|
||||||
{GPIO_VDD_5V_PERIPH_OC, 0, 0}, }
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GPIO numbers.
|
|
||||||
*
|
|
||||||
* There are no alternate functions on this board.
|
|
||||||
*/
|
|
||||||
#define GPIO_SERVO_1 (1<<0) /**< servo 1 output */
|
|
||||||
#define GPIO_SERVO_2 (1<<1) /**< servo 2 output */
|
|
||||||
#define GPIO_SERVO_3 (1<<2) /**< servo 3 output */
|
|
||||||
#define GPIO_SERVO_4 (1<<3) /**< servo 4 output */
|
|
||||||
#define GPIO_SERVO_5 (1<<4) /**< servo 5 output */
|
|
||||||
#define GPIO_SERVO_6 (1<<5) /**< servo 6 output */
|
|
||||||
|
|
||||||
#define GPIO_3V3_SENSORS_EN (1<<6) /**< PE3 - GPIO_VDD_3V3_SENSORS_EN */
|
|
||||||
#define GPIO_3V3_PERIPH_EN (1<<7) /**< PC5 - GPIO_VDD_3V3_PERIPH_EN */
|
|
||||||
|
|
||||||
#define GPIO_BRICK1_VALID (1<<8) /**< PB5 - GPIO_nVDD_BRICK1_VALID */
|
|
||||||
#define GPIO_BRICK2_VALID (1<<9) /**< PG5 - GPIO_nVDD_BRICK2_VALID */
|
|
||||||
#define GPIO_USB_VBUS_VALID (1<<10) /**< PC0 - GPIO_nVDD_USB_VALID */
|
|
||||||
|
|
||||||
#define GPIO_5V_HIPOWER_OC (1<<11) /**< PF3 - !GPIO_VDD_5V_RC_OC */
|
|
||||||
#define GPIO_5V_PERIPH_OC (1<<12) /**< PE10 - !GPIO_VDD_5V_PERIPH_OC */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* This board provides a DMA pool and APIs */
|
/* This board provides a DMA pool and APIs */
|
||||||
|
|
||||||
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -645,61 +645,6 @@
|
|||||||
|
|
||||||
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
|
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
|
||||||
|
|
||||||
#define BOARD_FMU_GPIO_TAB { \
|
|
||||||
{GPIO_GPIO0_INPUT, GPIO_GPIO0_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO1_INPUT, GPIO_GPIO1_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO2_INPUT, GPIO_GPIO2_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO3_INPUT, GPIO_GPIO3_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO4_INPUT, GPIO_GPIO4_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO5_INPUT, GPIO_GPIO5_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO6_INPUT, GPIO_GPIO6_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO7_INPUT, GPIO_GPIO7_OUTPUT, 0}, \
|
|
||||||
{GPIO_nPOWER_IN_A, 0, 0}, \
|
|
||||||
{GPIO_nPOWER_IN_B, 0, 0}, \
|
|
||||||
{GPIO_nPOWER_IN_C, 0, 0}, \
|
|
||||||
{0, GPIO_xVDD_5V_PERIPH_EN, 0}, \
|
|
||||||
{GPIO_nVDD_5V_PERIPH_OC, 0, 0}, \
|
|
||||||
{0, GPIO_nVDD_5V_HIPOWER_EN, 0}, \
|
|
||||||
{GPIO_nVDD_5V_HIPOWER_OC,0, 0}, \
|
|
||||||
{0, GPIO_VDD_3V3_SENSORS_EN, 0}, \
|
|
||||||
{0, GPIO_VDD_3V3_SPEKTRUM_POWER_EN, 0}, \
|
|
||||||
{0, GPIO_VDD_5V_RC_EN, 0}, \
|
|
||||||
{0, GPIO_VDD_5V_WIFI_EN, 0}, \
|
|
||||||
{0, GPIO_VDD_3V3_SD_CARD_EN, 0}, \
|
|
||||||
{0, GPIO_HW_REV_DRIVE, 0}, \
|
|
||||||
{0, GPIO_HW_VER_DRIVE, 0}, \
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GPIO numbers.
|
|
||||||
*
|
|
||||||
* There are no alternate functions on this board.
|
|
||||||
*/
|
|
||||||
#define GPIO_SERVO_1 (1<<0) /**< servo 1 output */
|
|
||||||
#define GPIO_SERVO_2 (1<<1) /**< servo 2 output */
|
|
||||||
#define GPIO_SERVO_3 (1<<2) /**< servo 3 output */
|
|
||||||
#define GPIO_SERVO_4 (1<<3) /**< servo 4 output */
|
|
||||||
#define GPIO_SERVO_5 (1<<4) /**< servo 5 output */
|
|
||||||
#define GPIO_SERVO_6 (1<<5) /**< servo 6 output */
|
|
||||||
#define GPIO_SERVO_7 (1<<6) /**< servo 7 output */
|
|
||||||
#define GPIO_SERVO_8 (1<<7) /**< servo 8 output */
|
|
||||||
|
|
||||||
#define GPIO_nPOWER_INPUT_A (1<<8) /**<PG1 GPIO_nPOWER_IN_A */
|
|
||||||
#define GPIO_nPOWER_INPUT_B (1<<9) /**<PG2 GPIO_nPOWER_IN_B */
|
|
||||||
#define GPIO_nPOWER_INPUT_C (1<<10) /**<PG3 GPIO_nPOWER_IN_C */
|
|
||||||
|
|
||||||
#define GPIO_PERIPH_5V_POWER_EN (1<<11) /**< PG4 - GPIO_nVDD_5V_PERIPH_EN */
|
|
||||||
#define GPIO_PERIPH_5V_POWER_OC (1<<12) /**< PE15 - GPIO_nVDD_5V_PERIPH_OC */
|
|
||||||
#define GPIO_PERIPH_5V_HIPOWER_EN (1<<13) /**< PF12 - GPIO_nVDD_5V_HIPOWER_EN */
|
|
||||||
#define GPIO_PERIPH_5V_HIPOWER_OC (1<<14) /**< PG13 - GPIO_nVDD_5V_HIPOWER_OC */
|
|
||||||
#define GPIO_3V3_SENSORS_EN (1<<15) /**< PE3 - VDD_3V3_SENSORS_EN */
|
|
||||||
#define GPIO_SPEKTRUM_POWER (1<<16) /**< PE4 - GPIO_VDD_3V3_SPEKTRUM_POWER_EN */
|
|
||||||
#define GPIO_RC_POWER_EN (1<<17) /**< PG5 - GPIO_VDD_5V_RC_EN */
|
|
||||||
#define GPIO_WIFI_POWER_EN (1<<18) /**< PG6 - GPIO_VDD_5V_WIFI_EN */
|
|
||||||
#define GPIO_SD_CARD_POWER_EN (1<<19) /**< PG7 - GPIO_VDD_3V3_SD_CARD_EN */
|
|
||||||
#define GPIO_HW_REV_DRIVE_EN (1<<20) /**< PH14 - GPIO_HW_REV_DRIVE */
|
|
||||||
#define GPIO_HW_VER_DRIVE_EN (1<<21) /**< PG0 - GPIO_HW_VER_DRIVE */
|
|
||||||
|
|
||||||
/* This board provides a DMA pool and APIs */
|
/* This board provides a DMA pool and APIs */
|
||||||
|
|
||||||
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
#gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
#gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
#gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ px4_add_board(
|
|||||||
fw_pos_control_l1
|
fw_pos_control_l1
|
||||||
gnd_att_control
|
gnd_att_control
|
||||||
gnd_pos_control
|
gnd_pos_control
|
||||||
gpio_led
|
|
||||||
land_detector
|
land_detector
|
||||||
landing_target_estimator
|
landing_target_estimator
|
||||||
load_mon
|
load_mon
|
||||||
|
|||||||
@@ -324,31 +324,6 @@ __BEGIN_DECLS
|
|||||||
|
|
||||||
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
|
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
|
||||||
|
|
||||||
#define BOARD_FMU_GPIO_TAB { \
|
|
||||||
{GPIO_GPIO0_INPUT, GPIO_GPIO0_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO1_INPUT, GPIO_GPIO1_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO2_INPUT, GPIO_GPIO2_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO3_INPUT, GPIO_GPIO3_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO4_INPUT, GPIO_GPIO4_OUTPUT, 0}, \
|
|
||||||
{GPIO_GPIO5_INPUT, GPIO_GPIO5_OUTPUT, 0}, \
|
|
||||||
{0, GPIO_VDD_3V3_SENSORS_EN, 0}, \
|
|
||||||
{GPIO_VDD_BRICK_VALID, 0, 0}, }
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GPIO numbers.
|
|
||||||
*
|
|
||||||
* There are no alternate functions on this board.
|
|
||||||
*/
|
|
||||||
#define GPIO_SERVO_1 (1<<0) /**< servo 1 output */
|
|
||||||
#define GPIO_SERVO_2 (1<<1) /**< servo 2 output */
|
|
||||||
#define GPIO_SERVO_3 (1<<2) /**< servo 3 output */
|
|
||||||
#define GPIO_SERVO_4 (1<<3) /**< servo 4 output */
|
|
||||||
#define GPIO_SERVO_5 (1<<4) /**< servo 5 output */
|
|
||||||
#define GPIO_SERVO_6 (1<<5) /**< servo 6 output */
|
|
||||||
|
|
||||||
#define GPIO_3V3_SENSORS_EN (1<<6) /**< PE3 - VDD_3V3_SENSORS_EN */
|
|
||||||
#define GPIO_BRICK_VALID (1<<7) /**< PB10 - !VDD_BRICK_VALID */
|
|
||||||
|
|
||||||
/* This board provides a DMA pool and APIs */
|
/* This board provides a DMA pool and APIs */
|
||||||
|
|
||||||
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ set(tests
|
|||||||
dataman
|
dataman
|
||||||
file2
|
file2
|
||||||
float
|
float
|
||||||
gpio
|
|
||||||
hrt
|
hrt
|
||||||
hysteresis
|
hysteresis
|
||||||
int
|
int
|
||||||
|
|||||||
@@ -232,14 +232,6 @@
|
|||||||
#define BOARD_BATTERY2_A_PER_V 0.0f
|
#define BOARD_BATTERY2_A_PER_V 0.0f
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Conditional use of FMU GPIO
|
|
||||||
* If the board use the PX4FMU driver and the board provides
|
|
||||||
* BOARD_FMU_GPIO_TAB then we publish the logical BOARD_HAS_FMU_GPIO
|
|
||||||
*/
|
|
||||||
#if defined(BOARD_FMU_GPIO_TAB)
|
|
||||||
# define BOARD_HAS_FMU_GPIO
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Conditional use of PX4 PIO is Used to determine if the board
|
/* Conditional use of PX4 PIO is Used to determine if the board
|
||||||
* has a PX4IO processor.
|
* has a PX4IO processor.
|
||||||
* We then publish the logical BOARD_USES_PX4IO
|
* We then publish the logical BOARD_USES_PX4IO
|
||||||
|
|||||||
@@ -1,77 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
*
|
|
||||||
* Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* 3. Neither the name PX4 nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file drv_gpio.h
|
|
||||||
*
|
|
||||||
* Generic GPIO ioctl interface.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _DRV_GPIO_H
|
|
||||||
#define _DRV_GPIO_H
|
|
||||||
|
|
||||||
#include <px4_config.h>
|
|
||||||
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Device paths for devices that support the GPIO ioctl protocol.
|
|
||||||
*/
|
|
||||||
#define PX4FMU_DEVICE_PATH "/dev/px4fmu"
|
|
||||||
#define PX4IO_DEVICE_PATH "/dev/px4io"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* IOCTL definitions.
|
|
||||||
*
|
|
||||||
* For all ioctls, the (arg) argument is a bitmask of GPIOs to be affected
|
|
||||||
* by the operation, with the LSB being the lowest-numbered GPIO.
|
|
||||||
*
|
|
||||||
* Note that there may be board-specific relationships between GPIOs;
|
|
||||||
* applications using GPIOs should be aware of this.
|
|
||||||
*/
|
|
||||||
#define _GPIOCBASE 0x2700
|
|
||||||
#define GPIOC(_x) _IOC(_GPIOCBASE, _x)
|
|
||||||
|
|
||||||
/** reset all board GPIOs to their default state */
|
|
||||||
#define GPIO_RESET GPIOC(0)
|
|
||||||
|
|
||||||
/** configure the board GPIOs in (arg) as outputs */
|
|
||||||
#define GPIO_SET_OUTPUT GPIOC(1)
|
|
||||||
|
|
||||||
/** set the GPIOs in (arg) */
|
|
||||||
#define GPIO_SET GPIOC(10)
|
|
||||||
|
|
||||||
/** clear the GPIOs in (arg) */
|
|
||||||
#define GPIO_CLEAR GPIOC(11)
|
|
||||||
|
|
||||||
#endif /* _DRV_GPIO_H */
|
|
||||||
+2
-164
@@ -42,7 +42,6 @@
|
|||||||
#include <board_config.h>
|
#include <board_config.h>
|
||||||
#include <drivers/device/device.h>
|
#include <drivers/device/device.h>
|
||||||
#include <drivers/device/i2c.h>
|
#include <drivers/device/i2c.h>
|
||||||
#include <drivers/drv_gpio.h>
|
|
||||||
#include <drivers/drv_hrt.h>
|
#include <drivers/drv_hrt.h>
|
||||||
#include <drivers/drv_input_capture.h>
|
#include <drivers/drv_input_capture.h>
|
||||||
#include <drivers/drv_mixer.h>
|
#include <drivers/drv_mixer.h>
|
||||||
@@ -101,6 +100,8 @@ enum PortMode {
|
|||||||
# error "board_config.h needs to define BOARD_HAS_PWM"
|
# error "board_config.h needs to define BOARD_HAS_PWM"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define PX4FMU_DEVICE_PATH "/dev/px4fmu"
|
||||||
|
|
||||||
class PX4FMU : public cdev::CDev, public ModuleBase<PX4FMU>
|
class PX4FMU : public cdev::CDev, public ModuleBase<PX4FMU>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -263,23 +264,8 @@ private:
|
|||||||
|
|
||||||
void update_params();
|
void update_params();
|
||||||
|
|
||||||
struct GPIOConfig {
|
|
||||||
uint32_t input;
|
|
||||||
uint32_t output;
|
|
||||||
uint32_t alt;
|
|
||||||
};
|
|
||||||
|
|
||||||
#if defined(BOARD_HAS_FMU_GPIO)
|
|
||||||
static const GPIOConfig _gpio_tab[];
|
|
||||||
static const unsigned _ngpio;
|
|
||||||
#endif
|
|
||||||
static void sensor_reset(int ms);
|
static void sensor_reset(int ms);
|
||||||
static void peripheral_reset(int ms);
|
static void peripheral_reset(int ms);
|
||||||
int gpio_reset(void);
|
|
||||||
int gpio_set_function(uint32_t gpios, int function);
|
|
||||||
int gpio_write(uint32_t gpios, int function);
|
|
||||||
int gpio_read(uint32_t *value);
|
|
||||||
int gpio_ioctl(file *filp, int cmd, unsigned long arg);
|
|
||||||
|
|
||||||
int capture_ioctl(file *filp, int cmd, unsigned long arg);
|
int capture_ioctl(file *filp, int cmd, unsigned long arg);
|
||||||
|
|
||||||
@@ -296,11 +282,6 @@ private:
|
|||||||
inline void reorder_outputs(uint16_t values[MAX_ACTUATORS]);
|
inline void reorder_outputs(uint16_t values[MAX_ACTUATORS]);
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(BOARD_HAS_FMU_GPIO)
|
|
||||||
const PX4FMU::GPIOConfig PX4FMU::_gpio_tab[] = BOARD_FMU_GPIO_TAB;
|
|
||||||
|
|
||||||
const unsigned PX4FMU::_ngpio = arraySize(PX4FMU::_gpio_tab);
|
|
||||||
#endif
|
|
||||||
pwm_limit_t PX4FMU::_pwm_limit;
|
pwm_limit_t PX4FMU::_pwm_limit;
|
||||||
actuator_armed_s PX4FMU::_armed = {};
|
actuator_armed_s PX4FMU::_armed = {};
|
||||||
work_s PX4FMU::_work = {};
|
work_s PX4FMU::_work = {};
|
||||||
@@ -1464,13 +1445,6 @@ PX4FMU::ioctl(file *filp, int cmd, unsigned long arg)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* try it as a GPIO ioctl first */
|
|
||||||
ret = gpio_ioctl(filp, cmd, arg);
|
|
||||||
|
|
||||||
if (ret != -ENOTTY) {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* try it as a Capture ioctl next */
|
/* try it as a Capture ioctl next */
|
||||||
ret = capture_ioctl(filp, cmd, arg);
|
ret = capture_ioctl(filp, cmd, arg);
|
||||||
|
|
||||||
@@ -2311,100 +2285,6 @@ PX4FMU::peripheral_reset(int ms)
|
|||||||
board_peripheral_reset(ms);
|
board_peripheral_reset(ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
PX4FMU::gpio_reset(void)
|
|
||||||
{
|
|
||||||
#if !defined(BOARD_HAS_FMU_GPIO)
|
|
||||||
return -EINVAL;
|
|
||||||
#else
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Setup default GPIO config - all pins as GPIOs, input if
|
|
||||||
* possible otherwise output if possible.
|
|
||||||
*/
|
|
||||||
for (unsigned i = 0; i < _ngpio; i++) {
|
|
||||||
if (_gpio_tab[i].input != 0) {
|
|
||||||
px4_arch_configgpio(_gpio_tab[i].input);
|
|
||||||
|
|
||||||
} else if (_gpio_tab[i].output != 0) {
|
|
||||||
px4_arch_configgpio(_gpio_tab[i].output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# if defined(GPIO_GPIO_DIR)
|
|
||||||
/* if we have a GPIO direction control, set it to zero (input) */
|
|
||||||
px4_arch_gpiowrite(GPIO_GPIO_DIR, 0);
|
|
||||||
px4_arch_configgpio(GPIO_GPIO_DIR);
|
|
||||||
# endif
|
|
||||||
return OK;
|
|
||||||
#endif // !defined(BOARD_HAS_FMU_GPIO)
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
PX4FMU::gpio_set_function(uint32_t gpios, int function)
|
|
||||||
{
|
|
||||||
#if !defined(BOARD_HAS_FMU_GPIO)
|
|
||||||
return -EINVAL;
|
|
||||||
#else
|
|
||||||
|
|
||||||
/* configure selected GPIOs as required */
|
|
||||||
for (unsigned i = 0; i < _ngpio; i++) {
|
|
||||||
if (gpios & (1 << i)) {
|
|
||||||
switch (function) {
|
|
||||||
case GPIO_SET_OUTPUT:
|
|
||||||
if (_gpio_tab[i].output) {
|
|
||||||
px4_arch_configgpio(_gpio_tab[i].output);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return OK;
|
|
||||||
#endif // !defined(BOARD_HAS_FMU_GPIO)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
PX4FMU::gpio_write(uint32_t gpios, int function)
|
|
||||||
{
|
|
||||||
#if !defined(BOARD_HAS_FMU_GPIO)
|
|
||||||
return -EINVAL;
|
|
||||||
#else
|
|
||||||
int value = (function == GPIO_SET) ? 1 : 0;
|
|
||||||
|
|
||||||
for (unsigned i = 0; i < _ngpio; i++) {
|
|
||||||
if (gpios & (1 << i)) {
|
|
||||||
if (_gpio_tab[i].output) {
|
|
||||||
px4_arch_gpiowrite(_gpio_tab[i].output, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return OK;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
PX4FMU::gpio_read(uint32_t *value)
|
|
||||||
{
|
|
||||||
#if !defined(BOARD_HAS_FMU_GPIO)
|
|
||||||
return -EINVAL;
|
|
||||||
#else
|
|
||||||
uint32_t bits = 0;
|
|
||||||
|
|
||||||
for (unsigned i = 0; i < _ngpio; i++) {
|
|
||||||
if (_gpio_tab[i].input != 0 && px4_arch_gpioread(_gpio_tab[i].input)) {
|
|
||||||
bits |= (1 << i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*value = bits;
|
|
||||||
return OK;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
PX4FMU::capture_ioctl(struct file *filp, int cmd, unsigned long arg)
|
PX4FMU::capture_ioctl(struct file *filp, int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
@@ -2551,37 +2431,6 @@ PX4FMU::capture_ioctl(struct file *filp, int cmd, unsigned long arg)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
PX4FMU::gpio_ioctl(struct file *filp, int cmd, unsigned long arg)
|
|
||||||
{
|
|
||||||
int ret = OK;
|
|
||||||
|
|
||||||
lock();
|
|
||||||
|
|
||||||
switch (cmd) {
|
|
||||||
|
|
||||||
case GPIO_RESET:
|
|
||||||
ret = gpio_reset();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPIO_SET_OUTPUT:
|
|
||||||
ret = gpio_set_function(arg, cmd);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPIO_SET:
|
|
||||||
case GPIO_CLEAR:
|
|
||||||
ret = gpio_write(arg, cmd);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
ret = -ENOTTY;
|
|
||||||
}
|
|
||||||
|
|
||||||
unlock();
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
PX4FMU::fmu_new_mode(PortMode new_mode)
|
PX4FMU::fmu_new_mode(PortMode new_mode)
|
||||||
{
|
{
|
||||||
@@ -2590,7 +2439,6 @@ PX4FMU::fmu_new_mode(PortMode new_mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PX4FMU::Mode servo_mode;
|
PX4FMU::Mode servo_mode;
|
||||||
bool mode_with_input = false;
|
|
||||||
|
|
||||||
servo_mode = PX4FMU::MODE_NONE;
|
servo_mode = PX4FMU::MODE_NONE;
|
||||||
|
|
||||||
@@ -2645,7 +2493,6 @@ PX4FMU::fmu_new_mode(PortMode new_mode)
|
|||||||
case PORT_PWM5CAP1:
|
case PORT_PWM5CAP1:
|
||||||
/* select 5-pin PWM mode 1 capture */
|
/* select 5-pin PWM mode 1 capture */
|
||||||
servo_mode = PX4FMU::MODE_5PWM1CAP;
|
servo_mode = PX4FMU::MODE_5PWM1CAP;
|
||||||
mode_with_input = true;
|
|
||||||
break;
|
break;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
@@ -2659,7 +2506,6 @@ PX4FMU::fmu_new_mode(PortMode new_mode)
|
|||||||
case PORT_PWM4CAP1:
|
case PORT_PWM4CAP1:
|
||||||
/* select 4-pin PWM mode 1 capture */
|
/* select 4-pin PWM mode 1 capture */
|
||||||
servo_mode = PX4FMU::MODE_4PWM1CAP;
|
servo_mode = PX4FMU::MODE_4PWM1CAP;
|
||||||
mode_with_input = true;
|
|
||||||
break;
|
break;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
@@ -2673,7 +2519,6 @@ PX4FMU::fmu_new_mode(PortMode new_mode)
|
|||||||
case PORT_PWM3CAP1:
|
case PORT_PWM3CAP1:
|
||||||
/* select 3-pin PWM mode 1 capture */
|
/* select 3-pin PWM mode 1 capture */
|
||||||
servo_mode = PX4FMU::MODE_3PWM1CAP;
|
servo_mode = PX4FMU::MODE_3PWM1CAP;
|
||||||
mode_with_input = true;
|
|
||||||
break;
|
break;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
@@ -2687,7 +2532,6 @@ PX4FMU::fmu_new_mode(PortMode new_mode)
|
|||||||
case PORT_PWM2CAP2:
|
case PORT_PWM2CAP2:
|
||||||
/* select 2-pin PWM mode 2 capture */
|
/* select 2-pin PWM mode 2 capture */
|
||||||
servo_mode = PX4FMU::MODE_2PWM2CAP;
|
servo_mode = PX4FMU::MODE_2PWM2CAP;
|
||||||
mode_with_input = true;
|
|
||||||
break;
|
break;
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
@@ -2699,12 +2543,6 @@ PX4FMU::fmu_new_mode(PortMode new_mode)
|
|||||||
PX4FMU *object = get_instance();
|
PX4FMU *object = get_instance();
|
||||||
|
|
||||||
if (servo_mode != object->get_mode()) {
|
if (servo_mode != object->get_mode()) {
|
||||||
|
|
||||||
/* reset to all-inputs */
|
|
||||||
if (mode_with_input) {
|
|
||||||
object->ioctl(0, GPIO_RESET, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (re)set the PWM output mode */
|
/* (re)set the PWM output mode */
|
||||||
object->set_mode(servo_mode);
|
object->set_mode(servo_mode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,6 @@
|
|||||||
#include <drivers/drv_rc_input.h>
|
#include <drivers/drv_rc_input.h>
|
||||||
#include <drivers/drv_pwm_output.h>
|
#include <drivers/drv_pwm_output.h>
|
||||||
#include <drivers/drv_sbus.h>
|
#include <drivers/drv_sbus.h>
|
||||||
#include <drivers/drv_gpio.h>
|
|
||||||
#include <drivers/drv_hrt.h>
|
#include <drivers/drv_hrt.h>
|
||||||
#include <drivers/drv_mixer.h>
|
#include <drivers/drv_mixer.h>
|
||||||
|
|
||||||
@@ -449,6 +448,8 @@ namespace
|
|||||||
PX4IO *g_dev = nullptr;
|
PX4IO *g_dev = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define PX4IO_DEVICE_PATH "/dev/px4io"
|
||||||
|
|
||||||
PX4IO::PX4IO(device::Device *interface) :
|
PX4IO::PX4IO(device::Device *interface) :
|
||||||
CDev(PX4IO_DEVICE_PATH),
|
CDev(PX4IO_DEVICE_PATH),
|
||||||
_interface(interface),
|
_interface(interface),
|
||||||
@@ -2749,19 +2750,6 @@ PX4IO::ioctl(file *filep, int cmd, unsigned long arg)
|
|||||||
ret = (arg == PWM_SERVO_ENTER_TEST_MODE || PWM_SERVO_EXIT_TEST_MODE) ? 0 : -EINVAL;
|
ret = (arg == PWM_SERVO_ENTER_TEST_MODE || PWM_SERVO_EXIT_TEST_MODE) ? 0 : -EINVAL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GPIO_RESET: {
|
|
||||||
ret = -EINVAL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case GPIO_SET:
|
|
||||||
ret = -EINVAL;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPIO_CLEAR:
|
|
||||||
ret = -EINVAL;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MIXERIOCGETOUTPUTCOUNT:
|
case MIXERIOCGETOUTPUTCOUNT:
|
||||||
*(unsigned *)arg = _max_actuators;
|
*(unsigned *)arg = _max_actuators;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
############################################################################
|
|
||||||
#
|
|
||||||
# Copyright (c) 2015 PX4 Development Team. All rights reserved.
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions
|
|
||||||
# are met:
|
|
||||||
#
|
|
||||||
# 1. Redistributions of source code must retain the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer.
|
|
||||||
# 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer in
|
|
||||||
# the documentation and/or other materials provided with the
|
|
||||||
# distribution.
|
|
||||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
|
||||||
# used to endorse or promote products derived from this software
|
|
||||||
# without specific prior written permission.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
# POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
#
|
|
||||||
############################################################################
|
|
||||||
px4_add_module(
|
|
||||||
MODULE modules__gpio_led
|
|
||||||
MAIN gpio_led
|
|
||||||
COMPILE_FLAGS
|
|
||||||
SRCS
|
|
||||||
gpio_led.c
|
|
||||||
DEPENDS
|
|
||||||
)
|
|
||||||
|
|
||||||
@@ -1,355 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
*
|
|
||||||
* Copyright (c) 2013 PX4 Development Team. All rights reserved.
|
|
||||||
* Author: Anton Babushkin <anton.babushkin@me.com>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* 3. Neither the name PX4 nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file gpio_led.c
|
|
||||||
*
|
|
||||||
* Status LED via GPIO driver.
|
|
||||||
*
|
|
||||||
* @author Anton Babushkin <anton.babushkin@me.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <px4_module.h>
|
|
||||||
#include <px4_log.h>
|
|
||||||
#include <nuttx/wqueue.h>
|
|
||||||
#include <nuttx/clock.h>
|
|
||||||
#include <systemlib/err.h>
|
|
||||||
#include <uORB/uORB.h>
|
|
||||||
#include <uORB/topics/vehicle_status.h>
|
|
||||||
#include <uORB/topics/battery_status.h>
|
|
||||||
#include <poll.h>
|
|
||||||
#include <drivers/drv_gpio.h>
|
|
||||||
#include <modules/px4iofirmware/protocol.h>
|
|
||||||
|
|
||||||
|
|
||||||
#define CYCLE_RATE_HZ 5
|
|
||||||
|
|
||||||
#define PIN_NAME "AUX OUT 1"
|
|
||||||
|
|
||||||
/* Minimum pin number */
|
|
||||||
#define GPIO_MIN_SERVO_PIN 1
|
|
||||||
|
|
||||||
/* Maximum */
|
|
||||||
#if defined(GPIO_SERVO_16)
|
|
||||||
# define GPIO_MAX_SERVO_PIN 16
|
|
||||||
#elif defined(GPIO_SERVO_15)
|
|
||||||
# define GPIO_MAX_SERVO_PIN 15
|
|
||||||
#elif defined(GPIO_SERVO_14)
|
|
||||||
# define GPIO_MAX_SERVO_PIN 14
|
|
||||||
#elif defined(GPIO_SERVO_13)
|
|
||||||
# define GPIO_MAX_SERVO_PIN 13
|
|
||||||
#elif defined(GPIO_SERVO_12)
|
|
||||||
# define GPIO_MAX_SERVO_PIN 12
|
|
||||||
#elif defined(GPIO_SERVO_11)
|
|
||||||
# define GPIO_MAX_SERVO_PIN 11
|
|
||||||
#elif defined(GPIO_SERVO_10)
|
|
||||||
# define GPIO_MAX_SERVO_PIN 10
|
|
||||||
#elif defined(GPIO_SERVO_9)
|
|
||||||
# define GPIO_MAX_SERVO_PIN 9
|
|
||||||
#elif defined(GPIO_SERVO_8)
|
|
||||||
# define GPIO_MAX_SERVO_PIN 8
|
|
||||||
#elif defined(GPIO_SERVO_7)
|
|
||||||
# define GPIO_MAX_SERVO_PIN 7
|
|
||||||
#elif defined(GPIO_SERVO_6)
|
|
||||||
# define GPIO_MAX_SERVO_PIN 6
|
|
||||||
#elif defined(GPIO_SERVO_5)
|
|
||||||
# define GPIO_MAX_SERVO_PIN 5
|
|
||||||
#elif defined(GPIO_SERVO_4)
|
|
||||||
# define GPIO_MAX_SERVO_PIN 4
|
|
||||||
#else
|
|
||||||
# error "Board must define GPIO_SERVO_1 and GPIO_SERVO_n where n is 4-16"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct gpio_led_s {
|
|
||||||
struct work_s work;
|
|
||||||
int gpio_fd;
|
|
||||||
int pin;
|
|
||||||
struct vehicle_status_s vehicle_status;
|
|
||||||
struct battery_status_s battery_status;
|
|
||||||
int vehicle_status_sub;
|
|
||||||
int battery_status_sub;
|
|
||||||
bool led_state;
|
|
||||||
int counter;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static struct gpio_led_s *gpio_led_data;
|
|
||||||
static volatile enum {
|
|
||||||
Stopped = 0,
|
|
||||||
Running = 1,
|
|
||||||
Falied = 2,
|
|
||||||
Stopping = 3
|
|
||||||
} gpio_led_state = Stopped;
|
|
||||||
|
|
||||||
__EXPORT int gpio_led_main(int argc, char *argv[]);
|
|
||||||
|
|
||||||
void gpio_led_start(FAR void *arg);
|
|
||||||
|
|
||||||
void gpio_led_cycle(FAR void *arg);
|
|
||||||
|
|
||||||
static void print_usage(const char *reason)
|
|
||||||
{
|
|
||||||
if (reason) {
|
|
||||||
PX4_WARN("%s\n", reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
PRINT_MODULE_DESCRIPTION(
|
|
||||||
R"DESCR_STR(
|
|
||||||
### Description
|
|
||||||
This module is responsible for drving a single LED on one of the FMU AUX pins.
|
|
||||||
|
|
||||||
It listens on the vehicle_status and battery_status topics and provides visual annunciation on the LED.
|
|
||||||
|
|
||||||
### Implementation
|
|
||||||
The module runs on the work queue. It schedules at a fixed frequency of 5 Hz
|
|
||||||
|
|
||||||
### Examples
|
|
||||||
It is started with:
|
|
||||||
$ gpio_led start
|
|
||||||
To drive an LED connected AUX1 pin.
|
|
||||||
|
|
||||||
OR with any of the avaliabel AUX pins
|
|
||||||
$ gpio_led start -p 5
|
|
||||||
To drive an LED connected AUX5 pin.
|
|
||||||
)DESCR_STR");
|
|
||||||
|
|
||||||
PRINT_MODULE_USAGE_NAME("gpio_led", "driver");
|
|
||||||
PRINT_MODULE_USAGE_COMMAND_DESCR("start", "annunciation on AUX OUT pin");
|
|
||||||
PRINT_MODULE_USAGE_PARAM_FLAG('p', "Use specified AUX OUT pin number (default: 1)", true);
|
|
||||||
PRINT_MODULE_USAGE_COMMAND("stop");
|
|
||||||
}
|
|
||||||
|
|
||||||
int gpio_led_main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
if (argc < 2) {
|
|
||||||
print_usage(NULL);
|
|
||||||
exit(1);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (!strcmp(argv[1], "start")) {
|
|
||||||
if (gpio_led_state != Stopped) {
|
|
||||||
PX4_WARN("already running");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* by default GPIO_SERVO_1 on FMUv2 */
|
|
||||||
int pin = 1;
|
|
||||||
|
|
||||||
/* pin name to display */
|
|
||||||
char pin_name[sizeof(PIN_NAME) + 2] = PIN_NAME;
|
|
||||||
|
|
||||||
if (argc > 2) {
|
|
||||||
if (!strcmp(argv[2], "-p")) {
|
|
||||||
|
|
||||||
unsigned int n = strtoul(argv[3], NULL, 10);
|
|
||||||
|
|
||||||
if (n >= GPIO_MIN_SERVO_PIN && n <= GPIO_MAX_SERVO_PIN) {
|
|
||||||
pin = 1 << (n - 1);
|
|
||||||
snprintf(pin_name, sizeof(pin_name), "AUX OUT %d", n);
|
|
||||||
} else {
|
|
||||||
PX4_ERR("unsupported pin: %s (valid values are %d-%d)", argv[3], GPIO_MIN_SERVO_PIN, GPIO_MAX_SERVO_PIN);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gpio_led_data = malloc(sizeof(struct gpio_led_s));
|
|
||||||
if (gpio_led_data == NULL) {
|
|
||||||
PX4_ERR("failed to allocate memory!");
|
|
||||||
exit(1);
|
|
||||||
} else {
|
|
||||||
memset(gpio_led_data, 0, sizeof(struct gpio_led_s));
|
|
||||||
gpio_led_data->pin = pin;
|
|
||||||
int ret = work_queue(LPWORK, &(gpio_led_data->work), gpio_led_start, gpio_led_data, 0);
|
|
||||||
|
|
||||||
if (ret != 0) {
|
|
||||||
PX4_ERR("failed to queue work: %d", ret);
|
|
||||||
goto out;
|
|
||||||
} else {
|
|
||||||
usleep(1000000/CYCLE_RATE_HZ);
|
|
||||||
if (gpio_led_state != Running) {
|
|
||||||
gpio_led_state = Stopped;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
PX4_INFO("start, using pin: %s", pin_name);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (!strcmp(argv[1], "stop")) {
|
|
||||||
if (gpio_led_state == Running) {
|
|
||||||
gpio_led_state = Stopping;
|
|
||||||
while(gpio_led_state != Stopped) {
|
|
||||||
usleep(1000000/CYCLE_RATE_HZ);
|
|
||||||
}
|
|
||||||
PX4_INFO("stopped");
|
|
||||||
free (gpio_led_data);
|
|
||||||
gpio_led_data = NULL;
|
|
||||||
exit(0);
|
|
||||||
} else {
|
|
||||||
PX4_WARN("not running");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
print_usage("unrecognized command");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
out:
|
|
||||||
free (gpio_led_data);
|
|
||||||
gpio_led_data = NULL;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void gpio_led_start(FAR void *arg)
|
|
||||||
{
|
|
||||||
FAR struct gpio_led_s *priv = (FAR struct gpio_led_s *)arg;
|
|
||||||
|
|
||||||
char *gpio_dev = PX4FMU_DEVICE_PATH;
|
|
||||||
|
|
||||||
/* open GPIO device */
|
|
||||||
priv->gpio_fd = open(gpio_dev, 0);
|
|
||||||
|
|
||||||
if (priv->gpio_fd < 0) {
|
|
||||||
PX4_ERR("gpio_led: GPIO device \"%s\" open fail\n", gpio_dev);
|
|
||||||
gpio_led_state = Falied;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* configure GPIO pin */
|
|
||||||
|
|
||||||
ioctl(priv->gpio_fd, GPIO_SET_OUTPUT, priv->pin);
|
|
||||||
|
|
||||||
/* initialize vehicle status structure */
|
|
||||||
memset(&priv->vehicle_status, 0, sizeof(priv->vehicle_status));
|
|
||||||
|
|
||||||
/* initialize battery status structure */
|
|
||||||
memset(&priv->battery_status, 0, sizeof(priv->battery_status));
|
|
||||||
|
|
||||||
/* subscribe to vehicle status topic */
|
|
||||||
priv->vehicle_status_sub = orb_subscribe(ORB_ID(vehicle_status));
|
|
||||||
|
|
||||||
/* subscribe to battery status topic */
|
|
||||||
priv->battery_status_sub = orb_subscribe(ORB_ID(battery_status));
|
|
||||||
|
|
||||||
/* add worker to queue */
|
|
||||||
int ret = work_queue(LPWORK, &priv->work, gpio_led_cycle, priv, 0);
|
|
||||||
|
|
||||||
if (ret != 0) {
|
|
||||||
PX4_ERR("gpio_led: failed to queue work: %d\n", ret);
|
|
||||||
close(priv->gpio_fd);
|
|
||||||
gpio_led_state = Falied;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
gpio_led_state = Running;
|
|
||||||
}
|
|
||||||
|
|
||||||
void gpio_led_cycle(FAR void *arg)
|
|
||||||
{
|
|
||||||
FAR struct gpio_led_s *priv = (FAR struct gpio_led_s *)arg;
|
|
||||||
|
|
||||||
/* check for vehicle status updates*/
|
|
||||||
bool updated;
|
|
||||||
orb_check(priv->vehicle_status_sub, &updated);
|
|
||||||
|
|
||||||
if (updated) {
|
|
||||||
orb_copy(ORB_ID(vehicle_status), priv->vehicle_status_sub, &priv->vehicle_status);
|
|
||||||
}
|
|
||||||
|
|
||||||
orb_check(priv->battery_status_sub, &updated);
|
|
||||||
|
|
||||||
if (updated) {
|
|
||||||
orb_copy(ORB_ID(battery_status), priv->battery_status_sub, &priv->battery_status);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* select pattern for current vehiclestatus */
|
|
||||||
int pattern = 0;
|
|
||||||
|
|
||||||
if (priv->vehicle_status.arming_state == VEHICLE_STATUS_ARMING_STATE_ARMED) {
|
|
||||||
if (priv->battery_status.warning == BATTERY_STATUS_BATTERY_WARNING_NONE
|
|
||||||
&& !priv->vehicle_status.failsafe) {
|
|
||||||
pattern = 0x3f; // ****** solid (armed)
|
|
||||||
|
|
||||||
} else {
|
|
||||||
pattern = 0x3e; // *****_ slow blink (armed, battery low or failsafe)
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (priv->vehicle_status.arming_state == VEHICLE_STATUS_ARMING_STATE_STANDBY) {
|
|
||||||
pattern = 0x38; // ***___ slow blink (disarmed, ready)
|
|
||||||
|
|
||||||
} else if (priv->vehicle_status.arming_state == VEHICLE_STATUS_ARMING_STATE_STANDBY_ERROR) {
|
|
||||||
pattern = 0x28; // *_*___ slow double blink (disarmed, error)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* blink pattern */
|
|
||||||
bool led_state_new = (pattern & (1 << priv->counter)) != 0;
|
|
||||||
|
|
||||||
if (led_state_new != priv->led_state) {
|
|
||||||
priv->led_state = led_state_new;
|
|
||||||
|
|
||||||
if (led_state_new) {
|
|
||||||
ioctl(priv->gpio_fd, GPIO_SET, priv->pin);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
ioctl(priv->gpio_fd, GPIO_CLEAR, priv->pin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
priv->counter++;
|
|
||||||
|
|
||||||
if (priv->counter > 5) {
|
|
||||||
priv->counter = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* repeat cycle at 5 Hz */
|
|
||||||
if (gpio_led_state == Running) {
|
|
||||||
work_queue(LPWORK, &priv->work, gpio_led_cycle, priv, USEC2TICK(1000000/CYCLE_RATE_HZ));
|
|
||||||
|
|
||||||
} else {
|
|
||||||
/* switch off LED on stop */
|
|
||||||
ioctl(priv->gpio_fd, GPIO_CLEAR, priv->pin);
|
|
||||||
orb_unsubscribe(priv->vehicle_status_sub);
|
|
||||||
orb_unsubscribe(priv->battery_status_sub);
|
|
||||||
close(priv->gpio_fd);
|
|
||||||
gpio_led_state = Stopped;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -42,7 +42,6 @@ set(srcs
|
|||||||
test_file.c
|
test_file.c
|
||||||
test_file2.c
|
test_file2.c
|
||||||
test_float.cpp
|
test_float.cpp
|
||||||
test_gpio.c
|
|
||||||
test_hott_telemetry.c
|
test_hott_telemetry.c
|
||||||
test_hrt.cpp
|
test_hrt.cpp
|
||||||
test_hysteresis.cpp
|
test_hysteresis.cpp
|
||||||
|
|||||||
@@ -1,119 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
* px4/sensors/test_gpio.c
|
|
||||||
*
|
|
||||||
* Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Included Files
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include <px4_config.h>
|
|
||||||
#include <px4_posix.h>
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
|
|
||||||
#include "tests_main.h"
|
|
||||||
|
|
||||||
#include <drivers/drv_gpio.h>
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Types
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Function Prototypes
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: test_gpio
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
int test_gpio(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
#if defined(BOARD_USES_PX4IO)
|
|
||||||
|
|
||||||
int fd = px4_open(PX4IO_DEVICE_PATH, 0);
|
|
||||||
|
|
||||||
if (fd < 0) {
|
|
||||||
PX4_ERR("GPIO: open fail");
|
|
||||||
return ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set all GPIOs to default state */
|
|
||||||
px4_ioctl(fd, GPIO_RESET, ~0);
|
|
||||||
|
|
||||||
|
|
||||||
/* XXX need to add some GPIO waving stuff here */
|
|
||||||
|
|
||||||
|
|
||||||
/* Go back to default */
|
|
||||||
px4_ioctl(fd, GPIO_RESET, ~0);
|
|
||||||
|
|
||||||
px4_close(fd);
|
|
||||||
PX4_INFO("GPIO test successful.");
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
@@ -43,12 +43,12 @@
|
|||||||
* Included Files
|
* Included Files
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <drivers/drv_gpio.h>
|
|
||||||
#include <px4_config.h>
|
#include <px4_config.h>
|
||||||
#include <px4_defines.h>
|
#include <px4_defines.h>
|
||||||
#include <px4_log.h>
|
#include <px4_log.h>
|
||||||
|
#include <px4_posix.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <systemlib/err.h>
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|||||||
@@ -51,39 +51,6 @@
|
|||||||
#include <drivers/drv_adc.h>
|
#include <drivers/drv_adc.h>
|
||||||
#include <systemlib/err.h>
|
#include <systemlib/err.h>
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Types
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Function Prototypes
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: test_gpio
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
int test_jig_voltages(int argc, char *argv[])
|
int test_jig_voltages(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int fd = open(ADC0_DEVICE_PATH, O_RDONLY);
|
int fd = open(ADC0_DEVICE_PATH, O_RDONLY);
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* px4/sensors/test_gpio.c
|
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
* Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* px4/sensors/test_gpio.c
|
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
* Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* px4/sensors/test_gpio.c
|
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
* Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
||||||
* Lorenz Meier <lm@inf.ethz.ch>
|
* Lorenz Meier <lm@inf.ethz.ch>
|
||||||
|
|||||||
@@ -108,7 +108,6 @@ const struct {
|
|||||||
{"dataman", test_dataman, OPT_NOJIGTEST | OPT_NOALLTEST},
|
{"dataman", test_dataman, OPT_NOJIGTEST | OPT_NOALLTEST},
|
||||||
{"file2", test_file2, OPT_NOJIGTEST},
|
{"file2", test_file2, OPT_NOJIGTEST},
|
||||||
{"float", test_float, 0},
|
{"float", test_float, 0},
|
||||||
{"gpio", test_gpio, OPT_NOJIGTEST | OPT_NOALLTEST},
|
|
||||||
{"hott_telemetry", test_hott_telemetry, OPT_NOJIGTEST | OPT_NOALLTEST},
|
{"hott_telemetry", test_hott_telemetry, OPT_NOJIGTEST | OPT_NOALLTEST},
|
||||||
{"hrt", test_hrt, OPT_NOJIGTEST | OPT_NOALLTEST},
|
{"hrt", test_hrt, OPT_NOJIGTEST | OPT_NOALLTEST},
|
||||||
{"int", test_int, 0},
|
{"int", test_int, 0},
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ extern int test_dataman(int argc, char *argv[]);
|
|||||||
extern int test_file(int argc, char *argv[]);
|
extern int test_file(int argc, char *argv[]);
|
||||||
extern int test_file2(int argc, char *argv[]);
|
extern int test_file2(int argc, char *argv[]);
|
||||||
extern int test_float(int argc, char *argv[]);
|
extern int test_float(int argc, char *argv[]);
|
||||||
extern int test_gpio(int argc, char *argv[]);
|
|
||||||
extern int test_hott_telemetry(int argc, char *argv[]);
|
extern int test_hott_telemetry(int argc, char *argv[]);
|
||||||
extern int test_hrt(int argc, char *argv[]);
|
extern int test_hrt(int argc, char *argv[]);
|
||||||
extern int test_int(int argc, char *argv[]);
|
extern int test_int(int argc, char *argv[]);
|
||||||
|
|||||||
@@ -42,7 +42,6 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <drivers/drv_gpio.h>
|
|
||||||
#include <arch/board/board.h>
|
#include <arch/board/board.h>
|
||||||
#include <board_config.h>
|
#include <board_config.h>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user