mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
LP-512 SPRacingF3Evo: Allow PPM on UART2 pins only.
This commit is contained in:
parent
5b5546a1cb
commit
6eb97ed213
@ -510,46 +510,18 @@ const struct pios_servo_cfg pios_servo_cfg = {
|
|||||||
#if defined(PIOS_INCLUDE_PPM)
|
#if defined(PIOS_INCLUDE_PPM)
|
||||||
#include <pios_ppm_priv.h>
|
#include <pios_ppm_priv.h>
|
||||||
|
|
||||||
static const struct pios_tim_channel pios_tim_ppm_uart[] = {
|
static const struct pios_tim_channel pios_tim_ppm = TIM_SERVO_CHANNEL_CONFIG(TIM8, 1, A, 15);
|
||||||
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_uart_cfg[] = {
|
const struct pios_ppm_cfg pios_ppm_cfg = {
|
||||||
[0] = {
|
.tim_ic_init = {
|
||||||
.tim_ic_init = {
|
.TIM_ICPolarity = TIM_ICPolarity_Rising,
|
||||||
.TIM_ICPolarity = TIM_ICPolarity_Rising,
|
.TIM_ICSelection = TIM_ICSelection_DirectTI,
|
||||||
.TIM_ICSelection = TIM_ICSelection_DirectTI,
|
.TIM_ICPrescaler = TIM_ICPSC_DIV1,
|
||||||
.TIM_ICPrescaler = TIM_ICPSC_DIV1,
|
.TIM_ICFilter = 0x0,
|
||||||
.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,
|
||||||
|
.num_channels = 1,
|
||||||
};
|
};
|
||||||
#endif /* PIOS_INCLUDE_PPM */
|
#endif /* PIOS_INCLUDE_PPM */
|
||||||
|
|
||||||
|
@ -214,19 +214,15 @@ void PIOS_Board_Init(void)
|
|||||||
[HWSPRACINGF3EVOSETTINGS_UARTPORT_MAVLINK] = PIOS_BOARD_IO_UART_MAVLINK,
|
[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) {
|
for (unsigned int i = 0; i < HWSPRACINGF3EVOSETTINGS_UARTPORT_NUMELEM; ++i) {
|
||||||
if(boardHwSettings.UARTPort[i] < NELEMENTS(uart_function_map)) {
|
if(boardHwSettings.UARTPort[i] < NELEMENTS(uart_function_map)) {
|
||||||
PIOS_BOARD_IO_Configure_UART(&pios_usart_cfg[i], uart_function_map[boardHwSettings.UARTPort[i]]);
|
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) {
|
/* allow PPM on uart2 only, to avoid uart1&3 TIM2_CH4 conflict with output PWMSync, OneShot and MultiShot modes */
|
||||||
PIOS_BOARD_IO_Configure_PPM_RCVR(ppm_cfg);
|
if(boardHwSettings.UARTPort[1] == HWSPRACINGF3EVOSETTINGS_UARTPORT_PPM) {
|
||||||
|
PIOS_BOARD_IO_Configure_PPM_RCVR(&pios_ppm_cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef PIOS_ENABLE_DEBUG_PINS
|
#ifndef PIOS_ENABLE_DEBUG_PINS
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<xml>
|
<xml>
|
||||||
<object name="HwSPRacingF3EVOSettings" singleinstance="true" settings="true" category="System">
|
<object name="HwSPRacingF3EVOSettings" singleinstance="true" settings="true" category="System">
|
||||||
<description>Seriously Pro SPRacingF3 EVO hardware configuration.</description>
|
<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,PPM" 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" limits="%NE:PPM;;%NE:PPM"/>
|
||||||
<field name="I2CPort" units="function" type="enum" elements="1" options="Disabled,I2C" 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="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"/>
|
<field name="BuzzerPort" units="function" type="enum" elements="1" options="Disabled,Output" defaultvalue="Disabled"/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user