Add companion terminal mode and LoRa OTA tooling
This commit is contained in:
1 parent
cfdf33b7ca
commit
bf62afa240
16 files changed
+2956
-8
No files matched your search
@@ -5,22 +5,46 @@
|
||||
|
||||
class ArduinoSerialInterface : public BaseSerialInterface {
|
||||
bool _isEnabled;
|
||||
bool _passthroughMode;
|
||||
bool _controlSequenceReceived;
|
||||
uint8_t _state;
|
||||
size_t _controlSequencePos;
|
||||
uint16_t _frame_len;
|
||||
uint16_t rx_len;
|
||||
Stream* _serial;
|
||||
const char* _controlSequence;
|
||||
uint8_t rx_buf[MAX_FRAME_SIZE];
|
||||
|
||||
public:
|
||||
ArduinoSerialInterface() { _isEnabled = false; _state = 0; }
|
||||
bool checkControlSequence(uint8_t c);
|
||||
void resetReceiveState();
|
||||
|
||||
void begin(Stream& serial) {
|
||||
_serial = &serial;
|
||||
public:
|
||||
ArduinoSerialInterface()
|
||||
: _isEnabled(false), _passthroughMode(false),
|
||||
_controlSequenceReceived(false), _state(0), _controlSequencePos(0),
|
||||
_frame_len(0), rx_len(0), _serial(nullptr),
|
||||
_controlSequence(nullptr) {}
|
||||
|
||||
void begin(Stream& serial, const char* controlSequence = nullptr) {
|
||||
_serial = &serial;
|
||||
_controlSequence = controlSequence;
|
||||
_passthroughMode = false;
|
||||
_controlSequenceReceived = false;
|
||||
resetReceiveState();
|
||||
#ifdef RAK_4631
|
||||
pinMode(WB_IO2, OUTPUT);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
// In passthrough mode another line-oriented consumer owns the Stream. Binary
|
||||
// frames are neither read from nor written to this interface.
|
||||
void setPassthroughMode(bool enabled);
|
||||
bool isPassthroughMode() const { return _passthroughMode; }
|
||||
|
||||
// Returns true once for each complete control sequence received while the
|
||||
// binary frame parser was idle.
|
||||
bool takeControlSequence();
|
||||
|
||||
// BaseSerialInterface methods
|
||||
void enable() override;
|
||||
void disable() override;
|
||||
|
||||
Reference in new issue
Block a user