Digital Class

class DigitalClass

The DigitalClass is the interface to digital entities on BrainStem modules. Digital entities have the following 5 possabilities: 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.

Public Functions

DigitalClass(Acroname::BrainStem::DigitalClass &digital)

Constructor.

~DigitalClass()

Destructor.

Acroname::BrainStem2CLI::DigitalClass::!DigitalClass()

Finalizer.

aErr setState(const unsigned char state)

Set the logical state.

Return

Returns common entity return values

Parameters
  • state: The state to be set. 0 is logic low, 1 is logic high.

aErr getState(unsigned char %state)

Get the state.

Return

Returns common entity return values

Parameters
  • state: The current state of the digital entity. 0 is logic low, 1 is logic high. Note: If in high Z state an error will be returned.

aErr setConfiguration(const unsigned char configuration)

Set the digital configuration to one of the avaliable 5 states. Note: Some configurations are only supported on specific pins.

Return

Returns common entity return values

Return

aErrConfiguration - Entity does not support this configuration.

Parameters
  • configuration:

    • Digital Input: digitalConfigurationInput = 0

    • Digital Output: digitalConfigurationOutput = 1

    • RCServo Input: FdigitalConfigurationRCServoInput = 2

    • RCServo Output: digitalConfigurationRCServoOutput = 3

    • High Z State: digitalConfigurationHiZ = 4

    • Digital Input: digitalConfigurationInputPullUp = 0

    • Digital Input: digitalConfigurationInputNoPull = 4

    • Digital Input: digitalConfigurationInputPullDown = 5

aErr getConfiguration(unsigned char %configuration)

Get the digital configuration.

Return

Returns common entity return values

Parameters
  • configuration: - Current configuration of the digital entity.

aErr setStateAll(const unsigned int start)

Sets the logical state of all available digitals based on the bit mapping. Number of digitals varies across BrainStem modules. Refer to the datasheet for the capabilities of your module.

Return

Returns common entity return values

Parameters
  • state: The state to be set for all digitals in a bit mapped representation. 0 is logic low, 1 is logic high. Where bit 0 = digital 0, bit 1 = digital 1 etc.

aErr getStateAll(unsigned int %state)

Gets the logical state of all available digitals in a bit mapped representation. Number of digitals varies across BrainStem modules. Refer to the datasheet for the capabilities of your module.

Return

Returns common entity return values

Parameters
  • state: The state of all digitals where bit 0 = digital 0, bit 1 = digital 1 etc. 0 is logic low, 1 is logic high.