Description
u8_get_local_id()
returns the LID (local id) which is the unique address of this device on the CAN bus.
Syntax
u8_get_local_id();
Parameters
none
Returns
uint8_t – the local id of this device (default:1, range 1..62)
Example Code
This example shows how to read, set and store the ‘local id’ value of the bootloader settings.
void setup()
{
Serial.begin();
while (!Serial)
{
yield(); // wait for PC CAN2SER-monitor to open
}
uint8_t u8_local_id = BOOTLOADER_SETTING.u8_get_local_id();
Serial.println("Current bootloader settings:");
Serial.println(" - own local id : "+ String( u8_local_id));
delay(2000);
Serial.println("Modify the settings");
BOOTLOADER_SETTING.u8_set_local_id(1);
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).