Description

utils/consoleBootloader.h provides the following functions to a console application:

  • s_console_boot_config_cmds() :
    • bootloader info – lists bootloader information of the device
    • setBaud – sets the startup CAN bus baudrate (125/250/500/1000)
    • setSendID – sets the standard CAN-ID[hex] this devices sends mesg on (766)
    • setLocalID – sets the local ID[dec] of the device (1..62)
    • setDevName – sets the devices name (6 chars)
    • setListenOnly <0/1> – controls if the device starts in CAN listen only mode
    • setListenDur – controls the duration the bootloader waits for boot a command at startup (300) [ms]
    • setResetMsg – defines the CAN msg. that resets the device (RESET)
    • storeBootValues – writes the current boot settings in flash

The commands load the bootloader settings from the protected area of the processors flash memory. It let the console user display, modify and store them.

Syntax (examples)

#include "utils/consoleBootloader.h"
. . .
s_console_string = s_console_boot_config_cmds( s_console_string );

Parameters

String s_console_string – String that holds the user command. Normally returned by s_console_routine() or a previous console function.

Returns

String : the user command or an empty String “” if the user command was recognised and processed by this function. (see of commands above)

Example Codes:

#include "consoleLogin.h"
#include "utils/consoleBootloader.h"
void setup()
{
  console_init(&Serial);
}
void loop()
{
  String s_console_string = s_console_routine();
  s_console_boot_config_cmds(s_console_string);
}

Notes and Warnings

This function and its commands might be helpful to test and learn how to work with bootloader settings.
See the source code as example code for your own application:

C:\Users\yourName\AppData\Local\Arduino15\packages\dice\hardware\samc\1.0.0\libraries\Console\src\...

In a ‘real world’ application, these functions might not be necessary or it might even be problematic to offer the end-user the opportunity to change bootloader settings.

Please keep in mind that each included file and its used function increase the size of the resulting application. So in order to keep the application binaries as small as possible, include only functions that are really necessary for the final application.

An example can be found in the Arduino IDE menu:
File -> Examples -> Consoles -> Dev_Console

See also