Skip to content

Commit bd8d53c

Browse files
committed
Replace #define with a constant, use speaking names.
1 parent e9e6820 commit bd8d53c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

libraries/Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino

+8-4
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,12 @@
2323

2424
#include <Arduino_CAN.h>
2525

26-
#define Mask11Bit 0x1FFC0000
27-
#define Mask29Bit 0x1FFFFFFF
26+
/**************************************************************************************
27+
* CONST
28+
**************************************************************************************/
29+
30+
static uint32_t const CAN_FILTER_MASK_STANDARD = 0x1FFC0000;
31+
static uint32_t const CAN_FILTER_MASK_EXTENDED = 0x1FFFFFFF;
2832

2933
/**************************************************************************************
3034
* SETUP/LOOP
@@ -35,8 +39,8 @@ void setup()
3539
Serial.begin(115200);
3640
while (!Serial) { }
3741

38-
CAN.setFilterMask_Extended(Mask29Bit);
39-
CAN.setFilterMask_Standard(Mask11Bit);
42+
CAN.setFilterMask_Extended(CAN_FILTER_MASK_EXTENDED);
43+
CAN.setFilterMask_Standard(CAN_FILTER_MASK_STANDARD);
4044

4145
for (int c=16; c <= 23; c++) {
4246
CAN.setMailboxID(c, 0x0100);

0 commit comments

Comments
 (0)