Skip to content

Commit

Permalink
[boards] nicer way to configure RADIO_CONTROL_PPM_PIN
Browse files Browse the repository at this point in the history
  • Loading branch information
flixr committed Dec 13, 2015
1 parent a8d581f commit 78c5134
Show file tree
Hide file tree
Showing 16 changed files with 151 additions and 13 deletions.
11 changes: 11 additions & 0 deletions conf/boards/cc3d.makefile
Expand Up @@ -55,6 +55,17 @@ MODEM_BAUD ?= B57600
GPS_PORT ?= UART3
GPS_BAUD ?= B38400

#
# default PPM input is on PA01
#
RADIO_CONTROL_PPM_PIN ?= PA01
ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PB_06 PB06 PB6))
PPM_CONFIG=1
else ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_01 PA01 PA1))
PPM_CONFIG=2
else
$(error Unknown RADIO_CONTROL_PPM_PIN, configure it to either PA01, PB06)
endif

#
# default actuator configuration
Expand Down
14 changes: 14 additions & 0 deletions conf/boards/cjmcu.makefile
Expand Up @@ -57,6 +57,20 @@ MODEM_BAUD ?= B57600
GPS_PORT ?= UART3
GPS_BAUD ?= B38400

#
# default PPM input is on PA0
#
RADIO_CONTROL_PPM_PIN ?= PA0
ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_00 PA00 PA0)
PPM_CONFIG=1
else ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_01 PA01 PA1))
PPM_CONFIG=2
else ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_03 PA03 PA3))
PPM_CONFIG=3
else
$(error Unknown RADIO_CONTROL_PPM_PIN, configure it to either PA00, PA01, PA03)
endif


#
# default actuator configuration
Expand Down
12 changes: 12 additions & 0 deletions conf/boards/elle0_1.0.makefile
Expand Up @@ -52,6 +52,18 @@ MODEM_BAUD ?= B57600
GPS_PORT ?= UART3
GPS_BAUD ?= B38400

#
# default PPM input is on PA01
#
RADIO_CONTROL_PPM_PIN ?= PA01
ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_10 PA10 UART1_RX)
PPM_CONFIG=1
else ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_01 PA01 PA1 SERVO6))
PPM_CONFIG=2
else
$(error Unknown RADIO_CONTROL_PPM_PIN, configure it to either PA01, PA10)
endif


#
# default actuator configuration
Expand Down
12 changes: 12 additions & 0 deletions conf/boards/elle0_1.2.makefile
Expand Up @@ -52,6 +52,18 @@ MODEM_BAUD ?= B57600
GPS_PORT ?= UART3
GPS_BAUD ?= B38400

#
# default PPM input is on PA01
#
RADIO_CONTROL_PPM_PIN ?= PA01
ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_10 PA10 UART1_RX)
PPM_CONFIG=1
else ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_01 PA01 PA1 SERVO6))
PPM_CONFIG=2
else
$(error Unknown RADIO_CONTROL_PPM_PIN, configure it to either PA01, PA10)
endif


#
# default actuator configuration
Expand Down
11 changes: 11 additions & 0 deletions conf/boards/lisa_m_1.0.makefile
Expand Up @@ -51,6 +51,17 @@ MODEM_BAUD ?= B57600
GPS_PORT ?= UART1
GPS_BAUD ?= B38400

#
# default PPM input is on PA01 (SERVO6)
#
RADIO_CONTROL_PPM_PIN ?= PA01
ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_10 PA10 UART1_RX))
PPM_CONFIG=1
else ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_01 PA01 PA1 SERVO6))
PPM_CONFIG=2
else
$(error Unknown RADIO_CONTROL_PPM_PIN, configure it to either PA01 or PA10)
endif

#
# default actuator configuration
Expand Down
11 changes: 11 additions & 0 deletions conf/boards/lisa_m_2.0.makefile
Expand Up @@ -57,6 +57,17 @@ MODEM_BAUD ?= B57600
GPS_PORT ?= UART3
GPS_BAUD ?= B38400

#
# default PPM input is on PA01 (SERVO6)
#
RADIO_CONTROL_PPM_PIN ?= PA01
ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_10 PA10 UART1_RX))
PPM_CONFIG=1
else ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_01 PA01 PA1 SERVO6))
PPM_CONFIG=2
else
$(error Unknown RADIO_CONTROL_PPM_PIN, configure it to either PA01 or PA10)
endif

#
# default actuator configuration
Expand Down
11 changes: 11 additions & 0 deletions conf/boards/lisa_m_2.1.makefile
Expand Up @@ -57,6 +57,17 @@ MODEM_BAUD ?= B57600
GPS_PORT ?= UART3
GPS_BAUD ?= B38400

#
# default PPM input is on PA01 (SERVO6)
#
RADIO_CONTROL_PPM_PIN ?= PA01
ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_10 PA10 UART1_RX))
PPM_CONFIG=1
else ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_01 PA01 PA1 SERVO6))
PPM_CONFIG=2
else
$(error Unknown RADIO_CONTROL_PPM_PIN, configure it to either PA01 or PA10)
endif

#
# default actuator configuration
Expand Down
11 changes: 11 additions & 0 deletions conf/boards/lisa_mx_2.0.makefile
Expand Up @@ -52,6 +52,17 @@ MODEM_BAUD ?= B57600
GPS_PORT ?= UART3
GPS_BAUD ?= B38400

#
# default PPM input is on PA01 (SERVO6)
#
RADIO_CONTROL_PPM_PIN ?= PA01
ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_10 PA10 UART1_RX))
PPM_CONFIG=1
else ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_01 PA01 PA1 SERVO6))
PPM_CONFIG=2
else
$(error Unknown RADIO_CONTROL_PPM_PIN, configure it to either PA01 or PA10)
endif

#
# default actuator configuration
Expand Down
11 changes: 11 additions & 0 deletions conf/boards/lisa_mx_2.1.makefile
Expand Up @@ -52,6 +52,17 @@ MODEM_BAUD ?= B57600
GPS_PORT ?= UART3
GPS_BAUD ?= B38400

#
# default PPM input is on PA01 (SERVO6)
#
RADIO_CONTROL_PPM_PIN ?= PA01
ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_10 PA10 UART1_RX))
PPM_CONFIG=1
else ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_01 PA01 PA1 SERVO6))
PPM_CONFIG=2
else
$(error Unknown RADIO_CONTROL_PPM_PIN, configure it to either PA01 or PA10)
endif

#
# default actuator configuration
Expand Down
14 changes: 14 additions & 0 deletions conf/boards/lisa_s_1.0.makefile
Expand Up @@ -47,6 +47,20 @@ MODEM_BAUD ?= B57600
GPS_PORT ?= UART3
GPS_BAUD ?= B38400

#
# default PPM input is on PA03 (Aux RX)
#
RADIO_CONTROL_PPM_PIN ?= PA03
ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_10 PA10 UART1_RX))
PPM_CONFIG=1
else ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_01 PA01 PA1 SERVO6))
PPM_CONFIG=2
else ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_03 PA03 PA3))
PPM_CONFIG=3
else
$(error Unknown RADIO_CONTROL_PPM_PIN, configure it to either PA01, PA03 or PA10)
endif

#
# default actuator configuration
#
Expand Down
11 changes: 11 additions & 0 deletions conf/boards/naze32_rev4.makefile
Expand Up @@ -48,6 +48,17 @@ MODEM_BAUD ?= B57600
GPS_PORT ?= UART2
GPS_BAUD ?= B38400

#
# default PPM input is on PA7 (RC_CH6)
#
RADIO_CONTROL_PPM_PIN ?= PA7
ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_07 PA07 PA7 RC_CH6))
PPM_CONFIG=2
else ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_00 PA00 PA0 RC_CH1))
PPM_CONFIG=1
else
$(error Unknown RADIO_CONTROL_PPM_PIN, configure it to either PA7 or PA0)
endif

#
# default actuator configuration
Expand Down
12 changes: 12 additions & 0 deletions conf/boards/naze32_rev5.makefile
Expand Up @@ -49,6 +49,18 @@ GPS_PORT ?= UART2
GPS_BAUD ?= B38400


#
# default PPM input is on PA7 (RC_CH6)
#
RADIO_CONTROL_PPM_PIN ?= PA7
ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_07 PA07 PA7 RC_CH6))
PPM_CONFIG=2
else ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_00 PA00 PA0 RC_CH1))
PPM_CONFIG=1
else
$(error Unknown RADIO_CONTROL_PPM_PIN, configure it to either PA7 or PA0)
endif

#
# default actuator configuration
#
Expand Down
14 changes: 8 additions & 6 deletions conf/firmwares/subsystems/shared/radio_control_ppm.makefile
Expand Up @@ -17,13 +17,15 @@ RC_SRCS += $(SRC_SUBSYSTEMS)/radio_control.c
RC_SRCS += $(SRC_SUBSYSTEMS)/radio_control/ppm.c
RC_SRCS += $(SRC_ARCH)/subsystems/radio_control/ppm_arch.c

#
# Some STM32 boards have the option to configure RADIO_CONTROL_PPM_PIN.
# See the board makefile for configure options of the pins.
# If they set the PPM_CONFIG makefile variable, add it to the target.
# The PPM_CONFIG define is then used in the <board>.h file to set the configuration.
#
ifeq ($(ARCH),stm32)
ifdef RADIO_CONTROL_PPM_PIN
ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_10 UART1_RX))
$(TARGET).CFLAGS += -DPPM_CONFIG=1
else ifeq ($(RADIO_CONTROL_PPM_PIN),$(filter $(RADIO_CONTROL_PPM_PIN),PA_01 SERVO6))
$(TARGET).CFLAGS += -DPPM_CONFIG=2
endif
ifdef PPM_CONFIG
$(TARGET).CFLAGS += -DPPM_CONFIG=$(PPM_CONFIG)
endif
endif

Expand Down
2 changes: 1 addition & 1 deletion sw/airborne/boards/cc3d.h
Expand Up @@ -83,7 +83,7 @@

/* PPM
*
* Default is PPM config 2, input on GPIOB6: RC input pin 8 (S6_IN)
* Default is PPM config 2, input on GPIOA1: RC input pin 8 (S6_IN)
*/
#ifndef PPM_CONFIG
#define PPM_CONFIG 2
Expand Down
5 changes: 0 additions & 5 deletions sw/airborne/boards/cjmcu.h
Expand Up @@ -109,11 +109,6 @@
/* PPM
*/

/*
* On Lisa/S there is no really dedicated port available. But we could use a
* bunch of different pins to do PPM Input.
*/

/*
* Default is PPM config 1, input on PA0
*/
Expand Down
2 changes: 1 addition & 1 deletion sw/airborne/boards/lisa_s_1.0.h
Expand Up @@ -189,7 +189,7 @@
*/

/*
* Default is PPM config 2, input on GPIO01 (Servo pin 6)
* Default is PPM config 3, input on PA3 (Aux RX pin)
*/

#ifndef PPM_CONFIG
Expand Down

0 comments on commit 78c5134

Please sign in to comment.