acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
ModuleTemplate.h (3613B)
1 /* 2 RadioLib Module Template header file 3 4 Before opening pull request, please make sure that: 5 1. All files MUST be compiled without errors using default Arduino IDE settings. 6 2. All files SHOULD be compiled without warnings with compiler warnings set to "All". 7 3. Example sketches MUST be working correctly and MUST be stable enough to run for prolonged periods of time. 8 4. Writing style SHOULD be consistent. 9 5. Comments SHOULD be in place for the most important chunks of code and SHOULD be free of typos. 10 6. To indent, 2 spaces MUST be used. 11 12 If at any point you are unsure about the required style, please refer to the rest of the modules. 13 */ 14 15 #if !defined(_RADIOLIB_<module_name>_H) && !defined(RADIOLIB_EXCLUDE_<module_name>) 16 #if !defined(_RADIOLIB_<module_name>_H) 17 #define _RADIOLIB_<module_name>_H 18 19 /* 20 Header file for each module MUST include Module.h and TypeDef.h in the src folder. 21 The header file MAY include additional header files. 22 */ 23 #include "../../Module.h" 24 #include "../../TypeDef.h" 25 26 /* 27 Only use the following include if the module implements methods for OSI physical layer control. 28 This concerns only modules similar to SX127x/RF69/CC1101 etc. 29 30 In this case, your class MUST implement all virtual methods of PhysicalLayer class. 31 */ 32 //#include "../../protocols/PhysicalLayer/PhysicalLayer.h" 33 34 /* 35 Register map 36 Definition of SPI register map SHOULD be placed here. The register map SHOULD have two parts: 37 38 1 - Address map: only defines register names and addresses. Register names MUST match names in 39 official documentation (datasheets etc.). 40 2 - Variable map: defines variables inside register. This functions as a bit range map for a specific register. 41 Bit range (MSB and LSB) as well as short description for each variable MUST be provided in a comment. 42 43 See RF69 and SX127x header files for examples of register maps. 44 */ 45 // <module_name> register map | spaces up to this point 46 #define RADIOLIB_<module_name>_REG_<register_name> 0x00 47 48 // <module_name>_REG_<register_name> MSB LSB DESCRIPTION 49 #define RADIOLIB_<module_name>_<register_variable> 0b00000000 // 7 0 <description> 50 51 52 /* 53 Module class definition 54 55 The module class MAY inherit from the following classes: 56 57 1 - PhysicalLayer: In case the module implements methods for OSI physical layer control (e.g. SX127x). 58 2 - Common class: In case the module further specifies some more generic class (e.g. SX127x/SX1278) 59 */ 60 class <module_name> { 61 public: 62 /* 63 Constructor MUST have only one parameter "Module* mod". 64 The class MAY implement additional overloaded constructors. 65 */ 66 // constructor 67 <module_name>(Module* mod); 68 69 /* 70 The class MUST implement at least one basic method called "begin". 71 The "begin" method MUST initialize the module and return the status as int16_t type. 72 */ 73 // basic methods 74 int16_t begin(); 75 76 /* 77 The class MAY implement additional methods. 78 All implemented methods SHOULD return the status as int16_t type. 79 */ 80 81 #if !defined(RADIOLIB_GODMODE) 82 private: 83 #endif 84 /* 85 The class MUST contain private member "Module* _mod" 86 */ 87 Module* _mod; 88 89 /* 90 The class MAY contain additional private variables and/or methods. 91 Private member variables MUST have a name prefixed with "_" (underscore, ASCII 0x5F) 92 93 Usually, these are variables for saving module configuration, or methods that do not have to be exposed to the end user. 94 */ 95 }; 96 97 #endif 98 99 #endif