Description

s_get_device_name() returns the bootloader setting ‘device name’. This is a six characters long String helping to identify the device. It will appear for example in the diceConfig tool or the CAN2SER monitor.

Syntax

s_get_device_name();

Parameters

none

Returns

String – the device name

Example Code

This example shows how to read, set and store the ‘device name’ value of the bootloader settings.

void setup()
{  
  Serial.begin();
  while (!Serial) 
  {
    yield(); // wait for PC CAN2SER-monitor to open 
  }

  String s_device_name = BOOTLOADER_SETTING.u8_get_device_name();;
  
  Serial.println("Current bootloader settings:");
  Serial.println(" - device name:    " + s_device_name);
  
  delay(2000);
  Serial.println("Modify the settings");
  BOOTLOADER_SETTING.u8_set_device_name("myDICE");
  
  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_device_name()
SAMC21_CAN