From 06d40c78bcdb3372e17d32a83c0dad96b98b574c Mon Sep 17 00:00:00 2001 From: jgromes Date: Mon, 14 Jun 2021 21:14:47 +0200 Subject: [PATCH] [CC1101] Added direct reception support --- src/modules/CC1101/CC1101.cpp | 9 ++++++++- src/modules/CC1101/CC1101.h | 14 ++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/modules/CC1101/CC1101.cpp b/src/modules/CC1101/CC1101.cpp index e7eb7b18..4b665492 100644 --- a/src/modules/CC1101/CC1101.cpp +++ b/src/modules/CC1101/CC1101.cpp @@ -865,11 +865,18 @@ uint8_t CC1101::random() { return(randByte); } - int16_t CC1101::getChipVersion() { return(SPIgetRegValue(CC1101_REG_VERSION)); } +void CC1101::setDirectAction(void (*func)(void)) { + setGdo2Action(func); +} + +void CC1101::readBit(RADIOLIB_PIN_TYPE pin) { + updateDirectBuffer((uint8_t)digitalRead(pin)); +} + int16_t CC1101::config() { // Reset the radio. Registers may be dirty from previous usage. SPIsendCommand(CC1101_CMD_RESET); diff --git a/src/modules/CC1101/CC1101.h b/src/modules/CC1101/CC1101.h index 55ffaa71..edfd7b14 100644 --- a/src/modules/CC1101/CC1101.h +++ b/src/modules/CC1101/CC1101.h @@ -897,6 +897,20 @@ class CC1101: 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