mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 01:35:41 +03:00
Interrupt/DMA driven SX1280 interaction for ELRS
This commit is contained in:
parent
7b4415f062
commit
fc8640154a
39 changed files with 1003 additions and 438 deletions
|
@ -494,6 +494,7 @@ extern "C" {
|
|||
bool areMotorsRunning(void){ return true; }
|
||||
bool pidOsdAntiGravityActive(void) { return false; }
|
||||
bool failsafeIsActive(void) { return false; }
|
||||
bool failsafeIsReceivingRxData(void) { return true; }
|
||||
bool gpsIsHealthy(void) { return true; }
|
||||
bool gpsRescueIsConfigured(void) { return false; }
|
||||
int8_t calculateThrottlePercent(void) { return 0; }
|
||||
|
|
|
@ -107,6 +107,7 @@ extern "C" {
|
|||
|
||||
void failsafeOnRxSuspend(uint32_t ) {}
|
||||
void failsafeOnRxResume(void) {}
|
||||
bool failsafeIsReceivingRxData(void) { return true; }
|
||||
bool taskUpdateRxMainInProgress() { return true; }
|
||||
|
||||
uint32_t micros(void) { return 0; }
|
||||
|
|
|
@ -210,6 +210,7 @@ extern "C" {
|
|||
|
||||
void failsafeOnRxSuspend(uint32_t ) {}
|
||||
void failsafeOnRxResume(void) {}
|
||||
bool failsafeIsReceivingRxData(void) { return true; }
|
||||
|
||||
uint32_t micros(void) { return 0; }
|
||||
uint32_t millis(void) { return 0; }
|
||||
|
|
|
@ -45,7 +45,7 @@ extern "C" {
|
|||
#include "drivers/rx/rx_sx127x.h"
|
||||
#include "drivers/rx/rx_sx1280.h"
|
||||
|
||||
extern uint8_t FHSSsequence[ELRS_NR_SEQUENCE_ENTRIES];
|
||||
extern uint8_t fhssSequence[ELRS_NR_SEQUENCE_ENTRIES];
|
||||
extern uint16_t crc14tab[ELRS_CRC_LEN];
|
||||
|
||||
extern elrsReceiver_t receiver;
|
||||
|
@ -164,14 +164,14 @@ TEST(RxSpiExpressLrsUnitTest, TestFHSSTable)
|
|||
}
|
||||
};
|
||||
|
||||
FHSSrandomiseFHSSsequence(UID, ISM2400);
|
||||
fhssGenSequence(UID, ISM2400);
|
||||
for (int i = 0; i < ELRS_NR_SEQUENCE_ENTRIES; i++) {
|
||||
EXPECT_EQ(expectedSequence[0][i], FHSSsequence[i]);
|
||||
EXPECT_EQ(expectedSequence[0][i], fhssSequence[i]);
|
||||
}
|
||||
|
||||
FHSSrandomiseFHSSsequence(UID, FCC915);
|
||||
fhssGenSequence(UID, FCC915);
|
||||
for (int i = 0; i < ELRS_NR_SEQUENCE_ENTRIES; i++) {
|
||||
EXPECT_EQ(expectedSequence[1][i], FHSSsequence[i]);
|
||||
EXPECT_EQ(expectedSequence[1][i], fhssSequence[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -390,7 +390,8 @@ extern "C" {
|
|||
IO_t IOGetByTag(ioTag_t ) { return (IO_t)1; }
|
||||
void IOHi(IO_t ) {}
|
||||
void IOLo(IO_t ) {}
|
||||
void writeEEPROM(void) {}
|
||||
|
||||
void saveConfigAndNotify(void) {}
|
||||
|
||||
void rxSpiCommonIOInit(const rxSpiConfig_t *) {}
|
||||
void rxSpiLedBlinkRxLoss(rx_spi_received_e ) {}
|
||||
|
@ -404,11 +405,10 @@ extern "C" {
|
|||
bool sx1280IsBusy(void) { return false; }
|
||||
void sx1280Config(const sx1280LoraBandwidths_e , const sx1280LoraSpreadingFactors_e , const sx1280LoraCodingRates_e , const uint32_t , const uint8_t , const bool ) {}
|
||||
void sx1280StartReceiving(void) {}
|
||||
uint8_t sx1280ISR(uint32_t *timestamp)
|
||||
{
|
||||
*timestamp = 0;
|
||||
return 0;
|
||||
}
|
||||
void sx1280ISR(void) {}
|
||||
bool rxSpiGetExtiState(void) { return false; }
|
||||
void sx1280HandleFromTock(void) {}
|
||||
bool sx1280HandleFromTick(void) { return false; }
|
||||
void sx1280TransmitData(const uint8_t *, const uint8_t ) {}
|
||||
void sx1280ReceiveData(uint8_t *, const uint8_t ) {}
|
||||
void sx1280SetFrequencyReg(const uint32_t ) {}
|
||||
|
@ -469,5 +469,4 @@ extern "C" {
|
|||
void getCurrentTelemetryPayload(uint8_t *, uint8_t *, uint8_t **) {}
|
||||
void confirmCurrentTelemetryPayload(const bool ) {}
|
||||
void updateTelemetryRate(const uint16_t , const uint8_t , const uint8_t ) {}
|
||||
|
||||
}
|
||||
|
|
|
@ -67,9 +67,13 @@ extern "C" {
|
|||
int16_t debug[1];
|
||||
uint8_t debugMode = 0;
|
||||
|
||||
bool rxFrameReady(void) { return 0; }
|
||||
void rxFrameCheck(timeUs_t, timeDelta_t) {}
|
||||
|
||||
// set up micros() to simulate time
|
||||
uint32_t simulatedTime = 0;
|
||||
uint32_t micros(void) { return simulatedTime; }
|
||||
uint32_t millis(void) { return simulatedTime/1000; } // Note simplistic mapping suitable only for short unit tests
|
||||
uint32_t clockCyclesToMicros(uint32_t x) { return x/10;}
|
||||
int32_t clockCyclesTo10thMicros(int32_t x) { return x;}
|
||||
uint32_t clockMicrosToCycles(uint32_t x) { return x*10;}
|
||||
|
@ -78,6 +82,8 @@ extern "C" {
|
|||
// set up tasks to take a simulated representative time to execute
|
||||
bool gyroFilterReady(void) { return taskFilterReady; }
|
||||
bool pidLoopReady(void) { return taskPidReady; }
|
||||
void failsafeCheckDataFailurePeriod(void) {}
|
||||
void failsafeUpdateState(void) {}
|
||||
void taskGyroSample(timeUs_t) { simulatedTime += TEST_GYRO_SAMPLE_TIME; taskGyroRan = true; }
|
||||
void taskFiltering(timeUs_t) { simulatedTime += TEST_FILTERING_TIME; taskFilterRan = true; }
|
||||
void taskMainPidLoop(timeUs_t) { simulatedTime += TEST_PID_LOOP_TIME; taskPidRan = true; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue