System Entity

Every BrainStem module includes a single system entity. The system entity allows the retrieval and manipulation of configuration settings like the module address and input voltage, control over the user LED, as well as other functionality.

The code examples below are canonical calls to the system entity for each of the available commands.

System save (Set)

system . save => (void)

BrainStem configuration settings are stored in volatile memory until the save command is executed. Settings such as the BootSlot, and changes to the Module or Router address will not persist across resets unless followed by a call to system.save().

System reset (Set)

system . reset => (void)

Calling system.reset() will reset the BrainStem module just as if the reset button were pressed.

User LED (Get/Set)

system . setLED => (unsigned char) state
system . getLED <= (unsigned char) state

Gets or Sets the state of the User LED. Setting LED with a value of 1 turns the User LED on and setting it to 0 turns it off.

Reflex Sleep (Set)

system . setSleep => (unsigned int) microseconds

Sleep is a write only call that will put the current Reflex thread to sleep for the specified number of microseconds. This command is only accessible from the Reflex language, as it only has meaning in the context of a VM thread of execution.

Boot Slot (Get/Set)

system . setBootSlot => (unsigned char) slot
system . getBootSlot <= (unsigned char) slot

BrainStem modules can be configured to enable a reflex file at boot. The reflex file must be loaded into a slot in the internal store. Setting the boot slot to the value 255 will disable on boot functionality. For more information about stores and slots please see the store section of the reference manual. For more information about reflexes please see the Reflex section of the manual.

Input Voltage (Get)

system . getInputVoltage <= (unsigned int) inputVoltage

The input voltage system command is a read only command and will return the input supply voltage of the BrainStem module in micro volts.

Serial Number (Get)

system . getSerialNumber <= (unsigned int) serialNumber

Read only command that returns the unique module serial number. The returned value is an unsigned int. In Acroname UI applications the serial number is generally represented as an 8 character Hexadecimal number.

BrainStem Model (Get)

system . getModel <= (unsigned char) BrainStem model.

Read only command that returns the model of the BrainStem module.

Version (Get)

system . getVersion <= (unsigned int) version number.

Read only command that returns the version number of the BrainStem firmware. This is a packed format. The aVersion.h C API can represent this version in a human readable manner. The format of the version number is 3 digits separated by ..

major . minor . patch

Module Address (Get)

system . getModule <= (unsigned char) module

The module address is the number used to address the module on the BrainStem network and from the host. This is a combination of the module base address, any software offset that is applied and any hardware module offset.

Module Base Address (Get)

system . getModuleBaseAddress <= (unsigned char) module

The module base address is the default or base address of the module, before any offsets are applied.

Module Software Offset (Set/Get)

system . getModuleSoftwareOffset <= (unsigned char) software offset
system . setModuleSoftwareOffset => (unsigned char) software offset

The module software offset is added to the module’s base address and any hardware offsets to determine the final module address of the module. This setting is not applied until saved and the module has been reset.

Module Hardware Offset (Get)

system . getModuleHardwareOffset <= (unsigned char) module hardware offset

MTM BrainStems have a set of module offset pins which will adjust the module address via hardware. See the data sheet for your MTM module for more information about these hardware settings. The module offset command is a read only command that returns the offset that will be added to the base module address and any software offset to determine the operating address of the MTM BrainStem module. Changes to the hardware offset are applied when the Device is reset.

Router Address (Get/Set)

system . setRouter => (unsigned char) module
system . getRouter <= (unsigned char) module

The BrainStem router address refers to the BrainStem module address of the module that will coordinate communication with the host system. This setting is not applied until it is saved and the module has been reset.

Changing the router address can have negative consequences for communicating with the BrainStem network. Please see the appendix on the BrainStem Network setup for more information.

HeartBeat Interval (Get/Set)

system . setHBInterval => (unsigned char) interval
system . getHBInterval <= (unsigned char) interval

Gets or sets the heartbeat interval to control the amount of heartbeat traffic. This value is set at approximately 1/50th of a second resolution. Heartbeat packets are handled by the underlying system, and are indicated on the brainstem by the blinking green heartbeat LED. UI applications also have Heartbeat indicators. Default value is 12.

Code Examples

C++

// Get requests fill the parameter with the current system value upon success.
// All commands return aErr values when errors are encountered and aErrNone on
// success.

stem.system.save();
stem.system.reset();
stem.system.setLED(1);
stem.system.getLED(state);
stem.system.setBootSlot(5);
stem.system.getBootSlot(slot);
stem.system.getInputVoltage(voltage);
stem.system.getModule(address);
stem.system.getRouter(address);
stem.system.setRouter(6);
stem.system.getModuleBaseAddress(address);
stem.system.setModuleSoftwareOffset(16);
stem.system.getModuleSoftwareOffset(offset);
stem.system.getModuleHardwareOffset(offset);
stem.system.getSerialNumber(serialNumber);
stem.system.getModel(model);
stem.system.getVersion(version);
stem.system.getHBInterval(interval);
stem.system.setHBInterval(interval);

Reflex

// Get requests fill the parameter with the current system value upon success.

stem.system.save();
stem.system.reset();
stem.system.setLED(1);
stem.system.getLED(state);
stem.system.setBootSlot(5);
stem.system.getBootSlot(slot);
stem.system.getInputVoltage(voltage);
stem.system.getModule(address);
stem.system.getRouter(address);
stem.system.setRouter(6);
stem.system.getModuleBaseAddress(address);
stem.system.setModuleSoftwareOffset(16);
stem.system.getModuleSoftwareOffset(offset);
stem.system.getModuleHardwareOffset(offset);
stem.system.getSerialNumber(serialNumber);
stem.system.getModel(model);
stem.system.getVersion(version);
stem.system.getHBInterval(interval);
stem.system.setHBInterval(interval);

Python

stem.system.save()
stem.system.reset()
stem.system.setLED(1)
stem.system.ledOn() # Convenience routines for turning on and off User LED.
stem.system.ledOff()
state = stem.system.getLED()
print state.value
stem.system.setBootSlot(5)
slot = stem.system.getBootSlot()
print slot.value
inputVoltage = stem.system.getInputVoltage()
print inputVoltage.value
module = stem.system.getModule()
print module.value
address = stem.system.getModuleBaseAddress();
print address.value
stem.system.setModuleSoftwareOffset(16);
offset = stem.system.getModuleSoftwareOffset();
print offset.value
offset = stem.system.getModuleHardwareOffset();
print offset.value
serialNumber = stem.system.getSerialNumber()
print serialNumber.value
model = stem.system.getModel()
version = stem.system.getVersion()
print brainstem.version.get_version_string(version.value)
hbInterval = stem.system.getHBInterval()
print hbInterval.value
stem.system.setHBInterval(12)