Rail

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

Provides power rail functionality on certain modules.

This entity is only available on certain modules. The RailClass can be used to control power to downstream devices, I has the ability to take current and voltage measurements, and depending on hardware, may have additional modes and capabilities.

Useful Constants:
  • KELVIN_SENSING_OFF (0)
  • KELVIN_SENSING_ON (1)
  • OPERATIONAL_MODE_AUTO (0)
  • OPERATIONAL_MODE_LINEAR (1)
  • OPERATIONAL_MODE_SWITCHER (2)
  • OPERATIONAL_MODE_SWITCHER_LINEAR (3)
  • DEFAULT_OPERATIONAL_MODE (OPERATIONAL_MODE_AUTO)
  • OPERATIONAL_STATE_INITIALIZING (0)
  • OPERATIONAL_STATE_POWER_GOOD (1)
  • OPERATIONAL_STATE_POWER_FAULT (2)
  • OPERATIONAL_STATE_LDO_OVERTEMP (3)
  • OPERATIONAL_STATE_LINEAR (4)
  • OPERATIONAL_STATE_SWITCHER (5)
getCurrent()[source]

Get the rail current.

Returns:
Result object, containing NO_ERROR and the current in microamps
or a non zero Error code.
Return type:Result
getCurrentLimit()[source]

Get the rail current limit setting.

Check product datasheet to see if this feature is available.

Parameters:microamps (int) – The current in micro-amps (1 == 1e-6A).
Returns:
Return result object with NO_ERROR set and the current
limit setting in the Result.value or an Error condition.
Return type:Result
getEnable()[source]

Get the state of the rail switch.

Not all rails can be switched on and off. Refer to the module datasheet for capability specification of the rails.

Returns:Return result object with NO_ERROR set and the current rail enable state in the Result.value or an Error condition.
Return type:Result
getKelvinSensingEnable()[source]

Determine whether kelvin sensing is enabled or disabled.

Refer to the module datasheet for definition of the rail kelvin sensing capabilities.

Parameters:bEnable (bool) – Kelvin sensing is enabled or disabled.
Returns:Return result object with NO_ERROR set and the current rail kelvin sensing mode setting in the Result.value or an Error.
Return type:Result
getKelvinSensingState()[source]

Determine whether kelvin sensing has been disabled by the system.

Refer to the module datasheet for definition of the rail kelvin sensing capabilities.

Returns:Return result object with NO_ERROR set and the current rail kelvin sensing state setting in the Result.value or an Error.
Return type:Result
getOperationalMode()[source]

Determine the current operational mode of the system.

Refer to the module datasheet for definition of the rail operational mode capabilities.

Returns:Return result object with NO_ERROR set and the current rail operational mode setting in the Result.value or an Error.
Return type:Result
getOperationalState()[source]

Determine the current operational state of the system.

Refer to the module datasheet for definition of the rail operational states.

Returns:Return result object with NO_ERROR set and the current rail operational state in the Result.value or an Error.
Return type:Result
getTemperature()[source]

Get the rail temperature.

Returns:Return result object with NO_ERROR set and the rail temperature in the Result.value or an Error condition.
Return type:Result
getVoltage()[source]

Get the rail supply voltage.

Rail voltage control capabilities vary between modules. Refer to the module datasheet for definition of the rail voltage capabilities.

On some modules this is a measured value so may not exactly match what was previously set via the setVoltage interface. Refer to the module datasheet to to determine if this is a measured or stored value.

Returns:Return result object with NO_ERROR set and the current rail voltage setting in the Result.value or an Error.
Return type:Result
getVoltageSetpoint()[source]

Get the rail setpoint voltage.

Rail voltage control capabilities vary between modules. Refer to the module datasheet for definition of the rail voltage capabilities.

Returns:Return result object with NO_ERROR set and the current rail voltage setting in the Result.value or an Error.
Return type:Result
setCurrentLimit(microamps)[source]

Set the rail current limit setting.

Check product datasheet to see if this feature is available.

Parameters:microamps (int) – The current in micro-amps (1 == 1e-6A).
Returns:Return NO_ERROR on success, or one of the common sets of return error codes on failure.
Return type:Result.error
setEnable(bEnable)[source]

Set the state of the rail switch.

Not all rails can be switched on and off. Refer to the module datasheet for capability specification of the rails.

Parameters:bEnable (bool) – true: enable and connect to the supply rail voltage; false: disable and disconnect from the supply rail voltage
Returns:
Return NO_ERROR on success, or one of the common
sets of return error codes on failure.
Return type:Result.error
setKelvinSensingEnable(bEnable)[source]

Enable or Disable kelvin sensing on the module.

Refer to the module datasheet for definition of the rail kelvin sensing capabilities.

Parameters:bEnable (bool) – enable or disable kelvin sensing.
Returns:
Return NO_ERROR on success, or one of the common
sets of return error codes on failure.
Return type:Result.error
setOperationalMode(mode)[source]

Set the operational mode of the rail.

Refer to the module datasheet for definition of the rail operational capabilities.

Parameters:mode (int) – The operational mode to employ.
Returns:
Return NO_ERROR on success, or one of the common
sets of return error codes on failure.
Return type:Result.error
setVoltage(microvolts)[source]

Set the rail supply voltage.

Rail voltage control capabilities vary between modules. Refer to the module datasheet for definition of the rail voltage capabilities.

Parameters:microvolts (int) – The voltage in micro-volts (1 == 1e-6V) to be supply by the rail.
Returns:
Return NO_ERROR on success, or one of the common
sets of return error codes on failure.
Return type:Result.error