MIP_SDK  v3.0.0
MicroStrain Communications Library for embedded systems
Classes | Functions
(0x0C,0x42) Gpio State

Allows the state of the pin to be read or controlled. More...

Classes

struct  mip::commands_3dm::GpioState
 

Functions

TypedResult< GpioStatemip::commands_3dm::writeGpioState (C::mip_interface &device, uint8_t pin, bool state)
 
TypedResult< GpioStatemip::commands_3dm::readGpioState (C::mip_interface &device, uint8_t pin, bool *stateOut)
 

Detailed Description

Allows the state of the pin to be read or controlled.

This command serves two purposes: 1) To allow reading the state of a pin via command, rather than polling a data quantity, and 2) to provide a way to set the output state without also having to specify the operating mode.

The state read back from the pin is the physical state of the pin, rather than a configuration value. The state can be read regardless of its configuration as long as the device supports GPIO input on that pin. If the pin is set to an output, the read value would match the output value.

While the state of a pin can always be set, it will only have an observable effect if the pin is set to output mode.

This command does not support saving, loading, or resetting the state. Instead, use the GPIO Configuration command, which allows the initial state to be configured.

Function Documentation

◆ readGpioState()

TypedResult< GpioState > mip::commands_3dm::readGpioState ( C::mip_interface device,
uint8_t  pin,
bool *  stateOut 
)

◆ writeGpioState()

TypedResult< GpioState > mip::commands_3dm::writeGpioState ( C::mip_interface device,
uint8_t  pin,
bool  state 
)