From 1a2d66305d5b40abe75d4d12f92ed7285024f0e4 Mon Sep 17 00:00:00 2001 From: jgromes Date: Sat, 13 Feb 2021 15:43:16 +0100 Subject: [PATCH] [PHY] Added method to set direct mode parameters (#177) --- src/protocols/PhysicalLayer/PhysicalLayer.cpp | 10 ++++++++++ src/protocols/PhysicalLayer/PhysicalLayer.h | 9 ++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/protocols/PhysicalLayer/PhysicalLayer.cpp b/src/protocols/PhysicalLayer/PhysicalLayer.cpp index b30a0cf9..82d04910 100644 --- a/src/protocols/PhysicalLayer/PhysicalLayer.cpp +++ b/src/protocols/PhysicalLayer/PhysicalLayer.cpp @@ -167,3 +167,13 @@ int32_t PhysicalLayer::random(int32_t min, int32_t max) { return(PhysicalLayer::random(max - min) + min); } + +int16_t PhysicalLayer::startDirect() { + // disable encodings + int16_t state = setEncoding(0); + RADIOLIB_ASSERT(state); + + // set frequency deviation to the lowest possible value + state = setFrequencyDeviation(0); + return(state); +} diff --git a/src/protocols/PhysicalLayer/PhysicalLayer.h b/src/protocols/PhysicalLayer/PhysicalLayer.h index d817fbcc..b3fe2829 100644 --- a/src/protocols/PhysicalLayer/PhysicalLayer.h +++ b/src/protocols/PhysicalLayer/PhysicalLayer.h @@ -239,7 +239,7 @@ class PhysicalLayer { \param min The minimum value of the random number (inclusive). \param max The maximum value of the random number (non-inclusive). - + \returns Random number. */ int32_t random(int32_t min, int32_t max); @@ -251,6 +251,13 @@ class PhysicalLayer { */ virtual uint8_t random() = 0; + /*! + \brief Configure module parameters for direct modes. Must be called prior to "ham" modes like RTTY or AX.25. Only available in FSK mode. + + \returns \ref status_codes + */ + int16_t startDirect(); + #ifndef RADIOLIB_GODMODE private: #endif