mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 01:35:41 +03:00
Merge pull request #5990 from jflyper/bfdev-create-pg-rxSpiConfig
Add basic SPI RX configurability
This commit is contained in:
commit
418fd4beaa
32 changed files with 192 additions and 78 deletions
|
@ -127,6 +127,7 @@ extern uint8_t __config_end;
|
|||
#include "pg/pg.h"
|
||||
#include "pg/pg_ids.h"
|
||||
#include "pg/rx.h"
|
||||
#include "pg/rx_spi.h"
|
||||
#include "pg/rx_pwm.h"
|
||||
#include "pg/timerio.h"
|
||||
#include "pg/usb.h"
|
||||
|
@ -2404,10 +2405,10 @@ static void cliBeeper(char *cmdline)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_RX_FRSKY_SPI
|
||||
void cliFrSkyBind(char *cmdline){
|
||||
UNUSED(cmdline);
|
||||
switch (rxConfig()->rx_spi_protocol) {
|
||||
#ifdef USE_RX_FRSKY_SPI
|
||||
switch (rxSpiConfig()->rx_spi_protocol) {
|
||||
case RX_SPI_FRSKY_D:
|
||||
case RX_SPI_FRSKY_X:
|
||||
frSkySpiBind();
|
||||
|
@ -2415,13 +2416,13 @@ void cliFrSkyBind(char *cmdline){
|
|||
cliPrint("Binding...");
|
||||
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
cliPrint("Not supported.");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void printMap(uint8_t dumpMask, const rxConfig_t *rxConfig, const rxConfig_t *defaultRxConfig)
|
||||
{
|
||||
|
@ -3591,6 +3592,9 @@ const cliResourceValue_t resourceTable[] = {
|
|||
DEFA( OWNER_SPI_PREINIT_IPU, PG_SPI_PREINIT_IPU_CONFIG, spiCs_t, csnTag, SPI_PREINIT_IPU_COUNT ),
|
||||
DEFA( OWNER_SPI_PREINIT_OPU, PG_SPI_PREINIT_OPU_CONFIG, spiCs_t, csnTag, SPI_PREINIT_OPU_COUNT ),
|
||||
#endif
|
||||
#ifdef USE_RX_SPI
|
||||
DEFS( OWNER_RX_SPI_CS, PG_RX_SPI_CONFIG, rxSpiConfig_t, csnTag ),
|
||||
#endif
|
||||
};
|
||||
|
||||
#undef DEFS
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "pg/pg_ids.h"
|
||||
#include "pg/beeper.h"
|
||||
#include "pg/rx.h"
|
||||
#include "pg/rx_spi.h"
|
||||
|
||||
#include "drivers/accgyro/accgyro.h"
|
||||
#include "drivers/bus_i2c.h"
|
||||
|
@ -1054,9 +1055,15 @@ static bool mspProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst)
|
|||
sbufWriteU8(dst, rxConfig()->rcInterpolation);
|
||||
sbufWriteU8(dst, rxConfig()->rcInterpolationInterval);
|
||||
sbufWriteU16(dst, rxConfig()->airModeActivateThreshold * 10 + 1000);
|
||||
sbufWriteU8(dst, rxConfig()->rx_spi_protocol);
|
||||
sbufWriteU32(dst, rxConfig()->rx_spi_id);
|
||||
sbufWriteU8(dst, rxConfig()->rx_spi_rf_channel_count);
|
||||
#ifdef USE_RX_SPI
|
||||
sbufWriteU8(dst, rxSpiConfig()->rx_spi_protocol);
|
||||
sbufWriteU32(dst, rxSpiConfig()->rx_spi_id);
|
||||
sbufWriteU8(dst, rxSpiConfig()->rx_spi_rf_channel_count);
|
||||
#else
|
||||
sbufWriteU8(dst, 0);
|
||||
sbufWriteU32(dst, 0);
|
||||
sbufWriteU8(dst, 0);
|
||||
#endif
|
||||
sbufWriteU8(dst, rxConfig()->fpvCamAngleDegrees);
|
||||
break;
|
||||
|
||||
|
@ -1894,9 +1901,15 @@ static mspResult_e mspProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
|
|||
rxConfigMutable()->airModeActivateThreshold = (sbufReadU16(src) - 1000) / 10;
|
||||
}
|
||||
if (sbufBytesRemaining(src) >= 6) {
|
||||
rxConfigMutable()->rx_spi_protocol = sbufReadU8(src);
|
||||
rxConfigMutable()->rx_spi_id = sbufReadU32(src);
|
||||
rxConfigMutable()->rx_spi_rf_channel_count = sbufReadU8(src);
|
||||
#ifdef USE_RX_SPI
|
||||
rxSpiConfigMutable()->rx_spi_protocol = sbufReadU8(src);
|
||||
rxSpiConfigMutable()->rx_spi_id = sbufReadU32(src);
|
||||
rxSpiConfigMutable()->rx_spi_rf_channel_count = sbufReadU8(src);
|
||||
#else
|
||||
sbufReadU8(src);
|
||||
sbufReadU32(src);
|
||||
sbufReadU8(src);
|
||||
#endif
|
||||
}
|
||||
if (sbufBytesRemaining(src) >= 1) {
|
||||
rxConfigMutable()->fpvCamAngleDegrees = sbufReadU8(src);
|
||||
|
|
|
@ -76,6 +76,7 @@
|
|||
#include "pg/pinio.h"
|
||||
#include "pg/piniobox.h"
|
||||
#include "pg/rx.h"
|
||||
#include "pg/rx_spi.h"
|
||||
#include "pg/rx_pwm.h"
|
||||
#include "pg/sdcard.h"
|
||||
#include "pg/vcd.h"
|
||||
|
@ -531,7 +532,8 @@ const clivalue_t valueTable[] = {
|
|||
{ "rx_max_usec", VAR_UINT16 | MASTER_VALUE, .config.minmax = { PWM_PULSE_MIN, PWM_PULSE_MAX }, PG_RX_CONFIG, offsetof(rxConfig_t, rx_max_usec) },
|
||||
{ "serialrx_halfduplex", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_RX_CONFIG, offsetof(rxConfig_t, halfDuplex) },
|
||||
#ifdef USE_RX_SPI
|
||||
{ "rx_spi_protocol", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_RX_SPI }, PG_RX_CONFIG, offsetof(rxConfig_t, rx_spi_protocol) },
|
||||
{ "rx_spi_protocol", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_RX_SPI }, PG_RX_SPI_CONFIG, offsetof(rxSpiConfig_t, rx_spi_protocol) },
|
||||
{ "rx_spi_bus", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, SPIDEV_COUNT }, PG_RX_SPI_CONFIG, offsetof(rxSpiConfig_t, spibus) },
|
||||
#endif
|
||||
|
||||
// PG_ADC_CONFIG
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue