Digital Class

class DigitalClass : public Acroname::BrainStem::EntityClass

MARK: Digital Class.

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.

Public Functions

DigitalClass(void)

Constructor.

virtual ~DigitalClass(void)

Destructor.

void init(Module *pModule, const uint8_t index)

Initialize the class.

Parameters:
  • pModule – The module to which this entity belongs.

  • index – The index of the digital entity being initialized.

aErr setConfiguration(const uint8_t configuration)

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

Parameters:

configuration

  • Digital Input: digitalConfigurationInput = 0

  • Digital Output: digitalConfigurationOutput = 1

  • RCServo Input: digitalConfigurationRCServoInput = 2

  • RCServo Output: digitalConfigurationRCServoOutput = 3

  • High Z State: digitalConfigurationHiZ = 4

  • Digital Input: digitalConfigurationInputPullUp = 0

  • Digital Input: digitalConfigurationInputNoPull = 4

  • Digital Input: digitalConfigurationInputPullDown = 5

Returns:

Returns common entity return values

Returns:

aErrConfiguration - Entity does not support this configuration.

aErr getConfiguration(uint8_t *configuration)

Get the digital configuration.

Parameters:

configuration – - Current configuration of the digital entity.

Returns:

Returns common entity return values

aErr setState(const uint8_t state)

Set the logical state.

Parameters:

state – The state to be set. 0 is logic low, 1 is logic high.

Returns:

Returns common entity return values

aErr getState(uint8_t *state)

Get the state.

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.

Returns:

Returns common entity return values

aErr setStateAll(const uint32_t state)

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.

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.

Returns:

Returns common entity return values

aErr getStateAll(uint32_t *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.

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.

Returns:

Returns common entity return values