Description
u16_get_can_listen_id()
returns the CAN identifier of messages from the PC (default 0x765). The device and its bootloader will expect to receive bootloader protocol messages with this ID.
Syntax
u16_get_can_listen_id();
Parameters
none
Returns
uint16_t – the standard (11 bit) ID of messages from the PC.
Example Code
This example shows how to read, set and store the ‘can_listen_id’ value of the bootloader settings.
void setup()
{
Serial.begin();
while (!Serial)
{
yield(); // wait for PC CAN2SER-monitor to open
}
uint16_t u16_can_listen_id = BOOTLOADER_SETTING.u16_get_can_listen_id();
Serial.println("Current bootloader settings:");
Serial.println(" - can listen id: 0x"+ String( u16_can_listen_id, HEX ));
delay(2000);
Serial.println("Modify the settings");
BOOTLOADER_SETTING.u8_set_can_listen_id(0x765);
delay(2000);
Serial.println("Store the settings in flash");
uint8_t u8_ret = BOOTLOADER_SETTING.u8_store_bootloader_settings();
if(u8_ret != 0)
Serial.println("Error writing into flash");
Serial.println("DONE");
}
void loop ()
{
}
Notes and Warnings
This method returns the RAM copy value of the bootloader settings which are copied into the BOOTLOADER_SETTING object during its instantiation at system start (variant.cpp).
See also
u8_store_bootloader_settings()
u8_set_can_listen_id()
SAMC21_CAN