BrainStem Entities

How does one describe the capabilities of an embedded system? Essentially this is the question that BrainStem entities answer. BrainStem modules are capable of I/O in the form of digitals, analogs, I2C, serial UARTs and other specialized interfaces. This section details how entities are referenced, and then describes the core Entities that BrainStem modules implement.

Entities

If you read the Reflex Language or C++ API sections of the reference, you will quickly see that Entities form the backbone of communication with BrainStem modules. They are the basic control mechanism for interacting with the BrainStem and the hardware to which it is connected. he following subsections describe the core entities that are available on most BrainStem modules. Less common and application specific entities will be described in the module’s datasheet.

Entities usually describe a class of interaction, and usually are formed by a group of individual instances. For example; the digital entity is made up of multiple digital I/Os, which can be manipulated individually. In general the following form applies to an Entity.

Module . EntityClass [ Element Index ] . operation ( parameters )

To further the digital example, the 4th digital output of a module can be set to logic high with the Reflex language via the following syntax.

stem.digital[3].setState(1);

Indices for entities always start with a zero index.

Single individual element entities like the System entity can be addressed in the Reflex programming language without the [] syntax, however this is just a convenience and any individual can always be addressed explicitly.

// Explicit reference.
stem.system[0].setLED(1);

// Implicit reference.
stem.system.setLED(1);

Entities are so fundamental that they form one of the elements of the BrainStem communication protocol. The protocol specifics are detailed in the following appendices: