Smart-Home am Beispiel der Präsenzerkennung im Raum Projektarbeit Lennart Heimbs, Johannes Krug, Sebastian Dohle und Kevin Holzschuh bei Prof. Oliver Hofmann SS2019
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MyConfig.h 70KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347
  1. /*
  2. * The MySensors Arduino library handles the wireless radio link and protocol
  3. * between your home built sensors/actuators and HA controller of choice.
  4. * The sensors forms a self healing radio network with optional repeaters. Each
  5. * repeater and gateway builds a routing tables in RAM or EEPROM which keeps track of the
  6. * network topology allowing messages to be routed to nodes.
  7. *
  8. * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
  9. * Copyright (C) 2013-2018 Sensnology AB
  10. * Full contributor list: https://github.com/mysensors/MySensors/graphs/contributors
  11. *
  12. * Documentation: http://www.mysensors.org
  13. * Support Forum: http://forum.mysensors.org
  14. *
  15. * This program is free software; you can redistribute it and/or
  16. * modify it under the terms of the GNU General Public License
  17. * version 2 as published by the Free Software Foundation.
  18. */
  19. /**
  20. * @file MyConfig.h
  21. * @ingroup MyConfigGrp
  22. *
  23. * @brief MySensors specific configuration flags.
  24. *
  25. * Set these in your sketch before including MySensors.h to customize the library to your needs.
  26. * If the sketch does not define these flags, they will get default values where applicable.
  27. */
  28. #ifndef MyConfig_h
  29. #define MyConfig_h
  30. #include <stdint.h>
  31. /**
  32. * @defgroup SerialDebugGrpPub Serial and debugging
  33. * @ingroup MyConfigGrp
  34. * @brief These options control serial and debugging features and functionalities in the library.
  35. * @{
  36. */
  37. /**
  38. * @def MY_DEBUG
  39. * @brief Define MY_DEBUG to show debug prints.
  40. *
  41. * This option will add a lot to the size of the final sketch but is helpful to see what is actually
  42. * is happening during development.
  43. *
  44. * @note Values in parenthesis indicate default values which will be used if you have not defined
  45. * the flag in your sketch.
  46. */
  47. //#define MY_DEBUG
  48. /**
  49. * @def MY_DEBUGDEVICE
  50. * @brief Define MY_DEBUGDEVICE to redirect debug prints.
  51. *
  52. * If defined, MY_DEBUGDEVICE replaces MY_SERIALDEVICE for the purpose
  53. * of printing debug messages. This only applies to debugging.
  54. *
  55. * The intent is to provide the ability to send debugging messages
  56. * out a different serial port than what is being used for
  57. * communication between nodes or from gateway to controller when
  58. * this communication uses a serial interface. This assumes that
  59. * the MY_DEBUGDEVICE serial interface already exists. It can be a
  60. * hardware serial device or a software serial device.
  61. */
  62. //#define MY_DEBUGDEVICE
  63. /**
  64. * @def MY_DEBUG_OTA
  65. * @brief Define MY_DEBUG_OTA to redirect debug prints to given node ID
  66. *
  67. * With this option debugging messages over serial are disabled. It's not possible to send debug
  68. * messages generated by the radio. All other debug messages redirected to the given Node ID.
  69. * The debug messages are sent unsigned.
  70. *
  71. * This function allocates some additional memory for radio packet preparation and buffering.
  72. * Debug messages are sent to child ID 255 (NODE_SENSOR_ID) as I_LOG_MESSAGE type.
  73. *
  74. * You have to enable the MY_OTA_LOG_RECEIVER_FEATURE on the target node.
  75. * Look into the LogOTAGateway and LogOTANode examples.
  76. *
  77. * The output buffer can be configured via MY_SERIAL_OUTPUT_SIZE
  78. * Transport related debugging is disabled when MY_DEBUG_OTA is enabled.
  79. *
  80. */
  81. //#define MY_DEBUG_OTA (0)
  82. /**
  83. * @def MY_DEBUG_OTA_DISABLE_ACK
  84. * @brief Define MY_DEBUG_OTA_DISABLE_ACK to send messages with no ACK flag.
  85. *
  86. * This option reduces the latency added by OTA debug messages by sending packages
  87. * only once. You can loose debug messages.
  88. *
  89. */
  90. //#define MY_DEBUG_OTA_DISABLE_ACK
  91. /**
  92. * @def MY_OTA_LOG_RECEIVER_FEATURE
  93. * @brief Define this to enable printing of OTA logs.
  94. *
  95. * This option requires additional memory for buffering. The buffer size can be configured
  96. * via MY_SERIAL_OUTPUT_SIZE.
  97. */
  98. //#define MY_OTA_LOG_RECEIVER_FEATURE
  99. /**
  100. * @def MY_OTA_LOG_SENDER_FEATURE
  101. * @brief Define this to enable printing of OTA logs.
  102. *
  103. * This option requires additional memory for buffering. The buffer size can be configured
  104. * via MY_SERIAL_OUTPUT_SIZE.
  105. */
  106. //#define MY_OTA_LOG_SENDER_FEATURE
  107. /**
  108. * @def MY_SPECIAL_DEBUG
  109. * @brief Define MY_SPECIAL_DEBUG to enable support for I_DEBUG messages.
  110. *
  111. * I_DEBUG messages are sent from the controller to the node, which responds with the requested
  112. * data. The request can be one of the following:
  113. * - 'R': routing info (only repeaters): received msg XXYY (as stream), where XX is the node and YY
  114. * the routing node
  115. * - 'V': CPU voltage
  116. * - 'F': CPU frequency
  117. * - 'M': free memory
  118. * - 'E': clear MySensors EEPROM area and reboot (i.e. "factory" reset)
  119. */
  120. //#define MY_SPECIAL_DEBUG
  121. /**
  122. * @def MY_DISABLED_SERIAL
  123. * @brief Define MY_DISABLED_SERIAL if you want to use the UART TX/RX pins as normal I/O pins.
  124. *
  125. * @note When defined, if you want to use the pins as a UART, you need to handle initialization and
  126. * configuration yourself.
  127. */
  128. //#define MY_DISABLED_SERIAL
  129. /**
  130. * @def MY_SPLASH_SCREEN_DISABLED
  131. * @ingroup memorysavings
  132. * @brief If defined, will disable the MySensors splash screen.
  133. *
  134. * @note This saves 120 bytes of flash.
  135. */
  136. //#define MY_SPLASH_SCREEN_DISABLED
  137. /**
  138. * @def MY_BAUD_RATE
  139. * @brief Serial output baud rate (debug prints and serial gateway speed).
  140. *
  141. * The baud rate configured here must match the baud rate at the "other" end.
  142. *
  143. * @warning Depending on your target device and clock speed, certain baud rates might not work well.
  144. */
  145. #ifndef MY_BAUD_RATE
  146. #define MY_BAUD_RATE (115200ul)
  147. #endif
  148. /**
  149. * @def MY_SERIAL_OUTPUT_SIZE
  150. * @brief Maximum characters for serial output.
  151. *
  152. * If you are running extremely low on memory, reducing this size might just save your day.
  153. */
  154. #ifndef MY_SERIAL_OUTPUT_SIZE
  155. #define MY_SERIAL_OUTPUT_SIZE (120u)
  156. #endif
  157. /** @}*/ // End of SerialDebugGrpPub group
  158. /**
  159. * @def MY_DEBUG_VERBOSE_OTA_UPDATE
  160. * @brief Define this for verbose debug prints related to FOTA updates.
  161. */
  162. //#define MY_DEBUG_VERBOSE_OTA_UPDATE
  163. /**
  164. * @def MY_OTA_USE_I2C_EEPROM
  165. * @brief Define this if you want I2C EEPROM instead
  166. * of a SPI flash. Used EEPROM needs to be large enough, an 24(L)C256 will do as minimum.
  167. * HW I2C assumed. This will exclude the SPI flash code.
  168. * Note that you also need an updated DualOptiboot supporting I2C EEPROM!
  169. */
  170. //#define MY_OTA_USE_I2C_EEPROM
  171. #ifdef MY_OTA_USE_I2C_EEPROM
  172. // I2C address of EEPROM. Wire will shift this left, i.e. 0x50->0xA0
  173. #ifndef MY_OTA_I2C_ADDR
  174. #define MY_OTA_I2C_ADDR 0x50
  175. #endif
  176. #endif
  177. /**
  178. * @defgroup RadioSettingGrpPub Radio selection
  179. * @ingroup MyConfigGrp
  180. * @brief These options control what radio type to use and various radio specific customisations.
  181. * @{
  182. */
  183. /**
  184. * @defgroup RS485SettingGrpPub RS485
  185. * @ingroup RadioSettingGrpPub
  186. * @brief These options are specific to the RS485 wired transport.
  187. * @{
  188. */
  189. /**
  190. * @def MY_RS485
  191. * @brief Define this to use the RS485 wired transport for sensor network communication.
  192. */
  193. //#define MY_RS485
  194. /**
  195. * @def MY_RS485_BAUD_RATE
  196. * @brief The RS485 BAUD rate.
  197. */
  198. #ifndef MY_RS485_BAUD_RATE
  199. #define MY_RS485_BAUD_RATE (9600)
  200. #endif
  201. /**
  202. * @def MY_RS485_MAX_MESSAGE_LENGTH
  203. * @brief The maximum message length used for RS485.
  204. */
  205. #ifndef MY_RS485_MAX_MESSAGE_LENGTH
  206. #define MY_RS485_MAX_MESSAGE_LENGTH (40)
  207. #endif
  208. /**
  209. * @def MY_RS485_SOH_COUNT
  210. * @brief Use this in case of collisions on the bus. 3 might be a good setting.
  211. */
  212. #ifndef MY_RS485_SOH_COUNT
  213. #define MY_RS485_SOH_COUNT (1)
  214. #endif
  215. /**
  216. * @def MY_RS485_DE_PIN
  217. * @brief RS485 driver enable pin.
  218. */
  219. //#define MY_RS485_DE_PIN (2)
  220. /**
  221. * @def MY_RS485_HWSERIAL
  222. * @brief Define this if RS485 is connected to a hardware serial port.
  223. *
  224. * Example: @code #define MY_RS485_HWSERIAL Serial1 @endcode
  225. */
  226. //#define MY_RS485_HWSERIAL (Serial1)
  227. /** @}*/ // End of RS485SettingGrpPub group
  228. /**
  229. * @defgroup RF24SettingGrpPub RF24
  230. * @ingroup RadioSettingGrpPub
  231. * @brief These options are specific to the RF24 family of wireless transport modules.
  232. *
  233. * The following chips are supported by this driver:
  234. * | Vendor | Chip
  235. * |--------------------------|----------
  236. * | Nordic Semiconductor | nRF24L01
  237. * | | nRF24L01+
  238. * | Beken Corporation | BK2401
  239. * | | BK2421
  240. * | | BK2491
  241. * | Hope Microelectronics | RFM70
  242. * | | RFM73
  243. * | Panchip Microelectronics | XN297
  244. * | Silicon Labs(?) | SI24R1
  245. * @{
  246. */
  247. // legacy - remove for 3.0.0
  248. /**
  249. * @def MY_RADIO_NRF24
  250. * @brief Define this to use a RF24-based radio transport for sensor network communication.
  251. * @deprecated This flag is deprecated and replaced by @ref MY_RADIO_RF24
  252. */
  253. #ifdef MY_RADIO_NRF24
  254. #warning MY_RADIO_NRF24 is deprecated, use MY_RADIO_RF24 instead.
  255. #undef MY_RADIO_NRF24
  256. #define MY_RADIO_RF24
  257. #endif
  258. /**
  259. * @def MY_RADIO_RF24
  260. * @brief Define this to use a RF24-based radio transport for sensor network communication.
  261. */
  262. //#define MY_RADIO_RF24
  263. /**
  264. * @def MY_RF24_ENABLE_ENCRYPTION
  265. * @brief Define this to enable software based %AES encryption.
  266. *
  267. * All nodes and gateway must have this enabled, and all must be personalized with the same %AES
  268. * key.
  269. * @see @ref personalization
  270. *
  271. * @warning This driver always sets the initialization vector to 0 so encryption is weak.
  272. */
  273. //#define MY_RF24_ENABLE_ENCRYPTION
  274. /**
  275. * @def MY_DEBUG_VERBOSE_RF24
  276. * @brief Define this for verbose debug prints related to the RF24 driver.
  277. */
  278. //#define MY_DEBUG_VERBOSE_RF24
  279. /**
  280. * @def MY_RF24_SPI_SPEED
  281. * @brief Define this if you need to run the SPI clock at a different frequency than the default.
  282. *
  283. * Default nRF24L01+ SPI speed, 2MHz should be safe for nRF24L01+ clones.
  284. */
  285. #ifndef MY_RF24_SPI_SPEED
  286. #define MY_RF24_SPI_SPEED (2*1000000ul)
  287. #endif
  288. /**
  289. * @def MY_RF24_CE_PIN
  290. * @brief Define this to change the chip enable pin from the default.
  291. */
  292. #ifndef MY_RF24_CE_PIN
  293. #define MY_RF24_CE_PIN (DEFAULT_RF24_CE_PIN)
  294. #endif
  295. /**
  296. * @def MY_RF24_CS_PIN
  297. * @brief Define this to change the chip select pin from the default.
  298. */
  299. #ifndef MY_RF24_CS_PIN
  300. #define MY_RF24_CS_PIN (DEFAULT_RF24_CS_PIN)
  301. #endif
  302. /**
  303. * @def MY_RF24_IRQ_PIN
  304. * @brief Define this to use the IRQ pin of the RF24 module (optional).
  305. */
  306. //#define MY_RF24_IRQ_PIN (2)
  307. /**
  308. * @def MY_RF24_POWER_PIN
  309. * @brief Define this to use the RF24 power pin (optional).
  310. */
  311. //#define MY_RF24_POWER_PIN (3)
  312. /**
  313. * @def MY_RX_MESSAGE_BUFFER_FEATURE
  314. * @brief This enables the receiving buffer feature.
  315. *
  316. * This feature is currently not supported for anything but RF24.
  317. * Require @ref MY_RF24_IRQ_PIN to be set.
  318. */
  319. //#define MY_RX_MESSAGE_BUFFER_FEATURE
  320. /**
  321. * @def MY_RX_MESSAGE_BUFFER_SIZE
  322. * @brief Define this to change the incoming message buffer size from the default.
  323. *
  324. * Require @ref MY_RX_MESSAGE_BUFFER_FEATURE to be set.
  325. */
  326. #ifdef MY_RX_MESSAGE_BUFFER_FEATURE
  327. #ifndef MY_RX_MESSAGE_BUFFER_SIZE
  328. #define MY_RX_MESSAGE_BUFFER_SIZE (20)
  329. #endif
  330. #endif
  331. /**
  332. * @def MY_RF24_PA_LEVEL
  333. * @brief Default RF24 PA level. Override in sketch if needed.
  334. *
  335. * - RF24_PA_MIN = -18dBm
  336. * - RF24_PA_LOW = -12dBm
  337. * - RF24_PA_HIGH = -6dBm
  338. * - RF24_PA_MAX = 0dBm
  339. */
  340. #ifndef MY_RF24_PA_LEVEL
  341. #define MY_RF24_PA_LEVEL (RF24_PA_HIGH)
  342. #endif
  343. /**
  344. * @def MY_RF24_CHANNEL
  345. * @brief RF channel for the sensor net, 0-125.
  346. *
  347. * Frequencies: 2400 Mhz - 2525 Mhz
  348. *
  349. * Channels: 126
  350. * @see https://www.nordicsemi.com/eng/nordic/download_resource/8765/2/42877161/2726
  351. *
  352. * - 0 => 2400 Mhz (RF24 channel 1)
  353. * - 1 => 2401 Mhz (RF24 channel 2)
  354. * - 76 => 2476 Mhz (RF24 channel 77)
  355. * - 83 => 2483 Mhz (RF24 channel 84)
  356. * - 124 => 2524 Mhz (RF24 channel 125)
  357. * - 125 => 2525 Mhz (RF24 channel 126)
  358. *
  359. * In some countries there might be limitations, in Germany for example only the range
  360. * 2400,0 - 2483,5 Mhz is allowed.
  361. * @see http://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Frequenzen/Allgemeinzuteilungen/2013_10_WLAN_2,4GHz_pdf.pdf
  362. */
  363. #ifndef MY_RF24_CHANNEL
  364. #define MY_RF24_CHANNEL (76)
  365. #endif
  366. /**
  367. * @def MY_RF24_DATARATE
  368. * @brief RF24 data rate.
  369. *
  370. * - RF24_250KBPS for 250kbs
  371. * - RF24_1MBPS for 1Mbps
  372. * - RF24_2MBPS for 2Mbps.
  373. *
  374. * @note nRF24L01, BK2401, BK2421, BK2491 and XN297 does not support RF24_250KBPS
  375. * @note BK2401 does not support RF24_2MBPS
  376. */
  377. #ifndef MY_RF24_DATARATE
  378. #define MY_RF24_DATARATE (RF24_250KBPS)
  379. #endif
  380. /**
  381. * @def MY_RF24_BASE_RADIO_ID
  382. * @brief RF24 radio network identifier.
  383. *
  384. * This acts as base value for sensor nodeId addresses. Change this (or channel) if you have more
  385. * than one sensor network.
  386. */
  387. #ifndef MY_RF24_BASE_RADIO_ID
  388. #define MY_RF24_BASE_RADIO_ID 0x00,0xFC,0xE1,0xA8,0xA8
  389. #endif
  390. /**
  391. * @def MY_RF24_ADDR_WIDTH
  392. * @brief RF24 base address width.
  393. */
  394. #ifndef MY_RF24_ADDR_WIDTH
  395. #define MY_RF24_ADDR_WIDTH (5)
  396. #endif
  397. /** @}*/ // End of RF24SettingGrpPub group
  398. /**
  399. * @defgroup NRF5SettingGrpPub nRF5
  400. * @ingroup RadioSettingGrpPub
  401. * @brief These options are specific to the nRF5 (with Enhanced ShockBurst) family of wireless
  402. * transport modules.
  403. *
  404. * The nRF5 driver is OTA compatible with the RF24 driver.
  405. *
  406. * The following chips are supported by this driver:
  407. * - nRF51x22
  408. * - nRF52822
  409. *
  410. * @{
  411. */
  412. /**
  413. * @def MY_RADIO_NRF5_ESB
  414. * @brief Define this to use nRF5 based radios for sensor network communication.
  415. *
  416. * @see ARDUINO_ARCH_NRF5
  417. */
  418. //#define MY_RADIO_NRF5_ESB
  419. /**
  420. * @def MY_NRF5_ESB_ENABLE_ENCRYPTION
  421. * @brief Define this to enable software based (RF24 compatible) %AES encryption.
  422. *
  423. * All nodes and gateway must have this enabled, and all must be personalized with the same %AES
  424. * key.
  425. * @see @ref personalization
  426. *
  427. * @warning This driver always sets the initialization vector to 0 so encryption is weak.
  428. */
  429. //#define MY_NRF5_ESB_ENABLE_ENCRYPTION
  430. /**
  431. * @def MY_DEBUG_VERBOSE_NRF5_ESB
  432. * @brief Define this for verbose debug prints related to the nRF5 driver.
  433. */
  434. //#define MY_DEBUG_VERBOSE_NRF5_ESB
  435. /**
  436. * @def MY_NRF5_ESB_PA_LEVEL
  437. * @brief Default nRF5 PA level. Override in sketch if needed.
  438. *
  439. * - NRF5_PA_MIN = -40dBm
  440. * - NRF5_PA_LOW = -16dBm
  441. * - NRF5_PA_HIGH = 0dBm
  442. * - NRF5_PA_MAX = 4dBm
  443. */
  444. #ifndef MY_NRF5_ESB_PA_LEVEL
  445. #define MY_NRF5_ESB_PA_LEVEL (NRF5_PA_MAX)
  446. #endif
  447. /**
  448. * @def MY_NRF5_ESB_CHANNEL
  449. * @brief RF channel for the sensor net, 0-125.
  450. *
  451. * Frequencies: 2400 Mhz - 2525 Mhz
  452. *
  453. * Channels: 126
  454. * @see https://www.nordicsemi.com/eng/nordic/download_resource/8765/2/42877161/2726
  455. *
  456. * - 0 => 2400 Mhz (RF24 channel 1)
  457. * - 1 => 2401 Mhz (RF24 channel 2)
  458. * - 76 => 2476 Mhz (RF24 channel 77)
  459. * - 83 => 2483 Mhz (RF24 channel 84)
  460. * - 124 => 2524 Mhz (RF24 channel 125)
  461. * - 125 => 2525 Mhz (RF24 channel 126)
  462. *
  463. * In some countries there might be limitations, in Germany for example only the range
  464. * 2400,0 - 2483,5 Mhz is allowed.
  465. * @see http://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Frequenzen/Allgemeinzuteilungen/2013_10_WLAN_2,4GHz_pdf.pdf
  466. */
  467. #ifndef MY_NRF5_ESB_CHANNEL
  468. #define MY_NRF5_ESB_CHANNEL (76)
  469. #endif
  470. /**
  471. * @def MY_NRF5_ESB_MODE
  472. * @brief nRF5 mode.
  473. *
  474. * - NRF5_250KBPS for 250kbs (Deprecated)
  475. * - NRF5_1MBPS for 1Mbps
  476. * - NRF5_2MBPS for 2Mbps.
  477. * - NRF5_BLE_1MBPS for 1Mbps BLE modulation
  478. */
  479. #ifndef MY_NRF5_ESB_MODE
  480. #define MY_NRF5_ESB_MODE (NRF5_250KBPS)
  481. #endif
  482. /**
  483. * @def MY_NRF5_ESB_BASE_RADIO_ID
  484. * @brief nRF5 radio network identifier.
  485. *
  486. * This acts as base value for sensor nodeId addresses. Change this (or channel) if you have more
  487. * than one sensor network.
  488. */
  489. #ifndef MY_NRF5_ESB_BASE_RADIO_ID
  490. #define MY_NRF5_ESB_BASE_RADIO_ID 0x00, 0xFC, 0xE1, 0xA8, 0xA8
  491. #endif
  492. /**
  493. * @def MY_NRF5_ESB_ADDR_WIDTH
  494. * @brief nRF5 base address width.
  495. */
  496. #ifndef MY_NRF5_ESB_ADDR_WIDTH
  497. #define MY_NRF5_ESB_ADDR_WIDTH (5)
  498. #endif
  499. /**
  500. * @def MY_NRF5_ESB_RX_BUFFER_SIZE
  501. * @brief Declare the amount of incoming messages that can be buffered at driver level.
  502. */
  503. #ifndef MY_NRF5_ESB_RX_BUFFER_SIZE
  504. #define MY_NRF5_ESB_RX_BUFFER_SIZE (20)
  505. #endif
  506. /**
  507. * @def MY_NRF5_ESB_REVERSE_ACK_TX
  508. * @brief Switch to SI24R1 or faked nRF24L01+ compatible ACK mode. ACK bit is reversed on TX side.
  509. */
  510. //#define MY_NRF5_ESB_REVERSE_ACK_TX
  511. /**
  512. * @def MY_NRF5_ESB_REVERSE_ACK_RX
  513. * @brief Switch to SI24R1 or faked nRF24L01+ compatible ACK mode. ACK bit is reversed on RX side.
  514. */
  515. //#define MY_NRF5_ESB_REVERSE_ACK_RX
  516. /** @}*/ // End of NRF5SettingGrpPub group
  517. /**
  518. * @defgroup RFM69SettingGrpPub RFM69
  519. * @ingroup RadioSettingGrpPub
  520. * @brief These options are specific to the %RFM69 family of wireless transport modules.
  521. *
  522. * The following chips are supported by this driver:
  523. * - Semtech sx1231
  524. *
  525. * If using the HW variant of the %RFM69 module, define @ref MY_IS_RFM69HW.
  526. * @{
  527. */
  528. /**
  529. * @def MY_RADIO_RFM69
  530. * @brief Define this to use %RFM69 based radios for sensor network communication.
  531. */
  532. //#define MY_RADIO_RFM69
  533. /**
  534. * @def MY_DEBUG_VERBOSE_RFM69
  535. * @brief Define this for verbose debug prints related to the %RFM69 driver.
  536. */
  537. //#define MY_DEBUG_VERBOSE_RFM69
  538. /**
  539. * @def MY_DEBUG_VERBOSE_RFM69_REGISTERS
  540. * @brief Define this for verbose dumping of the %RFM69 registers.
  541. */
  542. //#define MY_DEBUG_VERBOSE_RFM69_REGISTERS
  543. /**
  544. * @def MY_RFM69_NEW_DRIVER
  545. * @brief Define this to enable the improved %RFM69 driver.
  546. *
  547. * @note This driver is not compatible with the old (=default) %RFM69 driver.
  548. */
  549. //#define MY_RFM69_NEW_DRIVER
  550. /**
  551. * @def MY_RFM69_FREQUENCY
  552. * @brief The frequency to use.
  553. *
  554. * - RFM69_315MHZ
  555. * - RFM69_433MHZ
  556. * - RFM69_865MHZ
  557. * - RFM69_868MHZ
  558. * - RFM69_915MHZ
  559. * - Custom frequency in Hz (new %RFM69 driver only)
  560. * @see MY_RFM69_NEW_DRIVER
  561. *
  562. * This must match the hardware version of the %RFM69 radio.
  563. * Additional information: https://en.wikipedia.org/wiki/Short_Range_Devices
  564. */
  565. #ifndef MY_RFM69_FREQUENCY
  566. #define MY_RFM69_FREQUENCY (RFM69_868MHZ)
  567. #endif
  568. /**
  569. * @def MY_IS_RFM69HW
  570. * @brief Define this if you are using the RFM69HW model.
  571. */
  572. //#define MY_IS_RFM69HW
  573. /**
  574. * @def MY_RFM69HW
  575. * @brief Set to true if @ref MY_IS_RFM69HW is set.
  576. *
  577. * @todo Mark this internals
  578. */
  579. #ifdef MY_IS_RFM69HW
  580. #define MY_RFM69HW true
  581. #else
  582. #define MY_RFM69HW false
  583. #endif
  584. /**
  585. * @def MY_RFM69_TX_POWER_DBM
  586. * @brief Set TX power level, default 5dBm (overridden if ATC mode enabled).
  587. */
  588. #ifndef MY_RFM69_TX_POWER_DBM
  589. #define MY_RFM69_TX_POWER_DBM (5)
  590. #endif
  591. /**
  592. * @def MY_RFM69_ATC_TARGET_RSSI_DBM
  593. * @brief Target RSSI level (in dBm) for %RFM69 ATC mode.
  594. */
  595. #ifndef MY_RFM69_ATC_TARGET_RSSI_DBM
  596. #define MY_RFM69_ATC_TARGET_RSSI_DBM (-80)
  597. #endif
  598. /**
  599. * @def MY_RFM69_ATC_MODE_DISABLED
  600. * @brief Define to disable ATC mode of %RFM69 driver.
  601. */
  602. //#define MY_RFM69_ATC_MODE_DISABLED
  603. /**
  604. * @def MY_RFM69_MAX_POWER_LEVEL_DBM
  605. * @brief Set max TX power in dBm if local legislation requires this
  606. *
  607. * - 1mW = 0dBm
  608. * - 10mW = 10dBm
  609. * - 25mW = 14dBm
  610. * - 100mW = 20dBm
  611. *
  612. * See here: https://en.wikipedia.org/wiki/Short_Range_Devices
  613. */
  614. //#define MY_RFM69_MAX_POWER_LEVEL_DBM (10u)
  615. /**
  616. * @def MY_RFM69_NETWORKID
  617. * @brief %RFM69 Network ID. Use the same for all nodes that will talk to each other.
  618. */
  619. #ifndef MY_RFM69_NETWORKID
  620. #define MY_RFM69_NETWORKID (100)
  621. #endif
  622. /**
  623. * @def MY_RFM69_RST_PIN
  624. * @brief Define this to use the %RFM69 reset pin (optional).
  625. */
  626. //#define MY_RFM69_RST_PIN (9)
  627. #ifdef MY_RF69_RESET
  628. // legacy, older board files
  629. // not enabled now: #warning MY_RF69_RESET is depreciated, please use MY_RFM69_RST_PIN instead.
  630. #define MY_RFM69_RST_PIN MY_RF69_RESET
  631. #endif
  632. /**
  633. * @def MY_RFM69_POWER_PIN
  634. * @brief Define this to use the %RFM69 power pin (optional).
  635. */
  636. //#define MY_RFM69_POWER_PIN (3)
  637. /**
  638. * @def MY_RFM69_IRQ_PIN
  639. * @brief Define this to override the default %RFM69 IRQ pin assignment.
  640. */
  641. #ifndef MY_RFM69_IRQ_PIN
  642. #ifdef MY_RF69_IRQ_PIN
  643. // legacy, older board files
  644. // not enabled now: #warning MY_RF69_IRQ_PIN is depreciated, please use MY_RFM69_IRQ_PIN instead.
  645. #define MY_RFM69_IRQ_PIN MY_RF69_IRQ_PIN
  646. #else
  647. #define MY_RFM69_IRQ_PIN DEFAULT_RFM69_IRQ_PIN
  648. #endif
  649. #endif
  650. /**
  651. * @def MY_RFM69_IRQ_NUM
  652. * @brief %RFM69 IRQ number.
  653. */
  654. #ifndef MY_RFM69_IRQ_NUM
  655. #ifdef MY_RF69_IRQ_NUM
  656. // legacy, older board files
  657. // not enabled now: #warning MY_RF69_IRQ_NUM is depreciated, please use MY_RFM69_IRQ_NUM instead.
  658. #define MY_RFM69_IRQ_NUM MY_RF69_IRQ_NUM
  659. #else
  660. #define MY_RFM69_IRQ_NUM digitalPinToInterrupt(MY_RFM69_IRQ_PIN)
  661. #endif
  662. #endif
  663. /**
  664. * @def MY_RFM69_CS_PIN
  665. * @brief %RFM69 SPI chip select pin.
  666. */
  667. #ifndef MY_RFM69_CS_PIN
  668. #ifdef MY_RF69_SPI_CS
  669. // legacy, older board files
  670. // not enabled now: #warning MY_RF69_SPI_CS is depreciated, please use MY_RFM69_CS_PIN instead.
  671. #define MY_RFM69_CS_PIN MY_RF69_SPI_CS
  672. #else
  673. #define MY_RFM69_CS_PIN DEFAULT_RFM69_CS_PIN
  674. #endif
  675. #endif
  676. /**
  677. * @def MY_RFM69_SPI_SPEED
  678. * @brief Set to overrule default RFM69 SPI speed.
  679. */
  680. #ifndef MY_RFM69_SPI_SPEED
  681. #define MY_RFM69_SPI_SPEED (4*1000000ul) // datasheet says 10Mhz max.
  682. #endif
  683. /**
  684. * @def MY_RFM69_ENABLE_ENCRYPTION
  685. * @brief Define this to enable %AES encryption in the %RFM69 module.
  686. *
  687. * All nodes and gateway must have this enabled, and all must be personalized with the same %AES
  688. * key.
  689. * @see @ref personalization
  690. */
  691. //#define MY_RFM69_ENABLE_ENCRYPTION
  692. /**
  693. * @def MY_RFM69_ENABLE_LISTENMODE
  694. * @brief Define this if you need listenmode, or skip it to save memory
  695. */
  696. //#define MY_RFM69_ENABLE_LISTENMODE
  697. #if defined(MY_RFM69_ENABLE_LISTENMODE) && !defined(MY_RFM69_DEFAULT_LISTEN_RX_US)
  698. // By default, receive for 256uS in listen mode and idle for ~1s
  699. #define MY_RFM69_DEFAULT_LISTEN_RX_US (256)
  700. #endif
  701. #if defined(MY_RFM69_ENABLE_LISTENMODE) && !defined(MY_RFM69_DEFAULT_LISTEN_IDLE_US)
  702. // By default, receive for 256uS in listen mode and idle for ~1s
  703. #define MY_RFM69_DEFAULT_LISTEN_IDLE_US (1*1000000ul)
  704. #endif
  705. /**
  706. * @def MY_RFM69_MODEM_CONFIGURATION
  707. * @brief %RFM69 modem configuration, default is %RFM69_FSK_BR55_5_FD50
  708. *
  709. * | Configuration | Modulation (xxx) | Bit rate | FD | RXBW | Additional settings
  710. * |-------------------------|------------------|----------|--------|----------|---------------------------
  711. * | RFM69_xxx_BR2_FD5 | FSK/GFSK/OOK | 2000 | 5000 | 111_24_4 | Whitening
  712. * | RFM69_xxx_BR2_4_FD4_8 | FSK/GFSK/OOK | 2400 | 4800 | 111_24_4 | Whitening
  713. * | RFM69_xxx_BR4_8_FD9_6 | FSK/GFSK/OOK | 4800 | 9600 | 111_24_4 | Whitening
  714. * | RFM69_xxx_BR9_6_FD19_2 | FSK/GFSK/OOK | 9600 | 19200 | 111_24_4 | Whitening
  715. * | RFM69_xxx_BR19_2_FD38_4 | FSK/GFSK/OOK | 19200 | 38400 | 111_24_3 | Whitening
  716. * | RFM69_xxx_BR38_4_FD76_8 | FSK/GFSK/OOK | 38400 | 76800 | 111_24_2 | Whitening
  717. * | RFM69_xxx_BR55_5_FD50 | FSK/GFSK/OOK | 55555 | 50000 | 111_16_2 | Whitening
  718. * | RFM69_xxx_BR57_6_FD120 | FSK/GFSK/OOK | 57600 | 120000 | 111_16_1 | Whitening
  719. * | RFM69_xxx_BR125_FD125 | FSK/GFSK/OOK | 125000 | 125000 | 010_16_2 | Whitening
  720. * | RFM69_xxx_BR250_FD250 | FSK/GFSK/OOK | 250000 | 250000 | 111_16_0 | Whitening
  721. *
  722. * https://www.semtech.com/uploads/documents/sx1231.pdf
  723. *
  724. */
  725. //#define MY_RFM69_MODEM_CONFIGURATION (RFM69_FSK_BR55_5_FD50)
  726. /** @}*/ // End of RFM69SettingGrpPub group
  727. /**
  728. * @defgroup RFM95SettingGrpPub RFM95
  729. * @ingroup RadioSettingGrpPub
  730. * @brief These options are specific to the %RFM95 family of wireless transport modules.
  731. *
  732. * The following chips are supported by this driver:
  733. * - Semtech sx1276
  734. * @{
  735. */
  736. /**
  737. * @def MY_RADIO_RFM95
  738. * @brief Define this to use RFM95 based radios for sensor network communication.
  739. */
  740. //#define MY_RADIO_RFM95
  741. /**
  742. * @def MY_DEBUG_VERBOSE_RFM95
  743. * @brief Define this for verbose debug prints related to the RFM95 driver.
  744. */
  745. //#define MY_DEBUG_VERBOSE_RFM95
  746. /**
  747. * @def MY_RFM95_ENABLE_ENCRYPTION
  748. * @brief Define this to enable software based %AES encryption.
  749. *
  750. * All nodes and gateway must have this enabled, and all must be personalized with the same %AES
  751. * key.
  752. * @see @ref personalization
  753. *
  754. * @warning This driver always sets the initialization vector to 0 so encryption is weak.
  755. */
  756. //#define MY_RFM95_ENABLE_ENCRYPTION
  757. /**
  758. * @def MY_RFM95_FREQUENCY
  759. * @brief The frequency to use.
  760. *
  761. * - RFM95_169MHZ
  762. * - RFM95_315MHZ
  763. * - RFM95_434MHZ
  764. * - RFM95_868MHZ
  765. * - RFM95_915MHZ
  766. * - Custom frequency in Hz
  767. *
  768. * This must match the hardware version of the RFM95 radio.
  769. * Additional information: https://en.wikipedia.org/wiki/Short_Range_Devices
  770. */
  771. #ifndef MY_RFM95_FREQUENCY
  772. #define MY_RFM95_FREQUENCY (RFM95_868MHZ)
  773. #endif
  774. /**
  775. * @def MY_RFM95_MODEM_CONFIGRUATION
  776. * @brief RFM95 modem configuration.
  777. *
  778. * BW = Bandwidth in kHz
  779. * CR = Error correction code
  780. * SF = Spreading factor, chips / symbol
  781. *
  782. * | CONFIG | BW | CR | SF | Comment
  783. * |------------------------|-------|-----|------|-----------------------------
  784. * | RFM95_BW125CR45SF128 | 125 | 4/5 | 128 | Default, medium range
  785. * | RFM95_BW500CR45SF128 | 500 | 4/5 | 128 | Fast, short range
  786. * | RFM95_BW31_25CR48SF512 | 31.25 | 4/8 | 512 | Slow, long range
  787. * | RFM95_BW125CR48SF4096 | 125 | 4/8 | 4096 | Slow, long range
  788. *
  789. */
  790. #ifndef MY_RFM95_MODEM_CONFIGRUATION
  791. #define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128
  792. #endif
  793. /**
  794. * @def MY_RFM95_RST_PIN
  795. * @brief Define this to use the RFM95 reset pin (optional).
  796. */
  797. //#define MY_RFM95_RST_PIN (9)
  798. /**
  799. * @def MY_RFM95_POWER_PIN
  800. * @brief Define this to use the RFM95 power pin (optional).
  801. */
  802. //#define MY_RFM95_POWER_PIN (3)
  803. /**
  804. * @def MY_RFM95_IRQ_PIN
  805. * @brief Define this to use the RFM95 IRQ pin.
  806. */
  807. #ifndef MY_RFM95_IRQ_PIN
  808. #define MY_RFM95_IRQ_PIN DEFAULT_RFM95_IRQ_PIN
  809. #endif
  810. /**
  811. * @def MY_RFM95_IRQ_NUM
  812. * @brief RFM95 IRQ number.
  813. */
  814. #ifndef MY_RFM95_IRQ_NUM
  815. #define MY_RFM95_IRQ_NUM digitalPinToInterrupt(MY_RFM95_IRQ_PIN)
  816. #endif
  817. /**
  818. * @def MY_RFM95_CS_PIN
  819. * @brief RFM95 SPI chip select pin.
  820. */
  821. #ifndef MY_RFM95_CS_PIN
  822. #define MY_RFM95_CS_PIN DEFAULT_RFM95_CS_PIN
  823. #endif
  824. /**
  825. * @def MY_RFM95_SPI_SPEED
  826. * @brief Set to overrule default RFM95 SPI speed.
  827. */
  828. #ifndef MY_RFM95_SPI_SPEED
  829. #define MY_RFM95_SPI_SPEED (4*1000000ul)
  830. #endif
  831. /**
  832. * @def MY_RFM95_TX_POWER_DBM
  833. * @brief Set TX power level, default 13dBm (overridden if ATC mode enabled)
  834. *
  835. * See here https://en.wikipedia.org/wiki/Short_Range_Devices
  836. */
  837. #ifndef MY_RFM95_TX_POWER_DBM
  838. #define MY_RFM95_TX_POWER_DBM (13u) // 20mW
  839. #endif
  840. /**
  841. * @def MY_RFM95_ATC_MODE_DISABLED
  842. * @brief Define to disable ATC mode of RFM95 driver.
  843. */
  844. //#define MY_RFM95_ATC_MODE_DISABLED
  845. /**
  846. * @def MY_RFM95_ATC_TARGET_RSSI
  847. * @brief Target RSSI level (in dBm) for RFM95 ATC mode
  848. */
  849. #ifndef MY_RFM95_ATC_TARGET_RSSI
  850. #define MY_RFM95_ATC_TARGET_RSSI (-70)
  851. #endif
  852. /**
  853. * @def MY_RFM95_MAX_POWER_LEVEL_DBM
  854. * @brief Set max TX power in dBm if local legislation requires this
  855. *
  856. * - 1mW = 0dBm
  857. * - 10mW = 10dBm
  858. * - 25mW = 14dBm
  859. * - 100mW = 20dBm
  860. *
  861. * See here: https://en.wikipedia.org/wiki/Short_Range_Devices
  862. */
  863. //#define MY_RFM95_MAX_POWER_LEVEL_DBM (10u)
  864. /**
  865. * @def MY_RFM95_TCXO
  866. * @brief Enable to force your radio to use an external frequency source (e.g. TCXO, if present).
  867. *
  868. * This allows for better stability using SF 9 to 12.
  869. */
  870. //#define MY_RFM95_TCXO
  871. /** @}*/ // End of RFM95SettingGrpPub group
  872. /**
  873. * @defgroup SoftSpiSettingGrpPub Soft SPI
  874. * @ingroup RadioSettingGrpPub
  875. * @brief These options are specific the soft SPI driver for certain radio transport drivers.
  876. *
  877. * The following transport drivers supported by this driver:
  878. * - The RF24 driver @see RF24SettingGrpPub
  879. * - The new %RFM69 driver @see RFM69SettingGrpPub @see MY_RFM69_NEW_DRIVER
  880. * - The RFM95 driver @see RFM95SettingGrpPub
  881. * @{
  882. */
  883. /**
  884. * @def MY_SOFTSPI
  885. * @brief Define this to use a software based SPI driver which allows more freedom in pin selection
  886. * for the (supported) radio module.
  887. */
  888. //#define MY_SOFTSPI
  889. /**
  890. * @def MY_SOFT_SPI_SCK_PIN
  891. * @brief Soft SPI SCK pin.
  892. */
  893. #ifndef MY_SOFT_SPI_SCK_PIN
  894. #define MY_SOFT_SPI_SCK_PIN (14)
  895. #endif
  896. /**
  897. * @def MY_SOFT_SPI_MISO_PIN
  898. * @brief Soft SPI MISO pin.
  899. */
  900. #ifndef MY_SOFT_SPI_MISO_PIN
  901. #define MY_SOFT_SPI_MISO_PIN (16)
  902. #endif
  903. /**
  904. * @def MY_SOFT_SPI_MOSI_PIN
  905. * @brief Soft SPI MOSI pin.
  906. */
  907. #ifndef MY_SOFT_SPI_MOSI_PIN
  908. #define MY_SOFT_SPI_MOSI_PIN (15)
  909. #endif
  910. /** @}*/ // End of SoftSpiSettingGrpPub group
  911. /** @}*/ // End of RadioSettingGrpPub group
  912. /**
  913. * @defgroup RoutingNodeSettingGrpPub Routing and node
  914. * @ingroup MyConfigGrp
  915. * @brief These options control message routing and node configurations.
  916. * @{
  917. */
  918. /**
  919. * @def MY_DISABLE_RAM_ROUTING_TABLE_FEATURE
  920. * @ingroup memorysavings
  921. * @brief If defined, routing table will not be kept in RAM.
  922. * @see MY_RAM_ROUTING_TABLE_FEATURE
  923. */
  924. /**
  925. * @def MY_RAM_ROUTING_TABLE_FEATURE
  926. * @brief If enabled, the routing table is kept in RAM (if memory allows) and saved in regular
  927. * intervals.
  928. * @note Enabled by default on most platforms, but on AVR only for atmega1280, atmega1284 and
  929. * atmega2560.
  930. * @see MY_DISABLE_RAM_ROUTING_TABLE_FEATURE
  931. */
  932. #ifndef MY_DISABLE_RAM_ROUTING_TABLE_FEATURE
  933. #define MY_RAM_ROUTING_TABLE_FEATURE
  934. #endif
  935. /**
  936. * @def MY_ROUTING_TABLE_SAVE_INTERVAL_MS
  937. * @brief Interval to dump content of routing table to EEPROM
  938. */
  939. #ifndef MY_ROUTING_TABLE_SAVE_INTERVAL_MS
  940. #define MY_ROUTING_TABLE_SAVE_INTERVAL_MS (30*60*1000ul)
  941. #endif
  942. /**
  943. * @def MY_REPEATER_FEATURE
  944. * @brief Enables repeater functionality (relays messages from other nodes)
  945. * @note Repeaters need to be constantly kept awake to be useful. They are therefore not suitable
  946. * for battery powered operation.
  947. */
  948. //#define MY_REPEATER_FEATURE
  949. /**
  950. * @def MY_PASSIVE_NODE
  951. * @brief If enabled, the node operates fully autonomously, i.e. messages are sent without ACKing.
  952. *
  953. * @note All transport-related checks and safety-mechanisms are disabled.
  954. * @note Requires that @ref MY_NODE_ID is set, @ref MY_PARENT_NODE_ID and
  955. * @ref MY_PARENT_NODE_IS_STATIC are optional.
  956. * @note Singing, registration, and OTA FW update are disabled.
  957. */
  958. //#define MY_PASSIVE_NODE
  959. /**
  960. * @def MY_NODE_ID
  961. * @brief Node id defaults to AUTO (tries to fetch id from controller).
  962. */
  963. #ifndef MY_NODE_ID
  964. #define MY_NODE_ID (AUTO)
  965. #endif
  966. /**
  967. * @def MY_PARENT_NODE_ID
  968. * @brief Node parent defaults to AUTO (tries to find a parent automatically).
  969. */
  970. #ifndef MY_PARENT_NODE_ID
  971. #define MY_PARENT_NODE_ID (AUTO)
  972. #endif
  973. /**
  974. * @def MY_PARENT_NODE_IS_STATIC
  975. * @brief Define MY_PARENT_NODE_IS_STATIC to disable fall back if parent node fails
  976. */
  977. //#define MY_PARENT_NODE_IS_STATIC
  978. /**
  979. * @def MY_TRANSPORT_SANITY_CHECK
  980. * @brief If defined, will cause node to check transport in regular intervals to detect HW issues
  981. * and re-initialize in case of failure.
  982. * @note This feature is enabled for all repeater nodes (incl. GW)
  983. */
  984. //#define MY_TRANSPORT_SANITY_CHECK
  985. /**
  986. * @def MY_TRANSPORT_SANITY_CHECK_INTERVAL_MS
  987. * @brief Interval (in ms) for transport sanity checks
  988. */
  989. #ifndef MY_TRANSPORT_SANITY_CHECK_INTERVAL_MS
  990. #define MY_TRANSPORT_SANITY_CHECK_INTERVAL_MS (15*60*1000ul)
  991. #endif
  992. /**
  993. * @def MY_TRANSPORT_DISCOVERY_INTERVAL_MS
  994. * @brief This is a gateway-only feature: Interval (in ms) to issue network discovery checks
  995. */
  996. #ifndef MY_TRANSPORT_DISCOVERY_INTERVAL_MS
  997. #define MY_TRANSPORT_DISCOVERY_INTERVAL_MS (20*60*1000ul)
  998. #endif
  999. /**
  1000. *@def MY_TRANSPORT_UPLINK_CHECK_DISABLED
  1001. *@brief If defined, disables uplink check to GW during transport initialisation
  1002. */
  1003. //#define MY_TRANSPORT_UPLINK_CHECK_DISABLED
  1004. /**
  1005. *@def MY_TRANSPORT_MAX_TX_FAILURES
  1006. *@brief Define to override max. consecutive TX failures until SNP is initiated
  1007. */
  1008. //#define MY_TRANSPORT_MAX_TX_FAILURES (10u)
  1009. /**
  1010. * @def MY_TRANSPORT_WAIT_READY_MS
  1011. * @brief Timeout in ms until transport is ready during startup, set to 0 for no timeout
  1012. */
  1013. #ifndef MY_TRANSPORT_WAIT_READY_MS
  1014. #define MY_TRANSPORT_WAIT_READY_MS (0)
  1015. #endif
  1016. /**
  1017. * @def MY_SIGNAL_REPORT_ENABLED
  1018. * @brief Enables signal report functionality.
  1019. * @note This feature adds ~1kB code to the sketch.
  1020. */
  1021. //#define MY_SIGNAL_REPORT_ENABLED
  1022. /** @}*/ // End of RoutingNodeSettingGrpPub group
  1023. /**
  1024. * @defgroup RegistrationSettingGrpPub Node registration
  1025. * @ingroup MyConfigGrp
  1026. * @brief These options control node registration configurations.
  1027. * @{
  1028. */
  1029. /**
  1030. * @def MY_REGISTRATION_FEATURE
  1031. * @brief If enabled, node has to register to GW/controller before being allowed to send sensor
  1032. * data.
  1033. * @note Enabled by default.
  1034. */
  1035. #define MY_REGISTRATION_FEATURE
  1036. /**
  1037. * @def MY_REGISTRATION_RETRIES
  1038. * @brief Number of registration retries if no reply received from GW/controller.
  1039. */
  1040. #ifndef MY_REGISTRATION_RETRIES
  1041. #define MY_REGISTRATION_RETRIES (3u)
  1042. #endif
  1043. /**
  1044. * @def MY_REGISTRATION_DEFAULT
  1045. * @brief Node registration default - this applies if no registration response is received from
  1046. * controller.
  1047. */
  1048. #define MY_REGISTRATION_DEFAULT (true)
  1049. /**
  1050. * @def MY_REGISTRATION_CONTROLLER
  1051. * @brief If defined, node registration request has to be handled by controller
  1052. */
  1053. //#define MY_REGISTRATION_CONTROLLER
  1054. /** @}*/ // End of RegistrationSettingGrpPub group
  1055. /**
  1056. * @defgroup CoreSettingGrpPub Core
  1057. * @ingroup MyConfigGrp
  1058. * @brief These options control the library core configurations.
  1059. * @{
  1060. */
  1061. /**
  1062. * @def MY_CORE_ONLY
  1063. * @brief Define this if you want to use core functions without loading the framework.
  1064. */
  1065. //#define MY_CORE_ONLY
  1066. /**
  1067. * @def MY_CORE_COMPATIBILITY_CHECK
  1068. * @brief If defined, library compatibility is checked during node registration.
  1069. * Incompatible libraries are unable to send sensor data.
  1070. */
  1071. #define MY_CORE_COMPATIBILITY_CHECK
  1072. /** @}*/ // End of CoreSettingGrpPub group
  1073. /**
  1074. * @defgroup SleepSettingGrpPub Sleep
  1075. * @ingroup MyConfigGrp
  1076. * @brief These options control sleep configurations.
  1077. * @{
  1078. */
  1079. /**
  1080. * @def MY_SLEEP_TRANSPORT_RECONNECT_TIMEOUT_MS
  1081. * @brief Timeout (in ms) to re-establish link if node is send to sleep and transport is not ready.
  1082. */
  1083. #ifndef MY_SLEEP_TRANSPORT_RECONNECT_TIMEOUT_MS
  1084. #define MY_SLEEP_TRANSPORT_RECONNECT_TIMEOUT_MS (10*1000ul)
  1085. #endif
  1086. /**
  1087. * @def MY_SMART_SLEEP_WAIT_DURATION_MS
  1088. * @brief The wait period (in ms) before going to sleep when using smartSleep-functions.
  1089. *
  1090. * This period has to be long enough for controller to be able to send out
  1091. * potential buffered messages.
  1092. */
  1093. #ifndef MY_SMART_SLEEP_WAIT_DURATION_MS
  1094. #define MY_SMART_SLEEP_WAIT_DURATION_MS (500ul)
  1095. #endif
  1096. /** @}*/ // End of SleepSettingGrpPub group
  1097. /**
  1098. * @defgroup OTASettingGrpPub Over The Air firmware
  1099. * @ingroup MyConfigGrp
  1100. * @brief These options control OTA firmware configurations.
  1101. * @{
  1102. */
  1103. /**
  1104. * @def MY_OTA_FIRMWARE_FEATURE
  1105. * @brief Define this in sketch to allow safe over-the-air firmware updates.
  1106. *
  1107. * This feature requires external flash and the DualOptiBoot boot-loader.
  1108. * @note You can still have OTA FW updates without external flash but it
  1109. * requires the MYSBootloader and you must not define this flag.
  1110. */
  1111. //#define MY_OTA_FIRMWARE_FEATURE
  1112. /**
  1113. * @def MY_OTA_FLASH_SS
  1114. * @brief Slave select pin for external flash used for OTA.
  1115. */
  1116. #ifndef MY_OTA_FLASH_SS
  1117. #define MY_OTA_FLASH_SS (8)
  1118. #endif
  1119. /**
  1120. * @def MY_OTA_FLASH_JDECID
  1121. * @brief Flash JDECID used for OTA. Use (0x00) if unknown.
  1122. */
  1123. #ifndef MY_OTA_FLASH_JDECID
  1124. #define MY_OTA_FLASH_JDECID (0x1F65)
  1125. #endif
  1126. /**
  1127. * @def MY_DISABLE_REMOTE_RESET
  1128. * @brief Disables over-the-air reset of node
  1129. */
  1130. //#define MY_DISABLE_REMOTE_RESET
  1131. /** @}*/ // End of OTASettingGrpPub group
  1132. /**
  1133. * @defgroup GatewaySettingGrpPub Gateway
  1134. * @ingroup MyConfigGrp
  1135. * @brief These options control gateway specific configurations.
  1136. * @{
  1137. */
  1138. /**
  1139. * @def MY_GATEWAY_MAX_RECEIVE_LENGTH
  1140. * @brief Max buffersize needed for messages coming from controller.
  1141. */
  1142. #ifndef MY_GATEWAY_MAX_RECEIVE_LENGTH
  1143. #define MY_GATEWAY_MAX_RECEIVE_LENGTH (100u)
  1144. #endif
  1145. /**
  1146. * @def MY_GATEWAY_MAX_SEND_LENGTH
  1147. * @brief Max buffer size when sending messages.
  1148. */
  1149. #ifndef MY_GATEWAY_MAX_SEND_LENGTH
  1150. #define MY_GATEWAY_MAX_SEND_LENGTH (120u)
  1151. #endif
  1152. /**
  1153. * @def MY_GATEWAY_MAX_CLIENTS
  1154. * @brief Max number of parallel clients (sever mode).
  1155. */
  1156. #ifndef MY_GATEWAY_MAX_CLIENTS
  1157. #define MY_GATEWAY_MAX_CLIENTS (1u)
  1158. #endif
  1159. /**
  1160. * @def MY_INCLUSION_MODE_FEATURE
  1161. * @brief Define this to enable the inclusion mode feature.
  1162. */
  1163. //#define MY_INCLUSION_MODE_FEATURE
  1164. /**
  1165. * @def MY_INCLUSION_BUTTON_FEATURE
  1166. * @brief Enables inclusion-mode button feature on the gateway device.
  1167. *
  1168. * With this defined, you can put the GW in inclusion mode by pressing a button attached to the GW.
  1169. */
  1170. //#define MY_INCLUSION_BUTTON_FEATURE
  1171. // Disable inclusion mode button if inclusion mode feature is not enabled
  1172. #ifndef MY_INCLUSION_MODE_FEATURE
  1173. #undef MY_INCLUSION_BUTTON_FEATURE
  1174. #endif
  1175. /**
  1176. * @def MY_INCLUSION_LED_PIN
  1177. * @brief Enables an inclusion mode LED indicator on the gateway device.
  1178. *
  1179. * With this defined, inclusion mode status (on or off) is indicated by the LED.
  1180. * This feature obeys @ref MY_WITH_LEDS_BLINKING_INVERSE
  1181. */
  1182. //#define MY_INCLUSION_LED_PIN (7)
  1183. /**
  1184. * @def MY_INCLUSION_MODE_BUTTON_PIN
  1185. * @brief The default input pin used for the inclusion mode button.
  1186. */
  1187. #ifndef MY_INCLUSION_MODE_BUTTON_PIN
  1188. #if defined(ARDUINO_ARCH_ESP8266)
  1189. #define MY_INCLUSION_MODE_BUTTON_PIN (5)
  1190. #else
  1191. #define MY_INCLUSION_MODE_BUTTON_PIN (3)
  1192. #endif
  1193. #endif
  1194. /**
  1195. * @def MY_INCLUSION_MODE_DURATION
  1196. * @brief Number of seconds inclusion mode should be enabled.
  1197. */
  1198. #ifndef MY_INCLUSION_MODE_DURATION
  1199. #define MY_INCLUSION_MODE_DURATION (60)
  1200. #endif
  1201. /**
  1202. * @def MY_INCLUSION_BUTTON_EXTERNAL_PULLUP
  1203. * @brief Define this to change the default state for @ref MY_INCLUSION_BUTTON_PRESSED.
  1204. */
  1205. /**
  1206. * @def MY_INCLUSION_BUTTON_PRESSED
  1207. * @brief The logical level indicating a pressed inclusion mode button.
  1208. *
  1209. * If @ref MY_INCLUSION_BUTTON_EXTERNAL_PULLUP is defined, this defaults to HIGH.
  1210. */
  1211. #if defined(MY_INCLUSION_BUTTON_EXTERNAL_PULLUP)
  1212. #define MY_INCLUSION_BUTTON_PRESSED (HIGH)
  1213. #else
  1214. #define MY_INCLUSION_BUTTON_PRESSED (LOW)
  1215. #endif
  1216. /**************************************
  1217. * Ethernet Gateway Transport Defaults
  1218. ***************************************/
  1219. /**
  1220. * @def MY_GATEWAY_W5100
  1221. * @brief Define this for Ethernet GW based on the W5100 module.
  1222. * @def MY_GATEWAY_ENC28J60
  1223. * @brief Define this for Ethernet GW based on the ENC28J60 module.
  1224. * @def MY_GATEWAY_ESP8266
  1225. * @brief Define this for Ethernet GW based on the ESP8266.
  1226. * @def MY_GATEWAY_ESP32
  1227. * @brief Define this for Ethernet GW based on the ESP32.
  1228. * @def MY_GATEWAY_LINUX
  1229. * @brief Define this for Ethernet GW based on Linux.
  1230. * @def MY_GATEWAY_TINYGSM
  1231. * @brief Define this for Ethernet GW based on GSM modems supported by TinyGSM library.
  1232. * @def MY_GATEWAY_MQTT_CLIENT
  1233. * @brief Define this for MQTT client GW.
  1234. * @def MY_GATEWAY_SERIAL
  1235. * @brief Define this for Serial GW.
  1236. */
  1237. // The gateway options available
  1238. //#define MY_GATEWAY_W5100
  1239. //#define MY_GATEWAY_ENC28J60
  1240. //#define MY_GATEWAY_ESP8266
  1241. //#define MY_GATEWAY_ESP32
  1242. //#define MY_GATEWAY_LINUX
  1243. //#define MY_GATEWAY_TINYGSM
  1244. //#define MY_GATEWAY_MQTT_CLIENT
  1245. //#define MY_GATEWAY_SERIAL
  1246. /**
  1247. * @def MY_DEBUG_VERBOSE_GATEWAY
  1248. * @brief Define this for verbose debug prints related to the gateway transport.
  1249. */
  1250. //#define MY_DEBUG_VERBOSE_GATEWAY
  1251. /**
  1252. * @def MY_WIFI_SSID
  1253. * @brief SSID of your WiFi network
  1254. */
  1255. //#define MY_WIFI_SSID "MySSID"
  1256. /**
  1257. * @def MY_WIFI_BSSID
  1258. * @brief BSSID of your WiFi network
  1259. */
  1260. //#define MY_WIFI_BSSID "MyBSSID"
  1261. /**
  1262. * @def MY_WIFI_PASSWORD
  1263. * @brief Password of your WiFi network
  1264. */
  1265. //#define MY_WIFI_PASSWORD "MyVerySecretPassword"
  1266. /**
  1267. * @def MY_HOSTNAME
  1268. * @brief Hostname of your device
  1269. */
  1270. //#define MY_HOSTNAME "MyHostname"
  1271. /**
  1272. * @def MY_PORT
  1273. * @brief The Ethernet TCP/UDP port to open on controller or gateway.
  1274. */
  1275. #ifndef MY_PORT
  1276. #ifdef MY_GATEWAY_MQTT_CLIENT
  1277. #define MY_PORT 1883
  1278. #else
  1279. #define MY_PORT 5003
  1280. #endif
  1281. #endif
  1282. /**
  1283. * @def MY_MQTT_CLIENT_PUBLISH_RETAIN
  1284. * @brief Enables MQTT client to set the retain flag when publishing specific messages.
  1285. */
  1286. //#define MY_MQTT_CLIENT_PUBLISH_RETAIN
  1287. /**
  1288. * @def MY_MQTT_PASSWORD
  1289. * @brief Used for authenticated MQTT connections.
  1290. *
  1291. * Set if your MQTT broker requires username/password.
  1292. * Example: @code #define MY_MQTT_PASSWORD "secretpassword" @endcode
  1293. * @see MY_MQTT_USER
  1294. */
  1295. //#define MY_MQTT_PASSWORD "secretpassword"
  1296. /**
  1297. * @def MY_MQTT_USER
  1298. * @brief Used for authenticated MQTT connections.
  1299. *
  1300. * Set if your MQTT broker requires username/password.
  1301. * Example: @code #define MY_MQTT_USER "username" @endcode
  1302. * @see MY_MQTT_PASSWORD
  1303. */
  1304. //#define MY_MQTT_USER "username"
  1305. /**
  1306. * @def MY_MQTT_CLIENT_ID
  1307. * @brief Set client ID for MQTT connections
  1308. *
  1309. * This define is mandatory for all MQTT client gateways.
  1310. * Example: @code #define MY_MQTT_CLIENT_ID "mysensors-1" @endcode
  1311. */
  1312. //#define MY_MQTT_CLIENT_ID "mysensors-1"
  1313. /**
  1314. * @def MY_MQTT_PUBLISH_TOPIC_PREFIX
  1315. * @brief Set prefix for MQTT topic to publish to.
  1316. *
  1317. * This define is mandatory for all MQTT client gateways.
  1318. * Example: @code #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway1-out" @endcode
  1319. */
  1320. //#define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway1-out"
  1321. /**
  1322. * @def MY_MQTT_SUBSCRIBE_TOPIC_PREFIX
  1323. * @brief Set prefix for MQTT topic to subscribe to.
  1324. *
  1325. * This define is mandatory for all MQTT client gateways.
  1326. * Example: @code #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway1-in" @endcode
  1327. */
  1328. //#define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway1-in"
  1329. /**
  1330. * @def MY_IP_ADDRESS
  1331. * @brief Static ip address of gateway. If not defined, DHCP will be used.
  1332. *
  1333. * Example: @code #define MY_IP_ADDRESS 192,168,178,66 @endcode
  1334. */
  1335. //#define MY_IP_ADDRESS 192,168,178,66
  1336. /**
  1337. * @def MY_IP_GATEWAY_ADDRESS
  1338. * @brief IP address of your broadband router/gateway, if not using DHCP.
  1339. *
  1340. * Example: @code #define MY_IP_GATEWAY_ADDRESS 192,168,1,1 @endcode
  1341. */
  1342. //#define MY_IP_GATEWAY_ADDRESS 192,168,1,1
  1343. /**
  1344. * @def MY_IP_SUBNET_ADDRESS
  1345. * @brief Subnet address of your local network, if not using DHCP.
  1346. *
  1347. * Example: @code #define MY_IP_SUBNET_ADDRESS 255,255,255,0 @endcode
  1348. */
  1349. //#define MY_IP_SUBNET_ADDRESS 255,255,255,0
  1350. /**
  1351. * @def MY_USE_UDP
  1352. * @brief Enables UDP mode for Ethernet gateway.
  1353. * @note This is not supported on ENC28J60 and Linux based GWs.
  1354. */
  1355. //#define MY_USE_UDP
  1356. /**
  1357. * @def MY_IP_RENEWAL_INTERVAL_MS
  1358. * @brief DHCP, default renewal setting in milliseconds.
  1359. */
  1360. #ifndef MY_IP_RENEWAL_INTERVAL_MS
  1361. #define MY_IP_RENEWAL_INTERVAL_MS (60*1000ul)
  1362. #endif
  1363. /**
  1364. * @def MY_MAC_ADDRESS
  1365. * @brief Ethernet MAC address.
  1366. * @note This needs to be unique on the network.
  1367. */
  1368. #ifndef MY_MAC_ADDRESS
  1369. #define MY_MAC_ADDRESS 0xDE,0xAD,0xBE,0xEF,0xFE,0xED
  1370. #endif
  1371. /**
  1372. * @def MY_CONTROLLER_IP_ADDRESS
  1373. * @brief If this is defined, gateway will act as a client trying to contact controller on
  1374. * @ref MY_PORT using this IP address.
  1375. *
  1376. * Example: @code #define MY_CONTROLLER_IP_ADDRESS 192,168,178,254 @endcode
  1377. *
  1378. * If left un-defined, gateway acts as server allowing incoming connections.
  1379. * @see MY_CONTROLLER_URL_ADDRESS
  1380. */
  1381. //#define MY_CONTROLLER_IP_ADDRESS 192,168,178,254
  1382. /**
  1383. * @def MY_CONTROLLER_URL_ADDRESS
  1384. * @brief If this is defined, gateway will act as a client (ethernet or MQTT) trying to
  1385. * contact controller on the given URL.
  1386. *
  1387. * If left un-defined, gateway acts as server allowing incoming connections.
  1388. * Example: @code #define MY_CONTROLLER_URL_ADDRESS "test.mosquitto.org" @endcode
  1389. * @see MY_CONTROLLER_IP_ADDRESS
  1390. * @see MY_GATEWAY_MQTT_CLIENT
  1391. */
  1392. //#define MY_CONTROLLER_URL_ADDRESS "test.mosquitto.org"
  1393. /** @}*/ // End of GatewaySettingGrpPub group
  1394. /**
  1395. * @defgroup lEDSettingGrpPub LED
  1396. * @ingroup MyConfigGrp
  1397. * @brief These options control LED specific configurations.
  1398. * @{
  1399. */
  1400. /**
  1401. * @def MY_DEFAULT_ERR_LED_PIN
  1402. * @brief Define this with a value that correspond to your placement of the error indication LED.
  1403. *
  1404. * @note This is optional.
  1405. * @note On some platforms (for example sensebender GW) the hardware definitions can enable the LED
  1406. * by default. That default can be overridden by defining this flag.
  1407. */
  1408. //#define MY_DEFAULT_ERR_LED_PIN (6)
  1409. /**
  1410. * @def MY_DEFAULT_TX_LED_PIN
  1411. * @brief Define this with a value that correspond to your placement of the TX indication LED.
  1412. *
  1413. * @note This is optional.
  1414. * @note On some platforms (for example sensebender GW) the hardware definitions can enable the LED
  1415. * by default. That default can be overridden by defining this flag.
  1416. */
  1417. //#define MY_DEFAULT_TX_LED_PIN (7)
  1418. /**
  1419. * @def MY_DEFAULT_RX_LED_PIN
  1420. * @brief Define this with a value that correspond to your placement of the RX indication LED.
  1421. *
  1422. * @note This is optional.
  1423. * @note On some platforms (for example sensebender GW) the hardware definitions can enable the LED
  1424. * by default. That default can be overridden by defining this flag.
  1425. */
  1426. //#define MY_DEFAULT_RX_LED_PIN (8)
  1427. /**
  1428. * @def MY_WITH_LEDS_BLINKING_INVERSE
  1429. * @brief Define this to inverse the LED blinking.
  1430. *
  1431. * When defined LEDs are normally turned on and switches off when blinking.
  1432. */
  1433. //#define MY_WITH_LEDS_BLINKING_INVERSE
  1434. /**
  1435. * @def MY_INDICATION_HANDLER
  1436. * @brief Define to use own indication handler.
  1437. */
  1438. //#define MY_INDICATION_HANDLER
  1439. /**
  1440. * @def MY_DEFAULT_LED_BLINK_PERIOD
  1441. * @brief Default LEDs blinking period in milliseconds.
  1442. */
  1443. #ifndef MY_DEFAULT_LED_BLINK_PERIOD
  1444. #define MY_DEFAULT_LED_BLINK_PERIOD 300
  1445. #endif
  1446. /** @}*/ // End of lEDSettingGrpPub group
  1447. /**
  1448. * @defgroup SecuritySettingGrpPub Security
  1449. * @ingroup MyConfigGrp
  1450. * @brief These options control security related configurations.
  1451. *
  1452. * Overview over all security related settings and how/where to apply them:
  1453. * | Setting | Description | Arduino | Raspberry PI @c configure argument
  1454. * |--------------------------|-------------|---------|-------------
  1455. * | @ref MY_SECURITY_SIMPLE_PASSWD | Enables security (signing and encryption) without the need for @ref personalization | "#define" in the top of your sketch | Not supported (use the other two "simple" options)
  1456. * | @ref MY_SIGNING_SIMPLE_PASSWD | Enables signing without the need for @ref personalization | "#define" in the top of your sketch | @verbatim --my-signing=password --my-security-password=<PASSWORD> @endverbatim
  1457. * | @ref MY_ENCRYPTION_SIMPLE_PASSWD | Enables encryption without the need for @ref personalization | "#define" in the top of your sketch | @verbatim --my-security-password=<PASSWORD> @endverbatim and encryption enabled on the chosen transport
  1458. * | @ref MY_DEBUG_VERBOSE_SIGNING | Enables verbose signing debugging | "#define" in the top of your sketch | @verbatim --my-signing-debug @endverbatim
  1459. * | @ref MY_SIGNING_ATSHA204 | Enables support to sign messages backed by ATSHA204A hardware | "#define" in the top of your sketch | Not supported
  1460. * | @ref MY_SIGNING_SOFT | Enables support to sign messages backed by software | "#define" in the top of your sketch | @verbatim --my-signing=software @endverbatim
  1461. * | @ref MY_SIGNING_REQUEST_SIGNATURES | Enables node/gw to require signed messages | "#define" in the top of your sketch | @verbatim --my-signing-request-signatures @endverbatim
  1462. * | @ref MY_SIGNING_WEAK_SECURITY | Weakens signing security, useful for testing before deploying signing "globally" | "#define" in the top of your sketch | @verbatim --my-signing-weak_security @endverbatim
  1463. * | @ref MY_VERIFICATION_TIMEOUT_MS | Change default signing timeout | "#define" in the top of your sketch | @verbatim --my-signing-verification-timeout-ms=<TIMEOUT> @endverbatim
  1464. * | @ref MY_SIGNING_NODE_WHITELISTING | Defines a whitelist of trusted nodes | "#define" in the top of your sketch | @verbatim --my-signing-whitelist="<WHITELIST>" @endverbatim
  1465. * | @ref MY_SIGNING_ATSHA204_PIN | Change default ATSHA204A communication pin | "#define" in the top of your sketch | Not supported
  1466. * | @ref MY_SIGNING_SOFT_RANDOMSEED_PIN | Change default software RNG seed pin | "#define" in the top of your sketch | Not supported
  1467. * | @ref MY_RF24_ENABLE_ENCRYPTION | Enables encryption on RF24 radios | "#define" in the top of your sketch | @verbatim --my-rf24-encryption-enabled @endverbatim
  1468. * | @ref MY_RFM69_ENABLE_ENCRYPTION | Enables encryption on %RFM69 radios | "#define" in the top of your sketch | @verbatim --my-rfm69-encryption-enabled @endverbatim
  1469. * | @ref MY_RFM95_ENABLE_ENCRYPTION | Enables encryption on %RFM95 radios | "#define" in the top of your sketch | @verbatim --my-rfm95-encryption-enabled @endverbatim
  1470. * | @ref MY_NRF5_ESB_ENABLE_ENCRYPTION | Enables encryption on nRF5 radios | "#define" in the top of your sketch | Not supported
  1471. * | @ref MY_NODE_LOCK_FEATURE | Enables the node locking feature | "#define" in the top of your sketch | Not supported
  1472. * | @ref MY_NODE_UNLOCK_PIN | Change default unlock pin | "#define" in the top of your sketch | Not supported
  1473. * | @ref MY_NODE_LOCK_COUNTER_MAX | Change default "malicious activity" counter max value | "#define" in the top of your sketch | Not supported
  1474. *
  1475. * @{
  1476. */
  1477. /**
  1478. * @def MY_SECURITY_SIMPLE_PASSWD
  1479. * @brief Enables SW backed signing functionality and encryption functionality in library and uses
  1480. * provided password as key.
  1481. *
  1482. * Example: @code #define MY_SECURITY_SIMPLE_PASSWD "MyInsecurePassword" @endcode
  1483. *
  1484. * For details on the effects, see the references.
  1485. * @see MY_SIGNING_SIMPLE_PASSWD, MY_ENCRYPTION_SIMPLE_PASSWD
  1486. */
  1487. //#define MY_SECURITY_SIMPLE_PASSWD "MyInsecurePassword"
  1488. #if defined(MY_SECURITY_SIMPLE_PASSWD)
  1489. #define MY_SIGNING_SIMPLE_PASSWD MY_SECURITY_SIMPLE_PASSWD
  1490. #define MY_ENCRYPTION_SIMPLE_PASSWD MY_SECURITY_SIMPLE_PASSWD
  1491. #endif
  1492. /**
  1493. * @defgroup SigningSettingGrpPub Signing
  1494. * @ingroup SecuritySettingGrpPub
  1495. * @brief These options control signing related configurations.
  1496. *
  1497. * @see MySigninggrpPub
  1498. * @{
  1499. */
  1500. /**
  1501. * @def MY_DEBUG_VERBOSE_SIGNING
  1502. * @brief Define this for verbose debug prints related to signing.
  1503. */
  1504. //#define MY_DEBUG_VERBOSE_SIGNING
  1505. /**
  1506. * @def MY_SIGNING_SIMPLE_PASSWD
  1507. * @brief Enables SW backed signing functionality in library and uses provided password as key.
  1508. *
  1509. * This flag is automatically set if @ref MY_SECURITY_SIMPLE_PASSWD is used.
  1510. *
  1511. * This flag will enable signing and signature requests. It has to be identical on ALL nodes in the
  1512. * network.
  1513. *
  1514. * Whitelisting is supported and serial will be the first 8 characters of the password, the ninth
  1515. * character will be the node ID (to make each node have a unique serial).
  1516. *
  1517. * As with the regular signing modes, whitelisting is only activated if a whitelist is specified in
  1518. * the sketch.
  1519. *
  1520. * No @ref personalization is required for this mode.
  1521. *
  1522. * It is allowed to set @ref MY_SIGNING_WEAK_SECURITY for deployment purposes in this mode as it is
  1523. * with the regular software and ATSHA204A based modes.
  1524. *
  1525. * If the provided password is shorter than the size of the HMAC key, it will be null-padded
  1526. * to accommodate the key size in question. A 32 character password is the maximum length. Any
  1527. * password longer than that will be truncated.
  1528. *
  1529. * Example: @code #define MY_SIGNING_SIMPLE_PASSWD "MyInsecurePassword" @endcode
  1530. *
  1531. * @see MY_SECURITY_SIMPLE_PASSWD
  1532. *
  1533. */
  1534. //#define MY_SIGNING_SIMPLE_PASSWD "MyInsecurePassword"
  1535. #if defined(MY_SIGNING_SIMPLE_PASSWD)
  1536. #define MY_SIGNING_SOFT
  1537. #define MY_SIGNING_REQUEST_SIGNATURES
  1538. #endif
  1539. /**
  1540. * @def MY_SIGNING_ATSHA204
  1541. * @brief Enables HW backed signing functionality in library.
  1542. */
  1543. //#define MY_SIGNING_ATSHA204
  1544. /**
  1545. * @def MY_SIGNING_SOFT
  1546. * @brief Enables SW backed signing functionality in library.
  1547. */
  1548. //#define MY_SIGNING_SOFT
  1549. /**
  1550. * @def MY_SIGNING_REQUEST_SIGNATURES
  1551. * @brief Enable this to inform gateway to sign all messages sent to this node.
  1552. *
  1553. * If used for a gateway, gateway will by default require signatures from ALL nodes. This behavior
  1554. * can be disabled by weakening security.
  1555. * @see MY_SIGNING_WEAK_SECURITY
  1556. */
  1557. //#define MY_SIGNING_REQUEST_SIGNATURES
  1558. /**
  1559. * @def MY_SIGNING_WEAK_SECURITY
  1560. * @brief Enable this to permit downgrade of security preferences and relaxed gateway signing
  1561. * requirements.
  1562. *
  1563. * Use this for evaluating security. It allows for gradual introduction of signing requirements in
  1564. * a network. Nodes that present themselves as not requiring signing or whitelisting will be
  1565. * cleared of this requirement at the receiving end. A gateway which require signatures will only do
  1566. * so from nodes that in turn require signatures.
  1567. *
  1568. * When not set, any node that has presented themselves as a node that require signatures or
  1569. * whitelisting, will be permanently remembered as doing so at the receiver until EEPROM is cleared
  1570. * or the receiver is reconfigured with this flag set or has signing disabled alltogether.
  1571. *
  1572. * @warning This flag when set will weaken security significantly
  1573. */
  1574. //#define MY_SIGNING_WEAK_SECURITY
  1575. /**
  1576. * @def MY_VERIFICATION_TIMEOUT_MS
  1577. * @brief Define a suitable timeout for a signature verification session
  1578. *
  1579. * Consider the turnaround from a nonce being generated to a signed message being received
  1580. * which might vary, especially in networks with many hops.
  1581. *
  1582. * Shorter time gives less time for an attacker to figure a way to hijack the nonce and attempt to
  1583. * brute force attack the node. Longer time permits more network hops and node or GW processing
  1584. * time. 5s ought to be enough for anyone.
  1585. */
  1586. #ifndef MY_VERIFICATION_TIMEOUT_MS
  1587. #define MY_VERIFICATION_TIMEOUT_MS (5*1000ul)
  1588. #endif
  1589. /**
  1590. * @def MY_SIGNING_NODE_WHITELISTING
  1591. * @brief Define to turn on whitelisting
  1592. *
  1593. * When defined, a verifying node will look up the sender in the whitelist and salt the received
  1594. * signature with that information before validating the result. It will also inform GW (or other
  1595. * node) through the signing presentation message about this requirement.
  1596. *
  1597. * The signing node will check the presentaiton lists to determine if the recipient require
  1598. * whitelisting and salt the signature with it's unique signature and nodeId before transmitting
  1599. * the signed message.
  1600. *
  1601. * It is legal to only have one node with a whitelist for this reason but it is not required.
  1602. *
  1603. * Example: @code #define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01}}} @endcode
  1604. */
  1605. //#define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01}}}
  1606. /**
  1607. * @def MY_SIGNING_ATSHA204_PIN
  1608. * @brief Atsha204a default pin setting. Set it to match the pin the device is attached to.
  1609. */
  1610. #ifndef MY_SIGNING_ATSHA204_PIN
  1611. #define MY_SIGNING_ATSHA204_PIN (17)
  1612. #endif
  1613. /**
  1614. * @def MY_SIGNING_SOFT_RANDOMSEED_PIN
  1615. * @brief Pin used for random seed generation in soft signing
  1616. * @note Do not connect anything to this when soft signing is enabled, or the seed will be
  1617. * predictable.
  1618. */
  1619. #ifndef MY_SIGNING_SOFT_RANDOMSEED_PIN
  1620. #define MY_SIGNING_SOFT_RANDOMSEED_PIN (7)
  1621. #endif
  1622. /**
  1623. * @def MY_LOCK_DEVICE
  1624. * @brief Enable read back protection
  1625. *
  1626. * Enable read back protection feature. Currently only supported by NRF51+NRF52.
  1627. * Use this flag to protect signing and encryption keys stored in the MCU.
  1628. *
  1629. * Set this flag, when you use softsigning in MySensors. Don't set this
  1630. * in SecurityPersonalizer.
  1631. *
  1632. * @warning YOU CAN BRICK YOUR DEVICE!!!
  1633. * Don't set this flag without having an boot loader, OTA firmware update and
  1634. * an Gateway connection. To reset an device, you can try >>
  1635. * openocd -f interface/cmsis-dap.cfg -f target/nrf52.cfg -c "program dap apreg 1 0x04 0x01"
  1636. */
  1637. //#define MY_LOCK_DEVICE
  1638. /**
  1639. * @def MY_SIGNING_FEATURE
  1640. * @ingroup internals
  1641. * @brief Helper flag to indicate that some signing feature is enabled, set automatically
  1642. */
  1643. #if defined(MY_SIGNING_ATSHA204) || defined(MY_SIGNING_SOFT)
  1644. #define MY_SIGNING_FEATURE
  1645. #endif
  1646. /** @}*/ // End of SigningSettingGrpPub group
  1647. /**
  1648. * @defgroup EncryptionSettingGrpPub Encryption
  1649. * @ingroup SecuritySettingGrpPub
  1650. * @brief These options control encryption related configurations.
  1651. *
  1652. * Note that encryption is toggled on a per-radio basis.
  1653. * @see MY_RF24_ENABLE_ENCRYPTION, MY_RFM69_ENABLE_ENCRYPTION, MY_NRF5_ESB_ENABLE_ENCRYPTION, MY_RFM95_ENABLE_ENCRYPTION
  1654. * @{
  1655. */
  1656. /**
  1657. * @def MY_ENCRYPTION_SIMPLE_PASSWD
  1658. * @brief Enables encryption on all radio transports that supports it and uses provided password as key.
  1659. *
  1660. * This flag is automatically set if @ref MY_SECURITY_SIMPLE_PASSWD is used.
  1661. *
  1662. * This flag will enable encryption. It has to be identical on ALL nodes in the network.
  1663. *
  1664. * No @ref personalization is required for this mode.
  1665. *
  1666. * If the provided password is shorter than the size of the %AES key, it will be null-padded
  1667. * to accommodate the key size in question. A 16 character password is the maximum length. Any
  1668. * password longer than that will be truncated.
  1669. *
  1670. * Example: @code #define MY_ENCRYPTION_SIMPLE_PASSWD "MyInsecurePassword" @endcode
  1671. *
  1672. * @see MY_SECURITY_SIMPLE_PASSWD
  1673. */
  1674. //#define MY_ENCRYPTION_SIMPLE_PASSWD "MyInsecurePassword"
  1675. #if defined(MY_ENCRYPTION_SIMPLE_PASSWD)
  1676. #ifndef MY_RF24_ENABLE_ENCRYPTION
  1677. #define MY_RF24_ENABLE_ENCRYPTION
  1678. #endif
  1679. #ifndef MY_RFM69_ENABLE_ENCRYPTION
  1680. #define MY_RFM69_ENABLE_ENCRYPTION
  1681. #endif
  1682. #ifndef MY_NRF5_ESB_ENABLE_ENCRYPTION
  1683. #define MY_NRF5_ESB_ENABLE_ENCRYPTION
  1684. #endif
  1685. #ifndef MY_RFM95_ENABLE_ENCRYPTION
  1686. #define MY_RFM95_ENABLE_ENCRYPTION
  1687. #endif
  1688. #endif
  1689. /**
  1690. * @def MY_ENCRYPTION_FEATURE
  1691. * @ingroup internals
  1692. * @brief Helper flag to indicate that some encryption feature is enabled, set automatically
  1693. * @see MY_RF24_ENABLE_ENCRYPTION, MY_RFM69_ENABLE_ENCRYPTION, MY_NRF5_ESB_ENABLE_ENCRYPTION, MY_RFM95_ENABLE_ENCRYPTION
  1694. */
  1695. #if defined(MY_RF24_ENABLE_ENCRYPTION) || defined(MY_RFM69_ENABLE_ENCRYPTION) || defined(MY_NRF5_ESB_ENABLE_ENCRYPTION) || defined(MY_RFM95_ENABLE_ENCRYPTION)
  1696. #define MY_ENCRYPTION_FEATURE
  1697. #endif
  1698. /** @}*/ // End of EncryptionSettingGrpPub group
  1699. /**
  1700. * @defgroup MyLockgrppub Node locking
  1701. * @ingroup MyConfig
  1702. * @brief These options control node lock related configurations.
  1703. *
  1704. * This feature locks a node that suspect itself for being under some form of attack.
  1705. *
  1706. * This is achieved by having a counter stored in EEPROM which decrements when suspicious activity
  1707. * is detected.
  1708. *
  1709. * If the counter reaches 0, the node will not work anymore and will transmit a @ref I_LOCKED
  1710. * message to the gateway/controller with 30 minute intervals. Payload is a string with a reason for
  1711. * the locking.
  1712. *
  1713. * The string is abbreviated to accommodate a signature. The following abbreviations exist at the
  1714. * moment:
  1715. * - LDB (Locked During Boot)
  1716. * - TMNR (Too Many Nonce Requests)
  1717. * - TMFV (Too Many Failed Verifications)
  1718. *
  1719. * Typically, the counter only decrements when suspicious activity happens in a row.
  1720. * It is reset if legit traffic is present.
  1721. *
  1722. * Examples of malicious activity are:
  1723. * - Repeatedly incorrectly checksummed OTA firmware
  1724. * - Repeated requests for signing nonces without properly signed messages arriving
  1725. * - Repeatedly failed signature verifications
  1726. *
  1727. * If counter reaches zero, node locks down and EEPROM has to be erased/reset to reactivate node.
  1728. * Node can also be unlocked by grounding a pin.
  1729. * @see MY_NODE_UNLOCK_PIN
  1730. *
  1731. * The size of the counter can be adjusted using @ref MY_NODE_LOCK_COUNTER_MAX.
  1732. * @{
  1733. */
  1734. /**
  1735. * @def MY_NODE_LOCK_FEATURE
  1736. * @brief Enable this to activate intrusion prevention mechanisms on the node.
  1737. */
  1738. //#define MY_NODE_LOCK_FEATURE
  1739. /**
  1740. * @def MY_NODE_UNLOCK_PIN
  1741. * @brief By grounding this pin during reset of a locked node, the node will unlock.
  1742. *
  1743. * If using a secure bootloader, grounding the pin is the only option to reactivate the node.
  1744. * If using stock Android bootloader or a DualOptiBoot it is also possible to download a sketch
  1745. * using serial protocol to erase EEPROM to unlock the node.
  1746. */
  1747. #ifndef MY_NODE_UNLOCK_PIN
  1748. #define MY_NODE_UNLOCK_PIN (14)
  1749. #endif
  1750. /**
  1751. * @def MY_NODE_LOCK_COUNTER_MAX
  1752. * @brief Maximum accepted occurrences of suspected malicious activity in a node.
  1753. *
  1754. * Counter decrements on reoccurring incidents but resets if legitimate behaviour is identified.
  1755. */
  1756. #ifndef MY_NODE_LOCK_COUNTER_MAX
  1757. #define MY_NODE_LOCK_COUNTER_MAX (5)
  1758. #endif
  1759. /** @}*/ // Node lock group
  1760. /** @}*/ // End of SecuritySettingGrpPub group
  1761. /**
  1762. * @defgroup PlatformSettingGrpPub Platform specifics
  1763. * @ingroup MyConfigGrp
  1764. * @brief These options control platform specific configurations.
  1765. * @{
  1766. */
  1767. /**
  1768. * @defgroup ESP8266SettingGrpPub ESP8266
  1769. * @ingroup PlatformSettingGrpPub
  1770. * @brief These options control ESP8266 specific configurations.
  1771. * @{
  1772. */
  1773. /**
  1774. * @def MY_ESP8266_SERIAL_MODE
  1775. * @brief ESP8266 serial modes
  1776. *
  1777. * - SERIAL_FULL: Default mode.
  1778. * - SERIAL_TX_ONLY: allows to use RX (GPIO3) as a general purpose input/output.
  1779. * - SERIAL_RX_ONLY: allows to use TX (GPIO1) as a general purpose input/output.
  1780. */
  1781. #ifndef MY_ESP8266_SERIAL_MODE
  1782. #define MY_ESP8266_SERIAL_MODE SERIAL_FULL
  1783. #endif
  1784. /** @}*/ // End of ESP8266SettingGrpPub group
  1785. /**
  1786. * @defgroup ESP32SettingGrpPub ESP32
  1787. * @ingroup PlatformSettingGrpPub
  1788. * @brief These options control ESP32 specific configurations.
  1789. * @{
  1790. */
  1791. //
  1792. // no ESP32 settings
  1793. //
  1794. /** @}*/ // End of ESP32SettingGrpPub group
  1795. /**
  1796. * @defgroup LinuxSettingGrpPub Linux
  1797. * @ingroup PlatformSettingGrpPub
  1798. * @brief These options control Linux specific configurations.
  1799. * @{
  1800. */
  1801. /**
  1802. * @def MY_LINUX_SERIAL_PORT
  1803. * @brief Serial device port
  1804. */
  1805. //#define MY_LINUX_SERIAL_PORT "/dev/ttyUSB0"
  1806. /**
  1807. * @def MY_LINUX_SERIAL_PTY
  1808. * @brief deprecated option
  1809. */
  1810. #ifdef MY_LINUX_SERIAL_PTY
  1811. #warning MY_LINUX_SERIAL_PTY is deprecated, please use MY_LINUX_SERIAL_PORT
  1812. #define MY_LINUX_SERIAL_PORT MY_LINUX_SERIAL_PTY
  1813. #endif
  1814. /**
  1815. * @def MY_LINUX_IS_SERIAL_PTY
  1816. * @brief deprecated option
  1817. */
  1818. #ifdef MY_LINUX_IS_SERIAL_PTY
  1819. #warning MY_LINUX_IS_SERIAL_PTY is deprecated, please use MY_LINUX_SERIAL_IS_PTY
  1820. #define MY_LINUX_SERIAL_IS_PTY
  1821. #endif
  1822. /**
  1823. * @def MY_LINUX_SERIAL_IS_PTY
  1824. * @brief Set serial as a pseudo terminal.
  1825. *
  1826. * Enable this if you need to connect to a controller running on the same device.
  1827. * You also need to define MY_LINUX_SERIAL_PORT with the symlink name for the PTY device.
  1828. */
  1829. //#define MY_LINUX_SERIAL_IS_PTY
  1830. /**
  1831. * @def MY_LINUX_SERIAL_GROUPNAME
  1832. * @brief Grant access to the specified system group for the serial device.
  1833. */
  1834. //#define MY_LINUX_SERIAL_GROUPNAME "tty"
  1835. /**
  1836. * @def MY_LINUX_CONFIG_FILE
  1837. * @brief Sets the filepath for the gateway config file.
  1838. *
  1839. * @note For now the configuration file is only used to store the emulated eeprom state.
  1840. */
  1841. #ifndef MY_LINUX_CONFIG_FILE
  1842. #define MY_LINUX_CONFIG_FILE "/etc/mysensors.conf"
  1843. #endif
  1844. /** @}*/ // End of LinuxSettingGrpPub group
  1845. /** @}*/ // End of PlatformSettingGrpPub group
  1846. /*
  1847. * "Helper" definitions
  1848. */
  1849. /*
  1850. * Detect node type
  1851. * MY_GATEWAY_FEATURE is set for gateway sketches.
  1852. * MY_IS_GATEWAY is true when @ref MY_GATEWAY_FEATURE is set.
  1853. * MY_NODE_TYPE contain a string describing the class of sketch/node (gateway/repeater/node).
  1854. */
  1855. #if defined(MY_GATEWAY_SERIAL) || defined(MY_GATEWAY_W5100) || defined(MY_GATEWAY_ENC28J60) || defined(MY_GATEWAY_ESP8266) || defined(MY_GATEWAY_ESP32)|| defined(MY_GATEWAY_LINUX) || defined(MY_GATEWAY_MQTT_CLIENT) || defined(MY_GATEWAY_TINYGSM)
  1856. #define MY_GATEWAY_FEATURE
  1857. #define MY_IS_GATEWAY (true)
  1858. #define MY_NODE_TYPE "GW"
  1859. #elif defined(MY_REPEATER_FEATURE)
  1860. #define MY_IS_GATEWAY (false)
  1861. #define MY_NODE_TYPE "REPEATER"
  1862. #elif defined(DOXYGEN)
  1863. #define MY_IS_GATEWAY //!< true when configuration indicate a gateway device, @todo Mark these internals
  1864. #define MY_NODE_TYPE //!< "GW" for gateways, REPEATER" for repeaters, "NODE" for nodes, @todo Mark these internals
  1865. #else
  1866. #define MY_IS_GATEWAY (false)
  1867. #define MY_NODE_TYPE "NODE"
  1868. #endif
  1869. // DEBUG
  1870. #if defined(MY_DISABLED_SERIAL) && !defined(MY_DEBUG_OTA)
  1871. #undef MY_DEBUG
  1872. #endif
  1873. #if defined(MY_DEBUG)
  1874. // standard debug output
  1875. #define MY_DEBUG_VERBOSE_CORE //!< MY_DEBUG_VERBOSE_CORE
  1876. #define MY_DEBUG_VERBOSE_TRANSPORT //!< MY_DEBUG_VERBOSE_TRANSPORT
  1877. #define MY_DEBUG_VERBOSE_GATEWAY //!< MY_DEBUG_VERBOSE_GATEWAY
  1878. #define MY_DEBUG_VERBOSE_OTA_UPDATE //!< MY_DEBUG_VERBOSE_OTA_UPDATE
  1879. #endif
  1880. #if defined(MY_DEBUG) || defined(MY_DEBUG_VERBOSE_CORE) || defined(MY_DEBUG_VERBOSE_TRANSPORT) || defined(MY_DEBUG_VERBOSE_GATEWAY) || defined(MY_DEBUG_VERBOSE_SIGNING) || defined(MY_DEBUG_VERBOSE_OTA_UPDATE) || defined(MY_DEBUG_VERBOSE_RF24) || defined(MY_DEBUG_VERBOSE_NRF5_ESB) || defined(MY_DEBUG_VERBOSE_RFM69) || defined(MY_DEBUG_VERBOSE_RFM95)
  1881. #define DEBUG_OUTPUT_ENABLED //!< DEBUG_OUTPUT_ENABLED
  1882. #ifndef MY_DEBUG_OTA
  1883. #define DEBUG_OUTPUT(x,...) hwDebugPrint(x, ##__VA_ARGS__) //!< debug
  1884. #else
  1885. #ifndef MY_OTA_LOG_SENDER_FEATURE
  1886. #define MY_OTA_LOG_SENDER_FEATURE
  1887. #endif
  1888. #ifndef MY_DEBUG_OTA_DISABLE_ACK
  1889. #define DEBUG_OUTPUT(x,...) OTALog((MY_DEBUG_OTA), true, x, ##__VA_ARGS__) //!< debug
  1890. #else
  1891. #define DEBUG_OUTPUT(x,...) OTALog((MY_DEBUG_OTA), false, x, ##__VA_ARGS__) //!< debug
  1892. #endif
  1893. // disable radio related debugging messages
  1894. #undef MY_DEBUG_VERBOSE_RF24
  1895. #undef MY_DEBUG_VERBOSE_NRF5_ESB
  1896. #undef MY_DEBUG_VERBOSE_RFM69
  1897. #undef MY_DEBUG_VERBOSE_RFM69_REGISTERS
  1898. #undef MY_DEBUG_VERBOSE_RFM95
  1899. #endif
  1900. #else
  1901. #define DEBUG_OUTPUT(x,...) //!< debug NULL
  1902. #endif
  1903. // temp. workaround for nRF5 verifier: redirect RF24 to NRF_ESB
  1904. #if defined(ARDUINO_ARCH_NRF5) && (defined(MY_RADIO_RF24) )
  1905. #undef MY_RADIO_RF24
  1906. #define MY_RADIO_NRF5_ESB
  1907. #endif
  1908. // Enable sensor network "feature" if one of the transport types was enabled
  1909. #if defined(MY_RADIO_RF24) || defined(MY_RADIO_NRF5_ESB) || defined(MY_RADIO_RFM69) || defined(MY_RADIO_RFM95) || defined(MY_RS485)
  1910. #define MY_SENSOR_NETWORK
  1911. #endif
  1912. // LEDS
  1913. #if !defined(MY_DEFAULT_ERR_LED_PIN) && defined(MY_HW_ERR_LED_PIN)
  1914. #define MY_DEFAULT_ERR_LED_PIN MY_HW_ERR_LED_PIN
  1915. #endif
  1916. #if !defined(MY_DEFAULT_TX_LED_PIN) && defined(MY_HW_TX_LED_PIN)
  1917. #define MY_DEFAULT_TX_LED_PIN MY_HW_TX_LED_PIN
  1918. #endif
  1919. #if !defined(MY_DEFAULT_RX_LED_PIN) && defined(MY_HW_TX_LED_PIN)
  1920. #define MY_DEFAULT_RX_LED_PIN MY_HW_TX_LED_PIN
  1921. #endif
  1922. #endif // MyConfig_h
  1923. // Doxygen specific constructs, not included when built normally
  1924. // This is used to enable disabled macros/definitions to be included in the documentation as well.
  1925. #if DOXYGEN
  1926. /**
  1927. * @def ARDUINO_ARCH_SAMD
  1928. * @brief Automatically set when building for SAMD targets
  1929. */
  1930. #define ARDUINO_ARCH_SAMD
  1931. /**
  1932. * @def ARDUINO_ARCH_NRF5
  1933. * @brief Automatically set when building for nRF5 targets
  1934. */
  1935. #define ARDUINO_ARCH_NRF5
  1936. /**
  1937. * @def ARDUINO_ARCH_ESP8266
  1938. * @brief Automatically set when building for ESP8266 targets
  1939. */
  1940. #define ARDUINO_ARCH_ESP8266
  1941. /**
  1942. * @def ARDUINO_ARCH_AVR
  1943. * @brief Automatically set when building for AVR targets
  1944. */
  1945. #define ARDUINO_ARCH_AVR
  1946. /**
  1947. * @def ARDUINO_ARCH_STM32F1
  1948. * @brief Automatically set when building for STM32F1 targets
  1949. */
  1950. #define ARDUINO_ARCH_STM32F1
  1951. /**
  1952. * @def TEENSYDUINO
  1953. * @brief Automatically set when building for Teensy targets
  1954. */
  1955. #define TEENSYDUINO
  1956. // debug
  1957. #define MY_DEBUG
  1958. #define MY_DEBUGDEVICE
  1959. #define MY_DEBUG_OTA
  1960. #define MY_DEBUG_OTA_DISABLE_ACK
  1961. #define MY_SPECIAL_DEBUG
  1962. #define MY_DISABLED_SERIAL
  1963. #define MY_SPLASH_SCREEN_DISABLED
  1964. // linux
  1965. #define MY_LINUX_SERIAL_PORT
  1966. #define MY_LINUX_SERIAL_IS_PTY
  1967. #define MY_LINUX_SERIAL_GROUPNAME
  1968. #define MY_LINUX_SERIAL_PTY
  1969. #define MY_LINUX_IS_SERIAL_PTY
  1970. // inclusion mode
  1971. #define MY_INCLUSION_MODE_FEATURE
  1972. #define MY_INCLUSION_BUTTON_FEATURE
  1973. // OTA logging and debug
  1974. #define MY_OTA_LOG_RECEIVER_FEATURE
  1975. #define MY_OTA_LOG_SENDER_FEATURE
  1976. // transport
  1977. #define MY_PARENT_NODE_IS_STATIC
  1978. #define MY_REGISTRATION_CONTROLLER
  1979. #define MY_TRANSPORT_UPLINK_CHECK_DISABLED
  1980. #define MY_TRANSPORT_SANITY_CHECK
  1981. #define MY_NODE_LOCK_FEATURE
  1982. #define MY_REPEATER_FEATURE
  1983. #define MY_PASSIVE_NODE
  1984. #define MY_MQTT_CLIENT_PUBLISH_RETAIN
  1985. #define MY_MQTT_PASSWORD
  1986. #define MY_MQTT_USER
  1987. #define MY_MQTT_CLIENT_ID
  1988. #define MY_MQTT_PUBLISH_TOPIC_PREFIX
  1989. #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX
  1990. #define MY_SIGNAL_REPORT_ENABLED
  1991. // general
  1992. #define MY_WITH_LEDS_BLINKING_INVERSE
  1993. #define MY_INDICATION_HANDLER
  1994. #define MY_DISABLE_REMOTE_RESET
  1995. #define MY_DISABLE_RAM_ROUTING_TABLE_FEATURE
  1996. #define MY_LOCK_DEVICE
  1997. // core
  1998. #define MY_CORE_ONLY
  1999. // GW
  2000. #define MY_DEBUG_VERBOSE_GATEWAY
  2001. #define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP
  2002. #define MY_INCLUSION_LED_PIN
  2003. #define MY_GATEWAY_W5100
  2004. #define MY_GATEWAY_ENC28J60
  2005. #define MY_GATEWAY_ESP8266
  2006. #define MY_GATEWAY_ESP32
  2007. #define MY_WIFI_SSID
  2008. #define MY_WIFI_BSSID
  2009. #define MY_WIFI_PASSWORD
  2010. #define MY_HOSTNAME
  2011. #define MY_GATEWAY_LINUX
  2012. #define MY_GATEWAY_TINYGSM
  2013. #define MY_GATEWAY_MQTT_CLIENT
  2014. #define MY_GATEWAY_SERIAL
  2015. #define MY_IP_ADDRESS
  2016. #define MY_IP_GATEWAY_ADDRESS
  2017. #define MY_IP_SUBNET_ADDRESS
  2018. #define MY_USE_UDP
  2019. #define MY_CONTROLLER_IP_ADDRESS
  2020. #define MY_CONTROLLER_URL_ADDRESS
  2021. // TinyGSM
  2022. /**
  2023. * @def MY_GSM_APN
  2024. * @brief APN from your cell carrier / mobile provider. Example: 4g.tele2.se
  2025. */
  2026. #define MY_GSM_APN
  2027. /**
  2028. * @def MY_GSM_BAUDRATE
  2029. * @brief Baudrate for your GSM modem. If left undefined, TinyGSM will try to auto detect the correct rate
  2030. */
  2031. #define MY_GSM_BAUDRATE
  2032. /**
  2033. * @def MY_GSM_PIN
  2034. * @brief PIN code for your SIM card, if PIN lock is active.
  2035. */
  2036. #define MY_GSM_PIN
  2037. /**
  2038. * @def MY_GSM_PSW
  2039. * @brief If using a GSM modem, this is the password supplied by your cell carrier / mobile provider. If using ESP8266 as a WiFi modem, this is your WiFi network password
  2040. */
  2041. #define MY_GSM_PSW
  2042. /**
  2043. * @def MY_GSM_RX
  2044. * @brief If defined, uses softSerial using defined pins (must also define MY_GSM_TX)
  2045. */
  2046. #define MY_GSM_RX
  2047. /**
  2048. * @def MY_GSM_SSID
  2049. * @brief If using ESP8266 as WiFi modem, this is your network SSID
  2050. */
  2051. #define MY_GSM_SSID
  2052. /**
  2053. * @def MY_GSM_TX
  2054. * @brief If defined, uses softSerial using defined pins (must also define MY_GSM_RX)
  2055. */
  2056. #define MY_GSM_TX
  2057. /**
  2058. * @def MY_GSM_USR
  2059. * @brief Supplied by your cell carrier / mobile operator. If not required, leave undefined.
  2060. */
  2061. #define MY_GSM_USR
  2062. // LED
  2063. #define MY_DEFAULT_ERR_LED_PIN
  2064. #define MY_DEFAULT_TX_LED_PIN
  2065. #define MY_DEFAULT_RX_LED_PIN
  2066. // signing
  2067. #define MY_SECURITY_SIMPLE_PASSWD
  2068. #define MY_SIGNING_SIMPLE_PASSWD
  2069. #define MY_ENCRYPTION_SIMPLE_PASSWD
  2070. #define MY_SIGNING_ATSHA204
  2071. #define MY_SIGNING_SOFT
  2072. #define MY_SIGNING_REQUEST_SIGNATURES
  2073. #define MY_SIGNING_WEAK_SECURITY
  2074. #define MY_SIGNING_NODE_WHITELISTING
  2075. #define MY_DEBUG_VERBOSE_SIGNING
  2076. #define MY_SIGNING_FEATURE
  2077. #define MY_ENCRYPTION_FEATURE
  2078. // FOTA update
  2079. #define MY_DEBUG_VERBOSE_OTA_UPDATE
  2080. #define MY_OTA_USE_I2C_EEPROM
  2081. // RS485
  2082. #define MY_RS485
  2083. #define MY_RS485_HWSERIAL
  2084. // RF24
  2085. #define MY_RADIO_RF24
  2086. #define MY_RADIO_NRF24 //deprecated
  2087. #define MY_DEBUG_VERBOSE_RF24
  2088. #define MY_RF24_POWER_PIN
  2089. #define MY_RF24_IRQ_PIN
  2090. #define MY_RF24_ENABLE_ENCRYPTION
  2091. #define MY_RX_MESSAGE_BUFFER_FEATURE
  2092. #define MY_RX_MESSAGE_BUFFER_SIZE
  2093. // NRF5_ESB
  2094. #define MY_RADIO_NRF5_ESB
  2095. #define MY_NRF5_ESB_ENABLE_ENCRYPTION
  2096. #define MY_DEBUG_VERBOSE_NRF5_ESB
  2097. #define MY_NRF5_ESB_REVERSE_ACK_RX
  2098. #define MY_NRF5_ESB_REVERSE_ACK_TX
  2099. // RFM69
  2100. #define MY_RADIO_RFM69
  2101. #define MY_IS_RFM69HW
  2102. #define MY_RFM69_NEW_DRIVER
  2103. #define MY_RFM69_POWER_PIN
  2104. #define MY_RFM69_MODEM_CONFIGURATION
  2105. #define MY_RFM69_ENABLE_ENCRYPTION
  2106. #define MY_RFM69_ATC_MODE_DISABLED
  2107. #define MY_RFM69_MAX_POWER_LEVEL_DBM
  2108. #define MY_RFM69_RST_PIN
  2109. #define MY_DEBUG_VERBOSE_RFM69
  2110. #define MY_DEBUG_VERBOSE_RFM69_REGISTERS
  2111. #define MY_RFM69_ENABLE_LISTENMODE
  2112. // RFM95
  2113. #define MY_RADIO_RFM95
  2114. #define MY_DEBUG_VERBOSE_RFM95
  2115. #define MY_RFM95_ENABLE_ENCRYPTION
  2116. #define MY_RFM95_ATC_MODE_DISABLED
  2117. #define MY_RFM95_RST_PIN
  2118. #define MY_RFM95_MODEM_CONFIGRUATION
  2119. #define MY_RFM95_POWER_PIN
  2120. #define MY_RFM95_TCXO
  2121. #define MY_RFM95_MAX_POWER_LEVEL_DBM
  2122. // SOFT-SPI
  2123. #define MY_SOFTSPI
  2124. #endif
  2125. /** @}*/ // End of MyConfig group