1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

LP-512 SPRacingF3 Evo: Added PPM in to all UARTs. Untested.

This commit is contained in:
Vladimir Zidar 2017-04-26 11:20:44 +02:00
parent 9f16143ba7
commit 90e6ab8ef6
3 changed files with 48 additions and 14 deletions

View File

@ -428,9 +428,6 @@ static const struct pios_tim_channel pios_tim_servoport_pins[] = {
TIM_SERVO_CHANNEL_CONFIG(TIM3, 4, B, 1), // bank 3
};
static const struct pios_tim_channel pios_tim_ppm_flexi_port = TIM_SERVO_CHANNEL_CONFIG(TIM2, 4, B, 11);
#if defined(PIOS_INCLUDE_USART)
#define GPIO_AF_USART1 GPIO_AF_7
@ -513,18 +510,46 @@ const struct pios_servo_cfg pios_servo_cfg = {
#if defined(PIOS_INCLUDE_PPM)
#include <pios_ppm_priv.h>
static const struct pios_tim_channel pios_tim_ppm_channel = TIM_SERVO_CHANNEL_CONFIG(TIM8, 1, A, 15);
static const struct pios_tim_channel pios_tim_ppm_uart[] = {
TIM_SERVO_CHANNEL_CONFIG(TIM2, 4, A, 10),
TIM_SERVO_CHANNEL_CONFIG(TIM8, 1, A, 15),
TIM_SERVO_CHANNEL_CONFIG(TIM2, 4, B, 11)
};
const struct pios_ppm_cfg pios_ppm_cfg = {
.tim_ic_init = {
.TIM_ICPolarity = TIM_ICPolarity_Rising,
.TIM_ICSelection = TIM_ICSelection_DirectTI,
.TIM_ICPrescaler = TIM_ICPSC_DIV1,
.TIM_ICFilter = 0x0,
const struct pios_ppm_cfg pios_ppm_uart_cfg[] = {
[0] = {
.tim_ic_init = {
.TIM_ICPolarity = TIM_ICPolarity_Rising,
.TIM_ICSelection = TIM_ICSelection_DirectTI,
.TIM_ICPrescaler = TIM_ICPSC_DIV1,
.TIM_ICFilter = 0x0,
},
/* Use only the first channel for ppm */
.channels = &pios_tim_ppm_uart[0],
.num_channels = 1,
},
[1] = {
.tim_ic_init = {
.TIM_ICPolarity = TIM_ICPolarity_Rising,
.TIM_ICSelection = TIM_ICSelection_DirectTI,
.TIM_ICPrescaler = TIM_ICPSC_DIV1,
.TIM_ICFilter = 0x0,
},
/* Use only the first channel for ppm */
.channels = &pios_tim_ppm_uart[1],
.num_channels = 1,
},
[2] = {
.tim_ic_init = {
.TIM_ICPolarity = TIM_ICPolarity_Rising,
.TIM_ICSelection = TIM_ICSelection_DirectTI,
.TIM_ICPrescaler = TIM_ICPSC_DIV1,
.TIM_ICFilter = 0x0,
},
/* Use only the first channel for ppm */
.channels = &pios_tim_ppm_uart[2],
.num_channels = 1,
},
/* Use only the first channel for ppm */
.channels = &pios_tim_ppm_channel,
.num_channels = 1,
};
#endif /* PIOS_INCLUDE_PPM */

View File

@ -214,11 +214,20 @@ void PIOS_Board_Init(void)
[HWSPRACINGF3EVOSETTINGS_UARTPORT_MAVLINK] = PIOS_BOARD_IO_UART_MAVLINK,
};
const struct pios_ppm_cfg *ppm_cfg = 0;
for (unsigned int i = 0; i < HWSPRACINGF3EVOSETTINGS_UARTPORT_NUMELEM; ++i) {
if(boardHwSettings.UARTPort[i] < NELEMENTS(uart_function_map)) {
PIOS_BOARD_IO_Configure_UART(&pios_usart_cfg[i], uart_function_map[boardHwSettings.UARTPort[i]]);
if(boardHwSettings.UARTPort[i] == HWSPRACINGF3EVOSETTINGS_UARTPORT_PPM) {
ppm_cfg = &pios_ppm_uart_cfg[i];
}
}
}
if(ppm_cfg) {
PIOS_BOARD_IO_Configure_PPM_RCVR(ppm_cfg);
}
#ifndef PIOS_ENABLE_DEBUG_PINS
PIOS_Servo_Init(&pios_servo_cfg);

View File

@ -1,7 +1,7 @@
<xml>
<object name="HwSPRacingF3EVOSettings" singleinstance="true" settings="true" category="System">
<description>Seriously Pro SPRacingF3 EVO hardware configuration.</description>
<field name="UARTPort" units="function" type="enum" elements="3" options="Disabled,Telemetry,GPS,S.Bus,DSM,EX.Bus,HoTT SUMD,HoTT SUMH,SRXL,IBus,DebugConsole,ComBridge,MSP,MAVLink" defaultvalue="Disabled"/>
<field name="UARTPort" units="function" type="enum" elements="3" options="Disabled,Telemetry,GPS,S.Bus,DSM,EX.Bus,HoTT SUMD,HoTT SUMH,SRXL,IBus,DebugConsole,ComBridge,MSP,MAVLink,PPM" defaultvalue="Disabled"/>
<field name="I2CPort" units="function" type="enum" elements="1" options="Disabled,I2C" defaultvalue="Disabled"/>
<field name="LEDPort" units="function" type="enum" elements="1" options="Disabled,WS2811,Output" defaultvalue="Disabled"/>
<field name="BuzzerPort" units="function" type="enum" elements="1" options="Disabled,Output" defaultvalue="Disabled"/>