mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
spektrum: rename Spektrum to DSM (DSM2/DSMJ/DSMX used by Spektrum and JR radios)
No code changes, just file, variable and define names are changed. First, it better describes the serial protocol used by DSMx satellite receivers. Second, many people using Spektrum radio, assume Spektrum protocol. This is the attempt to address those inaccuracies.
This commit is contained in:
parent
8ed23c76b7
commit
f5e82b8242
@ -187,7 +187,7 @@ SRC += $(PIOSSTM32F10X)/pios_i2c.c
|
||||
SRC += $(PIOSSTM32F10X)/pios_spi.c
|
||||
SRC += $(PIOSSTM32F10X)/pios_ppm.c
|
||||
SRC += $(PIOSSTM32F10X)/pios_pwm.c
|
||||
SRC += $(PIOSSTM32F10X)/pios_spektrum.c
|
||||
SRC += $(PIOSSTM32F10X)/pios_dsm.c
|
||||
SRC += $(PIOSSTM32F10X)/pios_sbus.c
|
||||
SRC += $(PIOSSTM32F10X)/pios_debug.c
|
||||
SRC += $(PIOSSTM32F10X)/pios_gpio.c
|
||||
|
@ -46,7 +46,7 @@
|
||||
#define PIOS_INCLUDE_RCVR
|
||||
|
||||
/* Supported receiver interfaces */
|
||||
#define PIOS_INCLUDE_SPEKTRUM
|
||||
#define PIOS_INCLUDE_DSM
|
||||
#define PIOS_INCLUDE_SBUS
|
||||
#define PIOS_INCLUDE_PPM
|
||||
#define PIOS_INCLUDE_PWM
|
||||
|
@ -695,13 +695,13 @@ static const struct pios_usart_cfg pios_usart_gps_flexi_cfg = {
|
||||
};
|
||||
#endif /* PIOS_INCLUDE_GPS */
|
||||
|
||||
#if defined(PIOS_INCLUDE_SPEKTRUM)
|
||||
#if defined(PIOS_INCLUDE_DSM)
|
||||
/*
|
||||
* SPEKTRUM USART
|
||||
* Spektrum/JR DSM USART
|
||||
*/
|
||||
#include <pios_spektrum_priv.h>
|
||||
#include <pios_dsm_priv.h>
|
||||
|
||||
static const struct pios_usart_cfg pios_usart_spektrum_main_cfg = {
|
||||
static const struct pios_usart_cfg pios_usart_dsm_main_cfg = {
|
||||
.regs = USART1,
|
||||
.init = {
|
||||
.USART_BaudRate = 115200,
|
||||
@ -737,7 +737,7 @@ static const struct pios_usart_cfg pios_usart_spektrum_main_cfg = {
|
||||
},
|
||||
};
|
||||
|
||||
static const struct pios_spektrum_cfg pios_spektrum_main_cfg = {
|
||||
static const struct pios_dsm_cfg pios_dsm_main_cfg = {
|
||||
.bind = {
|
||||
.gpio = GPIOA,
|
||||
.init = {
|
||||
@ -748,7 +748,7 @@ static const struct pios_spektrum_cfg pios_spektrum_main_cfg = {
|
||||
},
|
||||
};
|
||||
|
||||
static const struct pios_usart_cfg pios_usart_spektrum_flexi_cfg = {
|
||||
static const struct pios_usart_cfg pios_usart_dsm_flexi_cfg = {
|
||||
.regs = USART3,
|
||||
.init = {
|
||||
.USART_BaudRate = 115200,
|
||||
@ -784,7 +784,7 @@ static const struct pios_usart_cfg pios_usart_spektrum_flexi_cfg = {
|
||||
},
|
||||
};
|
||||
|
||||
static const struct pios_spektrum_cfg pios_spektrum_flexi_cfg = {
|
||||
static const struct pios_dsm_cfg pios_dsm_flexi_cfg = {
|
||||
.bind = {
|
||||
.gpio = GPIOB,
|
||||
.init = {
|
||||
@ -795,7 +795,7 @@ static const struct pios_spektrum_cfg pios_spektrum_flexi_cfg = {
|
||||
},
|
||||
};
|
||||
|
||||
#endif /* PIOS_INCLUDE_SPEKTRUM */
|
||||
#endif /* PIOS_INCLUDE_DSM */
|
||||
|
||||
#if defined(PIOS_INCLUDE_SBUS)
|
||||
/*
|
||||
@ -1200,7 +1200,7 @@ void PIOS_Board_Init(void) {
|
||||
case HWSETTINGS_CC_MAINPORT_DSM2:
|
||||
case HWSETTINGS_CC_MAINPORT_DSMX10BIT:
|
||||
case HWSETTINGS_CC_MAINPORT_DSMX11BIT:
|
||||
#if defined(PIOS_INCLUDE_SPEKTRUM)
|
||||
#if defined(PIOS_INCLUDE_DSM)
|
||||
{
|
||||
enum pios_dsm_proto proto;
|
||||
switch (hwsettings_cc_mainport) {
|
||||
@ -1218,27 +1218,27 @@ void PIOS_Board_Init(void) {
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t pios_usart_spektrum_id;
|
||||
if (PIOS_USART_Init(&pios_usart_spektrum_id, &pios_usart_spektrum_main_cfg)) {
|
||||
uint32_t pios_usart_dsm_id;
|
||||
if (PIOS_USART_Init(&pios_usart_dsm_id, &pios_usart_dsm_main_cfg)) {
|
||||
PIOS_Assert(0);
|
||||
}
|
||||
|
||||
uint32_t pios_spektrum_id;
|
||||
if (PIOS_Spektrum_Init(&pios_spektrum_id,
|
||||
&pios_spektrum_main_cfg,
|
||||
&pios_usart_com_driver,
|
||||
pios_usart_spektrum_id,
|
||||
proto, 0)) {
|
||||
uint32_t pios_dsm_id;
|
||||
if (PIOS_DSM_Init(&pios_dsm_id,
|
||||
&pios_dsm_main_cfg,
|
||||
&pios_usart_com_driver,
|
||||
pios_usart_dsm_id,
|
||||
proto, 0)) {
|
||||
PIOS_Assert(0);
|
||||
}
|
||||
|
||||
uint32_t pios_spektrum_rcvr_id;
|
||||
if (PIOS_RCVR_Init(&pios_spektrum_rcvr_id, &pios_spektrum_rcvr_driver, pios_spektrum_id)) {
|
||||
uint32_t pios_dsm_rcvr_id;
|
||||
if (PIOS_RCVR_Init(&pios_dsm_rcvr_id, &pios_dsm_rcvr_driver, pios_dsm_id)) {
|
||||
PIOS_Assert(0);
|
||||
}
|
||||
pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_DSMMAINPORT] = pios_spektrum_rcvr_id;
|
||||
pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_DSMMAINPORT] = pios_dsm_rcvr_id;
|
||||
}
|
||||
#endif /* PIOS_INCLUDE_SPEKTRUM */
|
||||
#endif /* PIOS_INCLUDE_DSM */
|
||||
break;
|
||||
case HWSETTINGS_CC_MAINPORT_COMAUX:
|
||||
break;
|
||||
@ -1290,7 +1290,7 @@ void PIOS_Board_Init(void) {
|
||||
case HWSETTINGS_CC_FLEXIPORT_DSM2:
|
||||
case HWSETTINGS_CC_FLEXIPORT_DSMX10BIT:
|
||||
case HWSETTINGS_CC_FLEXIPORT_DSMX11BIT:
|
||||
#if defined(PIOS_INCLUDE_SPEKTRUM)
|
||||
#if defined(PIOS_INCLUDE_DSM)
|
||||
{
|
||||
enum pios_dsm_proto proto;
|
||||
switch (hwsettings_cc_flexiport) {
|
||||
@ -1308,27 +1308,27 @@ void PIOS_Board_Init(void) {
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t pios_usart_spektrum_id;
|
||||
if (PIOS_USART_Init(&pios_usart_spektrum_id, &pios_usart_spektrum_flexi_cfg)) {
|
||||
uint32_t pios_usart_dsm_id;
|
||||
if (PIOS_USART_Init(&pios_usart_dsm_id, &pios_usart_dsm_flexi_cfg)) {
|
||||
PIOS_Assert(0);
|
||||
}
|
||||
|
||||
uint32_t pios_spektrum_id;
|
||||
if (PIOS_Spektrum_Init(&pios_spektrum_id,
|
||||
&pios_spektrum_flexi_cfg,
|
||||
&pios_usart_com_driver,
|
||||
pios_usart_spektrum_id,
|
||||
proto, hwsettings_DSMxBind)) {
|
||||
uint32_t pios_dsm_id;
|
||||
if (PIOS_DSM_Init(&pios_dsm_id,
|
||||
&pios_dsm_flexi_cfg,
|
||||
&pios_usart_com_driver,
|
||||
pios_usart_dsm_id,
|
||||
proto, hwsettings_DSMxBind)) {
|
||||
PIOS_Assert(0);
|
||||
}
|
||||
|
||||
uint32_t pios_spektrum_rcvr_id;
|
||||
if (PIOS_RCVR_Init(&pios_spektrum_rcvr_id, &pios_spektrum_rcvr_driver, pios_spektrum_id)) {
|
||||
uint32_t pios_dsm_rcvr_id;
|
||||
if (PIOS_RCVR_Init(&pios_dsm_rcvr_id, &pios_dsm_rcvr_driver, pios_dsm_id)) {
|
||||
PIOS_Assert(0);
|
||||
}
|
||||
pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_DSMFLEXIPORT] = pios_spektrum_rcvr_id;
|
||||
pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_DSMFLEXIPORT] = pios_dsm_rcvr_id;
|
||||
}
|
||||
#endif /* PIOS_INCLUDE_SPEKTRUM */
|
||||
#endif /* PIOS_INCLUDE_DSM */
|
||||
break;
|
||||
case HWSETTINGS_CC_FLEXIPORT_COMAUX:
|
||||
break;
|
||||
|
@ -162,7 +162,7 @@ SRC += $(PIOSSTM32F10X)/pios_i2c.c
|
||||
SRC += $(PIOSSTM32F10X)/pios_spi.c
|
||||
SRC += $(PIOSSTM32F10X)/pios_ppm.c
|
||||
SRC += $(PIOSSTM32F10X)/pios_pwm.c
|
||||
SRC += $(PIOSSTM32F10X)/pios_spektrum.c
|
||||
SRC += $(PIOSSTM32F10X)/pios_dsm.c
|
||||
SRC += $(PIOSSTM32F10X)/pios_sbus.c
|
||||
SRC += $(PIOSSTM32F10X)/pios_tim.c
|
||||
SRC += $(PIOSSTM32F10X)/pios_debug.c
|
||||
|
@ -44,7 +44,7 @@
|
||||
|
||||
#define PIOS_INCLUDE_RCVR
|
||||
|
||||
#define PIOS_INCLUDE_SPEKTRUM
|
||||
#define PIOS_INCLUDE_DSM
|
||||
//#define PIOS_INCLUDE_SBUS
|
||||
#define PIOS_INCLUDE_PWM
|
||||
#define PIOS_INCLUDE_PPM
|
||||
|
@ -143,8 +143,8 @@ static void TaskTesting(void *pvParameters)
|
||||
PIOS_COM_SendFormattedStringNonBlocking(COM_DEBUG_USART, "%u\r", PIOS_BMP085_GetPressure());
|
||||
*/
|
||||
|
||||
#if defined(PIOS_INCLUDE_SPEKTRUM)
|
||||
PIOS_COM_SendFormattedStringNonBlocking(COM_DEBUG_USART, "%u,%u,%u,%u,%u,%u,%u,%u\r", PIOS_SPEKTRUM_Get(0), PIOS_SPEKTRUM_Get(1), PIOS_SPEKTRUM_Get(2), PIOS_SPEKTRUM_Get(3), PIOS_SPEKTRUM_Get(4), PIOS_SPEKTRUM_Get(5), PIOS_SPEKTRUM_Get(6), PIOS_SPEKTRUM_Get(7));
|
||||
#if defined(PIOS_INCLUDE_DSM)
|
||||
PIOS_COM_SendFormattedStringNonBlocking(COM_DEBUG_USART, "%u,%u,%u,%u,%u,%u,%u,%u\r", PIOS_DSM_Get(0), PIOS_DSM_Get(1), PIOS_DSM_Get(2), PIOS_DSM_Get(3), PIOS_DSM_Get(4), PIOS_DSM_Get(5), PIOS_DSM_Get(6), PIOS_DSM_Get(7));
|
||||
#endif
|
||||
#if defined(PIOS_INCLUDE_SBUS)
|
||||
PIOS_COM_SendFormattedStringNonBlocking(COM_DEBUG_USART, "%u,%u,%u,%u,%u,%u,%u,%u\r", PIOS_SBus_Get(0), PIOS_SBus_Get(1), PIOS_SBus_Get(2), PIOS_SBus_Get(3), PIOS_SBus_Get(4), PIOS_SBus_Get(5), PIOS_SBus_Get(6), PIOS_SBus_Get(7));
|
||||
|
@ -538,13 +538,13 @@ void PIOS_RTC_IRQ_Handler (void)
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(PIOS_INCLUDE_SPEKTRUM)
|
||||
#if defined(PIOS_INCLUDE_DSM)
|
||||
/*
|
||||
* SPEKTRUM USART
|
||||
* Spektrum/JR DSM USART
|
||||
*/
|
||||
#include <pios_spektrum_priv.h>
|
||||
#include <pios_dsm_priv.h>
|
||||
|
||||
static const struct pios_usart_cfg pios_usart_spektrum_cfg = {
|
||||
static const struct pios_usart_cfg pios_usart_dsm_cfg = {
|
||||
.regs = USART1,
|
||||
.init = {
|
||||
.USART_BaudRate = 115200,
|
||||
@ -580,7 +580,7 @@ static const struct pios_usart_cfg pios_usart_spektrum_cfg = {
|
||||
},
|
||||
};
|
||||
|
||||
static const struct pios_spektrum_cfg pios_spektrum_cfg = {
|
||||
static const struct pios_dsm_cfg pios_dsm_cfg = {
|
||||
.bind = {
|
||||
.gpio = GPIOA,
|
||||
.init = {
|
||||
@ -591,7 +591,7 @@ static const struct pios_spektrum_cfg pios_spektrum_cfg = {
|
||||
},
|
||||
};
|
||||
|
||||
#endif /* PIOS_COM_SPEKTRUM */
|
||||
#endif /* PIOS_COM_DSM */
|
||||
|
||||
#if defined(PIOS_INCLUDE_SBUS)
|
||||
#error PIOS_INCLUDE_SBUS not implemented
|
||||
@ -1062,7 +1062,7 @@ uint32_t pios_com_telem_rf_id;
|
||||
uint32_t pios_com_telem_usb_id;
|
||||
uint32_t pios_com_gps_id;
|
||||
uint32_t pios_com_aux_id;
|
||||
uint32_t pios_com_spektrum_id;
|
||||
uint32_t pios_com_dsm_id;
|
||||
|
||||
#include "ahrs_spi_comm.h"
|
||||
|
||||
@ -1206,7 +1206,7 @@ void PIOS_Board_Init(void) {
|
||||
case HWSETTINGS_OP_RCVRPORT_DSM2:
|
||||
case HWSETTINGS_OP_RCVRPORT_DSMX10BIT:
|
||||
case HWSETTINGS_OP_RCVRPORT_DSMX11BIT:
|
||||
#if defined(PIOS_INCLUDE_SPEKTRUM)
|
||||
#if defined(PIOS_INCLUDE_DSM)
|
||||
{
|
||||
enum pios_dsm_proto proto;
|
||||
switch (hwsettings_rcvrport) {
|
||||
@ -1224,25 +1224,25 @@ void PIOS_Board_Init(void) {
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t pios_usart_spektrum_id;
|
||||
if (PIOS_USART_Init(&pios_usart_spektrum_id, &pios_usart_spektrum_cfg)) {
|
||||
uint32_t pios_usart_dsm_id;
|
||||
if (PIOS_USART_Init(&pios_usart_dsm_id, &pios_usart_dsm_cfg)) {
|
||||
PIOS_Assert(0);
|
||||
}
|
||||
|
||||
uint32_t pios_spektrum_id;
|
||||
if (PIOS_Spektrum_Init(&pios_spektrum_id,
|
||||
&pios_spektrum_cfg,
|
||||
&pios_usart_com_driver,
|
||||
pios_usart_spektrum_id,
|
||||
proto, 0)) {
|
||||
uint32_t pios_dsm_id;
|
||||
if (PIOS_DSM_Init(&pios_dsm_id,
|
||||
&pios_dsm_cfg,
|
||||
&pios_usart_com_driver,
|
||||
pios_usart_dsm_id,
|
||||
proto, 0)) {
|
||||
PIOS_Assert(0);
|
||||
}
|
||||
|
||||
uint32_t pios_spektrum_rcvr_id;
|
||||
if (PIOS_RCVR_Init(&pios_spektrum_rcvr_id, &pios_spektrum_rcvr_driver, pios_spektrum_id)) {
|
||||
uint32_t pios_dsm_rcvr_id;
|
||||
if (PIOS_RCVR_Init(&pios_dsm_rcvr_id, &pios_dsm_rcvr_driver, pios_dsm_id)) {
|
||||
PIOS_Assert(0);
|
||||
}
|
||||
pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_DSMMAINPORT] = pios_spektrum_rcvr_id;
|
||||
pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_DSMMAINPORT] = pios_dsm_rcvr_id;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include "pios_rcvr_priv.h"
|
||||
|
||||
/* One slot per selectable receiver group.
|
||||
* eg. PWM, PPM, GCS, SPEKTRUM1, SPEKTRUM2, SBUS
|
||||
* eg. PWM, PPM, GCS, DSMMAINPORT, DSMFLEXIPORT, SBUS
|
||||
* NOTE: No slot in this map for NONE.
|
||||
*/
|
||||
uint32_t pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_NONE];
|
||||
|
@ -222,10 +222,10 @@ extern uint32_t pios_com_telem_usb_id;
|
||||
#define PIOS_PWM_NUM_INPUTS 6
|
||||
|
||||
//-------------------------
|
||||
// Receiver SPEKTRUM input
|
||||
// Receiver DSM input
|
||||
//-------------------------
|
||||
#define PIOS_SPEKTRUM_MAX_DEVS 2
|
||||
#define PIOS_SPEKTRUM_NUM_INPUTS 12
|
||||
#define PIOS_DSM_MAX_DEVS 2
|
||||
#define PIOS_DSM_NUM_INPUTS 12
|
||||
|
||||
//-------------------------
|
||||
// Receiver S.Bus input
|
||||
|
@ -195,10 +195,10 @@ extern uint32_t pios_com_aux_id;
|
||||
#define PIOS_PWM_NUM_INPUTS 8
|
||||
|
||||
//-------------------------
|
||||
// Receiver SPEKTRUM input
|
||||
// Receiver DSM input
|
||||
//-------------------------
|
||||
#define PIOS_SPEKTRUM_MAX_DEVS 1
|
||||
#define PIOS_SPEKTRUM_NUM_INPUTS 12
|
||||
#define PIOS_DSM_MAX_DEVS 1
|
||||
#define PIOS_DSM_NUM_INPUTS 12
|
||||
|
||||
//-------------------------
|
||||
// Receiver S.Bus input
|
||||
|
@ -32,8 +32,8 @@
|
||||
#include "pios.h"
|
||||
|
||||
#if defined(PIOS_INCLUDE_HCSR04)
|
||||
#if !(defined(PIOS_INCLUDE_SPEKTRUM) || defined(PIOS_INCLUDE_SBUS))
|
||||
#error Only supported with Spektrum or S.Bus interface!
|
||||
#if !(defined(PIOS_INCLUDE_DSM) || defined(PIOS_INCLUDE_SBUS))
|
||||
#error Only supported with Spektrum/JR DSM or S.Bus interface!
|
||||
#endif
|
||||
|
||||
/* Local Variables */
|
||||
|
@ -2,11 +2,11 @@
|
||||
******************************************************************************
|
||||
* @addtogroup PIOS PIOS Core hardware abstraction layer
|
||||
* @{
|
||||
* @addtogroup PIOS_Spektrum Spektrum/JR DSMx satellite receiver functions
|
||||
* @addtogroup PIOS_DSM Spektrum/JR DSMx satellite receiver functions
|
||||
* @brief Code to bind and read Spektrum/JR DSMx satellite receiver serial stream
|
||||
* @{
|
||||
*
|
||||
* @file pios_spektrum.c
|
||||
* @file pios_dsm.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2011.
|
||||
* @brief Code bind and read Spektrum/JR DSMx satellite receiver serial stream
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
@ -30,88 +30,88 @@
|
||||
|
||||
/* Project Includes */
|
||||
#include "pios.h"
|
||||
#include "pios_spektrum_priv.h"
|
||||
#include "pios_dsm_priv.h"
|
||||
|
||||
#if defined(PIOS_INCLUDE_SPEKTRUM)
|
||||
#if defined(PIOS_INCLUDE_DSM)
|
||||
|
||||
/* Forward Declarations */
|
||||
static int32_t PIOS_Spektrum_Get(uint32_t rcvr_id, uint8_t channel);
|
||||
static uint16_t PIOS_Spektrum_RxInCallback(uint32_t context,
|
||||
uint8_t *buf,
|
||||
uint16_t buf_len,
|
||||
uint16_t *headroom,
|
||||
bool *need_yield);
|
||||
static void PIOS_Spektrum_Supervisor(uint32_t spektrum_id);
|
||||
static int32_t PIOS_DSM_Get(uint32_t rcvr_id, uint8_t channel);
|
||||
static uint16_t PIOS_DSM_RxInCallback(uint32_t context,
|
||||
uint8_t *buf,
|
||||
uint16_t buf_len,
|
||||
uint16_t *headroom,
|
||||
bool *need_yield);
|
||||
static void PIOS_DSM_Supervisor(uint32_t dsm_id);
|
||||
|
||||
/* Local Variables */
|
||||
const struct pios_rcvr_driver pios_spektrum_rcvr_driver = {
|
||||
.read = PIOS_Spektrum_Get,
|
||||
const struct pios_rcvr_driver pios_dsm_rcvr_driver = {
|
||||
.read = PIOS_DSM_Get,
|
||||
};
|
||||
|
||||
enum pios_spektrum_dev_magic {
|
||||
PIOS_SPEKTRUM_DEV_MAGIC = 0x44534d78,
|
||||
enum pios_dsm_dev_magic {
|
||||
PIOS_DSM_DEV_MAGIC = 0x44534d78,
|
||||
};
|
||||
|
||||
struct pios_spektrum_state {
|
||||
uint16_t channel_data[PIOS_SPEKTRUM_NUM_INPUTS];
|
||||
uint8_t received_data[SPEKTRUM_FRAME_LENGTH];
|
||||
struct pios_dsm_state {
|
||||
uint16_t channel_data[PIOS_DSM_NUM_INPUTS];
|
||||
uint8_t received_data[DSM_FRAME_LENGTH];
|
||||
uint8_t receive_timer;
|
||||
uint8_t failsafe_timer;
|
||||
uint8_t frame_found;
|
||||
uint8_t byte_count;
|
||||
#if SPEKTRUM_LOST_FRAME_COUNTER
|
||||
#ifdef DSM_LOST_FRAME_COUNTER
|
||||
uint8_t frames_lost_last;
|
||||
uint16_t frames_lost;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct pios_spektrum_dev {
|
||||
enum pios_spektrum_dev_magic magic;
|
||||
const struct pios_spektrum_cfg *cfg;
|
||||
struct pios_dsm_dev {
|
||||
enum pios_dsm_dev_magic magic;
|
||||
const struct pios_dsm_cfg *cfg;
|
||||
enum pios_dsm_proto proto;
|
||||
struct pios_spektrum_state state;
|
||||
struct pios_dsm_state state;
|
||||
};
|
||||
|
||||
/* Allocate Spektrum device descriptor */
|
||||
/* Allocate DSM device descriptor */
|
||||
#if defined(PIOS_INCLUDE_FREERTOS)
|
||||
static struct pios_spektrum_dev *PIOS_Spektrum_Alloc(void)
|
||||
static struct pios_dsm_dev *PIOS_DSM_Alloc(void)
|
||||
{
|
||||
struct pios_spektrum_dev *spektrum_dev;
|
||||
struct pios_dsm_dev *dsm_dev;
|
||||
|
||||
spektrum_dev = (struct pios_spektrum_dev *)pvPortMalloc(sizeof(*spektrum_dev));
|
||||
if (!spektrum_dev)
|
||||
dsm_dev = (struct pios_dsm_dev *)pvPortMalloc(sizeof(*dsm_dev));
|
||||
if (!dsm_dev)
|
||||
return NULL;
|
||||
|
||||
spektrum_dev->magic = PIOS_SPEKTRUM_DEV_MAGIC;
|
||||
return spektrum_dev;
|
||||
dsm_dev->magic = PIOS_DSM_DEV_MAGIC;
|
||||
return dsm_dev;
|
||||
}
|
||||
#else
|
||||
static struct pios_spektrum_dev pios_spektrum_devs[PIOS_SPEKTRUM_MAX_DEVS];
|
||||
static uint8_t pios_spektrum_num_devs;
|
||||
static struct pios_spektrum_dev *PIOS_Spektrum_Alloc(void)
|
||||
static struct pios_dsm_dev pios_dsm_devs[PIOS_DSM_MAX_DEVS];
|
||||
static uint8_t pios_dsm_num_devs;
|
||||
static struct pios_dsm_dev *PIOS_DSM_Alloc(void)
|
||||
{
|
||||
struct pios_spektrum_dev *spektrum_dev;
|
||||
struct pios_dsm_dev *dsm_dev;
|
||||
|
||||
if (pios_spektrum_num_devs >= PIOS_SPEKTRUM_MAX_DEVS)
|
||||
if (pios_dsm_num_devs >= PIOS_DSM_MAX_DEVS)
|
||||
return NULL;
|
||||
|
||||
spektrum_dev = &pios_spektrum_devs[pios_spektrum_num_devs++];
|
||||
spektrum_dev->magic = PIOS_SPEKTRUM_DEV_MAGIC;
|
||||
dsm_dev = &pios_dsm_devs[pios_dsm_num_devs++];
|
||||
dsm_dev->magic = PIOS_DSM_DEV_MAGIC;
|
||||
|
||||
return spektrum_dev;
|
||||
return dsm_dev;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Validate Spektrum device descriptor */
|
||||
static bool PIOS_Spektrum_Validate(struct pios_spektrum_dev *spektrum_dev)
|
||||
/* Validate DSM device descriptor */
|
||||
static bool PIOS_DSM_Validate(struct pios_dsm_dev *dsm_dev)
|
||||
{
|
||||
return (spektrum_dev->magic == PIOS_SPEKTRUM_DEV_MAGIC);
|
||||
return (dsm_dev->magic == PIOS_DSM_DEV_MAGIC);
|
||||
}
|
||||
|
||||
/* Try to bind DSMx satellite using specified number of pulses */
|
||||
static void PIOS_Spektrum_Bind(struct pios_spektrum_dev *spektrum_dev, uint8_t bind)
|
||||
static void PIOS_DSM_Bind(struct pios_dsm_dev *dsm_dev, uint8_t bind)
|
||||
{
|
||||
const struct pios_spektrum_cfg *cfg = spektrum_dev->cfg;
|
||||
const struct pios_dsm_cfg *cfg = dsm_dev->cfg;
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitStructure.GPIO_Pin = cfg->bind.init.GPIO_Pin;
|
||||
@ -143,26 +143,26 @@ static void PIOS_Spektrum_Bind(struct pios_spektrum_dev *spektrum_dev, uint8_t b
|
||||
}
|
||||
|
||||
/* Reset channels in case of lost signal or explicit failsafe receiver flag */
|
||||
static void PIOS_Spektrum_ResetChannels(struct pios_spektrum_dev *spektrum_dev)
|
||||
static void PIOS_DSM_ResetChannels(struct pios_dsm_dev *dsm_dev)
|
||||
{
|
||||
struct pios_spektrum_state *state = &(spektrum_dev->state);
|
||||
for (int i = 0; i < PIOS_SPEKTRUM_NUM_INPUTS; i++) {
|
||||
struct pios_dsm_state *state = &(dsm_dev->state);
|
||||
for (int i = 0; i < PIOS_DSM_NUM_INPUTS; i++) {
|
||||
state->channel_data[i] = PIOS_RCVR_TIMEOUT;
|
||||
}
|
||||
}
|
||||
|
||||
/* Reset Spektrum receiver state */
|
||||
static void PIOS_Spektrum_ResetState(struct pios_spektrum_dev *spektrum_dev)
|
||||
/* Reset DSM receiver state */
|
||||
static void PIOS_DSM_ResetState(struct pios_dsm_dev *dsm_dev)
|
||||
{
|
||||
struct pios_spektrum_state *state = &(spektrum_dev->state);
|
||||
struct pios_dsm_state *state = &(dsm_dev->state);
|
||||
state->receive_timer = 0;
|
||||
state->failsafe_timer = 0;
|
||||
state->frame_found = 0;
|
||||
#if SPEKTRUM_LOST_FRAME_COUNTER
|
||||
#ifdef DSM_LOST_FRAME_COUNTER
|
||||
state->frames_lost_last = 0;
|
||||
state->frames_lost = 0;
|
||||
#endif
|
||||
PIOS_Spektrum_ResetChannels(spektrum_dev);
|
||||
PIOS_DSM_ResetChannels(dsm_dev);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -170,12 +170,12 @@ static void PIOS_Spektrum_ResetState(struct pios_spektrum_dev *spektrum_dev)
|
||||
* \output 0 frame data accepted
|
||||
* \output -1 frame error found
|
||||
*/
|
||||
static int PIOS_Spektrum_UnrollChannels(struct pios_spektrum_dev *spektrum_dev)
|
||||
static int PIOS_DSM_UnrollChannels(struct pios_dsm_dev *dsm_dev)
|
||||
{
|
||||
struct pios_spektrum_state *state = &(spektrum_dev->state);
|
||||
struct pios_dsm_state *state = &(dsm_dev->state);
|
||||
uint8_t resolution;
|
||||
|
||||
#if SPEKTRUM_LOST_FRAME_COUNTER
|
||||
#ifdef DSM_LOST_FRAME_COUNTER
|
||||
/* increment the lost frame counter */
|
||||
uint8_t frames_lost = state->received_data[0];
|
||||
state->frames_lost += (frames_lost - state->frames_lost_last);
|
||||
@ -189,9 +189,9 @@ static int PIOS_Spektrum_UnrollChannels(struct pios_spektrum_dev *spektrum_dev)
|
||||
case 0x02:
|
||||
case 0x12:
|
||||
/* DSM2, DSMJ stream */
|
||||
if (spektrum_dev->proto == PIOS_DSM_PROTO_DSM2) {
|
||||
if (dsm_dev->proto == PIOS_DSM_PROTO_DSM2) {
|
||||
/* DSM2/DSMJ resolution is known from the header */
|
||||
resolution = (type & SPEKTRUM_DSM2_RES_MASK) ? 11 : 10;
|
||||
resolution = (type & DSM_DSM2_RES_MASK) ? 11 : 10;
|
||||
} else {
|
||||
/* DSMX resolution should explicitly be selected */
|
||||
goto stream_error;
|
||||
@ -200,9 +200,9 @@ static int PIOS_Spektrum_UnrollChannels(struct pios_spektrum_dev *spektrum_dev)
|
||||
case 0xA2:
|
||||
case 0xB2:
|
||||
/* DSMX stream */
|
||||
if (spektrum_dev->proto == PIOS_DSM_PROTO_DSMX10BIT) {
|
||||
if (dsm_dev->proto == PIOS_DSM_PROTO_DSMX10BIT) {
|
||||
resolution = 10;
|
||||
} else if (spektrum_dev->proto == PIOS_DSM_PROTO_DSMX11BIT) {
|
||||
} else if (dsm_dev->proto == PIOS_DSM_PROTO_DSMX11BIT) {
|
||||
resolution = 11;
|
||||
} else {
|
||||
/* DSMX resolution should explicitly be selected */
|
||||
@ -218,7 +218,7 @@ static int PIOS_Spektrum_UnrollChannels(struct pios_spektrum_dev *spektrum_dev)
|
||||
uint8_t *s = &(state->received_data[2]);
|
||||
uint16_t mask = (resolution == 10) ? 0x03ff : 0x07ff;
|
||||
|
||||
for (int i = 0; i < SPEKTRUM_CHANNELS_PER_FRAME; i++) {
|
||||
for (int i = 0; i < DSM_CHANNELS_PER_FRAME; i++) {
|
||||
uint16_t word = ((uint16_t)s[0] << 8) | s[1];
|
||||
s += 2;
|
||||
|
||||
@ -227,20 +227,20 @@ static int PIOS_Spektrum_UnrollChannels(struct pios_spektrum_dev *spektrum_dev)
|
||||
continue;
|
||||
|
||||
/* minimal data validation */
|
||||
if ((i > 0) && (word & SPEKTRUM_2ND_FRAME_MASK)) {
|
||||
if ((i > 0) && (word & DSM_2ND_FRAME_MASK)) {
|
||||
/* invalid frame data, ignore rest of the frame */
|
||||
goto stream_error;
|
||||
}
|
||||
|
||||
/* extract and save the channel value */
|
||||
uint8_t channel_num = (word >> resolution) & 0x0f;
|
||||
if (channel_num < PIOS_SPEKTRUM_NUM_INPUTS)
|
||||
if (channel_num < PIOS_DSM_NUM_INPUTS)
|
||||
state->channel_data[channel_num] = (word & mask);
|
||||
}
|
||||
|
||||
#if SPEKTRUM_LOST_FRAME_COUNTER
|
||||
#ifdef DSM_LOST_FRAME_COUNTER
|
||||
/* put lost frames counter into the last channel for debugging */
|
||||
state->channel_data[PIOS_SPEKTRUM_NUM_INPUTS-1] = state->frames_lost;
|
||||
state->channel_data[PIOS_DSM_NUM_INPUTS-1] = state->frames_lost;
|
||||
#endif
|
||||
|
||||
/* all channels processed */
|
||||
@ -252,17 +252,17 @@ stream_error:
|
||||
}
|
||||
|
||||
/* Update decoder state processing input byte from the DSMx stream */
|
||||
static void PIOS_Spektrum_UpdateState(struct pios_spektrum_dev *spektrum_dev, uint8_t byte)
|
||||
static void PIOS_DSM_UpdateState(struct pios_dsm_dev *dsm_dev, uint8_t byte)
|
||||
{
|
||||
struct pios_spektrum_state *state = &(spektrum_dev->state);
|
||||
struct pios_dsm_state *state = &(dsm_dev->state);
|
||||
if (state->frame_found) {
|
||||
/* receiving the data frame */
|
||||
if (state->byte_count < SPEKTRUM_FRAME_LENGTH) {
|
||||
if (state->byte_count < DSM_FRAME_LENGTH) {
|
||||
/* store next byte */
|
||||
state->received_data[state->byte_count++] = byte;
|
||||
if (state->byte_count == SPEKTRUM_FRAME_LENGTH) {
|
||||
if (state->byte_count == DSM_FRAME_LENGTH) {
|
||||
/* full frame received - process and wait for new one */
|
||||
if (!PIOS_Spektrum_UnrollChannels(spektrum_dev))
|
||||
if (!PIOS_DSM_UnrollChannels(dsm_dev))
|
||||
/* data looking good */
|
||||
state->failsafe_timer = 0;
|
||||
|
||||
@ -273,40 +273,40 @@ static void PIOS_Spektrum_UpdateState(struct pios_spektrum_dev *spektrum_dev, ui
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialise Spektrum receiver interface */
|
||||
int32_t PIOS_Spektrum_Init(uint32_t *spektrum_id,
|
||||
const struct pios_spektrum_cfg *cfg,
|
||||
const struct pios_com_driver *driver,
|
||||
uint32_t lower_id,
|
||||
enum pios_dsm_proto proto,
|
||||
uint8_t bind)
|
||||
/* Initialise DSM receiver interface */
|
||||
int32_t PIOS_DSM_Init(uint32_t *dsm_id,
|
||||
const struct pios_dsm_cfg *cfg,
|
||||
const struct pios_com_driver *driver,
|
||||
uint32_t lower_id,
|
||||
enum pios_dsm_proto proto,
|
||||
uint8_t bind)
|
||||
{
|
||||
PIOS_DEBUG_Assert(spektrum_id);
|
||||
PIOS_DEBUG_Assert(dsm_id);
|
||||
PIOS_DEBUG_Assert(cfg);
|
||||
PIOS_DEBUG_Assert(driver);
|
||||
|
||||
struct pios_spektrum_dev *spektrum_dev;
|
||||
struct pios_dsm_dev *dsm_dev;
|
||||
|
||||
spektrum_dev = (struct pios_spektrum_dev *)PIOS_Spektrum_Alloc();
|
||||
if (!spektrum_dev)
|
||||
dsm_dev = (struct pios_dsm_dev *)PIOS_DSM_Alloc();
|
||||
if (!dsm_dev)
|
||||
return -1;
|
||||
|
||||
/* Bind the configuration to the device instance */
|
||||
spektrum_dev->cfg = cfg;
|
||||
spektrum_dev->proto = proto;
|
||||
dsm_dev->cfg = cfg;
|
||||
dsm_dev->proto = proto;
|
||||
|
||||
/* Bind the receiver if requested */
|
||||
if (bind)
|
||||
PIOS_Spektrum_Bind(spektrum_dev, bind);
|
||||
PIOS_DSM_Bind(dsm_dev, bind);
|
||||
|
||||
PIOS_Spektrum_ResetState(spektrum_dev);
|
||||
PIOS_DSM_ResetState(dsm_dev);
|
||||
|
||||
*spektrum_id = (uint32_t)spektrum_dev;
|
||||
*dsm_id = (uint32_t)dsm_dev;
|
||||
|
||||
/* Set comm driver callback */
|
||||
(driver->bind_rx_cb)(lower_id, PIOS_Spektrum_RxInCallback, *spektrum_id);
|
||||
(driver->bind_rx_cb)(lower_id, PIOS_DSM_RxInCallback, *dsm_id);
|
||||
|
||||
if (!PIOS_RTC_RegisterTickCallback(PIOS_Spektrum_Supervisor, *spektrum_id)) {
|
||||
if (!PIOS_RTC_RegisterTickCallback(PIOS_DSM_Supervisor, *dsm_id)) {
|
||||
PIOS_DEBUG_Assert(0);
|
||||
}
|
||||
|
||||
@ -314,26 +314,26 @@ int32_t PIOS_Spektrum_Init(uint32_t *spektrum_id,
|
||||
}
|
||||
|
||||
/* Comm byte received callback */
|
||||
static uint16_t PIOS_Spektrum_RxInCallback(uint32_t context,
|
||||
uint8_t *buf,
|
||||
uint16_t buf_len,
|
||||
uint16_t *headroom,
|
||||
bool *need_yield)
|
||||
static uint16_t PIOS_DSM_RxInCallback(uint32_t context,
|
||||
uint8_t *buf,
|
||||
uint16_t buf_len,
|
||||
uint16_t *headroom,
|
||||
bool *need_yield)
|
||||
{
|
||||
struct pios_spektrum_dev *spektrum_dev = (struct pios_spektrum_dev *)context;
|
||||
struct pios_dsm_dev *dsm_dev = (struct pios_dsm_dev *)context;
|
||||
|
||||
bool valid = PIOS_Spektrum_Validate(spektrum_dev);
|
||||
bool valid = PIOS_DSM_Validate(dsm_dev);
|
||||
PIOS_Assert(valid);
|
||||
|
||||
/* process byte(s) and clear receive timer */
|
||||
for (uint8_t i = 0; i < buf_len; i++) {
|
||||
PIOS_Spektrum_UpdateState(spektrum_dev, buf[i]);
|
||||
spektrum_dev->state.receive_timer = 0;
|
||||
PIOS_DSM_UpdateState(dsm_dev, buf[i]);
|
||||
dsm_dev->state.receive_timer = 0;
|
||||
}
|
||||
|
||||
/* Always signal that we can accept another byte */
|
||||
if (headroom)
|
||||
*headroom = SPEKTRUM_FRAME_LENGTH;
|
||||
*headroom = DSM_FRAME_LENGTH;
|
||||
|
||||
/* We never need a yield */
|
||||
*need_yield = false;
|
||||
@ -349,41 +349,41 @@ static uint16_t PIOS_Spektrum_RxInCallback(uint32_t context,
|
||||
* \output PIOS_RCVR_TIMEOUT failsafe condition or missing receiver
|
||||
* \output >0 channel value
|
||||
*/
|
||||
static int32_t PIOS_Spektrum_Get(uint32_t rcvr_id, uint8_t channel)
|
||||
static int32_t PIOS_DSM_Get(uint32_t rcvr_id, uint8_t channel)
|
||||
{
|
||||
struct pios_spektrum_dev *spektrum_dev = (struct pios_spektrum_dev *)rcvr_id;
|
||||
struct pios_dsm_dev *dsm_dev = (struct pios_dsm_dev *)rcvr_id;
|
||||
|
||||
if (!PIOS_Spektrum_Validate(spektrum_dev))
|
||||
if (!PIOS_DSM_Validate(dsm_dev))
|
||||
return PIOS_RCVR_INVALID;
|
||||
|
||||
/* return error if channel is not available */
|
||||
if (channel >= PIOS_SPEKTRUM_NUM_INPUTS)
|
||||
if (channel >= PIOS_DSM_NUM_INPUTS)
|
||||
return PIOS_RCVR_INVALID;
|
||||
|
||||
/* may also be PIOS_RCVR_TIMEOUT set by other function */
|
||||
return spektrum_dev->state.channel_data[channel];
|
||||
return dsm_dev->state.channel_data[channel];
|
||||
}
|
||||
|
||||
/**
|
||||
* Input data supervisor is called periodically and provides
|
||||
* two functions: frame syncing and failsafe triggering.
|
||||
*
|
||||
* Spektrum frames come at 11ms or 22ms rate at 115200bps.
|
||||
* DSM frames come at 11ms or 22ms rate at 115200bps.
|
||||
* RTC timer is running at 625Hz (1.6ms). So with divider 5 it gives
|
||||
* 8ms pause between frames which is good for both Spektrum frame rates.
|
||||
* 8ms pause between frames which is good for both DSM frame rates.
|
||||
*
|
||||
* Data receive function must clear the receive_timer to confirm new
|
||||
* data reception. If no new data received in 100ms, we must call the
|
||||
* failsafe function which clears all channels.
|
||||
*/
|
||||
static void PIOS_Spektrum_Supervisor(uint32_t spektrum_id)
|
||||
static void PIOS_DSM_Supervisor(uint32_t dsm_id)
|
||||
{
|
||||
struct pios_spektrum_dev *spektrum_dev = (struct pios_spektrum_dev *)spektrum_id;
|
||||
struct pios_dsm_dev *dsm_dev = (struct pios_dsm_dev *)dsm_id;
|
||||
|
||||
bool valid = PIOS_Spektrum_Validate(spektrum_dev);
|
||||
bool valid = PIOS_DSM_Validate(dsm_dev);
|
||||
PIOS_Assert(valid);
|
||||
|
||||
struct pios_spektrum_state *state = &(spektrum_dev->state);
|
||||
struct pios_dsm_state *state = &(dsm_dev->state);
|
||||
|
||||
/* waiting for new frame if no bytes were received in 8ms */
|
||||
if (++state->receive_timer > 4) {
|
||||
@ -394,12 +394,12 @@ static void PIOS_Spektrum_Supervisor(uint32_t spektrum_id)
|
||||
|
||||
/* activate failsafe if no frames have arrived in 102.4ms */
|
||||
if (++state->failsafe_timer > 64) {
|
||||
PIOS_Spektrum_ResetChannels(spektrum_dev);
|
||||
PIOS_DSM_ResetChannels(dsm_dev);
|
||||
state->failsafe_timer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* PIOS_INCLUDE_SPEKTRUM */
|
||||
#endif /* PIOS_INCLUDE_DSM */
|
||||
|
||||
/**
|
||||
* @}
|
@ -2,10 +2,10 @@
|
||||
******************************************************************************
|
||||
* @addtogroup PIOS PIOS Core hardware abstraction layer
|
||||
* @{
|
||||
* @addtogroup PIOS_Spektrum Spektrum/JR DSMx satellite receiver functions
|
||||
* @addtogroup PIOS_DSM Spektrum/JR DSMx satellite receiver functions
|
||||
* @{
|
||||
*
|
||||
* @file pios_spektrum.h
|
||||
* @file pios_dsm.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2011.
|
||||
* @brief Spektrum/JR DSMx satellite receiver functions header.
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
@ -27,14 +27,14 @@
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef PIOS_SPEKTRUM_H
|
||||
#define PIOS_SPEKTRUM_H
|
||||
#ifndef PIOS_DSM_H
|
||||
#define PIOS_DSM_H
|
||||
|
||||
/* Global Types */
|
||||
|
||||
/* Public Functions */
|
||||
|
||||
#endif /* PIOS_SPEKTRUM_H */
|
||||
#endif /* PIOS_DSM_H */
|
||||
|
||||
/**
|
||||
* @}
|
@ -2,11 +2,11 @@
|
||||
******************************************************************************
|
||||
* @addtogroup PIOS PIOS Core hardware abstraction layer
|
||||
* @{
|
||||
* @addtogroup PIOS_Spektrum Spektrum/JR DSMx satellite receiver functions
|
||||
* @addtogroup PIOS_DSM Spektrum/JR DSMx satellite receiver functions
|
||||
* @brief PIOS interface to bind and read Spektrum/JR DSMx satellite receiver
|
||||
* @{
|
||||
*
|
||||
* @file pios_spektrum_priv.h
|
||||
* @file pios_dsm_priv.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2011.
|
||||
* @brief Spektrum/JR DSMx satellite receiver private structures.
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
@ -28,8 +28,8 @@
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef PIOS_SPEKTRUM_PRIV_H
|
||||
#define PIOS_SPEKTRUM_PRIV_H
|
||||
#ifndef PIOS_DSM_PRIV_H
|
||||
#define PIOS_DSM_PRIV_H
|
||||
|
||||
#include <pios.h>
|
||||
#include <pios_stm32.h>
|
||||
@ -99,39 +99,39 @@
|
||||
* to bind in low resolution mode.
|
||||
*/
|
||||
|
||||
#define SPEKTRUM_CHANNELS_PER_FRAME 7
|
||||
#define SPEKTRUM_FRAME_LENGTH (1+1+SPEKTRUM_CHANNELS_PER_FRAME*2)
|
||||
#define SPEKTRUM_DSM2_RES_MASK 0x0010
|
||||
#define SPEKTRUM_2ND_FRAME_MASK 0x8000
|
||||
#define DSM_CHANNELS_PER_FRAME 7
|
||||
#define DSM_FRAME_LENGTH (1+1+DSM_CHANNELS_PER_FRAME*2)
|
||||
#define DSM_DSM2_RES_MASK 0x0010
|
||||
#define DSM_2ND_FRAME_MASK 0x8000
|
||||
|
||||
/*
|
||||
* Include lost frame counter and provide it as a last channel value
|
||||
* for debugging. Currently is not used by the receiver layer.
|
||||
*/
|
||||
#define SPEKTRUM_LOST_FRAME_COUNTER 0
|
||||
//#define DSM_LOST_FRAME_COUNTER
|
||||
|
||||
/* Spektrum protocol variations */
|
||||
/* DSM protocol variations */
|
||||
enum pios_dsm_proto {
|
||||
PIOS_DSM_PROTO_DSM2,
|
||||
PIOS_DSM_PROTO_DSMX10BIT,
|
||||
PIOS_DSM_PROTO_DSMX11BIT,
|
||||
};
|
||||
|
||||
/* Spektrum receiver instance configuration */
|
||||
struct pios_spektrum_cfg {
|
||||
/* DSM receiver instance configuration */
|
||||
struct pios_dsm_cfg {
|
||||
struct stm32_gpio bind;
|
||||
};
|
||||
|
||||
extern const struct pios_rcvr_driver pios_spektrum_rcvr_driver;
|
||||
extern const struct pios_rcvr_driver pios_dsm_rcvr_driver;
|
||||
|
||||
extern int32_t PIOS_Spektrum_Init(uint32_t *spektrum_id,
|
||||
const struct pios_spektrum_cfg *cfg,
|
||||
const struct pios_com_driver *driver,
|
||||
uint32_t lower_id,
|
||||
enum pios_dsm_proto proto,
|
||||
uint8_t bind);
|
||||
extern int32_t PIOS_DSM_Init(uint32_t *dsm_id,
|
||||
const struct pios_dsm_cfg *cfg,
|
||||
const struct pios_com_driver *driver,
|
||||
uint32_t lower_id,
|
||||
enum pios_dsm_proto proto,
|
||||
uint8_t bind);
|
||||
|
||||
#endif /* PIOS_SPEKTRUM_PRIV_H */
|
||||
#endif /* PIOS_DSM_PRIV_H */
|
||||
|
||||
/**
|
||||
* @}
|
@ -79,7 +79,7 @@
|
||||
#include <pios_ppm.h>
|
||||
#include <pios_pwm.h>
|
||||
#include <pios_rcvr.h>
|
||||
#include <pios_spektrum.h>
|
||||
#include <pios_dsm.h>
|
||||
#include <pios_sbus.h>
|
||||
#include <pios_usb_hid.h>
|
||||
#include <pios_debug.h>
|
||||
|
@ -96,7 +96,7 @@
|
||||
65643CAD1413322000A32F59 /* pios_rtc_priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_rtc_priv.h; sourceTree = "<group>"; };
|
||||
65643CAE1413322000A32F59 /* pios_sbus_priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_sbus_priv.h; sourceTree = "<group>"; };
|
||||
65643CAF1413322000A32F59 /* pios_sbus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_sbus.h; sourceTree = "<group>"; };
|
||||
65643CB01413322000A32F59 /* pios_spektrum_priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_spektrum_priv.h; sourceTree = "<group>"; };
|
||||
65643CB01413322000A32F59 /* pios_dsm_priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_dsm_priv.h; sourceTree = "<group>"; };
|
||||
65643CB91413456D00A32F59 /* pios_tim.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pios_tim.c; sourceTree = "<group>"; };
|
||||
65643CBA141350C200A32F59 /* pios_sbus.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pios_sbus.c; sourceTree = "<group>"; };
|
||||
6572CB1613D0F2B200FC2972 /* link_STM32103CB_CC_Rev1_memory.ld */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = link_STM32103CB_CC_Rev1_memory.ld; path = ../../PiOS/STM32F10x/link_STM32103CB_CC_Rev1_memory.ld; sourceTree = SOURCE_ROOT; };
|
||||
@ -2796,7 +2796,7 @@
|
||||
65E8F04911EFF25C00BBF654 /* pios_pwm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pios_pwm.h; path = ../../PiOS/inc/pios_pwm.h; sourceTree = SOURCE_ROOT; };
|
||||
65E8F04A11EFF25C00BBF654 /* pios_sdcard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pios_sdcard.h; path = ../../PiOS/inc/pios_sdcard.h; sourceTree = SOURCE_ROOT; };
|
||||
65E8F04B11EFF25C00BBF654 /* pios_servo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pios_servo.h; path = ../../PiOS/inc/pios_servo.h; sourceTree = SOURCE_ROOT; };
|
||||
65E8F04C11EFF25C00BBF654 /* pios_spektrum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pios_spektrum.h; path = ../../PiOS/inc/pios_spektrum.h; sourceTree = SOURCE_ROOT; };
|
||||
65E8F04C11EFF25C00BBF654 /* pios_dsm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pios_dsm.h; path = ../../PiOS/inc/pios_dsm.h; sourceTree = SOURCE_ROOT; };
|
||||
65E8F04D11EFF25C00BBF654 /* pios_spi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pios_spi.h; path = ../../PiOS/inc/pios_spi.h; sourceTree = SOURCE_ROOT; };
|
||||
65E8F04E11EFF25C00BBF654 /* pios_spi_priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pios_spi_priv.h; path = ../../PiOS/inc/pios_spi_priv.h; sourceTree = SOURCE_ROOT; };
|
||||
65E8F04F11EFF25C00BBF654 /* pios_stm32.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pios_stm32.h; path = ../../PiOS/inc/pios_stm32.h; sourceTree = SOURCE_ROOT; };
|
||||
@ -2925,7 +2925,7 @@
|
||||
65E8F0E411EFF25C00BBF654 /* pios_ppm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pios_ppm.c; path = ../../PiOS/STM32F10x/pios_ppm.c; sourceTree = SOURCE_ROOT; };
|
||||
65E8F0E511EFF25C00BBF654 /* pios_pwm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pios_pwm.c; path = ../../PiOS/STM32F10x/pios_pwm.c; sourceTree = SOURCE_ROOT; };
|
||||
65E8F0E611EFF25C00BBF654 /* pios_servo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pios_servo.c; path = ../../PiOS/STM32F10x/pios_servo.c; sourceTree = SOURCE_ROOT; };
|
||||
65E8F0E711EFF25C00BBF654 /* pios_spektrum.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pios_spektrum.c; path = ../../PiOS/STM32F10x/pios_spektrum.c; sourceTree = SOURCE_ROOT; };
|
||||
65E8F0E711EFF25C00BBF654 /* pios_dsm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pios_dsm.c; path = ../../PiOS/STM32F10x/pios_dsm.c; sourceTree = SOURCE_ROOT; };
|
||||
65E8F0E811EFF25C00BBF654 /* pios_spi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pios_spi.c; path = ../../PiOS/STM32F10x/pios_spi.c; sourceTree = SOURCE_ROOT; };
|
||||
65E8F0E911EFF25C00BBF654 /* pios_sys.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pios_sys.c; path = ../../PiOS/STM32F10x/pios_sys.c; sourceTree = SOURCE_ROOT; };
|
||||
65E8F0EA11EFF25C00BBF654 /* pios_usart.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pios_usart.c; path = ../../PiOS/STM32F10x/pios_usart.c; sourceTree = SOURCE_ROOT; };
|
||||
@ -7739,8 +7739,8 @@
|
||||
65E8F04A11EFF25C00BBF654 /* pios_sdcard.h */,
|
||||
65E8F04B11EFF25C00BBF654 /* pios_servo.h */,
|
||||
65FBE14412E7C98100176B5A /* pios_servo_priv.h */,
|
||||
65E8F04C11EFF25C00BBF654 /* pios_spektrum.h */,
|
||||
65643CB01413322000A32F59 /* pios_spektrum_priv.h */,
|
||||
65E8F04C11EFF25C00BBF654 /* pios_dsm.h */,
|
||||
65643CB01413322000A32F59 /* pios_dsm_priv.h */,
|
||||
65E8F04D11EFF25C00BBF654 /* pios_spi.h */,
|
||||
65E8F04E11EFF25C00BBF654 /* pios_spi_priv.h */,
|
||||
65E8F04F11EFF25C00BBF654 /* pios_stm32.h */,
|
||||
@ -7782,7 +7782,7 @@
|
||||
6589A9DB131DEE76006BD67C /* pios_rtc.c */,
|
||||
65643CBA141350C200A32F59 /* pios_sbus.c */,
|
||||
65E8F0E611EFF25C00BBF654 /* pios_servo.c */,
|
||||
65E8F0E711EFF25C00BBF654 /* pios_spektrum.c */,
|
||||
65E8F0E711EFF25C00BBF654 /* pios_dsm.c */,
|
||||
65E8F0E811EFF25C00BBF654 /* pios_spi.c */,
|
||||
65E8F0E911EFF25C00BBF654 /* pios_sys.c */,
|
||||
65643CB91413456D00A32F59 /* pios_tim.c */,
|
||||
|
Loading…
x
Reference in New Issue
Block a user