System Entity

group SystemEntity

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.

void system_getModule(unsigned int *id, struct Result *result)

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

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the devices module address or a non zero Error code.

void system_getModuleBaseAddress(unsigned int *id, struct Result *result)

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

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the devices module base address or a non zero Error code.

void system_getRouter(unsigned int *id, struct Result *result)

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

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the devices module address or a non zero Error code.

void system_setRouter(unsigned int *id, struct Result *result, int router)

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
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • router: Router address to be set.

void system_getHBInterval(unsigned int *id, struct Result *result)

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.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the devices heartbeat interval or a non zero Error code.

void system_setHBInterval(unsigned int *id, struct Result *result, int HBInterval)

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
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • HBInterval: New heartbeat interval to be set.

void system_getLED(unsigned int *id, struct Result *result)

Get the system LED state. Most modules have a blue system LED.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the LED state or a non zero Error code.

void system_setLED(unsigned int *id, struct Result *result, int LED)

Set the system LED state. Most modules have a blue system LED.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • LED: LED value to be set. 0 = LED Off; 1 =LED on

void system_getBootSlot(unsigned int *id, struct Result *result)

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

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the current boot slot or a non zero Error code.

void system_setBootSlot(unsigned int *id, struct Result *result, int 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.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • slot: LED Index of the slot to be designated as the boot slot.

void system_getVersion(unsigned int *id, struct Result *result)

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
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the devices firmware version or a non zero Error code.

void system_getModel(unsigned int *id, struct Result *result)

Get the module’s model enumeration. A subset of the possible model enumerations is defined in BrainStem.h under “BrainStem model codes”.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the devices model number or a non zero Error code.

void system_getSerialNumber(unsigned int *id, struct Result *result)

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

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the devices serial number or a non zero Error code.

void system_save(unsigned int *id, struct Result *result)

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

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

void system_reset(unsigned int *id, struct Result *result)

Reset the system.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

void system_getInputVoltage(unsigned int *id, struct Result *result)

Get the module’s input voltage.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the devices input voltage or a non zero Error code.

void system_getInputCurrent(unsigned int *id, struct Result *result)

Get the module’s input current.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the devices input current or a non zero Error code.

void system_getModuleHardwareOffset(unsigned int *id, struct Result *result)

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.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the devices hardware offset or a non zero Error code.

void system_getModuleSoftwareOffset(unsigned int *id, struct Result *result)

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.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the devices hardware offset or a non zero Error code.

void system_setModuleSoftwareOffset(unsigned int *id, struct Result *result, int offset)

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
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • offset: Offset to be set. Value must be even from 0-254.

void system_getRouterAddressSetting(unsigned int *id, struct Result *result)

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.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the devices router address setting or a non zero Error code.

void system_RouteToMe(unsigned int *id, struct Result *result, int enable)

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
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • enable: Enables/Disables the route to me functionality. 0 = Disabled; 1 = Enabled.