mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-01 18:29:16 +01:00
RM: Swap to using the CC_ flags for the flexi port too.
This commit is contained in:
parent
73c7190077
commit
d333e24a43
@ -460,7 +460,7 @@ void PIOS_Board_Init(void) {
|
||||
PIOS_Board_configure_com(&pios_usart_main_cfg, PIOS_COM_TELEM_RF_RX_BUF_LEN, PIOS_COM_TELEM_RF_TX_BUF_LEN, &pios_usart_com_driver, &pios_com_telem_rf_id);
|
||||
break;
|
||||
case HWSETTINGS_CC_MAINPORT_GPS:
|
||||
PIOS_Board_configure_com(&pios_usart_main_cfg, PIOS_COM_GPS_RX_BUF_LEN, 0, &pios_usart_com_driver, &pios_com_gps_id);
|
||||
PIOS_Board_configure_com(&pios_usart_main_cfg, PIOS_COM_GPS_RX_BUF_LEN, -1, &pios_usart_com_driver, &pios_com_gps_id);
|
||||
break;
|
||||
case HWSETTINGS_CC_MAINPORT_COMAUX:
|
||||
PIOS_Board_configure_com(&pios_usart_main_cfg, PIOS_COM_AUX_RX_BUF_LEN, PIOS_COM_AUX_TX_BUF_LEN, &pios_usart_com_driver, &pios_com_aux_id);
|
||||
@ -472,13 +472,14 @@ void PIOS_Board_Init(void) {
|
||||
} /* hwsettings_rv_telemetryport */
|
||||
|
||||
/* Configure FlexiPort */
|
||||
uint8_t hwsettings_rv_flexiport;
|
||||
HwSettingsRV_FlexiPortGet(&hwsettings_rv_flexiport);
|
||||
|
||||
switch (hwsettings_rv_flexiport) {
|
||||
case HWSETTINGS_RV_FLEXIPORT_DISABLED:
|
||||
uint8_t hwsettings_flexiport;
|
||||
HwSettingsCC_FlexiPortGet(&hwsettings_flexiport);
|
||||
// Disable, Telemetry, GPS, S.Bus, DSM (2,X10,X11), ComAux, ComBridge
|
||||
|
||||
switch (hwsettings_flexiport) {
|
||||
case HWSETTINGS_CC_FLEXIPORT_DISABLED:
|
||||
break;
|
||||
case HWSETTINGS_RV_FLEXIPORT_I2C:
|
||||
case HWSETTINGS_CC_FLEXIPORT_I2C:
|
||||
#if defined(PIOS_INCLUDE_I2C)
|
||||
{
|
||||
if (PIOS_I2C_Init(&pios_i2c_flexiport_adapter_id, &pios_i2c_flexiport_adapter_cfg)) {
|
||||
@ -487,13 +488,15 @@ void PIOS_Board_Init(void) {
|
||||
}
|
||||
#endif /* PIOS_INCLUDE_I2C */
|
||||
break;
|
||||
|
||||
case HWSETTINGS_RV_FLEXIPORT_DSM2:
|
||||
case HWSETTINGS_RV_FLEXIPORT_DSMX10BIT:
|
||||
case HWSETTINGS_RV_FLEXIPORT_DSMX11BIT:
|
||||
case HWSETTINGS_CC_MAINPORT_GPS:
|
||||
PIOS_Board_configure_com(&pios_usart_flexi_cfg, PIOS_COM_GPS_RX_BUF_LEN, -1, &pios_usart_com_driver, &pios_com_gps_id);
|
||||
break;
|
||||
case HWSETTINGS_CC_FLEXIPORT_DSM2:
|
||||
case HWSETTINGS_CC_FLEXIPORT_DSMX10BIT:
|
||||
case HWSETTINGS_CC_FLEXIPORT_DSMX11BIT:
|
||||
{
|
||||
enum pios_dsm_proto proto;
|
||||
switch (hwsettings_rv_flexiport) {
|
||||
switch (hwsettings_flexiport) {
|
||||
case HWSETTINGS_RV_FLEXIPORT_DSM2:
|
||||
proto = PIOS_DSM_PROTO_DSM2;
|
||||
break;
|
||||
@ -512,10 +515,10 @@ void PIOS_Board_Init(void) {
|
||||
&pios_usart_com_driver, &proto, MANUALCONTROLSETTINGS_CHANNELGROUPS_DSMMAINPORT,&hwsettings_DSMxBind);
|
||||
}
|
||||
break;
|
||||
case HWSETTINGS_RV_FLEXIPORT_COMAUX:
|
||||
case HWSETTINGS_CC_FLEXIPORT_COMAUX:
|
||||
PIOS_Board_configure_com(&pios_usart_flexi_cfg, PIOS_COM_AUX_RX_BUF_LEN, PIOS_COM_AUX_TX_BUF_LEN, &pios_usart_com_driver, &pios_com_aux_id);
|
||||
break;
|
||||
case HWSETTINGS_RV_FLEXIPORT_COMBRIDGE:
|
||||
case HWSETTINGS_CC_FLEXIPORT_COMBRIDGE:
|
||||
PIOS_Board_configure_com(&pios_usart_flexi_cfg, PIOS_COM_BRIDGE_RX_BUF_LEN, PIOS_COM_BRIDGE_TX_BUF_LEN, &pios_usart_com_driver, &pios_com_bridge_id);
|
||||
break;
|
||||
} /* hwsettings_rv_flexiport */
|
||||
|
@ -414,6 +414,64 @@ static const struct pios_usart_cfg pios_usart_main_cfg = {
|
||||
};
|
||||
#endif /* PIOS_INCLUDE_COM_TELEM */
|
||||
|
||||
#if defined(PIOS_INCLUDE_SBUS)
|
||||
/*
|
||||
* S.Bus USART
|
||||
*/
|
||||
#include <pios_sbus_priv.h>
|
||||
|
||||
static const struct pios_usart_cfg pios_usart_sbus_main_cfg = {
|
||||
.regs = USART1,
|
||||
.init = {
|
||||
.USART_BaudRate = 100000,
|
||||
.USART_WordLength = USART_WordLength_8b,
|
||||
.USART_Parity = USART_Parity_Even,
|
||||
.USART_StopBits = USART_StopBits_2,
|
||||
.USART_HardwareFlowControl = USART_HardwareFlowControl_None,
|
||||
.USART_Mode = USART_Mode_Rx,
|
||||
},
|
||||
.irq = {
|
||||
.init = {
|
||||
.NVIC_IRQChannel = USART1_IRQn,
|
||||
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH,
|
||||
.NVIC_IRQChannelSubPriority = 0,
|
||||
.NVIC_IRQChannelCmd = ENABLE,
|
||||
},
|
||||
},
|
||||
.rx = {
|
||||
.gpio = GPIOA,
|
||||
.init = {
|
||||
.GPIO_Pin = GPIO_Pin_10,
|
||||
.GPIO_Speed = GPIO_Speed_2MHz,
|
||||
.GPIO_Mode = GPIO_Mode_IPU,
|
||||
},
|
||||
},
|
||||
.tx = {
|
||||
.gpio = GPIOA,
|
||||
.init = {
|
||||
.GPIO_Pin = GPIO_Pin_9,
|
||||
.GPIO_Speed = GPIO_Speed_2MHz,
|
||||
.GPIO_Mode = GPIO_Mode_IN_FLOATING,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static const struct pios_sbus_cfg pios_sbus_cfg = {
|
||||
/* Inverter configuration */
|
||||
.inv = {
|
||||
.gpio = GPIOC,
|
||||
.init = {
|
||||
.GPIO_Pin = GPIO_Pin_0,
|
||||
.GPIO_Mode = GPIO_Mode_Out_PP,
|
||||
.GPIO_Speed = GPIO_Speed_2MHz,
|
||||
},
|
||||
},
|
||||
.gpio_clk_func = RCC_APB2PeriphClockCmd,
|
||||
.gpio_clk_periph = RCC_APB2Periph_GPIOC,
|
||||
.gpio_inv_enable = Bit_SET,
|
||||
};
|
||||
|
||||
#endif /* PIOS_INCLUDE_SBUS */
|
||||
|
||||
#ifdef PIOS_INCLUDE_COM_FLEXI
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user