mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-20 14:55:21 +03:00
Cleaned up RX initialisation. Updated Spektrum RX code to support 12
channels when using Spektrum 2048 - untested. Renamed and extracted core_t.numRCChannels to rxConfig.channelCount so that future commits can clean up core_t further since core_t contains completely unrelated properties.
This commit is contained in:
parent
d777bac39d
commit
f68fc17627
16 changed files with 137 additions and 74 deletions
|
@ -22,15 +22,17 @@
|
|||
|
||||
static bool sumdFrameDone = false;
|
||||
static void sumdDataReceive(uint16_t c);
|
||||
static uint16_t sumdReadRawRC(rxConfig_t *rxConfig, uint8_t chan);
|
||||
static uint16_t sumdReadRawRC(rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig, uint8_t chan);
|
||||
|
||||
static uint32_t sumdChannelData[SUMD_MAX_CHANNEL];
|
||||
|
||||
void sumdInit(rxConfig_t *rxConfig, rcReadRawDataPtr *callback)
|
||||
void sumdInit(rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig, rcReadRawDataPtr *callback)
|
||||
{
|
||||
core.rcvrport = uartOpen(USART2, sumdDataReceive, 115200, MODE_RX);
|
||||
if (callback)
|
||||
*callback = sumdReadRawRC;
|
||||
|
||||
rxRuntimeConfig->channelCount = SUMD_MAX_CHANNEL;
|
||||
}
|
||||
|
||||
static uint8_t sumd[SUMD_BUFFSIZE] = { 0, };
|
||||
|
@ -83,7 +85,7 @@ bool sumdFrameComplete(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
static uint16_t sumdReadRawRC(rxConfig_t *rxConfig, uint8_t chan)
|
||||
static uint16_t sumdReadRawRC(rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig, uint8_t chan)
|
||||
{
|
||||
return sumdChannelData[rxConfig->rcmap[chan]] / 8;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue