Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 16:f4277e9b8612
- Parent:
- 14:2e17a27f56b2
- Child:
- 17:faa4d4976d22
--- a/main.cpp Sat Jun 08 09:19:05 2019 +0000 +++ b/main.cpp Sat Jun 29 09:53:19 2019 +0000 @@ -54,7 +54,8 @@ EEPROM ep(SDA,SCL,EEPROM_ADDR,EEPROM::T24C256); extern void eeprom_test(void); -int device_address = DEVICE_DEFAULT_ADDRESS; // first 11 bytes +int device_address = DEVICE_DEFAULT_ADDRESS; // address 11 bits: last 8 bits is device_address +int device_type; //address 11 bits: first 3 bits is device_type int init_id = 0x00300000; // first 11 bit is the address int init_filter_handle, broadcast_filter_handle; int broadcast_id = 0x1ffC0000; @@ -295,6 +296,8 @@ printf("EEPROM: read device address:%d 0x%08x\r\n", device_address, device_address); if ((device_address == 0) || (device_address == 0xFFFFFFFF)) device_address = DEVICE_DEFAULT_ADDRESS; + device_type = (device_address & 0x00000700) >> 8; + #ifdef LCD_1621 lcd.clear(); // clears display lcd.allsegson(); @@ -303,11 +306,11 @@ #endif #ifdef LCD_1602 - lcd.printf( 0, "Hello world!" ); // line# (0 or 1), string - lcd.printf( 1, "pi = %.6f", 3.14159265 ); - lcd.putcxy(0x55, 5, 1); - lcd.printf(5, 0, "UUU"); - lcd.printf(0, 0, "pressed!" ); +// lcd.printf( 0, "Hello world!" ); // line# (0 or 1), string +// lcd.printf( 1, "pi = %.6f", 3.14159265 ); +// lcd.putcxy(0x55, 5, 1); +// lcd.printf(5, 0, "UUU"); +// lcd.printf(0, 0, "pressed!" ); #endif input1.mode(PullUp); @@ -317,8 +320,10 @@ // printf("Flash start address: 0x%08x Flash Size: %d\r\n", flashIAP.get_flash_start(), flashIAP.get_flash_size()); // can1.reset(); // can2.reset(); + printf("device_address =0x%08x \r\n", (device_address<<18)); can1.frequency(100000); can1.filter((device_address<<18), 0x1FFC0000, CANExtended, init_filter_handle); // 0x1FFC0000 to filter the last 18bits 0-17 + device_address = (device_address & 0x000000FF); //only support one filter // can1.filter(broadcast_id, 0x1FFC0000, CANExtended, broadcast_filter_handle); // the broadcast id // can2.frequency(100000);