From 9c9d2b7ec45bc3031bb4187260329603ced01573 Mon Sep 17 00:00:00 2001 From: jgromes Date: Sat, 29 Sep 2018 12:15:56 +0200 Subject: [PATCH] Updated module templates --- extras/ModuleTemplate.cpp | 2 +- extras/ModuleTemplate.h | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/extras/ModuleTemplate.cpp b/extras/ModuleTemplate.cpp index dc249a50..0ee26318 100644 --- a/extras/ModuleTemplate.cpp +++ b/extras/ModuleTemplate.cpp @@ -7,7 +7,7 @@ _mod = mod; } -uint8_t ::begin() { +int16_t ::begin() { /* "begin" method implementation MUST call the "init" method with appropriate settings. */ diff --git a/extras/ModuleTemplate.h b/extras/ModuleTemplate.h index 94979c57..8966393d 100644 --- a/extras/ModuleTemplate.h +++ b/extras/ModuleTemplate.h @@ -4,7 +4,7 @@ Before opening pull request, please make sure that: 1. All files MUST be compiled without errors using default Arduino IDE settings. 2. Example sketches MUST be working correctly and MUST be stable enough to run for prolonged periods of time. - 3. Writing style SHOULD be at least somewhat consistent. + 3. Writing style SHOULD be consistent. 4. Comments SHOULD be in place for the most important chunks of code and SHOULD be free of typos. 5. To indent, 2 spaces MUST be used. @@ -28,6 +28,14 @@ */ //#include "../protocols/TransportLayer.h" +/* + Only use the following include if the module implements methods for OSI physical layer control. + This concerns only modules similar to e.g. SX127x. + + In this case, your class MUST implement all virtual methods of PhysicalLayer class. +*/ +//#include "../protocols/PhysicalLayer.h" + /* Register map Definition of SPI/I2C register map MAY be placed here. The register map MAY have two parts: @@ -54,6 +62,7 @@ 1 - ISerial: Interface for Arduino Serial class, intended as a thin wrapper for modules that directly take Serial input (e.g. HC-05). 2 - TransportLayer: In case the module implements methods for OSI transport layer control (e.g. ESP8266). + 3 - PhysicalLayer: In case the module implements methods for OSI physical layer control (e.g. SX127x). */ class { public: @@ -66,14 +75,14 @@ class { /* The class MUST implement at least one basic method called "begin". - The "begin" method MUST initialize the module and return the status as uint8_t type. + The "begin" method MUST initialize the module and return the status as int16_t type. */ // basic methods - uint8_t begin(); + int16_t begin(); /* The class MAY implement additional methods. - All implemented methods SHOULD return the status as uint8_t type. + All implemented methods SHOULD return the status as int16_t type. */ private: