forked from mysensors/MySensors
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MyConfig.h
1235 lines (1074 loc) · 34.3 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-2017 Sensnology AB
* Full contributor list: https://github.com/mysensors/Arduino/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
*
* MySensors specific configurations
*/
#ifndef MyConfig_h
#define MyConfig_h
#include <stdint.h>
/**********************************
* Serial and debug options
***********************************/
/**
* @def MY_DEBUG
* @brief Enable MY_DEBUG in sketch 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
*/
//#define MY_DEBUG
/**
* @def MY_SPECIAL_DEBUG
* @brief Enable MY_SPECIAL_DEBUG to enable I_DEBUG messages.
* I_DEBUG requests are:
* 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 Enable MY_DISABLED_SERIAL in sketch if you want to use TX(1), RX(0) as normal I/O pins
*/
//#define MY_DISABLED_SERIAL
/**
* @def MY_CORE_ONLY
* @brief Enable MY_CORE_ONLY flag if you want to use core functions without loading the framework
*/
//#define MY_CORE_ONLY
// Turn off debug if serial pins is used for other stuff
#ifdef MY_DISABLED_SERIAL
#undef MY_DEBUG
#endif
/**
* @def MY_BAUD_RATE
* @brief Serial output baud rate (debug prints and serial gateway speed).
*/
#ifndef MY_BAUD_RATE
#define MY_BAUD_RATE (115200ul)
#endif
/**
* @def MY_SERIAL_OUTPUT_SIZE
* @brief Max. characters for serial output.
*/
#ifndef MY_SERIAL_OUTPUT_SIZE
#define MY_SERIAL_OUTPUT_SIZE (120u)
#endif
/**
* @def MY_DISABLE_REMOTE_RESET
* @brief Disables over-the-air reset of node
*/
//#define MY_DISABLE_REMOTE_RESET
/**********************************
* Radio selection and node config
***********************************/
// Selecting uplink transport layer is optional (for a gateway node).
//#define MY_RADIO_RF24
//#define MY_RADIO_RFM69
//#define MY_RADIO_RFM95
//#define MY_RS485
// legacy
#ifdef MY_RADIO_NRF24
//MY_RADIO_NRF24 is deprecated
#define MY_RADIO_RF24
#endif
/**
* @def MY_RAM_ROUTING_TABLE_FEATURE
* @brief If enabled, the routing table is kept in RAM (if memory allows) and saved in regular intervals.
* note: AVR has limited memory, use with care
*/
#define MY_RAM_ROUTING_TABLE_FEATURE
/**
* @def MY_ROUTING_TABLE_SAVE_INTERVAL_MS
* @brief Interval to dump content of routing table to eeprom
*/
#ifndef MY_ROUTING_TABLE_SAVE_INTERVAL_MS
#define MY_ROUTING_TABLE_SAVE_INTERVAL_MS (30*60*1000ul)
#endif
/**
* @def MY_TRANSPORT_SANITY_CHECK
* @brief If enabled, node will check transport in regular intervals to detect HW issues and re-initialize in case of failure.
* This feature is enabled for all repeater nodes (incl. GW)
*/
//#define MY_TRANSPORT_SANITY_CHECK
/**
* @def MY_TRANSPORT_SANITY_CHECK_INTERVAL_MS
* @brief Interval (in ms) for transport sanity checks
*/
#ifndef MY_TRANSPORT_SANITY_CHECK_INTERVAL_MS
#define MY_TRANSPORT_SANITY_CHECK_INTERVAL_MS (15*60*1000ul)
#endif
/**
* @def MY_TRANSPORT_DISCOVERY_INTERVAL_MS
* @brief This is a gateway-only feature: Interval (in ms) to issue network discovery checks
*/
#ifndef MY_TRANSPORT_DISCOVERY_INTERVAL_MS
#define MY_TRANSPORT_DISCOVERY_INTERVAL_MS (20*60*1000ul)
#endif
/**
*@def MY_TRANSPORT_UPLINK_CHECK_DISABLED
*@brief If set, uplink check to GW is disabled during transport initialisation
*/
//#define MY_TRANSPORT_UPLINK_CHECK_DISABLED
/**
*@def MY_TRANSPORT_MAX_TX_FAILURES
*@brief Set to override max. consecutive TX failures until SNP is initiated
*/
//#define MY_TRANSPORT_MAX_TX_FAILURES (10u)
/**
* @def MY_REGISTRATION_FEATURE
* @brief If enabled, node has to register to gateway/controller before allowed to send sensor data.
*/
#define MY_REGISTRATION_FEATURE
/**
* @def MY_REGISTRATION_RETRIES
* @brief Number of registration retries if no reply received from GW/controller
*/
#ifndef MY_REGISTRATION_RETRIES
#define MY_REGISTRATION_RETRIES (3u)
#endif
/**
* @def MY_REGISTRATION_DEFAULT
* @brief Node registration default - this applies if no registration response is received from controller
*/
#define MY_REGISTRATION_DEFAULT true
/**
* @def MY_REGISTRATION_CONTROLLER
* @brief If enabled, node registration request has to be handled by controller
*/
// #define MY_REGISTRATION_CONTROLLER
/**
* @def MY_CORE_COMPATIBILITY_CHECK
* @brief If enabled, library compatibility is checked during node registration. Incompatible libraries are unable to send sensor data.
*/
#define MY_CORE_COMPATIBILITY_CHECK
/**
* @def MY_TRANSPORT_WAIT_READY_MS
* @brief Timeout in MS until transport is ready during startup, set to 0 for no timeout
*/
#ifndef MY_TRANSPORT_WAIT_READY_MS
#define MY_TRANSPORT_WAIT_READY_MS (0ul)
#endif
/**
* @def MY_PASSIVE_NODE
* @brief If enabled, the node operates fully autonomously, i.e. messages are sent without ACKing.
* note: All transport-related checks and safety-mechanisms are disabled.
* Requirement: @ref MY_NODE_ID needs to be set, @ref MY_PARENT_NODE_ID and @ref MY_PARENT_NODE_IS_STATIC are optional.
* Singing, registration, and OTA FW update are disabled.
*/
//#define MY_PASSIVE_NODE
/**
* @def MY_NODE_ID
* @brief Node id defaults to AUTO (tries to fetch id from controller).
*/
#ifndef MY_NODE_ID
#define MY_NODE_ID AUTO
#endif
/**
* @def MY_PARENT_NODE_ID
* @brief Node parent defaults to AUTO (tries to find a parent automatically).
*/
#ifndef MY_PARENT_NODE_ID
#define MY_PARENT_NODE_ID AUTO
#endif
/**
* @def MY_PARENT_NODE_IS_STATIC
* @brief Enable MY_PARENT_NODE_IS_STATIC to disable fall back if parent node fails
*/
//#define MY_PARENT_NODE_IS_STATIC
/**
* @def MY_REPEATER_FEATURE
* @brief Enables repeater functionality (relays messages from other nodes)
*/
//#define MY_REPEATER_FEATURE
/**
* @def MY_SLEEP_TRANSPORT_RECONNECT_TIMEOUT_MS
* @brief Timeout (in ms) to re-establish link if node is send to sleep and transport is not ready.
*/
#ifndef MY_SLEEP_TRANSPORT_RECONNECT_TIMEOUT_MS
#define MY_SLEEP_TRANSPORT_RECONNECT_TIMEOUT_MS (10*1000ul)
#endif
/**
* @def MY_SMART_SLEEP_WAIT_DURATION_MS
* @brief The wait period (in ms) before going to sleep when using smartSleep-functions.
*
* This period has to be long enough for controller to be able to send out
* potential buffered messages.
*/
#ifndef MY_SMART_SLEEP_WAIT_DURATION_MS
#define MY_SMART_SLEEP_WAIT_DURATION_MS (500ul)
#endif
/**********************************
* Over the air firmware updates
***********************************/
// Enable MY_OTA_FIRMWARE_FEATURE in sketch to allow safe over-the-air firmware updates.
// This feature requires external flash and the DualOptiBoot boot-loader.
// Note: You can still have OTA FW updates without external flash but it
// requires the MYSBootloader and disabled MY_OTA_FIRMWARE_FEATURE
//#define MY_OTA_FIRMWARE_FEATURE
/**
* @def MY_OTA_FLASH_SS
* @brief Slave select pin for external flash.
*/
#ifndef MY_OTA_FLASH_SS
#define MY_OTA_FLASH_SS (8)
#endif
/**
* @def MY_OTA_FLASH_JDECID
* @brief Flash JDECID. Use (0x00) if unknown.
*/
#ifndef MY_OTA_FLASH_JDECID
#define MY_OTA_FLASH_JDECID (0x1F65)
#endif
/**********************************
* Gateway config
***********************************/
/**
* @def MY_GATEWAY_MAX_RECEIVE_LENGTH
* @brief Max buffersize needed for messages coming from controller.
*/
#ifndef MY_GATEWAY_MAX_RECEIVE_LENGTH
#define MY_GATEWAY_MAX_RECEIVE_LENGTH (100u)
#endif
/**
* @def MY_GATEWAY_MAX_SEND_LENGTH
* @brief Max buffer size when sending messages.
*/
#ifndef MY_GATEWAY_MAX_SEND_LENGTH
#define MY_GATEWAY_MAX_SEND_LENGTH (120u)
#endif
/**
* @def MY_GATEWAY_MAX_CLIENTS
* @brief Max number of parallel clients (sever mode).
*/
#ifndef MY_GATEWAY_MAX_CLIENTS
#define MY_GATEWAY_MAX_CLIENTS (1u)
#endif
/**********************************
* Information LEDs blinking
***********************************/
// If one of the following is defined here, or in the sketch, the pin will be used for the
// corresponding led function.
// They have to be enabled here (or in your sketch). Replace x with the pin number you have the LED on.
//
// NOTE!! that on some platforms (for example sensebender GW) the hardware variant can enable LEDs by default,
// These defaults can be overridden by defining one of these.
//#define MY_DEFAULT_ERR_LED_PIN x
//#define MY_DEFAULT_TX_LED_PIN x
//#define MY_DEFAULT_RX_LED_PIN x
/**
* @def MY_WITH_LEDS_BLINKING_INVERSE
* @brief The following setting allows you to inverse the LED blinking.
* When MY_WITH_LEDS_BLINKING_INVERSE is enabled LEDSs are normally turned on and switches off when blinking.
*/
//#define MY_WITH_LEDS_BLINKING_INVERSE
/**
* @def MY_INDICATION_HANDLER
* @brief Enable to use own indication handler.
*/
//#define MY_INDICATION_HANDLER
/**
* @def MY_DEFAULT_LED_BLINK_PERIOD
* @brief Default LEDs blinking period in milliseconds.
*/
#ifndef MY_DEFAULT_LED_BLINK_PERIOD
#define MY_DEFAULT_LED_BLINK_PERIOD 300
#endif
/**********************************************
* Gateway inclusion button/mode configuration
**********************************************/
/**
* @def MY_INCLUSION_MODE_FEATURE
* @brief Enables inclusion mode feature.
*/
//#define MY_INCLUSION_MODE_FEATURE
/**
* @def MY_INCLUSION_BUTTON_FEATURE
* @brief Enables inclusion-mode button feature on the gateway device
*/
//#define MY_INCLUSION_BUTTON_FEATURE
// Disable inclusion mode button if inclusion mode feature is not enabled
#ifndef MY_INCLUSION_MODE_FEATURE
#undef MY_INCLUSION_BUTTON_FEATURE
#endif
/**
* @def MY_INCLUSION_MODE_BUTTON_PIN
* @brief The default input pin used for the inclusion mode button.
*/
#ifndef MY_INCLUSION_MODE_BUTTON_PIN
#if defined(ARDUINO_ARCH_ESP8266)
#define MY_INCLUSION_MODE_BUTTON_PIN (5)
#else
#define MY_INCLUSION_MODE_BUTTON_PIN (3)
#endif
#endif
/**
* @def MY_INCLUSION_MODE_DURATION
* @brief Number of seconds (default one minute) inclusion mode should be enabled.
*/
#ifndef MY_INCLUSION_MODE_DURATION
#define MY_INCLUSION_MODE_DURATION (60)
#endif
/**
* @def MY_INCLUSION_BUTTON_PRESSED
* @brief The logical level indicating a pressed inclusion mode button.
*/
#if defined(MY_INCLUSION_BUTTON_EXTERNAL_PULLUP)
#define MY_INCLUSION_BUTTON_PRESSED HIGH
#else
#define MY_INCLUSION_BUTTON_PRESSED LOW
#endif
/**********************************
* Message Signing Settings
***********************************/
/**
* @def MY_DEBUG_VERBOSE_SIGNING
* @brief Flag for verbose debug prints related to signing. Requires DEBUG to be enabled.
* This will add even more to the size of the final sketch!
*/
//#define MY_DEBUG_VERBOSE_SIGNING
/**
* @def MY_SIGNING_ATSHA204
* @brief Enables HW backed signing functionality in library.
*
* For any signing related functionality to be included, this define or @ref MY_SIGNING_SOFT has to be enabled.
*/
//#define MY_SIGNING_ATSHA204
/**
* @def MY_SIGNING_SOFT
* @brief Enables SW backed signing functionality in library.
*
* For any signing related functionality to be included, this define or @ref MY_SIGNING_ATSHA204 has to be enabled.
*/
//#define MY_SIGNING_SOFT
/**
* @def MY_SIGNING_REQUEST_SIGNATURES
* @brief Enable this to inform gateway to sign all messages sent to this node.
*
* If used for a gateway, gateway will only request signatures from nodes that in turn
* request signatures from gateway.
*/
//#define MY_SIGNING_REQUEST_SIGNATURES
/**
* @def MY_SIGNING_GW_REQUEST_SIGNATURES_FROM_ALL
* @brief Enable this to have gateway require all nodes in the network to sign messages sent to it.
* @ref MY_SIGNING_REQUEST_SIGNATURES must also be set.
*
* Use this for maximum security, but be aware that every single node will have to be personalized before they can be used.
* Note that if this is enabled, and whitelisting is also enabled, whitelisting will also be in effect for all nodes.
*/
//#define MY_SIGNING_GW_REQUEST_SIGNATURES_FROM_ALL
/**
* @def MY_VERIFICATION_TIMEOUT_MS
* @brief Define a suitable timeout for a signature verification session
*
* Consider the turnaround from a nonce being generated to a signed message being received
* which might vary, especially in networks with many hops. 5s ought to be enough for anyone.
*/
#ifndef MY_VERIFICATION_TIMEOUT_MS
#define MY_VERIFICATION_TIMEOUT_MS (5*1000ul)
#endif
/**
* @def MY_SIGNING_NODE_WHITELISTING
* @brief Enable to turn on whitelisting
*
* When enabled, a signing node will salt the signature with it's unique signature and nodeId.<br>
* The verifying node will look up the sender in a local table of trusted nodes and
* do the corresponding salting in order to verify the signature.<br>
* For this reason, if whitelisting is enabled on one of the nodes in a sign-verify pair, both
* nodes have to implement whitelisting for this to work.<br>
* Note that a node can still transmit a non-salted message (i.e. have whitelisting disabled)
* to a node that has whitelisting enabled (assuming the receiver does not have a matching entry
* for the sender in it's whitelist). The whitelist to use is defined as the value of the flag.
*/
//#define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01}}}
/**
* @def MY_SIGNING_ATSHA204_PIN
* @brief Atsha204 default pin setting
*
* Pin where ATSHA204 is attached
*/
#ifndef MY_SIGNING_ATSHA204_PIN
#define MY_SIGNING_ATSHA204_PIN (17)
#endif
/**
* @def MY_SIGNING_SOFT_RANDOMSEED_PIN
* @brief Pin used for random generation in soft signing
*
* Do not connect anything to this when soft signing is enabled
*/
#ifndef MY_SIGNING_SOFT_RANDOMSEED_PIN
#define MY_SIGNING_SOFT_RANDOMSEED_PIN (7)
#endif
/**********************************
* RS485 Driver Defaults
***********************************/
/**
* @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_DE_PIN
* @brief RS485 driver enable pin.
*/
//#define MY_RS485_DE_PIN (2)
/**
* @def MY_RS485_HWSERIAL
* @brief Enable this if RS485 is connected to a hardware serial port.
*/
//#define MY_RS485_HWSERIAL Serial1
/**********************************
* NRF24L01P Driver Defaults
***********************************/
/**
* @def MY_RF24_ENABLE_ENCRYPTION
* @brief Enables RF24 encryption (all nodes and gateway must have this enabled, and all must be personalized with the same AES key)
*/
//#define MY_RF24_ENABLE_ENCRYPTION
/**
* @def MY_DEBUG_VERBOSE_RF24
* @brief Enable MY_DEBUG_VERBOSE_RF24 flag for verbose debug prints related to the RF24 driver.
*/
//#define MY_DEBUG_VERBOSE_RF24
/**
* @def MY_RF24_SPI_SPEED
* @brief MY_RF24_SPI_SPEED to overrule default nRF24L01+ SPI speed, 2MHz - safe for nRF24L01+ clones
*/
#ifndef MY_RF24_SPI_SPEED
#define MY_RF24_SPI_SPEED (2*1000000ul)
#endif
/**
* @def MY_RF24_CE_PIN
* @brief Default RF24 chip enable pin setting. Override in sketch if needed.
*/
#ifndef MY_RF24_CE_PIN
#define MY_RF24_CE_PIN DEFAULT_RF24_CE_PIN
#endif
/**
* @def MY_RF24_CS_PIN
* @brief Default RF24 chip select pin setting. Override in sketch if needed.
*/
#ifndef MY_RF24_CS_PIN
#define MY_RF24_CS_PIN DEFAULT_RF24_CS_PIN
#endif
/**
* @def MY_RF24_POWER_PIN
* @brief NRF24 power pin, uncomment if used
*/
//#define MY_RF24_POWER_PIN (3)
/**
* @def MY_RX_MESSAGE_BUFFER_FEATURE
* @brief This enabled the receiving buffer feature.
*
* This feature is currently not supported for RFM69 and RS485, for RF24 MY_RF24_IRQ_PIN has to be defined.
*/
//#define MY_RX_MESSAGE_BUFFER_FEATURE
/**
* @def MY_RX_MESSAGE_BUFFER_SIZE
* @brief Declare the amount of incoming messages that can be buffered.
*/
#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_LOW = -18dBm
* RF24_PA_MID = -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.
* Frequence: 2400 Mhz - 2525 Mhz Channels: 126
* http://www.mysensors.org/radio/nRF24L01Plus.pdf
* 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
* http://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Frequenzen/Allgemeinzuteilungen/2013_10_WLAN_2,4GHz_pdf.pdf
*/
#ifndef MY_RF24_CHANNEL
#define MY_RF24_CHANNEL (76)
#endif
/**
* @def MY_RF24_DATARATE
* @brief RF24 datarate (RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps or RF24_2MBPS for 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 address width.
*
* This defines the width of the base address.
*/
#ifndef MY_RF24_ADDR_WIDTH
#define MY_RF24_ADDR_WIDTH (5)
#endif
// Enable SOFTSPI for NRF24L01, useful for the W5100 Ethernet module
//#define MY_SOFTSPI
/**
* @def MY_SOFT_SPI_SCK_PIN
* @brief Soft SPI SCK pin.
*/
#ifndef MY_SOFT_SPI_SCK_PIN
#define MY_SOFT_SPI_SCK_PIN (14)
#endif
/**
* @def MY_SOFT_SPI_MISO_PIN
* @brief Soft SPI MISO pin.
*/
#ifndef MY_SOFT_SPI_MISO_PIN
#define MY_SOFT_SPI_MISO_PIN (16)
#endif
/**
* @def MY_SOFT_SPI_MOSI_PIN
* @brief Soft SPI MOSI pin.
*/
#ifndef MY_SOFT_SPI_MOSI_PIN
#define MY_SOFT_SPI_MOSI_PIN (15)
#endif
/**********************************
* RFM69 Driver Defaults
***********************************/
/**
* @def MY_DEBUG_VERBOSE_RFM69
* @brief Enable MY_DEBUG_VERBOSE_RFM69 flag for verbose debug prints related to the RFM69 driver.
*/
//#define MY_DEBUG_VERBOSE_RFM69
/**
* @def MY_DEBUG_VERBOSE_RFM69_REGISTERS
* @brief Print content of RFM69 radio registers.
*/
//#define MY_DEBUG_VERBOSE_RFM69_REGISTERS
/**
* @def MY_RFM69_NEW_DRIVER
* @brief Enable MY_RFM69_NEW_DRIVER to enable the refactored RFM69 driver.
* IMPORTANT: This driver is not compatible with the old (=default) RFM69 driver.
*/
//#define MY_RFM69_NEW_DRIVER
/**
* @def MY_RFM69_FREQUENCY
* @brief RFM69 frequency to use: RFM69_433MHZ, RFM69_868MHZ, RFM69_915MHZ, or custom frequency in Hz (new RFM69 driver only).
*
* 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 Enable this if you're running the RFM69HW model.
*/
//#define MY_IS_RFM69HW
/**
* @def MY_RFM69HW
* @brief Set to true if @ref MY_IS_RFM69HW is set.
*/
#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 (overriden 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 Switch 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
* 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 RFM69 reset pin, uncomment if used.
*/
//#define MY_RFM69_RST_PIN (9)
#ifdef MY_RF69_RESET
// legacy, older board files
#define MY_RFM69_RST_PIN MY_RF69_RESET
#endif
/**
* @def MY_RFM69_POWER_PIN
* @brief RFM69 power pin
*/
//#define MY_RFM69_POWER_PIN (3)
/**
* @def MY_RFM69_IRQ_PIN
* @brief RFM69 IRQ pin
*/
#ifndef MY_RFM69_IRQ_PIN
#ifdef MY_RF69_IRQ_PIN
// legacy, older board files
#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
// legacy, older board files
#define MY_RFM69_IRQ_NUM MY_RF69_IRQ_NUM
#else
#define MY_RFM69_IRQ_NUM DEFAULT_RFM69_IRQ_NUM
#endif
#endif
/**
* @def MY_RFM69_CS_PIN
* @brief RFM69 SPI chip select pin.
*/
#ifndef MY_RFM69_CS_PIN
#ifdef MY_RF69_SPI_CS
// legacy, older board files
#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
* Enables RFM69 encryption (all nodes and gateway must have this enabled, and all must be personalized with the same AES key)
*/
//#define MY_RFM69_ENABLE_ENCRYPTION
/**
* Uncomment if you need listenmode, else comment it and save memory
*/
//#define MY_RFM69_ENABLE_LISTENMODE
#if defined(MY_RFM69_ENABLE_LISTENMODE) && !defined(MY_RFM69_DEFAULT_LISTEN_RX_US)
// By default, receive for 256uS in listen mode and idle for ~1s
#define MY_RFM69_DEFAULT_LISTEN_RX_US (256)
#endif
#if defined(MY_RFM69_ENABLE_LISTENMODE) && !defined(MY_RFM69_DEFAULT_LISTEN_IDLE_US)
// By default, receive for 256uS in listen mode and idle for ~1s
#define MY_RFM69_DEFAULT_LISTEN_IDLE_US (1*1000000ul)
#endif
/**
* @def MY_RFM69_BITRATE_MSB
* The bit rate. Most significant bits. Bitrate between the transmitter and the receiver must be better than 6.5. Refer to RFM69registers.h (L.153) for settings or http://www.semtech.com/apps/filedown/down.php?file=sx1231.pdf
* @brief Datarate value. Note : RFM69_FOSC(Hz)/MSB_LSBVALUE = Bitrate in kbits
*
* @def MY_RFM69_BITRATE_LSB
* The bit rate. Less significant bits. Bitrate between the transmitter and the receiver must be better than 6.5. Refer to RFM69registers.h (L.153) for settings or http://www.semtech.com/apps/filedown/down.php?file=sx1231.pdf
* @brief Datarate value. Note : RFM69_FOSC(Hz)/MSB_LSBVALUE = Bitrate in kbits
*/
#if !defined(MY_RFM69_BITRATE_MSB) && !defined(MY_RFM69_BITRATE_LSB)
#define MY_RFM69_BITRATE_MSB RFM69_BITRATEMSB_55555
#define MY_RFM69_BITRATE_LSB RFM69_BITRATELSB_55555
#endif
/**********************************
* RFM95 driver defaults
***********************************/
/**
* @def MY_DEBUG_VERBOSE_RFM95
* @brief Enable MY_DEBUG_VERBOSE_RFM95 flag for verbose debug prints related to the RFM95 driver.
*/
//#define MY_DEBUG_VERBOSE_RFM95
/**
* @def MY_RFM95_FREQUENCY
* @brief RFM95 frequency to use: RFM95_169MHZ, RFM95_315MHZ, RFM95_434MHZ, RFM95_868MHZ, RFM95_915MHZ, or 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, see table. Default RFM95 modem configuration: @ref RFM95_BW125CR45SF128
*
* 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 RFM95 reset pin, uncomment if used.
*/
//#define MY_RFM95_RST_PIN (9)
/**
* @def MY_RFM95_POWER_PIN
* @brief RFM95 power pin, uncomment if used
*/
//#define MY_RFM95_POWER_PIN (3)
/**
* @def MY_RFM95_IRQ_PIN
* @brief 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 DEFAULT_RFM95_IRQ_NUM
#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, default 4Mhz.
*/
#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 (overriden 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 Switch to disable RFM95 ATC mode
*/
//#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 (-60)
#endif
/**
* @def MY_RFM95_MAX_POWER_LEVEL_DBM
* @brief Set max TX power in dBm if local legislation requires
* 1mW = 0dBm, 10mW = 10dBm, 25mW = 14dBm, 100mW = 20dBm
* see here: https://en.wikipedia.org/wiki/Short_Range_Devices
*/
//#define MY_RFM95_MAX_POWER_LEVEL_DBM (10u)
/**
* @def MY_RFM95_TCXO
* @brief Enable to force your radio to use an external frequency source (e.g. TCXO, if present).
* This allows for better stability using SF 9 to 12.
*/
//#define MY_RFM95_TCXO
/**************************************
* Signal report
***************************************/
/**
* @def MY_SIGNAL_REPORT_ENABLED
* @brief Enables signal report functionality, see @ref transportSignalReport().
* NOTE: This feature adds ~1kB code to the sketch.
*/
#define MY_SIGNAL_REPORT_ENABLED
/**************************************
* Ethernet Gateway Transport Defaults
***************************************/