1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-17 02:52:12 +01:00

RM SBUS: There is no pull down on the inverter direction so when not SBUS must explicitly set to off.

This commit is contained in:
James Cotton 2012-08-31 11:01:34 -05:00
parent d333e24a43
commit 300cee44b4
3 changed files with 15 additions and 7 deletions

View File

@ -79,6 +79,7 @@ struct pios_sbus_cfg {
void (*gpio_clk_func)(uint32_t periph, FunctionalState state);
uint32_t gpio_clk_periph;
BitAction gpio_inv_enable;
BitAction gpio_inv_disable;
};
extern const struct pios_rcvr_driver pios_sbus_rcvr_driver;

View File

@ -471,6 +471,11 @@ void PIOS_Board_Init(void) {
} /* hwsettings_rv_telemetryport */
if (hwsettings_mainport != HWSETTINGS_CC_MAINPORT_SBUS) {
GPIO_Init(pios_sbus_cfg.inv.gpio, &pios_sbus_cfg.inv.init);
GPIO_WriteBit(pios_sbus_cfg.inv.gpio, pios_sbus_cfg.inv.init.GPIO_Pin, pios_sbus_cfg.gpio_inv_disable);
}
/* Configure FlexiPort */
uint8_t hwsettings_flexiport;
HwSettingsCC_FlexiPortGet(&hwsettings_flexiport);

View File

@ -414,12 +414,11 @@ static const struct pios_usart_cfg pios_usart_main_cfg = {
};
#endif /* PIOS_INCLUDE_COM_TELEM */
#include <pios_sbus_priv.h>
#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 = {
@ -456,22 +455,25 @@ static const struct pios_usart_cfg pios_usart_sbus_main_cfg = {
},
};
#endif /* PIOS_INCLUDE_SBUS */
// Need this defined regardless to be able to turn it off
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_Pin = GPIO_Pin_0,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_OUT,
.GPIO_OType = GPIO_OType_PP,
.GPIO_PuPd = GPIO_PuPd_UP
},
},
.gpio_clk_func = RCC_APB2PeriphClockCmd,
.gpio_clk_periph = RCC_APB2Periph_GPIOC,
.gpio_inv_enable = Bit_SET,
.gpio_inv_disable = Bit_RESET,
};
#endif /* PIOS_INCLUDE_SBUS */
#ifdef PIOS_INCLUDE_COM_FLEXI
/*