System Class

class SystemClass : public Acroname::BrainStem::EntityClass

SystemClass. The System class provides access to the core settings, configuration and system information of the BrainStem module. The class provides access to the model type, serial number and other static information as well as the ability to set boot reflexes, toggle the user LED, as well as affect module and router addresses etc. The most common brainstem example uses the system entity to blink the User LED.

Public Functions

SystemClass(void)

Constructor.

virtual ~SystemClass(void)

Destructor.

void init(Module *pModule, const uint8_t index)

Initialize the aSystem class.

Parameters
  • pModule: The module to which this entity belongs.
  • index: Not used; always 0.

aErr getModule(uint8_t *address)

Get the current address the module uses on the BrainStem network.

Return
Returns common entity return values
Parameters
  • address: The address the module is using on the BrainStem network.

aErr getModuleBaseAddress(uint8_t *address)

Get the base address of the module. Software offsets and hardware offsets are added to this base address to produce the effective module address.

Return
Returns common entity return values
Parameters
  • address: The address the module is using on the BrainStem network.

aErr setRouter(const uint8_t address)

Set the router address the module uses to communicate with the host and heartbeat to in order to establish the BrainStem network. This setting must be saved and the board reset before the setting becomes active. Warning: changing the router address may cause the module to “drop off” the BrainStem network if the new router address is not in use by a BrainStem module. Please review the BrainStem network fundamentals before modifying the router address.

Return
Returns common entity return values
Parameters
  • address: The router address to be used.

aErr getRouter(uint8_t *address)

Get the router address the module uses to communicate with the host and heartbeat to in order to establish the BrainStem network.

Return
Returns common entity return values
Parameters
  • address: The address.

aErr setHBInterval(const uint8_t interval)

Set the delay between heartbeat packets which are sent from the module. For link modules, these these heartbeat are sent to the host. For non-link modules, these heartbeats are sent to the router address. Interval values are in 25.6 millisecond increments Valid values are 1-255; default is 10 (256 milliseconds).

Return
Returns common entity return values
Parameters
  • interval: The desired heartbeat delay.

aErr getHBInterval(uint8_t *interval)

Get the delay between heartbeat packets which are sent from the module. For link modules, these these heartbeat are sent to the host. For non-link modules, these heartbeats are sent to the router address. Interval values are in 25.6 millisecond increments.

Return
Returns common entity return values
Parameters
  • interval: The current heartbeat delay.

aErr setLED(const uint8_t bOn)

Set the system LED state. Most modules have a blue system LED. Refer to the module datasheet for details on the system LED location and color.

Return
Returns common entity return values
Parameters
  • bOn: true: turn the LED on, false: turn LED off.

aErr getLED(uint8_t *bOn)

Get the system LED state. Most modules have a blue system LED. Refer to the module datasheet for details on the system LED location and color.

Return
Returns common entity return values
Parameters
  • bOn: true: LED on, false: LED off.

aErr setBootSlot(const uint8_t slot)

Set a store slot to be mapped when the module boots. The boot slot will be mapped after the module boots from powers up, receives a reset signal on its reset input, or is issued a software reset command. Set the slot to 255 to disable mapping on boot.

Return
Returns common entity return values
Parameters
  • slot: The slot number in aSTORE_INTERNAL to be marked as a boot slot.

aErr getBootSlot(uint8_t *slot)

Get the store slot which is mapped when the module boots.

Return
Returns common entity return values
Parameters
  • slot: The slot number in aSTORE_INTERNAL that is mapped after the module boots.

aErr getVersion(uint32_t *build)

Get the modules firmware version number. The version number is packed into the return value. Utility functions in the aVersion module can unpack the major, minor and patch numbers from the version number which looks like M.m.p.

Parameters
  • build: The build version date code.

aErr getModel(uint8_t *model)

Get the module’s model enumeration. A subset of the possible model enumerations is defined in BrainStem.h under “BrainStem model codes”. Other codes are be used by Acroname for proprietary module types.

Return
Returns common entity return values
Parameters
  • model: The module’s model enumeration.

aErr getSerialNumber(uint32_t *serialNumber)

Get the module’s serial number. The serial number is a unique 32bit integer which is usually communicated in hexadecimal format.

Return
Returns common entity return values
Parameters
  • serialNumber: The module’s serial number.

aErr save(void)

Save the system operating parameters to the persistent module flash memory. Operating parameters stored in the system flash will be loaded after the module reboots. Operating parameters include: heartbeat interval, module address, module router address

Return
Returns common entity return values

aErr reset(void)

Reset the system.

Return
Returns common entity return values

aErr logEvents(void)

Saves system log events to a slot defined by the module (usually ram slot 0).

Return
Returns common entity return values

aErr getUptime(uint32_t *uptimeCounter)

Get the module’s accumulated uptime in minutes

Return
Returns common entity return values
Parameters
  • uptimeCounter: The module’s accumulated uptime in minutes.

aErr getMaximumTemperature(int32_t *maxTemperature)

Get the module’s maximum temperature in micro-C

Return
Returns common entity return values
Parameters
  • maxTemperature: The module’s maximum system temperature in micro-C

aErr getInputVoltage(uint32_t *inputVoltage)

Get the module’s input voltage.

Return
Returns common entity return values
Parameters
  • inputVoltage: The module’s input voltage reported in microvolts.

aErr getInputCurrent(uint32_t *inputCurrent)

Get the module’s input current.

Return
Returns common entity return values
Parameters
  • inputCurrent: The module’s input current reported in microamps.

aErr getModuleHardwareOffset(uint8_t *offset)

Get the module hardware address offset. This is added to the base address to allow the module address to be configured in hardware. Not all modules support the hardware module address offset. Refer to the module datasheet.

Return
Returns common entity return values
Parameters
  • offset: The module address offset.

aErr setModuleSoftwareOffset(const uint8_t address)

Set the software address offset. This software offset is added to the module base address, and potentially a module hardware address to produce the final module address. You must save the system settings and restart for this to take effect. Please review the BrainStem network fundamentals before modifying the module address.

Return
Returns common entity return values
Parameters
  • address: The address for the module. Value must be even from 0-254.

aErr getModuleSoftwareOffset(uint8_t *address)

Get the software address offset. This software offset is added to the module base address, and potentially a module hardware address to produce the final module address. You must save the system settings and restart for this to take effect. Please review the BrainStem network fundamentals before modifying the module address.

Return
Returns common entity return values
Parameters
  • address: The address for the module. Value must be even from 0-254.

aErr getRouterAddressSetting(uint8_t *address)

Get the router address system setting. This setting may not be the same as the current router address if the router setting was set and saved but no reset has occured. Please review the BrainStem network fundamentals before modifying the module address.

Return
Returns common entity return values
Parameters
  • address: The address for the module. Value must be even from 0-254.

aErr routeToMe(const uint8_t bOn)

Enables/Disables the route to me function. This function allows for easy networking of BrainStem modules. Enabling (1) this function will send an I2C General Call to all devices on the network and request that they change their router address to the of the calling device. Disabling (0) will cause all devices on the BrainStem network to revert to their default address.

Return
Returns common entity return values
Parameters
  • bOn: Enable or disable of the route to me function 1 = enable.