diff --git a/ROMFS/px4fmu_common/init.d/airframes/4004_H4_680mm b/ROMFS/px4fmu_common/init.d/airframes/4004_H4_680mm index b1efdd95a4..294aec2fe2 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/4004_H4_680mm +++ b/ROMFS/px4fmu_common/init.d/airframes/4004_H4_680mm @@ -25,6 +25,3 @@ fi # Start FrSky telemetry on SERIAL4 (ttyS6, designated "SERIAL4/5" on the case) frsky_telemetry start -d /dev/ttyS6 - -# GPIO LED -gpio_led start -p 6 diff --git a/boards/aerotenna/ocpoc/ubuntu.cmake b/boards/aerotenna/ocpoc/ubuntu.cmake index 4f12dd719c..e0ff231b46 100644 --- a/boards/aerotenna/ocpoc/ubuntu.cmake +++ b/boards/aerotenna/ocpoc/ubuntu.cmake @@ -41,7 +41,6 @@ px4_add_board( fw_pos_control_l1 gnd_att_control gnd_pos_control - #gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/airmind/mindpx-v2/default.cmake b/boards/airmind/mindpx-v2/default.cmake index e21396b290..d153ea8935 100644 --- a/boards/airmind/mindpx-v2/default.cmake +++ b/boards/airmind/mindpx-v2/default.cmake @@ -58,7 +58,6 @@ px4_add_board( fw_pos_control_l1 gnd_att_control gnd_pos_control - gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/airmind/mindpx-v2/src/board_config.h b/boards/airmind/mindpx-v2/src/board_config.h index e4808ac8f0..3d0fe95891 100644 --- a/boards/airmind/mindpx-v2/src/board_config.h +++ b/boards/airmind/mindpx-v2/src/board_config.h @@ -305,30 +305,6 @@ #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 */ #define BOARD_DMA_ALLOC_POOL_SIZE 5120 diff --git a/boards/atlflight/eagle/default.cmake b/boards/atlflight/eagle/default.cmake index 127da0597c..add68a96e7 100644 --- a/boards/atlflight/eagle/default.cmake +++ b/boards/atlflight/eagle/default.cmake @@ -75,7 +75,6 @@ px4_add_board( fw_pos_control_l1 gnd_att_control gnd_pos_control - #gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/atlflight/excelsior/default.cmake b/boards/atlflight/excelsior/default.cmake index 2b11644bcd..7c8581fbc8 100644 --- a/boards/atlflight/excelsior/default.cmake +++ b/boards/atlflight/excelsior/default.cmake @@ -75,7 +75,6 @@ px4_add_board( fw_pos_control_l1 gnd_att_control gnd_pos_control - #gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/atmel/same70xplained/default.cmake b/boards/atmel/same70xplained/default.cmake index 67a0ddf6aa..3f22b70f8a 100644 --- a/boards/atmel/same70xplained/default.cmake +++ b/boards/atmel/same70xplained/default.cmake @@ -58,7 +58,6 @@ px4_add_board( fw_pos_control_l1 gnd_att_control gnd_pos_control - gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/atmel/same70xplained/src/board_config.h b/boards/atmel/same70xplained/src/board_config.h index 188ab22298..f02857d261 100644 --- a/boards/atmel/same70xplained/src/board_config.h +++ b/boards/atmel/same70xplained/src/board_config.h @@ -315,22 +315,6 @@ __BEGIN_DECLS #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 /**************************************************************************************************** diff --git a/boards/auav/x21/default.cmake b/boards/auav/x21/default.cmake index 90e9ca6dc5..02593fd0c0 100644 --- a/boards/auav/x21/default.cmake +++ b/boards/auav/x21/default.cmake @@ -63,7 +63,6 @@ px4_add_board( fw_pos_control_l1 gnd_att_control gnd_pos_control - gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/auav/x21/src/board_config.h b/boards/auav/x21/src/board_config.h index 789a783c9b..f0deaf03f7 100644 --- a/boards/auav/x21/src/board_config.h +++ b/boards/auav/x21/src/board_config.h @@ -215,34 +215,6 @@ #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 */ #define BOARD_DMA_ALLOC_POOL_SIZE 5120 diff --git a/boards/av/x-v1/default.cmake b/boards/av/x-v1/default.cmake index 5ba973bcde..6bc430ba7c 100644 --- a/boards/av/x-v1/default.cmake +++ b/boards/av/x-v1/default.cmake @@ -63,7 +63,6 @@ px4_add_board( fw_pos_control_l1 gnd_att_control gnd_pos_control - gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/av/x-v1/src/board_config.h b/boards/av/x-v1/src/board_config.h index c8043f4b6b..90324a6a06 100644 --- a/boards/av/x-v1/src/board_config.h +++ b/boards/av/x-v1/src/board_config.h @@ -349,31 +349,6 @@ #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 */ #define BOARD_DMA_ALLOC_POOL_SIZE 5120 diff --git a/boards/beaglebone/blue/cross.cmake b/boards/beaglebone/blue/cross.cmake index e984224bce..58e554c066 100644 --- a/boards/beaglebone/blue/cross.cmake +++ b/boards/beaglebone/blue/cross.cmake @@ -41,7 +41,6 @@ px4_add_board( fw_pos_control_l1 gnd_att_control gnd_pos_control - #gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/beaglebone/blue/native.cmake b/boards/beaglebone/blue/native.cmake index 2078018c24..ff967a92c5 100644 --- a/boards/beaglebone/blue/native.cmake +++ b/boards/beaglebone/blue/native.cmake @@ -39,7 +39,6 @@ px4_add_board( fw_pos_control_l1 gnd_att_control gnd_pos_control - #gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/bitcraze/crazyflie/default.cmake b/boards/bitcraze/crazyflie/default.cmake index da9108d55c..836b99d94f 100644 --- a/boards/bitcraze/crazyflie/default.cmake +++ b/boards/bitcraze/crazyflie/default.cmake @@ -27,7 +27,6 @@ px4_add_board( #fw_pos_control_l1 #gnd_att_control #gnd_pos_control - #gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/emlid/navio2/cross.cmake b/boards/emlid/navio2/cross.cmake index d5e1cc038f..93ebd69cca 100644 --- a/boards/emlid/navio2/cross.cmake +++ b/boards/emlid/navio2/cross.cmake @@ -48,7 +48,6 @@ px4_add_board( fw_pos_control_l1 gnd_att_control gnd_pos_control - #gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/emlid/navio2/native.cmake b/boards/emlid/navio2/native.cmake index 23b11f1d5f..e0082c6f40 100644 --- a/boards/emlid/navio2/native.cmake +++ b/boards/emlid/navio2/native.cmake @@ -46,7 +46,6 @@ px4_add_board( fw_pos_control_l1 gnd_att_control gnd_pos_control - #gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/gumstix/aerocore2/default.cmake b/boards/gumstix/aerocore2/default.cmake index 3330cf383d..1c417e32f7 100644 --- a/boards/gumstix/aerocore2/default.cmake +++ b/boards/gumstix/aerocore2/default.cmake @@ -61,7 +61,6 @@ px4_add_board( #fw_pos_control_l1 #gnd_att_control #gnd_pos_control - #gpio_led land_detector #landing_target_estimator load_mon diff --git a/boards/gumstix/aerocore2/src/board_config.h b/boards/gumstix/aerocore2/src/board_config.h index 8b536813df..9a35789925 100644 --- a/boards/gumstix/aerocore2/src/board_config.h +++ b/boards/gumstix/aerocore2/src/board_config.h @@ -202,9 +202,6 @@ #define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS -#define BOARD_FMU_GPIO_TAB { \ - {0, 0, 0}, } - /* This board provides a DMA pool and APIs */ #define BOARD_DMA_ALLOC_POOL_SIZE 5120 diff --git a/boards/intel/aerofc-v1/default.cmake b/boards/intel/aerofc-v1/default.cmake index 5061b89296..1393401d87 100644 --- a/boards/intel/aerofc-v1/default.cmake +++ b/boards/intel/aerofc-v1/default.cmake @@ -44,7 +44,6 @@ px4_add_board( #fw_pos_control_l1 #gnd_att_control #gnd_pos_control - #gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/intel/aerofc-v1/rtps.cmake b/boards/intel/aerofc-v1/rtps.cmake index 23f0f156ef..1c1f968693 100644 --- a/boards/intel/aerofc-v1/rtps.cmake +++ b/boards/intel/aerofc-v1/rtps.cmake @@ -46,7 +46,6 @@ px4_add_board( #fw_pos_control_l1 #gnd_att_control #gnd_pos_control - #gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/nxp/fmuk66-v3/default.cmake b/boards/nxp/fmuk66-v3/default.cmake index 8415c057fd..c0a50dcbbc 100644 --- a/boards/nxp/fmuk66-v3/default.cmake +++ b/boards/nxp/fmuk66-v3/default.cmake @@ -60,7 +60,6 @@ px4_add_board( fw_pos_control_l1 gnd_att_control gnd_pos_control - gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/nxp/fmuk66-v3/src/board_config.h b/boards/nxp/fmuk66-v3/src/board_config.h index 5308295c3e..50292d20cd 100644 --- a/boards/nxp/fmuk66-v3/src/board_config.h +++ b/boards/nxp/fmuk66-v3/src/board_config.h @@ -421,38 +421,12 @@ __BEGIN_DECLS #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 LED_TIM3_CH1OUT /* PTD1 RGB_R */ PIN_FTM3_CH1_1 #define LED_TIM3_CH5OUT /* PTC9 RGB_G */ PIN_FTM3_CH5_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 */ #define BOARD_DMA_ALLOC_POOL_SIZE 5120 diff --git a/boards/omnibus/f4sd/default.cmake b/boards/omnibus/f4sd/default.cmake index db56f29f00..1bd69e5edc 100644 --- a/boards/omnibus/f4sd/default.cmake +++ b/boards/omnibus/f4sd/default.cmake @@ -55,7 +55,6 @@ px4_add_board( #fw_pos_control_l1 #gnd_att_control #gnd_pos_control - #gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/omnibus/f4sd/src/board_config.h b/boards/omnibus/f4sd/src/board_config.h index 44a176ce52..677375d853 100644 --- a/boards/omnibus/f4sd/src/board_config.h +++ b/boards/omnibus/f4sd/src/board_config.h @@ -254,22 +254,6 @@ #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 */ #define BOARD_DMA_ALLOC_POOL_SIZE 5120 diff --git a/boards/parrot/bebop/default.cmake b/boards/parrot/bebop/default.cmake index 393503e495..2d88437e5a 100644 --- a/boards/parrot/bebop/default.cmake +++ b/boards/parrot/bebop/default.cmake @@ -30,7 +30,6 @@ px4_add_board( #fw_pos_control_l1 #gnd_att_control #gnd_pos_control - #gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/px4/fmu-v2/default.cmake b/boards/px4/fmu-v2/default.cmake index 40d7778ddd..5fc1db62b9 100644 --- a/boards/px4/fmu-v2/default.cmake +++ b/boards/px4/fmu-v2/default.cmake @@ -70,7 +70,6 @@ px4_add_board( fw_pos_control_l1 #gnd_att_control #gnd_pos_control - #gpio_led land_detector #landing_target_estimator load_mon diff --git a/boards/px4/fmu-v2/lpe.cmake b/boards/px4/fmu-v2/lpe.cmake index 90df7f80e3..398206d16c 100644 --- a/boards/px4/fmu-v2/lpe.cmake +++ b/boards/px4/fmu-v2/lpe.cmake @@ -68,7 +68,6 @@ px4_add_board( #fw_pos_control_l1 #gnd_att_control #gnd_pos_control - #gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/px4/fmu-v2/src/board_config.h b/boards/px4/fmu-v2/src/board_config.h index fdc5dfcf2e..0fdf8d2fe1 100644 --- a/boards/px4/fmu-v2/src/board_config.h +++ b/boards/px4/fmu-v2/src/board_config.h @@ -463,41 +463,6 @@ #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 */ #define BOARD_DMA_ALLOC_POOL_SIZE 5120 diff --git a/boards/px4/fmu-v2/test.cmake b/boards/px4/fmu-v2/test.cmake index 598f518ed6..72327e6612 100644 --- a/boards/px4/fmu-v2/test.cmake +++ b/boards/px4/fmu-v2/test.cmake @@ -69,7 +69,6 @@ px4_add_board( #fw_pos_control_l1 #gnd_att_control #gnd_pos_control - #gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/px4/fmu-v3/default.cmake b/boards/px4/fmu-v3/default.cmake index ad90224f08..7e38d1f438 100644 --- a/boards/px4/fmu-v3/default.cmake +++ b/boards/px4/fmu-v3/default.cmake @@ -71,7 +71,6 @@ px4_add_board( fw_pos_control_l1 gnd_att_control gnd_pos_control - gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/px4/fmu-v3/rtps.cmake b/boards/px4/fmu-v3/rtps.cmake index 87369956cf..2b4b3585f0 100644 --- a/boards/px4/fmu-v3/rtps.cmake +++ b/boards/px4/fmu-v3/rtps.cmake @@ -71,7 +71,6 @@ px4_add_board( fw_pos_control_l1 gnd_att_control gnd_pos_control - gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/px4/fmu-v3/src/board_config.h b/boards/px4/fmu-v3/src/board_config.h index fdc5dfcf2e..0fdf8d2fe1 100644 --- a/boards/px4/fmu-v3/src/board_config.h +++ b/boards/px4/fmu-v3/src/board_config.h @@ -463,41 +463,6 @@ #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 */ #define BOARD_DMA_ALLOC_POOL_SIZE 5120 diff --git a/boards/px4/fmu-v3/stackcheck.cmake b/boards/px4/fmu-v3/stackcheck.cmake index 6015921753..b5441c0808 100644 --- a/boards/px4/fmu-v3/stackcheck.cmake +++ b/boards/px4/fmu-v3/stackcheck.cmake @@ -71,7 +71,6 @@ px4_add_board( fw_pos_control_l1 gnd_att_control gnd_pos_control - gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/px4/fmu-v4/default.cmake b/boards/px4/fmu-v4/default.cmake index c2b12f1dbf..3f616f356c 100644 --- a/boards/px4/fmu-v4/default.cmake +++ b/boards/px4/fmu-v4/default.cmake @@ -56,7 +56,6 @@ px4_add_board( fw_pos_control_l1 gnd_att_control gnd_pos_control - gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/px4/fmu-v4/rtps.cmake b/boards/px4/fmu-v4/rtps.cmake index 8bf32a8d0b..5f46abf326 100644 --- a/boards/px4/fmu-v4/rtps.cmake +++ b/boards/px4/fmu-v4/rtps.cmake @@ -57,7 +57,6 @@ px4_add_board( fw_pos_control_l1 gnd_att_control gnd_pos_control - gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/px4/fmu-v4/src/board_config.h b/boards/px4/fmu-v4/src/board_config.h index 204b9c38d4..902d4880d5 100644 --- a/boards/px4/fmu-v4/src/board_config.h +++ b/boards/px4/fmu-v4/src/board_config.h @@ -320,32 +320,6 @@ #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. */ #define BOARD_DMA_ALLOC_POOL_SIZE 5120 diff --git a/boards/px4/fmu-v4/stackcheck.cmake b/boards/px4/fmu-v4/stackcheck.cmake index 050ccee7f4..f0438a5e77 100644 --- a/boards/px4/fmu-v4/stackcheck.cmake +++ b/boards/px4/fmu-v4/stackcheck.cmake @@ -56,7 +56,6 @@ px4_add_board( fw_pos_control_l1 gnd_att_control gnd_pos_control - gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/px4/fmu-v4pro/default.cmake b/boards/px4/fmu-v4pro/default.cmake index 5a0b5ef4c8..3ef6a77218 100644 --- a/boards/px4/fmu-v4pro/default.cmake +++ b/boards/px4/fmu-v4pro/default.cmake @@ -70,7 +70,6 @@ px4_add_board( fw_pos_control_l1 gnd_att_control gnd_pos_control - gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/px4/fmu-v4pro/rtps.cmake b/boards/px4/fmu-v4pro/rtps.cmake index 26e3fb530a..b77f54699c 100644 --- a/boards/px4/fmu-v4pro/rtps.cmake +++ b/boards/px4/fmu-v4pro/rtps.cmake @@ -70,7 +70,6 @@ px4_add_board( fw_pos_control_l1 gnd_att_control gnd_pos_control - gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/px4/fmu-v4pro/src/board_config.h b/boards/px4/fmu-v4pro/src/board_config.h index 64fbb05985..0814327a65 100644 --- a/boards/px4/fmu-v4pro/src/board_config.h +++ b/boards/px4/fmu-v4pro/src/board_config.h @@ -332,45 +332,6 @@ #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 */ #define BOARD_DMA_ALLOC_POOL_SIZE 5120 diff --git a/boards/px4/fmu-v5/default.cmake b/boards/px4/fmu-v5/default.cmake index b1f6fe5d5d..356e13690e 100644 --- a/boards/px4/fmu-v5/default.cmake +++ b/boards/px4/fmu-v5/default.cmake @@ -70,7 +70,6 @@ px4_add_board( fw_pos_control_l1 gnd_att_control gnd_pos_control - gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/px4/fmu-v5/rtps.cmake b/boards/px4/fmu-v5/rtps.cmake index 5d109105b8..caf5e7785e 100644 --- a/boards/px4/fmu-v5/rtps.cmake +++ b/boards/px4/fmu-v5/rtps.cmake @@ -71,7 +71,6 @@ px4_add_board( fw_pos_control_l1 gnd_att_control gnd_pos_control - gpio_led land_detector landing_target_estimator load_mon diff --git a/boards/px4/fmu-v5/src/board_config.h b/boards/px4/fmu-v5/src/board_config.h index 477529c5ae..66b5ae4dbb 100644 --- a/boards/px4/fmu-v5/src/board_config.h +++ b/boards/px4/fmu-v5/src/board_config.h @@ -645,61 +645,6 @@ #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) /** - -#include - -/** - * 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 */ diff --git a/src/drivers/px4fmu/fmu.cpp b/src/drivers/px4fmu/fmu.cpp index 1c514180df..dba5ca3084 100644 --- a/src/drivers/px4fmu/fmu.cpp +++ b/src/drivers/px4fmu/fmu.cpp @@ -42,7 +42,6 @@ #include #include #include -#include #include #include #include @@ -101,6 +100,8 @@ enum PortMode { # error "board_config.h needs to define BOARD_HAS_PWM" #endif +#define PX4FMU_DEVICE_PATH "/dev/px4fmu" + class PX4FMU : public cdev::CDev, public ModuleBase { public: @@ -263,23 +264,8 @@ private: 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 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); @@ -296,11 +282,6 @@ private: 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; actuator_armed_s PX4FMU::_armed = {}; work_s PX4FMU::_work = {}; @@ -1464,13 +1445,6 @@ PX4FMU::ioctl(file *filp, int cmd, unsigned long arg) { 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 */ ret = capture_ioctl(filp, cmd, arg); @@ -2311,100 +2285,6 @@ PX4FMU::peripheral_reset(int 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 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; } -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 PX4FMU::fmu_new_mode(PortMode new_mode) { @@ -2590,7 +2439,6 @@ PX4FMU::fmu_new_mode(PortMode new_mode) } PX4FMU::Mode servo_mode; - bool mode_with_input = false; servo_mode = PX4FMU::MODE_NONE; @@ -2645,7 +2493,6 @@ PX4FMU::fmu_new_mode(PortMode new_mode) case PORT_PWM5CAP1: /* select 5-pin PWM mode 1 capture */ servo_mode = PX4FMU::MODE_5PWM1CAP; - mode_with_input = true; break; # endif @@ -2659,7 +2506,6 @@ PX4FMU::fmu_new_mode(PortMode new_mode) case PORT_PWM4CAP1: /* select 4-pin PWM mode 1 capture */ servo_mode = PX4FMU::MODE_4PWM1CAP; - mode_with_input = true; break; # endif @@ -2673,7 +2519,6 @@ PX4FMU::fmu_new_mode(PortMode new_mode) case PORT_PWM3CAP1: /* select 3-pin PWM mode 1 capture */ servo_mode = PX4FMU::MODE_3PWM1CAP; - mode_with_input = true; break; # endif @@ -2687,7 +2532,6 @@ PX4FMU::fmu_new_mode(PortMode new_mode) case PORT_PWM2CAP2: /* select 2-pin PWM mode 2 capture */ servo_mode = PX4FMU::MODE_2PWM2CAP; - mode_with_input = true; break; # endif #endif @@ -2699,12 +2543,6 @@ PX4FMU::fmu_new_mode(PortMode new_mode) PX4FMU *object = get_instance(); 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 */ object->set_mode(servo_mode); } diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index 5cd47fe69f..334f9d82a8 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -63,7 +63,6 @@ #include #include #include -#include #include #include @@ -449,6 +448,8 @@ namespace PX4IO *g_dev = nullptr; } +#define PX4IO_DEVICE_PATH "/dev/px4io" + PX4IO::PX4IO(device::Device *interface) : CDev(PX4IO_DEVICE_PATH), _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; break; - case GPIO_RESET: { - ret = -EINVAL; - break; - } - - case GPIO_SET: - ret = -EINVAL; - break; - - case GPIO_CLEAR: - ret = -EINVAL; - break; - case MIXERIOCGETOUTPUTCOUNT: *(unsigned *)arg = _max_actuators; break; diff --git a/src/modules/gpio_led/CMakeLists.txt b/src/modules/gpio_led/CMakeLists.txt deleted file mode 100644 index 8467a1fe7a..0000000000 --- a/src/modules/gpio_led/CMakeLists.txt +++ /dev/null @@ -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 - ) - diff --git a/src/modules/gpio_led/gpio_led.c b/src/modules/gpio_led/gpio_led.c deleted file mode 100644 index 10472c2386..0000000000 --- a/src/modules/gpio_led/gpio_led.c +++ /dev/null @@ -1,355 +0,0 @@ -/**************************************************************************** - * - * Copyright (c) 2013 PX4 Development Team. All rights reserved. - * Author: Anton Babushkin - * - * 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 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#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; - } -} diff --git a/src/systemcmds/tests/CMakeLists.txt b/src/systemcmds/tests/CMakeLists.txt index 2228020bf3..20507c96aa 100644 --- a/src/systemcmds/tests/CMakeLists.txt +++ b/src/systemcmds/tests/CMakeLists.txt @@ -42,7 +42,6 @@ set(srcs test_file.c test_file2.c test_float.cpp - test_gpio.c test_hott_telemetry.c test_hrt.cpp test_hysteresis.cpp diff --git a/src/systemcmds/tests/test_gpio.c b/src/systemcmds/tests/test_gpio.c deleted file mode 100644 index 6e67a58901..0000000000 --- a/src/systemcmds/tests/test_gpio.c +++ /dev/null @@ -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 -#include - -#include - -#include -#include -#include -#include -#include - - -#include "tests_main.h" - -#include - - -/**************************************************************************** - * 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; -} diff --git a/src/systemcmds/tests/test_hott_telemetry.c b/src/systemcmds/tests/test_hott_telemetry.c index adb76265ae..b9b01ff44a 100644 --- a/src/systemcmds/tests/test_hott_telemetry.c +++ b/src/systemcmds/tests/test_hott_telemetry.c @@ -43,12 +43,12 @@ * Included Files ****************************************************************************/ -#include #include #include #include +#include +#include #include -#include #include #include diff --git a/src/systemcmds/tests/test_jig_voltages.c b/src/systemcmds/tests/test_jig_voltages.c index 9b192d25a5..5282c64634 100644 --- a/src/systemcmds/tests/test_jig_voltages.c +++ b/src/systemcmds/tests/test_jig_voltages.c @@ -51,39 +51,6 @@ #include #include -/**************************************************************************** - * 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 fd = open(ADC0_DEVICE_PATH, O_RDONLY); diff --git a/src/systemcmds/tests/test_led.c b/src/systemcmds/tests/test_led.c index 2783ce24eb..72830a2e90 100644 --- a/src/systemcmds/tests/test_led.c +++ b/src/systemcmds/tests/test_led.c @@ -1,5 +1,4 @@ /**************************************************************************** - * px4/sensors/test_gpio.c * * Copyright (C) 2012 PX4 Development Team. All rights reserved. * diff --git a/src/systemcmds/tests/test_sleep.c b/src/systemcmds/tests/test_sleep.c index 02de5df653..9f4536c34d 100644 --- a/src/systemcmds/tests/test_sleep.c +++ b/src/systemcmds/tests/test_sleep.c @@ -1,5 +1,4 @@ /**************************************************************************** - * px4/sensors/test_gpio.c * * Copyright (C) 2012 PX4 Development Team. All rights reserved. * diff --git a/src/systemcmds/tests/test_uart_send.c b/src/systemcmds/tests/test_uart_send.c index 44cd613c45..6336834dab 100644 --- a/src/systemcmds/tests/test_uart_send.c +++ b/src/systemcmds/tests/test_uart_send.c @@ -1,5 +1,4 @@ /**************************************************************************** - * px4/sensors/test_gpio.c * * Copyright (C) 2012 PX4 Development Team. All rights reserved. * Lorenz Meier diff --git a/src/systemcmds/tests/tests_main.c b/src/systemcmds/tests/tests_main.c index 80c513101e..c5fed2ad81 100644 --- a/src/systemcmds/tests/tests_main.c +++ b/src/systemcmds/tests/tests_main.c @@ -108,7 +108,6 @@ const struct { {"dataman", test_dataman, OPT_NOJIGTEST | OPT_NOALLTEST}, {"file2", test_file2, OPT_NOJIGTEST}, {"float", test_float, 0}, - {"gpio", test_gpio, OPT_NOJIGTEST | OPT_NOALLTEST}, {"hott_telemetry", test_hott_telemetry, OPT_NOJIGTEST | OPT_NOALLTEST}, {"hrt", test_hrt, OPT_NOJIGTEST | OPT_NOALLTEST}, {"int", test_int, 0}, diff --git a/src/systemcmds/tests/tests_main.h b/src/systemcmds/tests/tests_main.h index 2d146a0b05..973d9f8e84 100644 --- a/src/systemcmds/tests/tests_main.h +++ b/src/systemcmds/tests/tests_main.h @@ -62,7 +62,6 @@ extern int test_dataman(int argc, char *argv[]); extern int test_file(int argc, char *argv[]); extern int test_file2(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_hrt(int argc, char *argv[]); extern int test_int(int argc, char *argv[]); diff --git a/src/systemcmds/usb_connected/usb_connected.c b/src/systemcmds/usb_connected/usb_connected.c index 9b74ed6cb0..b6d12443a4 100644 --- a/src/systemcmds/usb_connected/usb_connected.c +++ b/src/systemcmds/usb_connected/usb_connected.c @@ -42,7 +42,6 @@ #include #include #include -#include #include #include