-
-
Notifications
You must be signed in to change notification settings - Fork 891
/
MyConfig.h
executable file
·2795 lines (2532 loc) · 80.9 KB
/
MyConfig.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* The MySensors Arduino library handles the wireless radio link and protocol
* between your home built sensors/actuators and HA controller of choice.
* The sensors forms a self healing radio network with optional repeaters. Each
* repeater and gateway builds a routing tables in RAM or EEPROM which keeps track of the
* network topology allowing messages to be routed to nodes.
*
* Created by Henrik Ekblad <[email protected]>
* Copyright (C) 2013-2022 Sensnology AB
* Full contributor list: https://github.com/mysensors/MySensors/graphs/contributors
*
* Documentation: http://www.mysensors.org
* Support Forum: http://forum.mysensors.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*/
/**
* @file MyConfig.h
* @ingroup MyConfigGrp
* @brief MySensors specific configuration flags.
* @{
* Set these in your sketch before including MySensors.h to customize the library to your needs.
* If the sketch does not define these flags, they will get default values where applicable.
*/
#ifndef MyConfig_h
#define MyConfig_h
/**
* @defgroup SerialDebugGrpPub Serial and debugging
* @ingroup MyConfigGrp
* @brief These options control serial and debugging features and functionalities in the library.
* @{
*/
/**
* @def MY_DEBUG
* @brief Define MY_DEBUG to show debug prints.
*
* This option will add a lot to the size of the final sketch but is helpful to see what is actually
* is happening during development.
*
* @note Values in parenthesis indicate default values which will be used if you have not defined
* the flag in your sketch.
*/
//#define MY_DEBUG
/**
* @def MY_DEBUGDEVICE
* @brief Define MY_DEBUGDEVICE to redirect debug prints.
*
* If defined, MY_DEBUGDEVICE replaces MY_SERIALDEVICE for the purpose
* of printing debug messages. This only applies to debugging.
*
* The intent is to provide the ability to send debugging messages
* out a different serial port than what is being used for
* communication between nodes or from gateway to controller when
* this communication uses a serial interface. This assumes that
* the MY_DEBUGDEVICE serial interface already exists. It can be a
* hardware serial device or a software serial device.
*/
//#define MY_DEBUGDEVICE
/**
* @def MY_DEBUG_OTA
* @brief Define MY_DEBUG_OTA to (nodeID) to redirect debug prints to given node ID
*
* Example: @code #define MY_DEBUG_OTA (0) @endcode will redirect debug prints to node ID 0.
*
* With this option debugging messages over serial are disabled. It's not possible to send debug
* messages generated by the radio. All other debug messages redirected to the given Node ID.
* The debug messages are sent without signing.
*
* This function allocates some additional memory for radio packet preparation and buffering.
* Debug messages are sent to child ID 255 (NODE_SENSOR_ID) as I_LOG_MESSAGE type.
*
* You have to enable the @ref MY_OTA_LOG_RECEIVER_FEATURE on the target node.
* Look into the LogOTAGateway and LogOTANode examples.
*
* The output buffer can be configured via @ref MY_SERIAL_OUTPUT_SIZE
* Transport related debugging is disabled when MY_DEBUG_OTA is enabled.
*
*/
//#define MY_DEBUG_OTA (0)
/**
* @def MY_DEBUG_OTA_DISABLE_ECHO
* @brief Define MY_DEBUG_OTA_DISABLE_ECHO to send messages without requesting the
* destination to echo the message.
*
* This option reduces the latency added by OTA debug messages by sending packages
* only once. You can loose debug messages.
*
*/
//#define MY_DEBUG_OTA_DISABLE_ECHO
#if defined(MY_DEBUG_OTA_DISABLE_ACK) && !defined(DOXYGEN)
#warning MY_DEBUG_OTA_DISABLE_ACK is deprecated, please use MY_DEBUG_OTA_DISABLE_ECHO instead
#define MY_DEBUG_OTA_DISABLE_ECHO
#endif
/**
* @def MY_OTA_LOG_RECEIVER_FEATURE
* @brief Define this to enable printing of OTA logs.
*
* This option requires additional memory for buffering. The buffer size can be configured
* via MY_SERIAL_OUTPUT_SIZE.
*/
//#define MY_OTA_LOG_RECEIVER_FEATURE
/**
* @def MY_OTA_LOG_SENDER_FEATURE
* @brief Define this to enable printing of OTA logs.
*
* This option requires additional memory for buffering. The buffer size can be configured
* via MY_SERIAL_OUTPUT_SIZE.
*/
//#define MY_OTA_LOG_SENDER_FEATURE
/**
* @def MY_SPECIAL_DEBUG
* @brief Define MY_SPECIAL_DEBUG to enable support for I_DEBUG messages.
*
* I_DEBUG messages are sent from the controller to the node, which responds with the requested
* data. The request can be one of the following:
* - 'R': routing info (only repeaters): received msg XXYY (as stream), where XX is the node and YY
* the routing node
* - 'V': CPU voltage
* - 'F': CPU frequency
* - 'M': free memory
* - 'E': clear MySensors EEPROM area and reboot (i.e. "factory" reset)
*/
//#define MY_SPECIAL_DEBUG
/**
* @def MY_DISABLED_SERIAL
* @brief Define MY_DISABLED_SERIAL if you want to use the UART TX/RX pins as normal I/O pins.
*
* @note When defined, if you want to use the pins as a UART, you need to handle initialization and
* configuration yourself.
*/
//#define MY_DISABLED_SERIAL
/**
* @def MY_SPLASH_SCREEN_DISABLED
* @ingroup memorysavings
* @brief If defined, will disable the MySensors splash screen.
*
* @note This saves 120 bytes of flash.
*/
//#define MY_SPLASH_SCREEN_DISABLED
/**
* @def MY_BAUD_RATE
* @brief Serial output baud rate (debug prints and serial gateway speed).
*
* The baud rate configured here must match the baud rate at the "other" end.
*
* @warning Depending on your target device and clock speed, certain baud rates might not work well.
*/
#ifndef MY_BAUD_RATE
#define MY_BAUD_RATE (115200ul)
#endif
/**
* @def MY_SERIAL_OUTPUT_SIZE
* @brief Maximum characters for serial output.
*
* If you are running extremely low on memory, reducing this size might just save your day.
*/
#ifndef MY_SERIAL_OUTPUT_SIZE
#define MY_SERIAL_OUTPUT_SIZE (120u)
#endif
/** @}*/ // End of SerialDebugGrpPub group
/**
* @def MY_DEBUG_VERBOSE_OTA_UPDATE
* @brief Define this for verbose debug prints related to FOTA updates.
*/
//#define MY_DEBUG_VERBOSE_OTA_UPDATE
/**
* @def MY_OTA_USE_I2C_EEPROM
* @brief Define this if you want I2C EEPROM instead
* of a SPI flash. Used EEPROM needs to be large enough, an 24(L)C256 will do as minimum.
* HW I2C assumed. This will exclude the SPI flash code.
* Note that you also need an updated DualOptiboot supporting I2C EEPROM!
*/
//#define MY_OTA_USE_I2C_EEPROM
#ifdef MY_OTA_USE_I2C_EEPROM
// I2C address of EEPROM. Wire will shift this left, i.e. 0x50->0xA0
#ifndef MY_OTA_I2C_ADDR
#define MY_OTA_I2C_ADDR 0x50
#endif
#endif
/**
* @defgroup TransportSettingGrpPub Transport selection
* @ingroup MyConfigGrp
* @brief These options control what transport type to use and various transport specific customisations.
* @{
*/
/**
* @defgroup PJONSettingGrpPub PJON
* @ingroup RadioSettingGrpPub
* @brief These options are specific to the PJON wired transport.
* @{
*/
/**
* @def MY_PJON
* @brief Define this to use the PJON wired transport for sensor network communication.
*/
//#define MY_PJON
/**
* @def MY_PJON_PIN
* @brief Define this to change pin for PJON communication
*/
#ifndef MY_PJON_PIN
#define MY_PJON_PIN (12u)
#endif
/**
* @def MY_DEBUG_VERBOSE_PJON
* @brief Define this for verbose debug prints related to the %PJON driver.
*/
//#define MY_DEBUG_VERBOSE_PJON
/**
* @def MY_PJON_MAX_RETRIES
* @brief Define this to change max send retry in PJON communication
*/
#ifndef MY_PJON_MAX_RETRIES
#define MY_PJON_MAX_RETRIES (5u)
#endif
#ifdef MY_PJON
#ifndef PJON_STRATEGY_ALL
#define PJON_STRATEGY_BITBANG
#endif
#define PJON_NOT_ASSIGNED (253u)
#define PJON_BROADCAST (255u)
#define SWBB_MAX_ATTEMPTS (50u)
#define PJON_INCLUDE_SWBB
#endif
/** @}*/ // End of PJONSettingGrpPub group
/**
* @defgroup RS485SettingGrpPub RS485
* @ingroup TransportSettingGrpPub
* @brief These options are specific to the RS485 wired transport.
* @{
*/
/**
* @def MY_RS485
* @brief Define this to use the RS485 wired transport for sensor network communication.
*/
//#define MY_RS485
/**
* @def MY_RS485_BAUD_RATE
* @brief The RS485 BAUD rate.
*/
#ifndef MY_RS485_BAUD_RATE
#define MY_RS485_BAUD_RATE (9600)
#endif
/**
* @def MY_RS485_MAX_MESSAGE_LENGTH
* @brief The maximum message length used for RS485.
*/
#ifndef MY_RS485_MAX_MESSAGE_LENGTH
#define MY_RS485_MAX_MESSAGE_LENGTH (40)
#endif
/**
* @def MY_RS485_SOH_COUNT
* @brief Use this in case of collisions on the bus. 3 might be a good setting.
*/
#ifndef MY_RS485_SOH_COUNT
#define MY_RS485_SOH_COUNT (1)
#endif
/**
* @def MY_RS485_DE_PIN
* @brief RS485 driver enable pin.
*/
//#define MY_RS485_DE_PIN (2)
/**
* @def MY_RS485_DE_INVERSE
* @brief Define this if RS485 driver enable pin polarity is inverted (low-active).
*/
//#define MY_RS485_DE_INVERSE
/**
* @def MY_RS485_HWSERIAL
* @brief Define this if RS485 is connected to a hardware serial port.
*
* Example: @code #define MY_RS485_HWSERIAL Serial1 @endcode
*/
//#define MY_RS485_HWSERIAL (Serial1)
/** @}*/ // End of RS485SettingGrpPub group
/**
* @defgroup RF24SettingGrpPub RF24
* @ingroup TransportSettingGrpPub
* @brief These options are specific to the RF24 family of wireless transport modules.
*
* The following chips are supported by this driver:
* | Vendor | Chip
* |--------------------------|----------
* | Nordic Semiconductor | nRF24L01
* | | nRF24L01+
* | Beken Corporation | BK2401
* | | BK2421
* | | BK2491
* | Hope Microelectronics | RFM70
* | | RFM73
* | Panchip Microelectronics | XN297
* | Silicon Labs(?) | SI24R1
* @{
*/
// legacy - remove for 3.0.0
/**
* @def MY_RADIO_NRF24
* @brief Define this to use a RF24-based radio transport for sensor network communication.
* @deprecated This flag is deprecated and replaced by @ref MY_RADIO_RF24
*/
#ifdef MY_RADIO_NRF24
#warning MY_RADIO_NRF24 is deprecated, use MY_RADIO_RF24 instead.
#undef MY_RADIO_NRF24
#define MY_RADIO_RF24
#endif
/**
* @def MY_RADIO_RF24
* @brief Define this to use a RF24-based radio transport for sensor network communication.
*/
//#define MY_RADIO_RF24
/**
* @def MY_RF24_ENABLE_ENCRYPTION
* @brief Define this to enable software based %AES encryption.
*
* All nodes and gateway must have this enabled, and all must be personalized with the same %AES
* key.
* @see @ref personalization
*
* @warning This driver always sets the initialization vector to 0 so encryption is weak.
*/
//#define MY_RF24_ENABLE_ENCRYPTION
/**
* @def MY_DEBUG_VERBOSE_RF24
* @brief Define this for verbose debug prints related to the RF24 driver.
*/
//#define MY_DEBUG_VERBOSE_RF24
/**
* @def MY_RF24_SPI_SPEED
* @brief Define this if you need to run the SPI clock at a different frequency than the default.
*
* Default nRF24L01+ SPI speed, 2MHz should be safe for nRF24L01+ clones.
*/
#ifndef MY_RF24_SPI_SPEED
#define MY_RF24_SPI_SPEED (2*1000000ul)
#endif
/**
* @def MY_RF24_CE_PIN
* @brief Define this to change the chip enable pin from the default.
*/
#ifndef MY_RF24_CE_PIN
#define MY_RF24_CE_PIN (DEFAULT_RF24_CE_PIN)
#endif
/**
* @def MY_RF24_CS_PIN
* @brief Define this to change the chip select pin from the default.
*/
#ifndef MY_RF24_CS_PIN
#define MY_RF24_CS_PIN (DEFAULT_RF24_CS_PIN)
#endif
/**
* @def MY_RF24_IRQ_PIN
* @brief Define this to use the IRQ pin of the RF24 module (optional).
*/
//#define MY_RF24_IRQ_PIN (2)
/**
* @def MY_RF24_POWER_PIN
* @brief Define this to use the RF24 power pin (optional).
*/
//#define MY_RF24_POWER_PIN (3)
/**
* @def MY_RX_MESSAGE_BUFFER_FEATURE
* @brief This enables the receiving buffer feature.
*
* This feature is currently not supported for anything but RF24.
* Require @ref MY_RF24_IRQ_PIN to be set.
*
* Note: Not supported on ESP8266, ESP32, STM32, nRF5 and sketches
* that use SoftSPI. See below issue for details
* https://github.com/mysensors/MySensors/issues/1128
*/
//#define MY_RX_MESSAGE_BUFFER_FEATURE
/**
* @def MY_RX_MESSAGE_BUFFER_SIZE
* @brief Define this to change the incoming message buffer size from the default.
*
* Require @ref MY_RX_MESSAGE_BUFFER_FEATURE to be set.
*/
#ifdef MY_RX_MESSAGE_BUFFER_FEATURE
#ifndef MY_RX_MESSAGE_BUFFER_SIZE
#define MY_RX_MESSAGE_BUFFER_SIZE (20)
#endif
#endif
/**
* @def MY_RF24_PA_LEVEL
* @brief Default RF24 PA level. Override in sketch if needed.
*
* - RF24_PA_MIN = -18dBm
* - RF24_PA_LOW = -12dBm
* - RF24_PA_HIGH = -6dBm
* - RF24_PA_MAX = 0dBm
*/
#ifndef MY_RF24_PA_LEVEL
#define MY_RF24_PA_LEVEL (RF24_PA_HIGH)
#endif
/**
* @def MY_RF24_CHANNEL
* @brief RF channel for the sensor net, 0-125.
*
* Frequencies: 2400 Mhz - 2525 Mhz
*
* Channels: 126
* @see https://www.nordicsemi.com/eng/nordic/download_resource/8765/2/42877161/2726
*
* - 0 => 2400 Mhz (RF24 channel 1)
* - 1 => 2401 Mhz (RF24 channel 2)
* - 76 => 2476 Mhz (RF24 channel 77)
* - 83 => 2483 Mhz (RF24 channel 84)
* - 124 => 2524 Mhz (RF24 channel 125)
* - 125 => 2525 Mhz (RF24 channel 126)
*
* In some countries there might be limitations, in Germany for example only the range
* 2400,0 - 2483,5 Mhz is allowed.
* @see https://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Frequenzen/Allgemeinzuteilungen/MobilfunkDectWlanCBFunk/2013_10_WLAN_2,4GHz_pdf.pdf
*/
#ifndef MY_RF24_CHANNEL
#define MY_RF24_CHANNEL (76)
#endif
/**
* @def MY_RF24_DATARATE
* @brief RF24 data rate.
*
* - RF24_250KBPS for 250kbs
* - RF24_1MBPS for 1Mbps
* - RF24_2MBPS for 2Mbps.
*
* @note nRF24L01, BK2401, BK2421, BK2491 and XN297 does not support RF24_250KBPS
* @note BK2401 does not support RF24_2MBPS
*/
#ifndef MY_RF24_DATARATE
#define MY_RF24_DATARATE (RF24_250KBPS)
#endif
/**
* @def MY_RF24_BASE_RADIO_ID
* @brief RF24 radio network identifier.
*
* This acts as base value for sensor nodeId addresses. Change this (or channel) if you have more
* than one sensor network.
*/
#ifndef MY_RF24_BASE_RADIO_ID
#define MY_RF24_BASE_RADIO_ID 0x00,0xFC,0xE1,0xA8,0xA8
#endif
/**
* @def MY_RF24_ADDR_WIDTH
* @brief RF24 base address width.
*/
#ifndef MY_RF24_ADDR_WIDTH
#define MY_RF24_ADDR_WIDTH (5)
#endif
/** @}*/ // End of RF24SettingGrpPub group
/**
* @defgroup NRF5SettingGrpPub nRF5
* @ingroup TransportSettingGrpPub
* @brief These options are specific to the nRF5 (with Enhanced ShockBurst) family of wireless
* transport modules.
*
* The nRF5 driver is OTA compatible with the RF24 driver.
*
* The following chips are supported by this driver:
* - nRF51x22
* - nRF52822
*
* @{
*/
/**
* @def MY_RADIO_NRF5_ESB
* @brief Define this to use nRF5 based radios for sensor network communication.
*
* @see ARDUINO_ARCH_NRF5
*/
//#define MY_RADIO_NRF5_ESB
/**
* @def MY_NRF5_ESB_ENABLE_ENCRYPTION
* @brief Define this to enable software based (RF24 compatible) %AES encryption.
*
* All nodes and gateway must have this enabled, and all must be personalized with the same %AES
* key.
* @see @ref personalization
*
* @warning This driver always sets the initialization vector to 0 so encryption is weak.
*/
//#define MY_NRF5_ESB_ENABLE_ENCRYPTION
/**
* @def MY_DEBUG_VERBOSE_NRF5_ESB
* @brief Define this for verbose debug prints related to the nRF5 driver.
*/
//#define MY_DEBUG_VERBOSE_NRF5_ESB
/**
* @def MY_NRF5_ESB_PA_LEVEL
* @brief Default nRF5 PA level. Override in sketch if needed.
*
* - NRF5_PA_MIN = -40dBm
* - NRF5_PA_LOW = -16dBm
* - NRF5_PA_HIGH = 0dBm
* - NRF5_PA_MAX = 4dBm
*/
#ifndef MY_NRF5_ESB_PA_LEVEL
#define MY_NRF5_ESB_PA_LEVEL (NRF5_PA_MAX)
#endif
/**
* @def MY_NRF5_ESB_CHANNEL
* @brief RF channel for the sensor net, 0-125.
*
* Frequencies: 2400 Mhz - 2525 Mhz
*
* Channels: 126
* @see https://www.nordicsemi.com/eng/nordic/download_resource/8765/2/42877161/2726
*
* - 0 => 2400 Mhz (RF24 channel 1)
* - 1 => 2401 Mhz (RF24 channel 2)
* - 76 => 2476 Mhz (RF24 channel 77)
* - 83 => 2483 Mhz (RF24 channel 84)
* - 124 => 2524 Mhz (RF24 channel 125)
* - 125 => 2525 Mhz (RF24 channel 126)
*
* In some countries there might be limitations, in Germany for example only the range
* 2400,0 - 2483,5 Mhz is allowed.
* @see http://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Frequenzen/Allgemeinzuteilungen/2013_10_WLAN_2,4GHz_pdf.pdf
*/
#ifndef MY_NRF5_ESB_CHANNEL
#define MY_NRF5_ESB_CHANNEL (76)
#endif
/**
* @def MY_NRF5_ESB_MODE
* @brief nRF5 mode.
*
* - NRF5_250KBPS for 250kbs (Deprecated)
* - NRF5_1MBPS for 1Mbps
* - NRF5_2MBPS for 2Mbps.
* - NRF5_BLE_1MBPS for 1Mbps BLE modulation
*/
#ifndef MY_NRF5_ESB_MODE
#ifdef RADIO_MODE_MODE_Nrf_250Kbit
#define MY_NRF5_ESB_MODE (NRF5_250KBPS)
#else
#define MY_NRF5_ESB_MODE (NRF5_1MBPS)
#endif
#endif
/**
* @def MY_NRF5_ESB_BASE_RADIO_ID
* @brief nRF5 radio network identifier.
*
* This acts as base value for sensor nodeId addresses. Change this (or channel) if you have more
* than one sensor network.
*/
#ifndef MY_NRF5_ESB_BASE_RADIO_ID
#define MY_NRF5_ESB_BASE_RADIO_ID 0x00, 0xFC, 0xE1, 0xA8, 0xA8
#endif
/**
* @def MY_NRF5_ESB_ADDR_WIDTH
* @brief nRF5 base address width.
*/
#ifndef MY_NRF5_ESB_ADDR_WIDTH
#define MY_NRF5_ESB_ADDR_WIDTH (5)
#endif
/**
* @def MY_NRF5_ESB_RX_BUFFER_SIZE
* @brief Declare the amount of incoming messages that can be buffered at driver level.
*/
#ifndef MY_NRF5_ESB_RX_BUFFER_SIZE
#define MY_NRF5_ESB_RX_BUFFER_SIZE (20)
#endif
/**
* @def MY_NRF5_ESB_REVERSE_ACK_TX
* @brief Switch to SI24R1 or faked nRF24L01+ compatible ACK mode. ACK bit is reversed on TX side.
*/
//#define MY_NRF5_ESB_REVERSE_ACK_TX
/**
* @def MY_NRF5_ESB_REVERSE_ACK_RX
* @brief Switch to SI24R1 or faked nRF24L01+ compatible ACK mode. ACK bit is reversed on RX side.
*/
//#define MY_NRF5_ESB_REVERSE_ACK_RX
/** @}*/ // End of NRF5SettingGrpPub group
/**
* @defgroup RFM69SettingGrpPub RFM69
* @ingroup TransportSettingGrpPub
* @brief These options are specific to the %RFM69 family of wireless transport modules.
*
* The following chips are supported by this driver:
* - Semtech sx1231
*
* If using the HW variant of the %RFM69 module, define @ref MY_IS_RFM69HW.
* @{
*/
/**
* @def MY_RADIO_RFM69
* @brief Define this to use %RFM69 based radios for sensor network communication.
*/
//#define MY_RADIO_RFM69
/**
* @def MY_DEBUG_VERBOSE_RFM69
* @brief Define this for verbose debug prints related to the %RFM69 driver.
*/
//#define MY_DEBUG_VERBOSE_RFM69
/**
* @def MY_DEBUG_VERBOSE_RFM69_REGISTERS
* @brief Define this for verbose dumping of the %RFM69 registers.
*/
//#define MY_DEBUG_VERBOSE_RFM69_REGISTERS
/**
* @def MY_RFM69_NEW_DRIVER
* @brief Define this to enable the improved %RFM69 driver.
*
* @note This driver is not compatible with the old (=default) %RFM69 driver.
*/
//#define MY_RFM69_NEW_DRIVER
/**
* @def MY_RFM69_FREQUENCY
* @brief The frequency to use.
*
* - RFM69_315MHZ
* - RFM69_433MHZ
* - RFM69_865MHZ
* - RFM69_868MHZ
* - RFM69_915MHZ
* - Custom frequency in Hz (new %RFM69 driver only)
* @see MY_RFM69_NEW_DRIVER
*
* This must match the hardware version of the %RFM69 radio.
* Additional information: https://en.wikipedia.org/wiki/Short_Range_Devices
*/
#ifndef MY_RFM69_FREQUENCY
#define MY_RFM69_FREQUENCY (RFM69_868MHZ)
#endif
/**
* @def MY_IS_RFM69HW
* @brief Define this if you are using the RFM69HW model.
*/
//#define MY_IS_RFM69HW
/**
* @def MY_RFM69HW
* @brief Set to true if @ref MY_IS_RFM69HW is set.
*
* @todo Mark this internals
*/
#ifdef MY_IS_RFM69HW
#define MY_RFM69HW true
#else
#define MY_RFM69HW false
#endif
/**
* @def MY_RFM69_TX_POWER_DBM
* @brief Set TX power level, default 5dBm (overridden if ATC mode enabled).
*/
#ifndef MY_RFM69_TX_POWER_DBM
#define MY_RFM69_TX_POWER_DBM (5)
#endif
/**
* @def MY_RFM69_ATC_TARGET_RSSI_DBM
* @brief Target RSSI level (in dBm) for %RFM69 ATC mode.
*/
#ifndef MY_RFM69_ATC_TARGET_RSSI_DBM
#define MY_RFM69_ATC_TARGET_RSSI_DBM (-80)
#endif
/**
* @def MY_RFM69_ATC_MODE_DISABLED
* @brief Define to disable ATC mode of %RFM69 driver.
*/
//#define MY_RFM69_ATC_MODE_DISABLED
/**
* @def MY_RFM69_MAX_POWER_LEVEL_DBM
* @brief Set max TX power in dBm if local legislation requires this
*
* - 1mW = 0dBm
* - 10mW = 10dBm
* - 25mW = 14dBm
* - 100mW = 20dBm
*
* See here: https://en.wikipedia.org/wiki/Short_Range_Devices
*/
//#define MY_RFM69_MAX_POWER_LEVEL_DBM (10u)
/**
* @def MY_RFM69_NETWORKID
* @brief %RFM69 Network ID. Use the same for all nodes that will talk to each other.
*/
#ifndef MY_RFM69_NETWORKID
#define MY_RFM69_NETWORKID (100)
#endif
/**
* @def MY_RFM69_RST_PIN
* @brief Define this to use the %RFM69 reset pin (optional).
*/
//#define MY_RFM69_RST_PIN (9)
#ifdef MY_RF69_RESET
#warning MY_RF69_RESET is depreciated, please use MY_RFM69_RST_PIN instead.
#define MY_RFM69_RST_PIN MY_RF69_RESET
#endif
/**
* @def MY_RFM69_POWER_PIN
* @brief Define this to use the %RFM69 power pin (optional).
*/
//#define MY_RFM69_POWER_PIN (3)
/**
* @def MY_RFM69_IRQ_PIN
* @brief Define this to override the default %RFM69 IRQ pin assignment.
*/
#ifndef MY_RFM69_IRQ_PIN
#ifdef MY_RF69_IRQ_PIN
#warning MY_RF69_IRQ_PIN is depreciated, please use MY_RFM69_IRQ_PIN instead.
#define MY_RFM69_IRQ_PIN MY_RF69_IRQ_PIN
#else
#define MY_RFM69_IRQ_PIN DEFAULT_RFM69_IRQ_PIN
#endif
#endif
/**
* @def MY_RFM69_IRQ_NUM
* @brief %RFM69 IRQ number.
*/
#ifndef MY_RFM69_IRQ_NUM
#ifdef MY_RF69_IRQ_NUM
#warning MY_RF69_IRQ_NUM is depreciated, please use MY_RFM69_IRQ_NUM instead.
#define MY_RFM69_IRQ_NUM MY_RF69_IRQ_NUM
#else
#define MY_RFM69_IRQ_NUM digitalPinToInterrupt(MY_RFM69_IRQ_PIN)
#endif
#endif
/**
* @def MY_RFM69_CS_PIN
* @brief %RFM69 SPI chip select pin.
*/
#ifndef MY_RFM69_CS_PIN
#ifdef MY_RF69_SPI_CS
#warning MY_RF69_SPI_CS is depreciated, please use MY_RFM69_CS_PIN instead.
#define MY_RFM69_CS_PIN MY_RF69_SPI_CS
#else
#define MY_RFM69_CS_PIN DEFAULT_RFM69_CS_PIN
#endif
#endif
/**
* @def MY_RFM69_SPI_SPEED
* @brief Set to overrule default RFM69 SPI speed.
*/
#ifndef MY_RFM69_SPI_SPEED
#define MY_RFM69_SPI_SPEED (4*1000000ul) // datasheet says 10Mhz max.
#endif
/**
* @def MY_RFM69_ENABLE_ENCRYPTION
* @brief Define this to enable %AES encryption in the %RFM69 module.
*
* All nodes and gateway must have this enabled, and all must be personalized with the same %AES
* key.
* @see @ref personalization
*/
//#define MY_RFM69_ENABLE_ENCRYPTION
/**
* @def MY_RFM69_MODEM_CONFIGURATION
* @brief %RFM69 modem configuration, default is %RFM69_FSK_BR55_5_FD50
*
* | Configuration | Modulation (xxx) | Bit rate | FD | RXBW | Additional settings
* |-------------------------|------------------|----------|--------|----------|---------------------------
* | RFM69_xxx_BR2_FD5 | FSK/GFSK/OOK | 2000 | 5000 | 111_24_4 | Whitening
* | RFM69_xxx_BR2_4_FD4_8 | FSK/GFSK/OOK | 2400 | 4800 | 111_24_4 | Whitening
* | RFM69_xxx_BR4_8_FD9_6 | FSK/GFSK/OOK | 4800 | 9600 | 111_24_4 | Whitening
* | RFM69_xxx_BR9_6_FD19_2 | FSK/GFSK/OOK | 9600 | 19200 | 111_24_4 | Whitening
* | RFM69_xxx_BR19_2_FD38_4 | FSK/GFSK/OOK | 19200 | 38400 | 111_24_3 | Whitening
* | RFM69_xxx_BR38_4_FD76_8 | FSK/GFSK/OOK | 38400 | 76800 | 111_24_2 | Whitening
* | RFM69_xxx_BR55_5_FD50 | FSK/GFSK/OOK | 55555 | 50000 | 111_16_2 | Whitening
* | RFM69_xxx_BR57_6_FD120 | FSK/GFSK/OOK | 57600 | 120000 | 111_16_1 | Whitening
* | RFM69_xxx_BR125_FD125 | FSK/GFSK/OOK | 125000 | 125000 | 010_16_2 | Whitening
* | RFM69_xxx_BR250_FD250 | FSK/GFSK/OOK | 250000 | 250000 | 111_16_0 | Whitening
*
* https://www.semtech.com/uploads/documents/sx1231.pdf
*
*/
//#define MY_RFM69_MODEM_CONFIGURATION (RFM69_FSK_BR55_5_FD50)
/** @}*/ // End of RFM69SettingGrpPub group
/**
* @defgroup RFM95SettingGrpPub RFM95
* @ingroup TransportSettingGrpPub
* @brief These options are specific to the %RFM95 family of wireless transport modules.
*
* The following chips are supported by this driver:
* - Semtech sx1276
* @{
*/
/**
* @def MY_RADIO_RFM95
* @brief Define this to use RFM95 based radios for sensor network communication.
*/
//#define MY_RADIO_RFM95
/**
* @def MY_DEBUG_VERBOSE_RFM95
* @brief Define this for verbose debug prints related to the RFM95 driver.
*/
//#define MY_DEBUG_VERBOSE_RFM95
/**
* @def MY_RFM95_ENABLE_ENCRYPTION
* @brief Define this to enable software based %AES encryption.
*
* All nodes and gateway must have this enabled, and all must be personalized with the same %AES
* key.
* @see @ref personalization
*
* @warning This driver always sets the initialization vector to 0 so encryption is weak.
*/
//#define MY_RFM95_ENABLE_ENCRYPTION
/**
* @def MY_RFM95_FREQUENCY
* @brief The frequency to use.
*
* - RFM95_169MHZ
* - RFM95_315MHZ
* - RFM95_434MHZ
* - RFM95_868MHZ
* - RFM95_915MHZ
* - Custom frequency in Hz
*
* This must match the hardware version of the RFM95 radio.
* Additional information: https://en.wikipedia.org/wiki/Short_Range_Devices
*/
#ifndef MY_RFM95_FREQUENCY
#define MY_RFM95_FREQUENCY (RFM95_868MHZ)
#endif
/**
* @def MY_RFM95_MODEM_CONFIGRUATION
* @brief RFM95 modem configuration.
*
* BW = Bandwidth in kHz
* CR = Error correction code
* SF = Spreading factor, chips / symbol
*
* | CONFIG | BW | CR | SF | Comment
* |------------------------|-------|-----|------|-----------------------------
* | RFM95_BW125CR45SF128 | 125 | 4/5 | 128 | Default, medium range
* | RFM95_BW500CR45SF128 | 500 | 4/5 | 128 | Fast, short range
* | RFM95_BW31_25CR48SF512 | 31.25 | 4/8 | 512 | Slow, long range
* | RFM95_BW125CR48SF4096 | 125 | 4/8 | 4096 | Slow, long range
*
*/
#ifndef MY_RFM95_MODEM_CONFIGRUATION
#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128
#endif
/**
* @def MY_RFM95_RST_PIN
* @brief Define this to use the RFM95 reset pin (optional).
*/
//#define MY_RFM95_RST_PIN (9)
/**
* @def MY_RFM95_POWER_PIN
* @brief Define this to use the RFM95 power pin (optional).
*/
//#define MY_RFM95_POWER_PIN (3)
/**
* @def MY_RFM95_IRQ_PIN
* @brief Define this to use the RFM95 IRQ pin.
*/
#ifndef MY_RFM95_IRQ_PIN
#define MY_RFM95_IRQ_PIN DEFAULT_RFM95_IRQ_PIN
#endif
/**
* @def MY_RFM95_IRQ_NUM
* @brief RFM95 IRQ number.
*/
#ifndef MY_RFM95_IRQ_NUM
#define MY_RFM95_IRQ_NUM digitalPinToInterrupt(MY_RFM95_IRQ_PIN)
#endif
/**
* @def MY_RFM95_CS_PIN
* @brief RFM95 SPI chip select pin.
*/
#ifndef MY_RFM95_CS_PIN
#define MY_RFM95_CS_PIN DEFAULT_RFM95_CS_PIN
#endif
/**
* @def MY_RFM95_SPI_SPEED
* @brief Set to overrule default RFM95 SPI speed.
*/
#ifndef MY_RFM95_SPI_SPEED
#define MY_RFM95_SPI_SPEED (4*1000000ul)
#endif
/**
* @def MY_RFM95_TX_POWER_DBM
* @brief Set TX power level, default 13dBm (overridden if ATC mode enabled)
*
* See here https://en.wikipedia.org/wiki/Short_Range_Devices
*/
#ifndef MY_RFM95_TX_POWER_DBM
#define MY_RFM95_TX_POWER_DBM (13u) // 20mW
#endif
/**
* @def MY_RFM95_ATC_MODE_DISABLED
* @brief Define to disable ATC mode of RFM95 driver.
*/
//#define MY_RFM95_ATC_MODE_DISABLED
/**
* @def MY_RFM95_ATC_TARGET_RSSI
* @brief Target RSSI level (in dBm) for RFM95 ATC mode
*/
#ifndef MY_RFM95_ATC_TARGET_RSSI
#define MY_RFM95_ATC_TARGET_RSSI (-70)
#endif
/**
* @def MY_RFM95_MAX_POWER_LEVEL_DBM