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

LP-196 Added support for targets Revolution and RevoNano.

This commit is contained in:
Fredrik Arvidsson 2015-12-26 13:08:07 +01:00
parent 3e920bc5bc
commit 4b8582a3ad
8 changed files with 278 additions and 0 deletions

View File

@ -1054,6 +1054,95 @@ static const struct pios_usart_cfg pios_usart_srxl_flexi_cfg = {
};
#endif /* PIOS_INCLUDE_SRXL */
#if defined(PIOS_INCLUDE_EXBUS)
/*
* EXBUS USART
*/
#include <pios_exbus_priv.h>
static const struct pios_usart_cfg pios_usart_exbus_flexi_cfg = {
.regs = USART3,
.remap = GPIO_AF_USART3,
.init = {
.USART_BaudRate = 250000,
.USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1,
.USART_HardwareFlowControl = USART_HardwareFlowControl_None,
.USART_Mode = USART_Mode_Rx,
},
.irq = {
.init = {
.NVIC_IRQChannel = USART3_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.rx = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_11,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_AF,
.GPIO_OType = GPIO_OType_PP,
.GPIO_PuPd = GPIO_PuPd_UP
},
},
.tx = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_10,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_OUT,
.GPIO_OType = GPIO_OType_PP,
.GPIO_PuPd = GPIO_PuPd_UP
},
},
};
static const struct pios_usart_cfg pios_usart_exbus_main_cfg = {
.regs = USART1,
.remap = GPIO_AF_USART1,
.init = {
.USART_BaudRate = 250000,
.USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1,
.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_AF,
.GPIO_OType = GPIO_OType_PP,
.GPIO_PuPd = GPIO_PuPd_UP
},
},
.tx = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_9,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_AF,
.GPIO_OType = GPIO_OType_PP,
.GPIO_PuPd = GPIO_PuPd_UP
},
},
};
#endif /* PIOS_INCLUDE_EXBUS */
/*
* HK OSD
*/

View File

@ -104,6 +104,7 @@
#define PIOS_INCLUDE_DSM
#define PIOS_INCLUDE_SBUS
#define PIOS_INCLUDE_SRXL
#define PIOS_INCLUDE_EXBUS
#define PIOS_INCLUDE_GCSRCVR
#define PIOS_INCLUDE_OPLINKRCVR

View File

@ -520,6 +520,28 @@ void PIOS_Board_Init(void)
}
#endif
break;
case HWSETTINGS_RM_FLEXIPORT_JETIEXBUS:
#if defined(PIOS_INCLUDE_EXBUS)
{
uint32_t pios_usart_exbus_id;
if (PIOS_USART_Init(&pios_usart_exbus_id, &pios_usart_exbus_flexi_cfg)) {
PIOS_Assert(0);
}
uint32_t pios_exbus_id;
if (PIOS_EXBUS_Init(&pios_exbus_id, &pios_usart_com_driver, pios_usart_exbus_id)) {
PIOS_Assert(0);
}
uint32_t pios_exbus_rcvr_id;
if (PIOS_RCVR_Init(&pios_exbus_rcvr_id, &pios_exbus_rcvr_driver, pios_exbus_id)) {
PIOS_Assert(0);
}
pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_JETIEXBUSFLEXIPORT] = pios_exbus_rcvr_id;
}
#endif /* PIOS_INCLUDE_EXBUS */
break;
} /* hwsettings_rm_flexiport */
/* Moved this here to allow binding on flexiport */
@ -696,6 +718,27 @@ void PIOS_Board_Init(void)
}
#endif
break;
case HWSETTINGS_RM_MAINPORT_JETIEXBUS:
#if defined(PIOS_INCLUDE_EXBUS)
{
uint32_t pios_usart_exbus_id;
if (PIOS_USART_Init(&pios_usart_exbus_id, &pios_usart_exbus_main_cfg)) {
PIOS_Assert(0);
}
uint32_t pios_exbus_id;
if (PIOS_EXBUS_Init(&pios_exbus_id, &pios_usart_com_driver, pios_usart_exbus_id)) {
PIOS_Assert(0);
}
uint32_t pios_exbus_rcvr_id;
if (PIOS_RCVR_Init(&pios_exbus_rcvr_id, &pios_exbus_rcvr_driver, pios_exbus_id)) {
PIOS_Assert(0);
}
pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_JETIEXBUSMAINPORT] = pios_exbus_rcvr_id;
}
#endif /* PIOS_INCLUDE_EXBUS */
break;
case HWSETTINGS_RM_MAINPORT_DSM:
// Force binding to zero on the main port
hwsettings_DSMxBind = 0;

View File

@ -257,6 +257,12 @@ extern uint32_t pios_packet_handler;
#define PIOS_SBUS_MAX_DEVS 1
#define PIOS_SBUS_NUM_INPUTS (16 + 2)
// -------------------------
// Receiver EX.Bus input
// -------------------------
#define PIOS_EXBUS_MAX_DEVS 2
#define PIOS_EXBUS_NUM_INPUTS 16
// -------------------------
// Receiver Multiplex SRXL input
// -------------------------

View File

@ -583,6 +583,95 @@ static const struct pios_usart_cfg pios_usart_srxl_flexi_cfg = {
};
#endif /* PIOS_INCLUDE_SRXL */
#if defined(PIOS_INCLUDE_EXBUS)
/*
* EXBUS USART
*/
#include <pios_exbus_priv.h>
static const struct pios_usart_cfg pios_usart_exbus_flexi_cfg = {
.regs = FLEXI_USART_REGS,
.remap = FLEXI_USART_REMAP,
.init = {
.USART_BaudRate = 250000,
.USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1,
.USART_HardwareFlowControl = USART_HardwareFlowControl_None,
.USART_Mode = USART_Mode_Rx,
},
.irq = {
.init = {
.NVIC_IRQChannel = FLEXI_USART_IRQ,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.rx = {
.gpio = FLEXI_USART_RX_GPIO,
.init = {
.GPIO_Pin = FLEXI_USART_RX_PIN,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_AF,
.GPIO_OType = GPIO_OType_PP,
.GPIO_PuPd = GPIO_PuPd_UP
},
},
.tx = {
.gpio = FLEXI_USART_TX_GPIO,
.init = {
.GPIO_Pin = FLEXI_USART_TX_PIN,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_OUT,
.GPIO_OType = GPIO_OType_PP,
.GPIO_PuPd = GPIO_PuPd_UP
},
},
};
static const struct pios_usart_cfg pios_usart_exbus_main_cfg = {
.regs = MAIN_USART_REGS,
.remap = MAIN_USART_REMAP,
.init = {
.USART_BaudRate = 250000,
.USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1,
.USART_HardwareFlowControl = USART_HardwareFlowControl_None,
.USART_Mode = USART_Mode_Rx,
},
.irq = {
.init = {
.NVIC_IRQChannel = MAIN_USART_IRQ,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.rx = {
.gpio = MAIN_USART_RX_GPIO,
.init = {
.GPIO_Pin = MAIN_USART_RX_PIN,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_AF,
.GPIO_OType = GPIO_OType_PP,
.GPIO_PuPd = GPIO_PuPd_UP
},
},
.tx = {
.gpio = MAIN_USART_TX_GPIO,
.init = {
.GPIO_Pin = MAIN_USART_TX_PIN,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_AF,
.GPIO_OType = GPIO_OType_PP,
.GPIO_PuPd = GPIO_PuPd_UP
},
},
};
#endif /* PIOS_INCLUDE_EXBUS */
/*
* HK OSD
*/

View File

@ -108,6 +108,7 @@
#define PIOS_INCLUDE_DSM
#define PIOS_INCLUDE_SBUS
#define PIOS_INCLUDE_SRXL
#define PIOS_INCLUDE_EXBUS
#define PIOS_INCLUDE_GCSRCVR
// #define PIOS_INCLUDE_OPLINKRCVR

View File

@ -576,6 +576,27 @@ void PIOS_Board_Init(void)
}
#endif
break;
case HWSETTINGS_RM_MAINPORT_JETIEXBUS:
#if defined(PIOS_INCLUDE_EXBUS)
{
uint32_t pios_usart_exbus_id;
if (PIOS_USART_Init(&pios_usart_exbus_id, &pios_usart_exbus_main_cfg)) {
PIOS_Assert(0);
}
uint32_t pios_exbus_id;
if (PIOS_EXBUS_Init(&pios_exbus_id, &pios_usart_com_driver, pios_usart_exbus_id)) {
PIOS_Assert(0);
}
uint32_t pios_exbus_rcvr_id;
if (PIOS_RCVR_Init(&pios_exbus_rcvr_id, &pios_exbus_rcvr_driver, pios_exbus_id)) {
PIOS_Assert(0);
}
pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_JETIEXBUSMAINPORT] = pios_exbus_rcvr_id;
}
#endif /* PIOS_INCLUDE_EXBUS */
break;
case HWSETTINGS_RM_MAINPORT_DSM:
{
// Force binding to zero on the main port
@ -666,6 +687,28 @@ void PIOS_Board_Init(void)
}
#endif
break;
case HWSETTINGS_RM_FLEXIPORT_JETIEXBUS:
#if defined(PIOS_INCLUDE_EXBUS)
{
uint32_t pios_usart_exbus_id;
if (PIOS_USART_Init(&pios_usart_exbus_id, &pios_usart_exbus_flexi_cfg)) {
PIOS_Assert(0);
}
uint32_t pios_exbus_id;
if (PIOS_EXBUS_Init(&pios_exbus_id, &pios_usart_com_driver, pios_usart_exbus_id)) {
PIOS_Assert(0);
}
uint32_t pios_exbus_rcvr_id;
if (PIOS_RCVR_Init(&pios_exbus_rcvr_id, &pios_exbus_rcvr_driver, pios_exbus_id)) {
PIOS_Assert(0);
}
pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_JETIEXBUSFLEXIPORT] = pios_exbus_rcvr_id;
}
#endif /* PIOS_INCLUDE_EXBUS */
break;
} /* hwsettings_rm_flexiport */

View File

@ -257,6 +257,12 @@ extern uint32_t pios_packet_handler;
#define PIOS_SBUS_MAX_DEVS 1
#define PIOS_SBUS_NUM_INPUTS (16 + 2)
// -------------------------
// Receiver EX.Bus input
// -------------------------
#define PIOS_EXBUS_MAX_DEVS 2
#define PIOS_EXBUS_NUM_INPUTS 16
// -------------------------
// Receiver Multiplex SRXL input
// -------------------------