mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
LP-104 LP-196 Uncrustify and some other formatting issues fixed.
This commit is contained in:
parent
d32cc0e7fb
commit
c06fb0249f
@ -39,24 +39,24 @@
|
||||
*/
|
||||
|
||||
/* EXBUS frame size and contents definitions */
|
||||
#define EXBUS_HEADER_LENGTH 4
|
||||
#define EXBUS_CRC_LENGTH 2
|
||||
#define EXBUS_MAX_CHANNELS 16
|
||||
#define EXBUS_OVERHEAD_LENGTH (EXBUS_HEADER_LENGTH + EXBUS_CRC_LENGTH)
|
||||
#define EXBUS_MAX_FRAME_LENGTH (EXBUS_MAX_CHANNELS*2+10 + EXBUS_OVERHEAD_LENGTH)
|
||||
#define EXBUS_HEADER_LENGTH 4
|
||||
#define EXBUS_CRC_LENGTH 2
|
||||
#define EXBUS_MAX_CHANNELS 16
|
||||
#define EXBUS_OVERHEAD_LENGTH (EXBUS_HEADER_LENGTH + EXBUS_CRC_LENGTH)
|
||||
#define EXBUS_MAX_FRAME_LENGTH (EXBUS_MAX_CHANNELS * 2 + 10 + EXBUS_OVERHEAD_LENGTH)
|
||||
|
||||
#define EXBUS_SYNC_CHANNEL 0x3E
|
||||
#define EXBUS_SYNC_TELEMETRY 0x3D
|
||||
#define EXBUS_BYTE_REQ 0x01
|
||||
#define EXBUS_BYTE_NOREQ 0x03
|
||||
#define EXBUS_SYNC_CHANNEL 0x3E
|
||||
#define EXBUS_SYNC_TELEMETRY 0x3D
|
||||
#define EXBUS_BYTE_REQ 0x01
|
||||
#define EXBUS_BYTE_NOREQ 0x03
|
||||
|
||||
#define EXBUS_DATA_CHANNEL 0x31
|
||||
#define EXBUS_DATA_TELEMETRY 0x3A
|
||||
#define EXBUS_DATA_JETIBOX 0x3B
|
||||
#define EXBUS_DATA_CHANNEL 0x31
|
||||
#define EXBUS_DATA_TELEMETRY 0x3A
|
||||
#define EXBUS_DATA_JETIBOX 0x3B
|
||||
|
||||
#define EXBUS_LOW_BAUD_RATE 125000
|
||||
#define EXBUS_HIGH_BAUD_RATE 250000
|
||||
#define EXBUS_BAUD_RATE_LIMIT 64
|
||||
#define EXBUS_LOW_BAUD_RATE 125000
|
||||
#define EXBUS_HIGH_BAUD_RATE 250000
|
||||
#define EXBUS_BAUD_RATE_LIMIT 64
|
||||
|
||||
/* Forward Declarations */
|
||||
static int32_t PIOS_EXBUS_Get(uint32_t rcvr_id, uint8_t channel);
|
||||
@ -89,19 +89,19 @@ enum pios_exbus_frame_state {
|
||||
|
||||
struct pios_exbus_state {
|
||||
uint16_t channel_data[PIOS_EXBUS_NUM_INPUTS];
|
||||
uint8_t received_data[EXBUS_MAX_FRAME_LENGTH];
|
||||
uint8_t receive_timer;
|
||||
uint8_t failsafe_timer;
|
||||
uint8_t failsafe_count;
|
||||
uint8_t byte_count;
|
||||
uint8_t frame_length;
|
||||
uint8_t received_data[EXBUS_MAX_FRAME_LENGTH];
|
||||
uint8_t receive_timer;
|
||||
uint8_t failsafe_timer;
|
||||
uint8_t failsafe_count;
|
||||
uint8_t byte_count;
|
||||
uint8_t frame_length;
|
||||
uint16_t crc;
|
||||
bool high_baud_rate;
|
||||
bool frame_found;
|
||||
bool high_baud_rate;
|
||||
bool frame_found;
|
||||
};
|
||||
|
||||
struct pios_exbus_dev {
|
||||
enum pios_exbus_dev_magic magic;
|
||||
enum pios_exbus_dev_magic magic;
|
||||
uint32_t com_port_id;
|
||||
const struct pios_com_driver *driver;
|
||||
struct pios_exbus_state state;
|
||||
@ -114,8 +114,9 @@ static struct pios_exbus_dev *PIOS_EXBUS_Alloc(void)
|
||||
struct pios_exbus_dev *exbus_dev;
|
||||
|
||||
exbus_dev = (struct pios_exbus_dev *)pios_malloc(sizeof(*exbus_dev));
|
||||
if (!exbus_dev)
|
||||
if (!exbus_dev) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
exbus_dev->magic = PIOS_EXBUS_DEV_MAGIC;
|
||||
return exbus_dev;
|
||||
@ -127,26 +128,28 @@ static struct pios_exbus_dev *PIOS_EXBUS_Alloc(void)
|
||||
{
|
||||
struct pios_exbus_dev *exbus_dev;
|
||||
|
||||
if (pios_exbus_num_devs >= PIOS_EXBUS_MAX_DEVS)
|
||||
if (pios_exbus_num_devs >= PIOS_EXBUS_MAX_DEVS) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
exbus_dev = &pios_exbus_devs[pios_exbus_num_devs++];
|
||||
exbus_dev->magic = PIOS_EXBUS_DEV_MAGIC;
|
||||
|
||||
return exbus_dev;
|
||||
}
|
||||
#endif
|
||||
#endif /* if defined(PIOS_INCLUDE_FREERTOS) */
|
||||
|
||||
/* Validate EXBUS device descriptor */
|
||||
static bool PIOS_EXBUS_Validate(struct pios_exbus_dev *exbus_dev)
|
||||
{
|
||||
return (exbus_dev->magic == PIOS_EXBUS_DEV_MAGIC);
|
||||
return exbus_dev->magic == PIOS_EXBUS_DEV_MAGIC;
|
||||
}
|
||||
|
||||
/* Reset channels in case of lost signal or explicit failsafe receiver flag */
|
||||
static void PIOS_EXBUS_ResetChannels(struct pios_exbus_dev *exbus_dev)
|
||||
{
|
||||
struct pios_exbus_state *state = &(exbus_dev->state);
|
||||
|
||||
for (int i = 0; i < PIOS_EXBUS_NUM_INPUTS; i++) {
|
||||
state->channel_data[i] = PIOS_RCVR_TIMEOUT;
|
||||
}
|
||||
@ -156,11 +159,12 @@ static void PIOS_EXBUS_ResetChannels(struct pios_exbus_dev *exbus_dev)
|
||||
static void PIOS_EXBUS_ResetState(struct pios_exbus_dev *exbus_dev)
|
||||
{
|
||||
struct pios_exbus_state *state = &(exbus_dev->state);
|
||||
state->receive_timer = 0;
|
||||
|
||||
state->receive_timer = 0;
|
||||
state->failsafe_timer = 0;
|
||||
state->failsafe_count = 0;
|
||||
state->high_baud_rate = false;
|
||||
state->frame_found = false;
|
||||
state->frame_found = false;
|
||||
PIOS_EXBUS_ResetChannels(exbus_dev);
|
||||
}
|
||||
|
||||
@ -173,26 +177,25 @@ static int PIOS_EXBUS_UnrollChannels(struct pios_exbus_dev *exbus_dev)
|
||||
{
|
||||
struct pios_exbus_state *state = &(exbus_dev->state);
|
||||
|
||||
if(state->crc != 0) {
|
||||
if (state->crc != 0) {
|
||||
/* crc failed */
|
||||
DEBUG_PRINTF(2, "Jeti CRC error!%d\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
enum pios_exbus_frame_state exbus_state = EXBUS_STATE_SYNC;
|
||||
uint8_t *byte = state->received_data;
|
||||
uint8_t *byte = state->received_data;
|
||||
uint8_t sub_length;
|
||||
uint8_t n_channels = 0;
|
||||
uint8_t channel = 0;
|
||||
uint8_t channel = 0;
|
||||
|
||||
while((byte - state->received_data) < state->frame_length) {
|
||||
switch(exbus_state) {
|
||||
while ((byte - state->received_data) < state->frame_length) {
|
||||
switch (exbus_state) {
|
||||
case EXBUS_STATE_SYNC:
|
||||
/* sync byte */
|
||||
if(*byte == EXBUS_SYNC_CHANNEL) {
|
||||
if (*byte == EXBUS_SYNC_CHANNEL) {
|
||||
exbus_state = EXBUS_STATE_REQ;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
byte += sizeof(uint8_t);
|
||||
@ -203,13 +206,11 @@ static int PIOS_EXBUS_UnrollChannels(struct pios_exbus_dev *exbus_dev)
|
||||
* tells us whether the rx is requesting a reply or not,
|
||||
* currently nothing is actually done with this information...
|
||||
*/
|
||||
if(*byte == EXBUS_BYTE_REQ) {
|
||||
if (*byte == EXBUS_BYTE_REQ) {
|
||||
exbus_state = EXBUS_STATE_LEN;
|
||||
}
|
||||
else if(*byte == EXBUS_BYTE_NOREQ) {
|
||||
} else if (*byte == EXBUS_BYTE_NOREQ) {
|
||||
exbus_state = EXBUS_STATE_LEN;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
byte += sizeof(uint8_t);
|
||||
@ -229,23 +230,22 @@ static int PIOS_EXBUS_UnrollChannels(struct pios_exbus_dev *exbus_dev)
|
||||
|
||||
case EXBUS_STATE_DATA_ID:
|
||||
/* checks the type of data, ignore non-rc data */
|
||||
if(*byte == EXBUS_DATA_CHANNEL) {
|
||||
if (*byte == EXBUS_DATA_CHANNEL) {
|
||||
exbus_state = EXBUS_STATE_SUBLEN;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
byte += sizeof(uint8_t);
|
||||
break;
|
||||
|
||||
case EXBUS_STATE_SUBLEN:
|
||||
sub_length = *byte;
|
||||
n_channels = sub_length / 2;
|
||||
sub_length = *byte;
|
||||
n_channels = sub_length / 2;
|
||||
exbus_state = EXBUS_STATE_DATA;
|
||||
byte += sizeof(uint8_t);
|
||||
break;
|
||||
case EXBUS_STATE_DATA:
|
||||
if(channel < n_channels) {
|
||||
if (channel < n_channels) {
|
||||
/* 1 lsb = 1/8 us */
|
||||
state->channel_data[channel++] = (byte[1] << 8 | byte[0]) / 8;
|
||||
}
|
||||
@ -261,23 +261,22 @@ static void PIOS_EXBUS_UpdateState(struct pios_exbus_dev *exbus_dev, uint8_t byt
|
||||
{
|
||||
struct pios_exbus_state *state = &(exbus_dev->state);
|
||||
|
||||
if(!state->frame_found) {
|
||||
if(byte == EXBUS_SYNC_CHANNEL) {
|
||||
state->frame_found = true;
|
||||
state->byte_count = 0;
|
||||
if (!state->frame_found) {
|
||||
if (byte == EXBUS_SYNC_CHANNEL) {
|
||||
state->frame_found = true;
|
||||
state->byte_count = 0;
|
||||
state->frame_length = EXBUS_MAX_FRAME_LENGTH;
|
||||
state->crc = PIOS_EXBUS_CRC_Update(0, byte);
|
||||
state->received_data[state->byte_count++] = byte;
|
||||
}
|
||||
}
|
||||
else if(state->byte_count < EXBUS_MAX_FRAME_LENGTH) {
|
||||
} else if (state->byte_count < EXBUS_MAX_FRAME_LENGTH) {
|
||||
state->crc = PIOS_EXBUS_CRC_Update(state->crc, byte);
|
||||
state->received_data[state->byte_count++] = byte;
|
||||
|
||||
if(state->byte_count == 3) {
|
||||
if (state->byte_count == 3) {
|
||||
state->frame_length = byte;
|
||||
}
|
||||
if(state->byte_count == state->frame_length) {
|
||||
if (state->byte_count == state->frame_length) {
|
||||
if (!PIOS_EXBUS_UnrollChannels(exbus_dev)) {
|
||||
/* data looking good */
|
||||
state->failsafe_timer = 0;
|
||||
@ -286,8 +285,7 @@ static void PIOS_EXBUS_UpdateState(struct pios_exbus_dev *exbus_dev, uint8_t byt
|
||||
/* get ready for the next frame */
|
||||
state->frame_found = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
state->frame_found = false;
|
||||
}
|
||||
}
|
||||
@ -303,8 +301,9 @@ int32_t PIOS_EXBUS_Init(uint32_t *exbus_id,
|
||||
struct pios_exbus_dev *exbus_dev;
|
||||
|
||||
exbus_dev = (struct pios_exbus_dev *)PIOS_EXBUS_Alloc();
|
||||
if (!exbus_dev)
|
||||
if (!exbus_dev) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
PIOS_EXBUS_ResetState(exbus_dev);
|
||||
|
||||
@ -333,6 +332,7 @@ static uint16_t PIOS_EXBUS_RxInCallback(uint32_t context,
|
||||
struct pios_exbus_dev *exbus_dev = (struct pios_exbus_dev *)context;
|
||||
|
||||
bool valid = PIOS_EXBUS_Validate(exbus_dev);
|
||||
|
||||
PIOS_Assert(valid);
|
||||
|
||||
/* process byte(s) and clear receive timer */
|
||||
@ -342,8 +342,9 @@ static uint16_t PIOS_EXBUS_RxInCallback(uint32_t context,
|
||||
}
|
||||
|
||||
/* Always signal that we can accept more data */
|
||||
if (headroom)
|
||||
if (headroom) {
|
||||
*headroom = EXBUS_MAX_FRAME_LENGTH;
|
||||
}
|
||||
|
||||
/* We never need a yield */
|
||||
*need_yield = false;
|
||||
@ -363,25 +364,29 @@ static int32_t PIOS_EXBUS_Get(uint32_t rcvr_id, uint8_t channel)
|
||||
{
|
||||
struct pios_exbus_dev *exbus_dev = (struct pios_exbus_dev *)rcvr_id;
|
||||
|
||||
if (!PIOS_EXBUS_Validate(exbus_dev))
|
||||
if (!PIOS_EXBUS_Validate(exbus_dev)) {
|
||||
return PIOS_RCVR_INVALID;
|
||||
}
|
||||
|
||||
/* return error if channel is not available */
|
||||
if (channel >= PIOS_EXBUS_NUM_INPUTS)
|
||||
if (channel >= PIOS_EXBUS_NUM_INPUTS) {
|
||||
return PIOS_RCVR_INVALID;
|
||||
}
|
||||
|
||||
/* may also be PIOS_RCVR_TIMEOUT set by other function */
|
||||
return exbus_dev->state.channel_data[channel];
|
||||
}
|
||||
|
||||
static void PIOS_EXBUS_Change_BaudRate(struct pios_exbus_dev *device) {
|
||||
static void PIOS_EXBUS_Change_BaudRate(struct pios_exbus_dev *device)
|
||||
{
|
||||
struct pios_exbus_state *state = &(device->state);
|
||||
if (++state->failsafe_count >= EXBUS_BAUD_RATE_LIMIT) {
|
||||
state->high_baud_rate = !state->high_baud_rate;
|
||||
(device->driver->set_baud) (device->com_port_id,
|
||||
state->high_baud_rate ? EXBUS_HIGH_BAUD_RATE : EXBUS_LOW_BAUD_RATE);
|
||||
state->failsafe_count = 0;
|
||||
}
|
||||
|
||||
if (++state->failsafe_count >= EXBUS_BAUD_RATE_LIMIT) {
|
||||
state->high_baud_rate = !state->high_baud_rate;
|
||||
(device->driver->set_baud)(device->com_port_id,
|
||||
state->high_baud_rate ? EXBUS_HIGH_BAUD_RATE : EXBUS_LOW_BAUD_RATE);
|
||||
state->failsafe_count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -401,16 +406,17 @@ static void PIOS_EXBUS_Supervisor(uint32_t exbus_id)
|
||||
struct pios_exbus_dev *exbus_dev = (struct pios_exbus_dev *)exbus_id;
|
||||
|
||||
bool valid = PIOS_EXBUS_Validate(exbus_dev);
|
||||
|
||||
PIOS_Assert(valid);
|
||||
|
||||
struct pios_exbus_state *state = &(exbus_dev->state);
|
||||
|
||||
/* waiting for new frame if no bytes were received in 8ms */
|
||||
if (++state->receive_timer > 4) {
|
||||
state->frame_found = false;
|
||||
state->byte_count = 0;
|
||||
state->frame_found = false;
|
||||
state->byte_count = 0;
|
||||
state->receive_timer = 0;
|
||||
state->frame_length = EXBUS_MAX_FRAME_LENGTH;
|
||||
state->frame_length = EXBUS_MAX_FRAME_LENGTH;
|
||||
}
|
||||
|
||||
/* activate failsafe if no frames have arrived in 102.4ms */
|
||||
@ -425,13 +431,13 @@ static uint16_t PIOS_EXBUS_CRC_Update(uint16_t crc, uint8_t data)
|
||||
{
|
||||
data ^= (uint8_t)crc & (uint8_t)0xFF;
|
||||
data ^= data << 4;
|
||||
crc = ((((uint16_t)data << 8) | ((crc & 0xFF00) >> 8))
|
||||
^ (uint8_t)(data >> 4) ^ ((uint16_t)data << 3));
|
||||
crc = ((((uint16_t)data << 8) | ((crc & 0xFF00) >> 8))
|
||||
^ (uint8_t)(data >> 4) ^ ((uint16_t)data << 3));
|
||||
|
||||
return crc;
|
||||
}
|
||||
|
||||
#endif /* PIOS_INCLUDE_EXBUS */
|
||||
#endif /* PIOS_INCLUDE_EXBUS */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -77,105 +77,107 @@
|
||||
*/
|
||||
|
||||
/* HOTT frame size and contents definitions */
|
||||
#define HOTT_HEADER_LENGTH 3
|
||||
#define HOTT_CRC_LENGTH 2
|
||||
#define HOTT_HEADER_LENGTH 3
|
||||
#define HOTT_CRC_LENGTH 2
|
||||
#define HOTT_MAX_CHANNELS_PER_FRAME 32
|
||||
#define HOTT_OVERHEAD_LENGTH (HOTT_HEADER_LENGTH+HOTT_CRC_LENGTH)
|
||||
#define HOTT_MAX_FRAME_LENGTH (HOTT_MAX_CHANNELS_PER_FRAME*2+HOTT_OVERHEAD_LENGTH)
|
||||
#define HOTT_OVERHEAD_LENGTH (HOTT_HEADER_LENGTH + HOTT_CRC_LENGTH)
|
||||
#define HOTT_MAX_FRAME_LENGTH (HOTT_MAX_CHANNELS_PER_FRAME * 2 + HOTT_OVERHEAD_LENGTH)
|
||||
|
||||
#define HOTT_GRAUPNER_ID 0xA8
|
||||
#define HOTT_STATUS_LIVING_SUMH 0x00
|
||||
#define HOTT_STATUS_LIVING_SUMD 0x01
|
||||
#define HOTT_STATUS_FAILSAFE 0x81
|
||||
#define HOTT_GRAUPNER_ID 0xA8
|
||||
#define HOTT_STATUS_LIVING_SUMH 0x00
|
||||
#define HOTT_STATUS_LIVING_SUMD 0x01
|
||||
#define HOTT_STATUS_FAILSAFE 0x81
|
||||
|
||||
/* Forward Declarations */
|
||||
static int32_t PIOS_HOTT_Get(uint32_t rcvr_id, uint8_t channel);
|
||||
static uint16_t PIOS_HOTT_RxInCallback(uint32_t context,
|
||||
uint8_t *buf,
|
||||
uint16_t buf_len,
|
||||
uint16_t *headroom,
|
||||
bool *need_yield);
|
||||
uint8_t *buf,
|
||||
uint16_t buf_len,
|
||||
uint16_t *headroom,
|
||||
bool *need_yield);
|
||||
static void PIOS_HOTT_Supervisor(uint32_t hott_id);
|
||||
|
||||
/* Local Variables */
|
||||
const struct pios_rcvr_driver pios_hott_rcvr_driver = {
|
||||
.read = PIOS_HOTT_Get,
|
||||
.read = PIOS_HOTT_Get,
|
||||
};
|
||||
|
||||
enum pios_hott_dev_magic {
|
||||
PIOS_HOTT_DEV_MAGIC = 0x4853554D,
|
||||
PIOS_HOTT_DEV_MAGIC = 0x4853554D,
|
||||
};
|
||||
|
||||
struct pios_hott_state {
|
||||
uint16_t channel_data[PIOS_HOTT_NUM_INPUTS];
|
||||
uint8_t received_data[HOTT_MAX_FRAME_LENGTH];
|
||||
uint8_t receive_timer;
|
||||
uint8_t failsafe_timer;
|
||||
uint8_t frame_found;
|
||||
uint8_t tx_connected;
|
||||
uint8_t byte_count;
|
||||
uint8_t frame_length;
|
||||
uint16_t channel_data[PIOS_HOTT_NUM_INPUTS];
|
||||
uint8_t received_data[HOTT_MAX_FRAME_LENGTH];
|
||||
uint8_t receive_timer;
|
||||
uint8_t failsafe_timer;
|
||||
uint8_t frame_found;
|
||||
uint8_t tx_connected;
|
||||
uint8_t byte_count;
|
||||
uint8_t frame_length;
|
||||
};
|
||||
|
||||
struct pios_hott_dev {
|
||||
enum pios_hott_dev_magic magic;
|
||||
const struct pios_hott_cfg *cfg;
|
||||
enum pios_hott_proto proto;
|
||||
struct pios_hott_state state;
|
||||
enum pios_hott_dev_magic magic;
|
||||
const struct pios_hott_cfg *cfg;
|
||||
enum pios_hott_proto proto;
|
||||
struct pios_hott_state state;
|
||||
};
|
||||
|
||||
/* Allocate HOTT device descriptor */
|
||||
#if defined(PIOS_INCLUDE_FREERTOS)
|
||||
static struct pios_hott_dev *PIOS_HOTT_Alloc(void)
|
||||
{
|
||||
struct pios_hott_dev *hott_dev;
|
||||
struct pios_hott_dev *hott_dev;
|
||||
|
||||
hott_dev = (struct pios_hott_dev *)pios_malloc(sizeof(*hott_dev));
|
||||
if (!hott_dev)
|
||||
return NULL;
|
||||
hott_dev = (struct pios_hott_dev *)pios_malloc(sizeof(*hott_dev));
|
||||
if (!hott_dev) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hott_dev->magic = PIOS_HOTT_DEV_MAGIC;
|
||||
return hott_dev;
|
||||
hott_dev->magic = PIOS_HOTT_DEV_MAGIC;
|
||||
return hott_dev;
|
||||
}
|
||||
#else
|
||||
static struct pios_hott_dev pios_hott_devs[PIOS_HOTT_MAX_DEVS];
|
||||
static uint8_t pios_hott_num_devs;
|
||||
static struct pios_hott_dev *PIOS_HOTT_Alloc(void)
|
||||
{
|
||||
struct pios_hott_dev *hott_dev;
|
||||
struct pios_hott_dev *hott_dev;
|
||||
|
||||
if (pios_hott_num_devs >= PIOS_HOTT_MAX_DEVS)
|
||||
return NULL;
|
||||
if (pios_hott_num_devs >= PIOS_HOTT_MAX_DEVS) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hott_dev = &pios_hott_devs[pios_hott_num_devs++];
|
||||
hott_dev->magic = PIOS_HOTT_DEV_MAGIC;
|
||||
hott_dev = &pios_hott_devs[pios_hott_num_devs++];
|
||||
hott_dev->magic = PIOS_HOTT_DEV_MAGIC;
|
||||
|
||||
return hott_dev;
|
||||
return hott_dev;
|
||||
}
|
||||
#endif
|
||||
#endif /* if defined(PIOS_INCLUDE_FREERTOS) */
|
||||
|
||||
/* Validate HOTT device descriptor */
|
||||
static bool PIOS_HOTT_Validate(struct pios_hott_dev *hott_dev)
|
||||
{
|
||||
return (hott_dev->magic == PIOS_HOTT_DEV_MAGIC);
|
||||
return hott_dev->magic == PIOS_HOTT_DEV_MAGIC;
|
||||
}
|
||||
|
||||
/* Reset channels in case of lost signal or explicit failsafe receiver flag */
|
||||
static void PIOS_HOTT_ResetChannels(struct pios_hott_state *state)
|
||||
{
|
||||
for (int i = 0; i < PIOS_HOTT_NUM_INPUTS; i++) {
|
||||
state->channel_data[i] = PIOS_RCVR_TIMEOUT;
|
||||
}
|
||||
for (int i = 0; i < PIOS_HOTT_NUM_INPUTS; i++) {
|
||||
state->channel_data[i] = PIOS_RCVR_TIMEOUT;
|
||||
}
|
||||
}
|
||||
|
||||
/* Reset HOTT receiver state */
|
||||
static void PIOS_HOTT_ResetState(struct pios_hott_state *state)
|
||||
{
|
||||
state->receive_timer = 0;
|
||||
state->failsafe_timer = 0;
|
||||
state->frame_found = 0;
|
||||
state->tx_connected = 0;
|
||||
PIOS_HOTT_ResetChannels(state);
|
||||
state->receive_timer = 0;
|
||||
state->failsafe_timer = 0;
|
||||
state->frame_found = 0;
|
||||
state->tx_connected = 0;
|
||||
PIOS_HOTT_ResetChannels(state);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -185,142 +187,152 @@ static void PIOS_HOTT_ResetState(struct pios_hott_state *state)
|
||||
*/
|
||||
static int PIOS_HOTT_UnrollChannels(struct pios_hott_dev *hott_dev)
|
||||
{
|
||||
struct pios_hott_state *state = &(hott_dev->state);
|
||||
struct pios_hott_state *state = &(hott_dev->state);
|
||||
|
||||
/* check the header and crc for a valid HoTT SUM stream */
|
||||
uint8_t vendor = state->received_data[0];
|
||||
uint8_t status = state->received_data[1];
|
||||
if (vendor != HOTT_GRAUPNER_ID)
|
||||
/* Graupner ID was expected */
|
||||
goto stream_error;
|
||||
/* check the header and crc for a valid HoTT SUM stream */
|
||||
uint8_t vendor = state->received_data[0];
|
||||
uint8_t status = state->received_data[1];
|
||||
|
||||
switch (status) {
|
||||
case HOTT_STATUS_LIVING_SUMH:
|
||||
case HOTT_STATUS_LIVING_SUMD:
|
||||
case HOTT_STATUS_FAILSAFE:
|
||||
/* check crc before processing */
|
||||
if (hott_dev->proto == PIOS_HOTT_PROTO_SUMD) {
|
||||
/* SUMD has 16 bit CCITT CRC */
|
||||
uint16_t crc = 0;
|
||||
uint8_t *s = &(state->received_data[0]);
|
||||
int len = state->byte_count - 2;
|
||||
for (int n = 0; n < len; n++) {
|
||||
crc ^= (uint16_t)s[n] << 8;
|
||||
for (int i = 0; i < 8; i++)
|
||||
crc = (crc & 0x8000) ? (crc << 1) ^ 0x1021 : (crc << 1);
|
||||
}
|
||||
if (crc ^ (((uint16_t)s[len] << 8) | s[len + 1]))
|
||||
/* wrong crc checksum found */
|
||||
goto stream_error;
|
||||
}
|
||||
if (hott_dev->proto == PIOS_HOTT_PROTO_SUMH) {
|
||||
/* SUMH has only 8 bit added CRC */
|
||||
uint8_t crc = 0;
|
||||
uint8_t *s = &(state->received_data[0]);
|
||||
int len = state->byte_count - 1;
|
||||
for (int n = 0; n < len; n++)
|
||||
crc += s[n];
|
||||
if (crc ^ s[len])
|
||||
/* wrong crc checksum found */
|
||||
goto stream_error;
|
||||
}
|
||||
/* check for a living connect */
|
||||
state->tx_connected |= (status != HOTT_STATUS_FAILSAFE);
|
||||
break;
|
||||
default:
|
||||
/* wrong header format */
|
||||
goto stream_error;
|
||||
}
|
||||
if (vendor != HOTT_GRAUPNER_ID) {
|
||||
/* Graupner ID was expected */
|
||||
goto stream_error;
|
||||
}
|
||||
|
||||
/* check initial connection since reset or timeout */
|
||||
if (!(state->tx_connected)) {
|
||||
/* these are failsafe data without a first connect. ignore it */
|
||||
PIOS_HOTT_ResetChannels(state);
|
||||
return 0;
|
||||
}
|
||||
switch (status) {
|
||||
case HOTT_STATUS_LIVING_SUMH:
|
||||
case HOTT_STATUS_LIVING_SUMD:
|
||||
case HOTT_STATUS_FAILSAFE:
|
||||
/* check crc before processing */
|
||||
if (hott_dev->proto == PIOS_HOTT_PROTO_SUMD) {
|
||||
/* SUMD has 16 bit CCITT CRC */
|
||||
uint16_t crc = 0;
|
||||
uint8_t *s = &(state->received_data[0]);
|
||||
int len = state->byte_count - 2;
|
||||
for (int n = 0; n < len; n++) {
|
||||
crc ^= (uint16_t)s[n] << 8;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
crc = (crc & 0x8000) ? (crc << 1) ^ 0x1021 : (crc << 1);
|
||||
}
|
||||
}
|
||||
if (crc ^ (((uint16_t)s[len] << 8) | s[len + 1])) {
|
||||
/* wrong crc checksum found */
|
||||
goto stream_error;
|
||||
}
|
||||
}
|
||||
if (hott_dev->proto == PIOS_HOTT_PROTO_SUMH) {
|
||||
/* SUMH has only 8 bit added CRC */
|
||||
uint8_t crc = 0;
|
||||
uint8_t *s = &(state->received_data[0]);
|
||||
int len = state->byte_count - 1;
|
||||
for (int n = 0; n < len; n++) {
|
||||
crc += s[n];
|
||||
}
|
||||
if (crc ^ s[len]) {
|
||||
/* wrong crc checksum found */
|
||||
goto stream_error;
|
||||
}
|
||||
}
|
||||
/* check for a living connect */
|
||||
state->tx_connected |= (status != HOTT_STATUS_FAILSAFE);
|
||||
break;
|
||||
default:
|
||||
/* wrong header format */
|
||||
goto stream_error;
|
||||
}
|
||||
|
||||
/* unroll channels */
|
||||
uint8_t n_channels = state->received_data[2];
|
||||
uint8_t *s = &(state->received_data[3]);
|
||||
uint16_t word;
|
||||
/* check initial connection since reset or timeout */
|
||||
if (!(state->tx_connected)) {
|
||||
/* these are failsafe data without a first connect. ignore it */
|
||||
PIOS_HOTT_ResetChannels(state);
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < HOTT_MAX_CHANNELS_PER_FRAME; i++) {
|
||||
if (i < n_channels) {
|
||||
word = ((uint16_t)s[0] << 8) | s[1];
|
||||
s += sizeof(uint16_t);
|
||||
/* save the channel value */
|
||||
if (i < PIOS_HOTT_NUM_INPUTS) {
|
||||
/* floating version. channel limits from -100..+100% are mapped to 1000..2000 */
|
||||
state->channel_data[i] = (uint16_t)(word / 6.4f - 375);
|
||||
}
|
||||
} else
|
||||
/* this channel was not received */
|
||||
state->channel_data[i] = PIOS_RCVR_INVALID;
|
||||
}
|
||||
/* unroll channels */
|
||||
uint8_t n_channels = state->received_data[2];
|
||||
uint8_t *s = &(state->received_data[3]);
|
||||
uint16_t word;
|
||||
|
||||
/* all channels processed */
|
||||
return 0;
|
||||
for (int i = 0; i < HOTT_MAX_CHANNELS_PER_FRAME; i++) {
|
||||
if (i < n_channels) {
|
||||
word = ((uint16_t)s[0] << 8) | s[1];
|
||||
s += sizeof(uint16_t);
|
||||
/* save the channel value */
|
||||
if (i < PIOS_HOTT_NUM_INPUTS) {
|
||||
/* floating version. channel limits from -100..+100% are mapped to 1000..2000 */
|
||||
state->channel_data[i] = (uint16_t)(word / 6.4f - 375);
|
||||
}
|
||||
} else {
|
||||
/* this channel was not received */
|
||||
state->channel_data[i] = PIOS_RCVR_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
/* all channels processed */
|
||||
return 0;
|
||||
|
||||
stream_error:
|
||||
/* either SUMD selected with SUMH stream found, or vice-versa */
|
||||
return -1;
|
||||
/* either SUMD selected with SUMH stream found, or vice-versa */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Update decoder state processing input byte from the HoTT stream */
|
||||
static void PIOS_HOTT_UpdateState(struct pios_hott_dev *hott_dev, uint8_t byte)
|
||||
{
|
||||
struct pios_hott_state *state = &(hott_dev->state);
|
||||
if (state->frame_found) {
|
||||
/* receiving the data frame */
|
||||
if (state->byte_count < HOTT_MAX_FRAME_LENGTH) {
|
||||
/* store next byte */
|
||||
state->received_data[state->byte_count++] = byte;
|
||||
if (state->byte_count == HOTT_HEADER_LENGTH) {
|
||||
/* 3rd byte contains the number of channels. calculate frame size */
|
||||
state->frame_length = HOTT_OVERHEAD_LENGTH + 2 * byte;
|
||||
}
|
||||
if (state->byte_count == state->frame_length) {
|
||||
/* full frame received - process and wait for new one */
|
||||
if (!PIOS_HOTT_UnrollChannels(hott_dev))
|
||||
/* data looking good */
|
||||
state->failsafe_timer = 0;
|
||||
/* prepare for the next frame */
|
||||
state->frame_found = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
struct pios_hott_state *state = &(hott_dev->state);
|
||||
|
||||
if (state->frame_found) {
|
||||
/* receiving the data frame */
|
||||
if (state->byte_count < HOTT_MAX_FRAME_LENGTH) {
|
||||
/* store next byte */
|
||||
state->received_data[state->byte_count++] = byte;
|
||||
if (state->byte_count == HOTT_HEADER_LENGTH) {
|
||||
/* 3rd byte contains the number of channels. calculate frame size */
|
||||
state->frame_length = HOTT_OVERHEAD_LENGTH + 2 * byte;
|
||||
}
|
||||
if (state->byte_count == state->frame_length) {
|
||||
/* full frame received - process and wait for new one */
|
||||
if (!PIOS_HOTT_UnrollChannels(hott_dev)) {
|
||||
/* data looking good */
|
||||
state->failsafe_timer = 0;
|
||||
}
|
||||
/* prepare for the next frame */
|
||||
state->frame_found = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialise HoTT receiver interface */
|
||||
int32_t PIOS_HOTT_Init(uint32_t *hott_id,
|
||||
const struct pios_com_driver *driver,
|
||||
uint32_t lower_id,
|
||||
uint32_t lower_id,
|
||||
enum pios_hott_proto proto)
|
||||
{
|
||||
PIOS_DEBUG_Assert(hott_id);
|
||||
PIOS_DEBUG_Assert(driver);
|
||||
PIOS_DEBUG_Assert(hott_id);
|
||||
PIOS_DEBUG_Assert(driver);
|
||||
|
||||
struct pios_hott_dev *hott_dev;
|
||||
struct pios_hott_dev *hott_dev;
|
||||
|
||||
hott_dev = (struct pios_hott_dev *)PIOS_HOTT_Alloc();
|
||||
if (!hott_dev)
|
||||
return -1;
|
||||
hott_dev = (struct pios_hott_dev *)PIOS_HOTT_Alloc();
|
||||
if (!hott_dev) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Bind the configuration to the device instance */
|
||||
hott_dev->proto = proto;
|
||||
/* Bind the configuration to the device instance */
|
||||
hott_dev->proto = proto;
|
||||
|
||||
PIOS_HOTT_ResetState(&(hott_dev->state));
|
||||
PIOS_HOTT_ResetState(&(hott_dev->state));
|
||||
|
||||
*hott_id = (uint32_t)hott_dev;
|
||||
*hott_id = (uint32_t)hott_dev;
|
||||
|
||||
/* Set comm driver callback */
|
||||
(driver->bind_rx_cb)(lower_id, PIOS_HOTT_RxInCallback, *hott_id);
|
||||
/* Set comm driver callback */
|
||||
(driver->bind_rx_cb)(lower_id, PIOS_HOTT_RxInCallback, *hott_id);
|
||||
|
||||
if (!PIOS_RTC_RegisterTickCallback(PIOS_HOTT_Supervisor, *hott_id)) {
|
||||
PIOS_DEBUG_Assert(0);
|
||||
}
|
||||
if (!PIOS_RTC_RegisterTickCallback(PIOS_HOTT_Supervisor, *hott_id)) {
|
||||
PIOS_DEBUG_Assert(0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Comm byte received callback */
|
||||
@ -330,26 +342,28 @@ static uint16_t PIOS_HOTT_RxInCallback(uint32_t context,
|
||||
uint16_t *headroom,
|
||||
bool *need_yield)
|
||||
{
|
||||
struct pios_hott_dev *hott_dev = (struct pios_hott_dev *)context;
|
||||
struct pios_hott_dev *hott_dev = (struct pios_hott_dev *)context;
|
||||
|
||||
bool valid = PIOS_HOTT_Validate(hott_dev);
|
||||
PIOS_Assert(valid);
|
||||
bool valid = PIOS_HOTT_Validate(hott_dev);
|
||||
|
||||
/* process byte(s) and clear receive timer */
|
||||
for (uint8_t i = 0; i < buf_len; i++) {
|
||||
PIOS_HOTT_UpdateState(hott_dev, buf[i]);
|
||||
hott_dev->state.receive_timer = 0;
|
||||
}
|
||||
PIOS_Assert(valid);
|
||||
|
||||
/* Always signal that we can accept more data */
|
||||
if (headroom)
|
||||
*headroom = HOTT_MAX_FRAME_LENGTH;
|
||||
/* process byte(s) and clear receive timer */
|
||||
for (uint8_t i = 0; i < buf_len; i++) {
|
||||
PIOS_HOTT_UpdateState(hott_dev, buf[i]);
|
||||
hott_dev->state.receive_timer = 0;
|
||||
}
|
||||
|
||||
/* We never need a yield */
|
||||
*need_yield = false;
|
||||
/* Always signal that we can accept more data */
|
||||
if (headroom) {
|
||||
*headroom = HOTT_MAX_FRAME_LENGTH;
|
||||
}
|
||||
|
||||
/* Always indicate that all bytes were consumed */
|
||||
return buf_len;
|
||||
/* We never need a yield */
|
||||
*need_yield = false;
|
||||
|
||||
/* Always indicate that all bytes were consumed */
|
||||
return buf_len;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -361,17 +375,19 @@ static uint16_t PIOS_HOTT_RxInCallback(uint32_t context,
|
||||
*/
|
||||
static int32_t PIOS_HOTT_Get(uint32_t rcvr_id, uint8_t channel)
|
||||
{
|
||||
struct pios_hott_dev *hott_dev = (struct pios_hott_dev *)rcvr_id;
|
||||
struct pios_hott_dev *hott_dev = (struct pios_hott_dev *)rcvr_id;
|
||||
|
||||
if (!PIOS_HOTT_Validate(hott_dev))
|
||||
return PIOS_RCVR_INVALID;
|
||||
if (!PIOS_HOTT_Validate(hott_dev)) {
|
||||
return PIOS_RCVR_INVALID;
|
||||
}
|
||||
|
||||
/* return error if channel is not available */
|
||||
if (channel >= PIOS_HOTT_NUM_INPUTS)
|
||||
return PIOS_RCVR_INVALID;
|
||||
/* return error if channel is not available */
|
||||
if (channel >= PIOS_HOTT_NUM_INPUTS) {
|
||||
return PIOS_RCVR_INVALID;
|
||||
}
|
||||
|
||||
/* may also be PIOS_RCVR_TIMEOUT set by other function */
|
||||
return hott_dev->state.channel_data[channel];
|
||||
/* may also be PIOS_RCVR_TIMEOUT set by other function */
|
||||
return hott_dev->state.channel_data[channel];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -388,30 +404,31 @@ static int32_t PIOS_HOTT_Get(uint32_t rcvr_id, uint8_t channel)
|
||||
*/
|
||||
static void PIOS_HOTT_Supervisor(uint32_t hott_id)
|
||||
{
|
||||
struct pios_hott_dev *hott_dev = (struct pios_hott_dev *)hott_id;
|
||||
struct pios_hott_dev *hott_dev = (struct pios_hott_dev *)hott_id;
|
||||
|
||||
bool valid = PIOS_HOTT_Validate(hott_dev);
|
||||
PIOS_Assert(valid);
|
||||
bool valid = PIOS_HOTT_Validate(hott_dev);
|
||||
|
||||
struct pios_hott_state *state = &(hott_dev->state);
|
||||
PIOS_Assert(valid);
|
||||
|
||||
/* waiting for new frame if no bytes were received in 8ms */
|
||||
if (++state->receive_timer > 4) {
|
||||
state->frame_found = 1;
|
||||
state->byte_count = 0;
|
||||
state->receive_timer = 0;
|
||||
state->frame_length = HOTT_MAX_FRAME_LENGTH;
|
||||
}
|
||||
struct pios_hott_state *state = &(hott_dev->state);
|
||||
|
||||
/* activate failsafe if no frames have arrived in 102.4ms */
|
||||
if (++state->failsafe_timer > 64) {
|
||||
PIOS_HOTT_ResetChannels(state);
|
||||
state->failsafe_timer = 0;
|
||||
state->tx_connected = 0;
|
||||
}
|
||||
/* waiting for new frame if no bytes were received in 8ms */
|
||||
if (++state->receive_timer > 4) {
|
||||
state->frame_found = 1;
|
||||
state->byte_count = 0;
|
||||
state->receive_timer = 0;
|
||||
state->frame_length = HOTT_MAX_FRAME_LENGTH;
|
||||
}
|
||||
|
||||
/* activate failsafe if no frames have arrived in 102.4ms */
|
||||
if (++state->failsafe_timer > 64) {
|
||||
PIOS_HOTT_ResetChannels(state);
|
||||
state->failsafe_timer = 0;
|
||||
state->tx_connected = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* PIOS_INCLUDE_HOTT */
|
||||
#endif /* PIOS_INCLUDE_HOTT */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -1,9 +1,5 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup PIOS PIOS Core hardware abstraction layer
|
||||
* @{
|
||||
* @addtogroup PIOS_SBus Futaba S.Bus receiver functions
|
||||
* @{
|
||||
*
|
||||
* @file pios_sbus.h
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
|
@ -36,8 +36,8 @@
|
||||
extern const struct pios_rcvr_driver pios_exbus_rcvr_driver;
|
||||
|
||||
extern int32_t PIOS_EXBUS_Init(uint32_t *exbus_id,
|
||||
const struct pios_com_driver *driver,
|
||||
uint32_t lower_id);
|
||||
const struct pios_com_driver *driver,
|
||||
uint32_t lower_id);
|
||||
|
||||
#endif /* PIOS_EXBUS_PRIV_H */
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
******************************************************************************
|
||||
* @file pios_hott.h
|
||||
* @author The LibrePilot Project, http://www.librepilot.org, Copyright (c) 2015
|
||||
* @author Tau Labs, http://taulabs.org, Copyright (C) 2013
|
||||
* Tau Labs, http://taulabs.org, Copyright (C) 2013
|
||||
* @addtogroup PIOS PIOS Core hardware abstraction layer
|
||||
* @{
|
||||
* @addtogroup PIOS_HOTT Graupner HoTT receiver functions
|
||||
|
@ -33,17 +33,17 @@
|
||||
|
||||
/* HOTT protocol variations */
|
||||
enum pios_hott_proto {
|
||||
PIOS_HOTT_PROTO_SUMD,
|
||||
PIOS_HOTT_PROTO_SUMH,
|
||||
PIOS_HOTT_PROTO_SUMD,
|
||||
PIOS_HOTT_PROTO_SUMH,
|
||||
};
|
||||
|
||||
/* HOTT receiver instance configuration */
|
||||
extern const struct pios_rcvr_driver pios_hott_rcvr_driver;
|
||||
|
||||
extern int32_t PIOS_HOTT_Init(uint32_t *hott_id,
|
||||
const struct pios_com_driver *driver,
|
||||
uint32_t lower_id,
|
||||
enum pios_hott_proto proto);
|
||||
const struct pios_com_driver *driver,
|
||||
uint32_t lower_id,
|
||||
enum pios_hott_proto proto);
|
||||
|
||||
#endif /* PIOS_HOTT_PRIV_H */
|
||||
|
||||
|
@ -233,6 +233,10 @@ extern "C" {
|
||||
#include <pios_hott.h>
|
||||
#endif
|
||||
|
||||
#ifdef PIOS_INCLUDE_EXBUS
|
||||
#include <pios_exbus.h>
|
||||
#endif
|
||||
|
||||
#ifdef PIOS_INCLUDE_SRXL
|
||||
#include <pios_srxl.h>
|
||||
#endif
|
||||
|
@ -686,7 +686,7 @@ void PIOS_Board_Init(void)
|
||||
|
||||
uint32_t pios_hott_id;
|
||||
if (PIOS_HOTT_Init(&pios_hott_id, &pios_usart_com_driver, pios_usart_hott_id,
|
||||
hwsettings_cc_flexiport == HWSETTINGS_CC_FLEXIPORT_HOTTSUMD ? PIOS_HOTT_PROTO_SUMD : PIOS_HOTT_PROTO_SUMH)) {
|
||||
hwsettings_cc_flexiport == HWSETTINGS_CC_FLEXIPORT_HOTTSUMD ? PIOS_HOTT_PROTO_SUMD : PIOS_HOTT_PROTO_SUMH)) {
|
||||
PIOS_Assert(0);
|
||||
}
|
||||
|
||||
@ -698,7 +698,7 @@ void PIOS_Board_Init(void)
|
||||
}
|
||||
#endif /* PIOS_INCLUDE_HOTT */
|
||||
break;
|
||||
|
||||
|
||||
case HWSETTINGS_CC_FLEXIPORT_EXBUS:
|
||||
#if defined(PIOS_INCLUDE_EXBUS)
|
||||
{
|
||||
|
@ -248,17 +248,17 @@ extern uint32_t pios_com_hkosd_id;
|
||||
#define PIOS_SBUS_MAX_DEVS 1
|
||||
#define PIOS_SBUS_NUM_INPUTS (16 + 2)
|
||||
|
||||
//-------------------------
|
||||
// -------------------------
|
||||
// Receiver HSUM input
|
||||
//-------------------------
|
||||
#define PIOS_HOTT_MAX_DEVS 1
|
||||
#define PIOS_HOTT_NUM_INPUTS 32
|
||||
// -------------------------
|
||||
#define PIOS_HOTT_MAX_DEVS 1
|
||||
#define PIOS_HOTT_NUM_INPUTS 32
|
||||
|
||||
// -------------------------
|
||||
// Receiver EX.Bus input
|
||||
// -------------------------
|
||||
#define PIOS_EXBUS_MAX_DEVS 1
|
||||
#define PIOS_EXBUS_NUM_INPUTS 16
|
||||
#define PIOS_EXBUS_MAX_DEVS 1
|
||||
#define PIOS_EXBUS_NUM_INPUTS 16
|
||||
|
||||
// -------------------------
|
||||
// Receiver Multiplex SRXL input
|
||||
|
@ -548,7 +548,7 @@ void PIOS_Board_Init(void)
|
||||
case HWSETTINGS_RM_FLEXIPORT_OSDHK:
|
||||
PIOS_Board_configure_com(&pios_usart_hkosd_flexi_cfg, PIOS_COM_HKOSD_RX_BUF_LEN, PIOS_COM_HKOSD_TX_BUF_LEN, &pios_usart_com_driver, &pios_com_hkosd_id);
|
||||
break;
|
||||
|
||||
|
||||
case HWSETTINGS_RM_FLEXIPORT_SRXL:
|
||||
#if defined(PIOS_INCLUDE_SRXL)
|
||||
{
|
||||
@ -582,7 +582,7 @@ void PIOS_Board_Init(void)
|
||||
|
||||
uint32_t pios_hott_id;
|
||||
if (PIOS_HOTT_Init(&pios_hott_id, &pios_usart_com_driver, pios_usart_hott_id,
|
||||
hwsettings_flexiport == HWSETTINGS_RM_FLEXIPORT_HOTTSUMD ? PIOS_HOTT_PROTO_SUMD : PIOS_HOTT_PROTO_SUMH)) {
|
||||
hwsettings_flexiport == HWSETTINGS_RM_FLEXIPORT_HOTTSUMD ? PIOS_HOTT_PROTO_SUMD : PIOS_HOTT_PROTO_SUMH)) {
|
||||
PIOS_Assert(0);
|
||||
}
|
||||
|
||||
@ -616,7 +616,6 @@ void PIOS_Board_Init(void)
|
||||
}
|
||||
#endif /* PIOS_INCLUDE_EXBUS */
|
||||
break;
|
||||
|
||||
} /* hwsettings_rm_flexiport */
|
||||
|
||||
/* Moved this here to allow binding on flexiport */
|
||||
|
@ -258,17 +258,17 @@ extern uint32_t pios_packet_handler;
|
||||
#define PIOS_SBUS_MAX_DEVS 1
|
||||
#define PIOS_SBUS_NUM_INPUTS (16 + 2)
|
||||
|
||||
//-------------------------
|
||||
// -------------------------
|
||||
// Receiver HSUM input
|
||||
//-------------------------
|
||||
#define PIOS_HOTT_MAX_DEVS 1
|
||||
#define PIOS_HOTT_NUM_INPUTS 32
|
||||
// -------------------------
|
||||
#define PIOS_HOTT_MAX_DEVS 1
|
||||
#define PIOS_HOTT_NUM_INPUTS 32
|
||||
|
||||
// -------------------------
|
||||
// Receiver EX.Bus input
|
||||
// -------------------------
|
||||
#define PIOS_EXBUS_MAX_DEVS 1
|
||||
#define PIOS_EXBUS_NUM_INPUTS 16
|
||||
#define PIOS_EXBUS_MAX_DEVS 1
|
||||
#define PIOS_EXBUS_NUM_INPUTS 16
|
||||
|
||||
// -------------------------
|
||||
// Receiver Multiplex SRXL input
|
||||
|
@ -727,7 +727,7 @@ void PIOS_Board_Init(void)
|
||||
|
||||
uint32_t pios_hott_id;
|
||||
if (PIOS_HOTT_Init(&pios_hott_id, &pios_usart_com_driver, pios_usart_hott_id,
|
||||
hwsettings_flexiport == HWSETTINGS_RM_FLEXIPORT_HOTTSUMD ? PIOS_HOTT_PROTO_SUMD : PIOS_HOTT_PROTO_SUMH)) {
|
||||
hwsettings_flexiport == HWSETTINGS_RM_FLEXIPORT_HOTTSUMD ? PIOS_HOTT_PROTO_SUMD : PIOS_HOTT_PROTO_SUMH)) {
|
||||
PIOS_Assert(0);
|
||||
}
|
||||
|
||||
@ -761,7 +761,6 @@ void PIOS_Board_Init(void)
|
||||
}
|
||||
#endif /* PIOS_INCLUDE_EXBUS */
|
||||
break;
|
||||
|
||||
} /* hwsettings_rm_flexiport */
|
||||
|
||||
|
||||
|
@ -258,17 +258,17 @@ extern uint32_t pios_packet_handler;
|
||||
#define PIOS_SBUS_MAX_DEVS 1
|
||||
#define PIOS_SBUS_NUM_INPUTS (16 + 2)
|
||||
|
||||
//-------------------------
|
||||
// -------------------------
|
||||
// Receiver HSUM input
|
||||
//-------------------------
|
||||
#define PIOS_HOTT_MAX_DEVS 1
|
||||
#define PIOS_HOTT_NUM_INPUTS 32
|
||||
// -------------------------
|
||||
#define PIOS_HOTT_MAX_DEVS 1
|
||||
#define PIOS_HOTT_NUM_INPUTS 32
|
||||
|
||||
// -------------------------
|
||||
// Receiver EX.Bus input
|
||||
// -------------------------
|
||||
#define PIOS_EXBUS_MAX_DEVS 1
|
||||
#define PIOS_EXBUS_NUM_INPUTS 16
|
||||
#define PIOS_EXBUS_MAX_DEVS 1
|
||||
#define PIOS_EXBUS_NUM_INPUTS 16
|
||||
|
||||
// -------------------------
|
||||
// Receiver Multiplex SRXL input
|
||||
|
Loading…
x
Reference in New Issue
Block a user