CCA API Reference

Welcome to the BrainStem CCA (CPP to C Abstraction) API reference documentation. This API provides a C interface to our CPP API. Historically, speaking this was our LabVIEW API and was only available on Windows through LabVIEW vi’s. After a slight rework to be more compatible with foreign function interface (ffi) layers this API is now available on all supported platforms and is responsible for the internal workings of our Python API. The CCA API brings the following advantages:

  • Reduced language specific code

  • Ensures consistent behaviors across languages

  • Allows Acroname to rapidly create API’s for new languages

  • Allows customers to access BrainStem API’s from any language that supports C calls.

  • User friendly C API that has access to higher level CPP functionality.

This reference assumes that you understand the BrainStem system. If you would like to get started using BrainStem, please see the following sections of the Reference documentation.

The Getting started guide is particularly useful for learning how to use the application tools we provide to communicate with your hardware.


Entities

group AnalogEntity

AnalogClass: Interface to analog entities on BrainStem modules. Analog entities may be configured as a input or output depending on hardware capabilities. Some modules are capable of providing actual voltage readings, while other simply return the raw analog-to-digital converter (ADC) output value. The resolution of the voltage or number of useful bits is also hardware dependent.

group AppEntity

AppClass: Used to send a cmdAPP packet to the BrainStem network. These commands are used for either host-to-stem or stem-to-stem interactions. BrainStem modules can implement a reflex origin to complete an action when a cmdAPP packet is addressed to the module.

group ClockEntity

ClockClass: Provides an interface to a real-time clock entity on a BrainStem module. The clock entity may be used to get and set the real time of the system. The clock entity has a one second resolution.

Note

Clock time must be reset if power to the BrainStem module is lost.

group DigitalEntity

DigitalClass: Interface to digital entities on BrainStem modules. Digital entities have the following 5 possibilities: Digital Input, Digital Output, RCServo Input, RCServo Output, and HighZ. Other capabilities may be available and not all pins support all configurations. Please see the product datasheet.

group EqualizerEntity

EqualizerClass: Provides receiver and transmitter gain/boost/emphasis settings for some of Acroname’s products. Please see product documentation for further details.

group I2CEntity

I2CClass: Interface the I2C buses on BrainStem modules. The class provides a way to send read and write commands to I2C devices on the entities bus.

group LinkEntity

The Link class provides link level access to streaming information.

group ModuleEntity

The Module Entity provides a generic interface to a BrainStem hardware module. The Module Class is the parent class for all BrainStem modules. Each module inherits from Module and implements its hardware specific features.

group MuxEntity

MuxClass: A MUX is a multiplexer that takes one or more similar inputs (bus, connection, or signal) and allows switching to one or more outputs. An analogy would be the switchboard of a telephone operator. Calls (inputs) come in and by re-connecting the input to an output, the operator (multiplexer) can direct that input to on or more outputs.

One possible output is to not connect the input to anything which essentially disables that input’s connection to anything.

Not every MUX has multiple inputs. Some may simply be a single input that can be enabled (connected to a single output) or disabled (not connected to anything).

group PointerEntity

PointerClass: Allows access to the reflex scratchpad from a host computer.

The Pointers access the pad which is a shared memory area on a BrainStem module. The interface allows the use of the brainstem scratchpad from the host, and provides a mechanism for allowing the host application and brainstem relexes to communicate.

The Pointer allows access to the pad in a similar manner as a file pointer accesses the underlying file. The cursor position can be set via setOffset. A read of a character short or int can be made from that cursor position. In addition the mode of the pointer can be set so that the cursor position automatically increments or set so that it does not this allows for multiple reads of the same pad value, or reads of multi-record values, via and incrementing pointer.

group PowerDeliveryEntity

PowerDeliveryClass: Power Delivery or PD is a power specification which allows more charging options and device behaviors within the USB interface. This Entity will allow you to directly access the vast landscape of PD.

group RailEntity

RailClass: 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.

group RCServoEntity

RCServoClass: Interface to servo entities on BrainStem modules. Servo entities are built upon the digital input/output pins and therefore can also be inputs or outputs. Please see the product datasheet on the configuration limitations.

group RelayEntity

RelayClass: Interface to relay entities on BrainStem modules. Relay entities can be set, and the voltage read. Other capabilities may be available, please see the product datasheet.

group SignalEntity

SignalClass: Interface to digital pins configured to produce square wave signals. This class is designed to allow for square waves at various frequencies and duty cycles. Control is defined by specifying the wave period as (T3Time) and the active portion of the cycle as (T2Time). See the entity overview section of the reference for more detail regarding the timing.

group StoreEntity

StoreClass: The store provides a flat file system on modules that have storage capacity. Files are referred to as slots and they have simple zero-based numbers for access. Store slots can be used for generalized storage and commonly contain compiled reflex code (files ending in .map) or templates used by the system. Slots simply contain bytes with no expected organization but the code or use of the slot may impose a structure. Stores have fixed indices based on type. Not every module contains a store of each type. Consult the module datasheet for details on which specific stores are implemented, if any, and the capacities of implemented stores.

group SystemEntity

SystemClass: 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.

group TemperatureEntity

TemperatureClass: This entity is only available on certain modules, and provides a temperature reading in microcelsius.

group TimerEntity

TimerClass: The Timer Class provides access to a simple scheduler. Reflex routines can be written which will be executed upon expiration of the timer entity. The timer can be set to fire only once, or to repeat at a certain interval.

group UARTEntity

UART Class: A UART is a “Universal Asynchronous Receiver/Transmitter. Many times referred to as a COM (communication), Serial, or TTY (teletypewriter) port.

The UART Class allows the enabling and disabling of the UART data lines.

group USBEntity

USBClass: The USB class provides methods to interact with a USB hub and USB switches. Different USB hub products have varying support; check the datasheet to understand the capabilities of each product.

group USBSystemEntity

USBSystem Class: The USBSystem class provides high level control of the lower level Port Class.