1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 21:05:35 +03:00

Merge pull request #9214 from etracer65/sbus_crsf_micros_interrupt

Update SBUS and CRSF to use microsISR() in the interrupt handler
This commit is contained in:
Michael Keller 2019-11-24 13:03:02 +13:00 committed by GitHub
commit b137bbe80c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 2 deletions

View file

@ -233,7 +233,7 @@ STATIC_UNIT_TESTED void crsfDataReceive(uint16_t c, void *data)
UNUSED(data);
static uint8_t crsfFramePosition = 0;
const timeUs_t currentTimeUs = micros();
const timeUs_t currentTimeUs = microsISR();
static timeUs_t lastRcFrameCompleteTimeUs = 0;
#ifdef DEBUG_CRSF_PACKETS

View file

@ -116,7 +116,7 @@ static void sbusDataReceive(uint16_t c, void *data)
static timeUs_t lastFrameCompleteTimeUs = 0;
sbusFrameData_t *sbusFrameData = data;
const timeUs_t nowUs = micros();
const timeUs_t nowUs = microsISR();
const timeDelta_t sbusFrameTime = cmpTimeUs(nowUs, sbusFrameData->startAtUs);

View file

@ -406,6 +406,10 @@ extern "C" {
return simulationTime;
}
uint32_t microsISR() {
return micros();
}
uint32_t millis() {
return micros() / 1000;
}

View file

@ -289,6 +289,7 @@ extern "C" {
int16_t debug[DEBUG16_VALUE_COUNT];
uint32_t micros(void) {return dummyTimeUs;}
uint32_t microsISR(void) {return micros();}
serialPort_t *openSerialPort(serialPortIdentifier_e, serialPortFunction_e, serialReceiveCallbackPtr, void *, uint32_t, portMode_e, portOptions_e) {return NULL;}
serialPortConfig_t *findSerialPortConfig(serialPortFunction_e ) {return NULL;}
bool telemetryCheckRxPortShared(const serialPortConfig_t *) {return false;}

View file

@ -255,6 +255,7 @@ extern "C" {
attitudeEulerAngles_t attitude = { { 0, 0, 0 } };
uint32_t micros(void) {return dummyTimeUs;}
uint32_t microsISR(void) {return micros();}
serialPort_t *openSerialPort(serialPortIdentifier_e, serialPortFunction_e, serialReceiveCallbackPtr, void *, uint32_t, portMode_e, portOptions_e) {return NULL;}
serialPortConfig_t *findSerialPortConfig(serialPortFunction_e ) {return NULL;}
bool isBatteryVoltageConfigured(void) { return true; }

View file

@ -313,6 +313,7 @@ gpsSolutionData_t gpsSol;
void beeperConfirmationBeeps(uint8_t beepCount) {UNUSED(beepCount);}
uint32_t micros(void) {return 0;}
uint32_t microsISR(void) {return micros();}
bool featureIsEnabled(uint32_t) {return true;}