From 1fc787c0620adb5ad8f1be64e8ed3848fb5b10c9 Mon Sep 17 00:00:00 2001 From: jgromes Date: Mon, 14 Jun 2021 21:15:27 +0200 Subject: [PATCH] [Si443x] Added direct reception support --- src/modules/Si443x/Si443x.cpp | 8 ++++++++ src/modules/Si443x/Si443x.h | 14 ++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/modules/Si443x/Si443x.cpp b/src/modules/Si443x/Si443x.cpp index 120d1c15..ff533151 100644 --- a/src/modules/Si443x/Si443x.cpp +++ b/src/modules/Si443x/Si443x.cpp @@ -571,6 +571,14 @@ int16_t Si443x::getChipVersion() { return(_mod->SPIgetRegValue(SI443X_REG_DEVICE_VERSION)); } +void Si443x::setDirectAction(void (*func)(void)) { + setIrqAction(func); +} + +void Si443x::readBit(RADIOLIB_PIN_TYPE pin) { + updateDirectBuffer((uint8_t)digitalRead(pin)); +} + int16_t Si443x::setFrequencyRaw(float newFreq) { // set mode to standby int16_t state = standby(); diff --git a/src/modules/Si443x/Si443x.h b/src/modules/Si443x/Si443x.h index fe507424..b30a1387 100644 --- a/src/modules/Si443x/Si443x.h +++ b/src/modules/Si443x/Si443x.h @@ -799,6 +799,20 @@ class Si443x: public PhysicalLayer { */ int16_t getChipVersion(); + /*! + \brief Set interrupt service routine function to call when data bit is receveid in direct mode. + + \param func Pointer to interrupt service routine. + */ + void setDirectAction(void (*func)(void)); + + /*! + \brief Function to read and process data bit in direct reception mode. + + \param pin Pin on which to read. + */ + void readBit(RADIOLIB_PIN_TYPE pin); + #if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL) protected: #endif