From e421ab4272d21af6d7b5e5d57f2dded84923b6e0 Mon Sep 17 00:00:00 2001 From: obones Date: Wed, 6 Jul 2022 15:28:50 +0200 Subject: [PATCH] Introduce setDIOMapping on the PhysicalLayer class which, by default, returns "not implemented" --- src/TypeDef.h | 10 ++++++++++ src/protocols/PhysicalLayer/PhysicalLayer.cpp | 4 ++++ src/protocols/PhysicalLayer/PhysicalLayer.h | 11 +++++++++++ 3 files changed, 25 insertions(+) diff --git a/src/TypeDef.h b/src/TypeDef.h index a9687c13..71b738c2 100644 --- a/src/TypeDef.h +++ b/src/TypeDef.h @@ -203,6 +203,16 @@ */ #define RADIOLIB_ERR_LORA_HEADER_DAMAGED (-24) +/*! + \brief The requested functionality is not supported for this device +*/ +#define RADIOLIB_ERR_UNSUPPORTED (-25) + +/*! + \brief The specified DIO pin does not exist on this device +*/ +#define RADIOLIB_ERR_INVALID_DIO_PIN (-26) + // RF69-specific status codes /*! diff --git a/src/protocols/PhysicalLayer/PhysicalLayer.cpp b/src/protocols/PhysicalLayer/PhysicalLayer.cpp index 8b514a9c..98c8778c 100644 --- a/src/protocols/PhysicalLayer/PhysicalLayer.cpp +++ b/src/protocols/PhysicalLayer/PhysicalLayer.cpp @@ -246,3 +246,7 @@ void PhysicalLayer::updateDirectBuffer(uint8_t bit) { } } } + +int16_t PhysicalLayer::setDIOMapping(RADIOLIB_PIN_TYPE pin, uint8_t value) { + return(RADIOLIB_ERR_UNSUPPORTED); +} diff --git a/src/protocols/PhysicalLayer/PhysicalLayer.h b/src/protocols/PhysicalLayer/PhysicalLayer.h index c1d236d8..e67dd1e8 100644 --- a/src/protocols/PhysicalLayer/PhysicalLayer.h +++ b/src/protocols/PhysicalLayer/PhysicalLayer.h @@ -300,6 +300,17 @@ class PhysicalLayer { */ uint8_t read(); + /*! + \brief Configure DIO pin mapping to get a given signal on a DIO pin (if available). + + \param pin Pin number onto which a signal is to be placed. + + \param value The value that indicates which function to place on that pin. See chip datasheet for details. + + \returns \ref status_codes + */ + virtual int16_t setDIOMapping(RADIOLIB_PIN_TYPE pin, uint8_t value); + protected: void updateDirectBuffer(uint8_t bit);