Use FlixPeriph library for SBUS

This commit is contained in:
Oleg Kalachev
2024-03-17 02:29:37 +03:00
parent f782f647cb
commit 646fa46f6b
6 changed files with 19 additions and 16 deletions

View File

@@ -5,13 +5,20 @@
#include "joystick.h"
struct SBUSData {
int16_t ch[16];
};
class SBUS {
public:
SBUS(HardwareSerial& bus) {};
void begin() {};
bool read(int16_t *channels, bool *failsafe, bool *lostFrame) { // NOTE: on the hardware channels is uint16_t
*failsafe = false;
*lostFrame = false;
return joystickGet();
bool read() { return joystickGet(); };
SBUSData data() {
SBUSData data;
for (uint8_t i = 0; i < 16; i++) {
data.ch[i] = channels[i];
}
return data;
};
};

View File

@@ -23,7 +23,7 @@ float t = NAN;
float dt;
float loopFreq;
float motors[4];
int16_t channels[16]; // raw rc channels WARNING: unsigned on hardware
int16_t channels[16]; // raw rc channels
float controls[RC_CHANNELS];
Vector acc;
Vector rates;