From 1eed30a829b64d73243696dc24c2d7dc73d73e13 Mon Sep 17 00:00:00 2001 From: clavisound Date: Thu, 4 Jul 2024 19:44:38 +0300 Subject: [PATCH] Added sleep function for dev testing on deep sleep. --- SlimLoRa.cpp | 5 +++++ SlimLoRa.h | 1 + library.properties | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/SlimLoRa.cpp b/SlimLoRa.cpp index 44e039a..da8bdc4 100644 --- a/SlimLoRa.cpp +++ b/SlimLoRa.cpp @@ -350,6 +350,11 @@ void SlimLoRa::Begin() { #endif } +// TODO this routine resides in some places. +void SlimLoRa::sleep() { + RfmWrite(RFM_REG_OP_MODE, 0x00); +} + // EVAL for accuracy (FAIL: does not compile) //void wait_until(unsigned long microsstamp) __attribute__((optimize("-Ofast"))); void wait_until(unsigned long microsstamp) { diff --git a/SlimLoRa.h b/SlimLoRa.h index 97d30b8..78883c4 100644 --- a/SlimLoRa.h +++ b/SlimLoRa.h @@ -241,6 +241,7 @@ class SlimLoRa { public: SlimLoRa(uint8_t pin_nss); // TODO: TinyLoRa rfm_dio0 (7), rfm_nss (8), rfm_rst (4) void Begin(void); + void sleep(void); bool HasJoined(void); int8_t Join(); void SendData(uint8_t fport, uint8_t *payload, uint8_t payload_length); diff --git a/library.properties b/library.properties index 542065a..90705f4 100644 --- a/library.properties +++ b/library.properties @@ -1,9 +1,9 @@ name=SlimLoRa -version=0.1.5 +version=0.1.6 author=novag maintainer=clavisound sentence=SlimLoRa Library -paragraph=Basic LoRaWAN library with OTAA and ADR support for EU868. Testes with avr32u4 aka ATmega32u4 and HopeRF 95w (SX1276) on Adafruit Feather. ABP untested. Testers wanted for other regions. +paragraph=Basic LoRaWAN library with OTAA and ADR support for EU868. Tested with avr32u4 aka ATmega32u4 and HopeRF 95w (SX1276) on Adafruit Feather. ABP untested. Testers wanted for other regions. category=Communication url=https://github.com/clavisound/SlimLoRa architectures=*