System¶
See the System Entity for generic information.
- class brainstem.entity.System(module, index)[source]¶
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.
- getBootSlot()[source]¶
Get the store slot which is mapped when the module boots.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueunsigned char
The slot number in aSTORE_INTERNAL that is mapped after the module boots.
- Return type:
- getBuild()[source]¶
Get the modules firmware build number The build number is a unique hash assigned to a specific firmware.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueunsigned int
Variable to be filled with build.
- Return type:
- getErrors()[source]¶
Gets any system level errors. Calling this function will clear the current errors. If the error persists it will be set again.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueunsigned int
Bit mapped field representing the devices errors
- Return type:
- getHBInterval()[source]¶
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.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueunsigned char
The current heartbeat delay.
- Return type:
- 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:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueunsigned int
The module’s hardware version information.
- Return type:
- getInputCurrent()[source]¶
Get the module’s input current.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueunsigned int
The module’s input current reported in microamps.
- Return type:
- 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:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueunsigned char
Variable to be filled with an enumerated value representing behavior.
- Return type:
- getInputPowerBehaviorConfig(buffer_length=16384)[source]¶
Gets the input power behavior configuration Certain behaviors use a list of ports to determine priority when budgeting power.
- Parameters:
buffer_length (unsigned int) – Length of the buffer to be filed
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valuelist(unsigned int)
pointer to the start of a c style buffer to be filled
- Return type:
- getInputPowerSource()[source]¶
Provides the source of the current power source in use.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueunsigned char
Variable to be filled with enumerated representation of the source.
- Return type:
- getInputVoltage()[source]¶
Get the module’s input voltage.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueunsigned int
The module’s input voltage reported in microvolts.
- Return type:
- 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:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valuebool
true: LED on, false: LED off.
- Return type:
- getLEDMaxBrightness()[source]¶
Gets the scaling factor for the brightness of all LEDs on the system. The brightness is set to the ratio of this value compared to 255 (maximum).
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueunsigned char
Brightness value relative to 255
- Return type:
- getLinkInterface()[source]¶
Gets the link interface configuration. This refers to which interface is being used for control by the device.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueunsigned char
- Variable to be filled with an enumerated value representing interface.
0 = Auto= systemLinkAuto
1 = Control Port = systemLinkUSBControl
2 = Hub Upstream Port = systemLinkUSBHub
- Return type:
- getMaximumTemperature()[source]¶
Get the module’s maximum temperature ever recorded in micro-C (uC). This value will persists through a power cycle.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueint
The module’s maximum system temperature in micro-C
- Return type:
- getMinimumTemperature()[source]¶
Get the module’s minimum temperature ever recorded in micro-C (uC). This value will persists through a power cycle.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueint
The module’s minimum system temperature in micro-C
- Return type:
- getModel()[source]¶
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.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueunsigned char
The module’s model enumeration.
- Return type:
- getModule()[source]¶
Get the current address the module uses on the BrainStem network.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueunsigned char
The address the module is using on the BrainStem network.
- Return type:
- getModuleBaseAddress()[source]¶
Get the base address of the module. Software offsets and hardware offsets are added to this base address to produce the effective module address.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueunsigned char
The address the module is using on the BrainStem network.
- Return type:
- getModuleHardwareOffset()[source]¶
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.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueunsigned char
The module address offset.
- Return type:
- getModuleSoftwareOffset()[source]¶
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.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueunsigned char
The address for the module. Value must be even from 0-254.
- Return type:
- getName(buffer_length=65536)[source]¶
Gets a user defined name of the device. Helpful for identifying ports/devices in a static environment.
- Parameters:
buffer_length (unsigned int) – Length of the buffer to be filed
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valuestring
pointer to the start of a c style buffer to be filled
- Return type:
- getPowerLimit()[source]¶
Reports the amount of power the system has access to and thus how much power can be budgeted to sinking devices.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueunsigned int
The available power in milli-Watts (mW, 1 t)
- Return type:
- getPowerLimitMax()[source]¶
Gets the user defined maximum power limit for the system. Provides mechanism for defining an unregulated power supplies capability.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueunsigned int
Variable to be filled with the power limit in milli-Watts (mW)
- Return type:
- getPowerLimitState()[source]¶
Gets a bit mapped representation of the factors contributing to the power limit. Active limit can be found through PowerDeliverClass::getPowerLimit().
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueunsigned int
Variable to be filled with the state.
- Return type:
- getProtocolFeatures()[source]¶
Gets the firmware protocol features
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueunsigned int
Value representing the firmware protocol features
- Return type:
- getRouter()[source]¶
Get the router address the module uses to communicate with the host and heartbeat to in order to establish the BrainStem network.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueunsigned char
The address.
- Return type:
- getRouterAddressSetting()[source]¶
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 occurred. Please review the BrainStem network fundamentals before modifying the module address.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueunsigned char
The address for the module. Value must be even from 0-254.
- Return type:
- getSerialNumber()[source]¶
Get the module’s serial number. The serial number is a unique 32 bit integer which is usually communicated in hexadecimal format.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueunsigned int
The module’s serial number.
- Return type:
- getTemperature()[source]¶
Get the module’s current temperature in micro-C
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueint
The module’s system temperature in micro-C
- Return type:
- getUnregulatedCurrent()[source]¶
Gets the current passing through the unregulated port.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueint
Variable to be filled with the current in micro-Amps (uA).
- Return type:
- getUnregulatedVoltage()[source]¶
Gets the voltage present at the unregulated port.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueint
Variable to be filled with the voltage in micro-Volts (uV).
- Return type:
- getUptime()[source]¶
Get the module’s accumulated uptime in minutes
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueunsigned int
The module’s accumulated uptime in minutes.
- Return type:
- getVersion()[source]¶
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.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueunsigned int
The build version date code.
- Return type:
- logEvents()[source]¶
Saves system log events to a slot defined by the module (usually ram slot 0).
- Returns:
An error result from the list of defined error codes in brainstem.result.Result
- Return type:
unsigned byte
- reset()[source]¶
Reset the system. A return value of aErrTimeout indicates a successful reset, as the system resets immediately, which tears down the USB-link immediately, thus preventing an affirmative response.
- Returns:
An error result from the list of defined error codes in brainstem.result.Result
- Return type:
unsigned byte
- resetDeviceToFactoryDefaults()[source]¶
Resets the device to it factory default configuration.
- Returns:
An error result from the list of defined error codes in brainstem.result.Result
- Return type:
unsigned byte
- routeToMe(enable)[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:
enable (bool) – Enable or disable of the route to me function 1 = enable.
- Returns:
An error result from the list of defined error codes in brainstem.result.Result
- Return type:
unsigned byte
- 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:
An error result from the list of defined error codes in brainstem.result.Result
- Return type:
unsigned byte
- setBootSlot(slot)[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:
slot (unsigned char) – The slot number in aSTORE_INTERNAL to be marked as a boot slot.
- Returns:
An error result from the list of defined error codes in brainstem.result.Result
- Return type:
unsigned byte
- setHBInterval(interval)[source]¶
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).
- Parameters:
interval (unsigned char) – The desired heartbeat delay.
- Returns:
An error result from the list of defined error codes in brainstem.result.Result
- Return type:
unsigned byte
- 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 (unsigned char) – An enumerated representation of behavior to be set.
- Returns:
An error result from the list of defined error codes in brainstem.result.Result
- Return type:
unsigned byte
- setInputPowerBehaviorConfig(buffer)[source]¶
Sets the input power behavior configuration Certain behaviors use a list of ports to determine priority when budgeting power.
- Parameters:
buffer (list(unsigned int)) – Pointer to the start of a c style buffer to be transferred.
- Returns:
An error result from the list of defined error codes in brainstem.result.Result
- Return type:
unsigned byte
- setLED(led_on)[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:
led_on (bool) – true: turn the LED on, false: turn LED off.
- Returns:
An error result from the list of defined error codes in brainstem.result.Result
- Return type:
unsigned byte
- setLEDMaxBrightness(brightness)[source]¶
Sets the scaling factor for the brightness of all LEDs on the system. The brightness is set to the ratio of this value compared to 255 (maximum). The colors of each LED may be inconsistent at low brightness levels. Note that if the brightness is set to zero and the settings are saved, then the LEDs will no longer indicate whether the system is powered on. When troubleshooting, the user configuration may need to be manually reset in order to view the LEDs again.
- Parameters:
brightness (unsigned char) – Brightness value relative to 255
- Returns:
An error result from the list of defined error codes in brainstem.result.Result
- Return type:
unsigned byte
- setLinkInterface(link_interface)[source]¶
Sets the link interface configuration. This refers to which interface is being used for control by the device.
- Parameters:
link_interface (unsigned char) –
- An enumerated representation of interface to be set.
0 = Auto= systemLinkAuto
1 = Control Port = systemLinkUSBControl
2 = Hub Upstream Port = systemLinkUSBHub
- Returns:
An error result from the list of defined error codes in brainstem.result.Result
- Return type:
unsigned byte
- setModuleSoftwareOffset(address)[source]¶
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.
- Parameters:
address (unsigned char) – The address for the module. Value must be even from 0-254.
- Returns:
An error result from the list of defined error codes in brainstem.result.Result
- Return type:
unsigned byte
- setName(buffer)[source]¶
Sets a user defined name for the device. Helpful for identification when multiple devices of the same type are present in a system.
- Parameters:
buffer (string) – Pointer to the start of a c style buffer to be transferred.
- Returns:
An error result from the list of defined error codes in brainstem.result.Result
- Return type:
unsigned byte
- setPowerLimitMax(power)[source]¶
Sets a user defined maximum power limit for the system. Provides mechanism for defining an unregulated power supplies capability.
- Parameters:
power (unsigned int) – Limit in milli-Watts (mW) to be set.
- Returns:
An error result from the list of defined error codes in brainstem.result.Result
- Return type:
unsigned byte
- setRouter(address)[source]¶
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.
- Parameters:
address (unsigned char) – The router address to be used.
- Returns:
An error result from the list of defined error codes in brainstem.result.Result
- Return type:
unsigned byte