System

class brainstem.entity.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

getErrors()[source]

Gets System level errors. Calling this function will clear the current errors. If the error persists it will be set again.

Returns:

value: Bit mapped value representing the errors. See product datasheet for details. error: Non-zero BrainStem error code on failure.

Return type:

Result (object)

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

getHardwareVersion()[source]

Get the module’s hardware revision information.

The content of the hardware version is specific to each Acroname product and used to indicate behavioral differences between product revisions. The codes are not well defined and may change at any time.

Returns:

Result object, containing NO_ERROR and hardware revision

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

getInputPowerBehavior()[source]
Gets the systems input power behavior.

This behavior refers to where the device sources its power from and what happens if that power source goes away.

Returns:

value (int): an enumerated value representing behavior. error: Non-zero BrainStem error code on failure.

Return type:

Result (object)

getInputPowerBehaviorConfig()[source]
Gets the input power behavior configuration

Certain behaviors use a list of ports to determine priority when budgeting power.

Returns:

value (tuple(int)): A list of ports which indicate priority sequencing. error: Non-zero BrainStem error code on failure.

Return type:

Result (object)

getInputPowerSource()[source]

Provides the source of the current power source in use.

Returns:

value (int): An enumerated value representing the current input power source. error: Non-zero BrainStem error code on failure.

Return type:

Result (object)

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

getLinkInterface()[source]
Gets the link interface configuration.

This refers to which interface is being used for control by the device.

Returns:

value (int): an enumerated value representing interface.
  • 0 = Auto

  • 1 = Control Port

  • 2 = Hub Upstream Port

error: Non-zero BrainStem error code on failure.

Return type:

Result (object)

getMaximumTemperature()[source]

Get the module’s maximum temperature ever recorded in micro-C (uC) his value will persists through a power cycle.

Returns:

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

or a non zero Error code.

Return type:

Result

getMinimumTemperature()[source]

Get the module’s minimum temperature ever recorded in micro-C (uC) This value will persists through a power cycle.

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

getName()[source]
Gets a user defined name of the port.

Helpful for identifying ports/devices in a static environment.

Returns:

value: The current name of the port on success. error: Non-zero BrainStem error code on failure.

Return type:

Result (object)

getPowerLimit()[source]

Reports the amount of power the system has access to and thus how much power can be budgeted to sinking devices.

Returns:

value (int): Power limit in milli-watts (mW) error: Non-zero BrainStem error code on failure.

Return type:

Result (object)

getPowerLimitMax()[source]
Gets the user defined maximum power limit for the system.

Provides mechanism for defining an unregulated power supplies capability.

Returns:

value (int): Power limit in milli-watts (mW) error: Non-zero BrainStem error code on failure.

Return type:

Result (object)

getPowerLimitState()[source]
Gets a bit mapped representation of the factors contributing to the power limit.

Active limit can be found through PowerDeliveryClass::getPowerLimit().

Returns:

value (int): The current power limit state. error: Non-zero BrainStem error code on failure.

Return type:

Result (object)

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

getTemperature()[source]

Get the module’s current temperature in micro-C

Returns:

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

or a non zero Error code.

Return type:

Result

getUnregulatedCurrent()[source]

Gets the current present at the unregulated port.

Returns:

value (int): Unregulated current in micro-amps (mA) error: Non-zero BrainStem error code on failure.

Return type:

Result (object)

getUnregulatedVoltage()[source]

Gets the voltage present at the unregulated port.

Returns:

value (int): Unregulated Voltage in micro-volts (mV) error: Non-zero BrainStem error code on failure.

Return type:

Result (object)

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 TIMEOUT on success, or one of the other common sets of return error codes on failure. The immediacy of this command tears down the USB link in the process, thus preventing an affirmative response.

Return type:

Result.error

resetDeviceToFactoryDefaults()[source]

Resets the device to it factory default configuration.

Returns (int):

Non-zero BrainStem error code on failure.

resetEntityToFactoryDefaults()[source]

Resets the SystemClass Entity to it factory default configuration.

Returns (int):

Non-zero BrainStem error code on failure.

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

setInputPowerBehavior(behavior)[source]
Sets the systems input power behavior.

This behavior refers to where the device sources its power from and what happens if that power source goes away.

Parameters:

behavior (int) – An enumerated representation of behavior to be set.

Returns (int):

Non-zero BrainStem error code on failure.

setInputPowerBehaviorConfig(config)[source]
Sets the input power behavior configuration

Certain behaviors use a list of ports to determine priority when budgeting power.

Parameters:

config (tuple(int)) – List of ports which indicate priority sequencing.

Returns (int):

Non-zero BrainStem error code on failure.

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

setLinkInterface(linkInterface)[source]
Sets the link interface configuration.

This refers to which interface is being used for control by the device.

Parameters:

interface (int) – An enumerated representation of interface to be set. * 0 = Auto= systemLinkAuto * 1 = Control Port = systemLinkUSBControl * 2 = Hub Upstream Port = systemLinkUSBHub

Returns (int):

Non-zero BrainStem error code on failure.

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

setName(name)[source]
Sets a user defined name of the port.

Helpful for identifying ports/devices in a static environment.

Parameters:

name (string) – User defined name to be set.

Returns (int):

Non-zero BrainStem error code on failure.

setPowerLimitMax(limit)[source]
Sets a user defined maximum power limit for the system.

Provides mechanism for defining an unregulated power supplies capability.

Parameters:

limit (int) – Limit in milli-watts (mW) to be set

Returns (int):

Non-zero BrainStem error code on failure.

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