Feng Hong / Mbed OS Nucleo_rtos_basic
Revision:
13:9f581a090e53
Parent:
12:5cb359f981f3
Child:
14:2e17a27f56b2
--- a/main.cpp	Sat Apr 20 09:31:30 2019 +0000
+++ b/main.cpp	Sat Apr 27 09:30:38 2019 +0000
@@ -50,7 +50,7 @@
 
 EEPROM ep(SDA,SCL,EEPROM_ADDR,EEPROM::T24C256);
 extern void eeprom_test(void);
-int init_id = 0x537;  // first 8 bit is the address
+int init_id = 0x12340000;  // first 8 bit is the address
 
 uint8_t can_tx_data[8];
 uint8_t can_rx_data[8];
@@ -273,15 +273,17 @@
 
     input1.mode(PullUp);
     input2.mode(PullUp);
-    can_receivethread.start(can_rxthread);  
-    can_handlethread.start(analyzePayload);   
+
 //    flashIAP.init();
 //    printf("Flash start address: 0x%08x Flash Size: %d\r\n", flashIAP.get_flash_start(), flashIAP.get_flash_size());
 //    can1.reset();
 //    can2.reset();
     can1.frequency(100000);
+    can1.filter(init_id, 0xFFFC0000, CANExtended);  // 0xFFFC0000 to filter the last 18bits 0-17
 //    can2.frequency(100000);
     //button0.mode(PullUp); // Activate pull-up
+    can_receivethread.start(can_rxthread);  
+    can_handlethread.start(analyzePayload);   
 
     button0.fall(callback(button0_onpressed_cb)); // Attach ISR to handle button press event
     button0.rise(callback(button0_onpressed_cb)); // Attach ISR to handle button press event