System

class brainstem.stem.System(module, index)[source]

Acccess system controls configuration and information.

The system entity is available on all BrainStem modules, and provides access to system information such as module, router and serial number, as well as control over the user LED, and information such as the system input voltage.

Useful Constants:
  • BOOT_SLOT_DISABLE (255)

getBootSlot()[source]

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

Returns

Result object, containing NO_ERROR and slot number

or a non zero Error code.

Return type

Result

getHBInterval()[source]

Get the delay between heartbeat packets.

For link modules, 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.

Returns

Result object, containing NO_ERROR and the Heartbeat interval

or a non zero Error code.

Return type

Result

getInputCurrent()[source]

Get the module’s input current.

Returns

Result object, containing NO_ERROR and input current

or a non zero Error code.

Return type

Result

getInputVoltage()[source]

Get the module’s input voltage.

Returns

Result object, containing NO_ERROR and input voltage

or a non zero Error code.

Return type

Result

getLED()[source]

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.

Returns

Result object, containing NO_ERROR and the LED State

or a non zero Error code.

Return type

Result

getMaximumTemperature()[source]

Get the maximum temperature the system has recorded.

This is the maximum temperature in micro-C recorded every minute.

Returns

Result object, containing NO_ERROR and max temperature in micro-C

or a non zero Error code.

Return type

Result

getModel()[source]

Get the module’s model enumeration.

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

Returns

Result object, containing NO_ERROR and model number

or a non zero Error code.

Return type

Result

getModule()[source]

Get the address the module uses on the BrainStem network.

Returns

Result object, containing NO_ERROR and the current module address

or a non zero Error code.

Return type

Result

getModuleBaseAddress()[source]

Get the base address the module.

The software and hardware addresses are added to the base address to produce the effective module address.

Returns

Result object, containing NO_ERROR and the current module address

or a non zero Error code.

Return type

Result

getModuleHardwareOffset()[source]

Get the module address hardware 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.

Returns

Result object, containing NO_ERROR and module offset

or a non zero Error code.

Return type

Result

getModuleSoftwareOffset()[source]

Get the module address software offset.

The address offset that is added to the module base address, and potentially the hardware offset to produce the module effective address.

Returns

Result object, containing NO_ERROR and the current module address

or a non zero Error code.

Return type

Result

getRouter()[source]

Get the router address the module uses to communicate with the host.

Returns

Result object, containing NO_ERROR and the current router address

or a non zero Error code.

Return type

Result

getRouterAddressSetting()[source]

Get the router address setting saved in the module.

This setting may be different from the effective router if the router has been set and saved but no reset has been made.

Returns

Result object, containing NO_ERROR and the current router address

or a non zero Error code.

Return type

Result

getSerialNumber()[source]

Get the module’s serial number.

The serial number is a unique 32bit integer which is usually communicated in hexadecimal format.

Returns

Result object, containing NO_ERROR and serial number

or a non zero Error code.

Return type

Result

getUptime()[source]

Get accumulated system uptime.

This is the total time the system has been powered up with the firmware running. The returned uptime is a count of minutes of uptime, or may be a module dependent counter.

Returns

Result object, containing NO_ERROR and uptime in minutes

or a non zero Error code.

Return type

Result

getVersion()[source]

Get the modules firmware version number.

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

Returns

Result object, containing NO_ERROR packed version number

or a non zero Error code.

Return type

Result

logEvents()[source]

Save system log entries to slot defined by module.

Returns

Return NO_ERROR on success, or one of the common sets of return error codes on failure.

Return type

Result.error

reset()[source]

Reset the system.

Returns

Return NO_ERROR on success, or one of the common sets of return error codes on failure.

Return type

Result.error

routeToMe(value)[source]

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.

Parameters

value (int) – Enable or disable of the route to me function 1 = enable.

Returns

Return NO_ERROR on success, or one of the common sets of return error codes on failure.

Return type

Result.error

save()[source]

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

Returns

Return NO_ERROR on success, or one of the common sets of return error codes on failure.

Return type

Result.error

setBootSlot(value)[source]

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.

Parameters

value (int) – The slot number in aSTORE_INTERNAL to be marked as a boot slot.

Returns

Return NO_ERROR on success, or one of the common sets of return error codes on failure.

Return type

Result.error

setHBInterval(value)[source]

Set the delay between heartbeat packets.

For link modules, 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).

Parameters

value (int) – Heartbeat interval settings.

Returns

Return NO_ERROR on success, or one of the common sets of return error codes on failure.

Return type

Result.error

setLED(value)[source]

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.

Parameters

value (int) – LED State setting.

Returns

Return NO_ERROR on success, or one of the common sets of return error codes on failure.

Return type

Result.error

setModuleSoftwareOffset(value)[source]

Set the software address offset.

The module software offset is added to the base module address, and potentially a hardware offset to determine the final calculated address the module uses on the brainstem network. You must save and reset the module for this change to become effective.

Warning:

changing the module address may cause the module to “drop off” the BrainStem network if the module is also the router. Please review the BrainStem network fundamentals before modifying the module address.

Parameters

value (int) – The module address offset.

Returns

Return NO_ERROR on success, or one of the common sets of return error codes on failure.

Return type

Result.error

setRouter(value)[source]

Set the router address the module uses to communicate with the host.

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.

Parameters

value (int) – The module address of the router module on the network.

Returns

Return NO_ERROR on success, or one of the common sets of return error codes on failure.

Return type

Result.error