MIP_SDK  latest-2-g34f3e39
MicroStrain Communications Library for embedded systems
Classes | Typedefs | Enumerations | Functions
(0x0C,0x41) Gpio Config

Configures the user GPIO pins on the connector for use with several built-in functions or for general input or output. More...

Classes

struct  mip::C::mip_3dm_gpio_config_command
 
struct  mip::C::mip_3dm_gpio_config_response
 

Typedefs

typedef enum mip_3dm_gpio_config_command_feature mip::C::mip_3dm_gpio_config_command_feature
 
typedef enum mip_3dm_gpio_config_command_behavior mip::C::mip_3dm_gpio_config_command_behavior
 
typedef uint8_t mip::C::mip_3dm_gpio_config_command_pin_mode
 
typedef struct mip_3dm_gpio_config_command mip::C::mip_3dm_gpio_config_command
 
typedef struct mip_3dm_gpio_config_response mip::C::mip_3dm_gpio_config_response
 

Enumerations

enum  mip::C::mip_3dm_gpio_config_command_feature {
  mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_FEATURE_UNUSED = 0, mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_FEATURE_GPIO = 1, mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_FEATURE_PPS = 2, mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_FEATURE_ENCODER = 3,
  mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_FEATURE_TIMESTAMP = 4, mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_FEATURE_UART = 5
}
 
enum  mip::C::mip_3dm_gpio_config_command_behavior {
  mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_UNUSED = 0, mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_GPIO_INPUT = 1, mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_GPIO_OUTPUT_LOW = 2, mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_GPIO_OUTPUT_HIGH = 3,
  mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_PPS_INPUT = 1, mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_PPS_OUTPUT = 2, mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_ENCODER_A = 1, mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_ENCODER_B = 2,
  mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_TIMESTAMP_RISING = 1, mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_TIMESTAMP_FALLING = 2, mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_TIMESTAMP_EITHER = 3, mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_UART_PORT2_TX = 33,
  mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_UART_PORT2_RX = 34, mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_UART_PORT3_TX = 49, mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_UART_PORT3_RX = 50
}
 

Functions

void mip::C::insert_mip_3dm_gpio_config_command (microstrain_serializer *serializer, const mip_3dm_gpio_config_command *self)
 
void mip::C::extract_mip_3dm_gpio_config_command (microstrain_serializer *serializer, mip_3dm_gpio_config_command *self)
 
void mip::C::insert_mip_3dm_gpio_config_response (microstrain_serializer *serializer, const mip_3dm_gpio_config_response *self)
 
void mip::C::extract_mip_3dm_gpio_config_response (microstrain_serializer *serializer, mip_3dm_gpio_config_response *self)
 
mip_cmd_result mip::C::mip_3dm_write_gpio_config (mip_interface *device, uint8_t pin, mip_3dm_gpio_config_command_feature feature, mip_3dm_gpio_config_command_behavior behavior, mip_3dm_gpio_config_command_pin_mode pin_mode)
 
mip_cmd_result mip::C::mip_3dm_read_gpio_config (mip_interface *device, uint8_t pin, mip_3dm_gpio_config_command_feature *feature_out, mip_3dm_gpio_config_command_behavior *behavior_out, mip_3dm_gpio_config_command_pin_mode *pin_mode_out)
 
mip_cmd_result mip::C::mip_3dm_save_gpio_config (mip_interface *device, uint8_t pin)
 
mip_cmd_result mip::C::mip_3dm_load_gpio_config (mip_interface *device, uint8_t pin)
 
mip_cmd_result mip::C::mip_3dm_default_gpio_config (mip_interface *device, uint8_t pin)
 

Detailed Description

Configures the user GPIO pins on the connector for use with several built-in functions or for general input or output.

GPIO pins are device-dependent. Some features are only available on certain pins. Some behaviors require specific configurations. Consult the device user manual for restrictions and default settings.

To avoid glitches on GPIOs configured as an output in a mode other than GPIO, always configure the relevant function before setting up the pin with this command. Otherwise, the pin state will be undefined between this command and the one to set up the feature. For input pins, use this command first so the state is well-defined when the feature is initialized.

Some configurations can only be active on one pin at a time. If such configuration is applied to a second pin, the second one will take precedence and the original pin's configuration will be reset.

Typedef Documentation

◆ mip_3dm_gpio_config_command

◆ mip_3dm_gpio_config_command_behavior

◆ mip_3dm_gpio_config_command_feature

◆ mip_3dm_gpio_config_command_pin_mode

◆ mip_3dm_gpio_config_response

Enumeration Type Documentation

◆ mip_3dm_gpio_config_command_behavior

Enumerator
MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_UNUSED 

Use 0 unless otherwise specified.

MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_GPIO_INPUT 

Pin will be an input. This can be used to stream or poll the value and is the default setting.

MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_GPIO_OUTPUT_LOW 

Pin is an output initially in the LOW state. This state will be restored during system startup if the configuration is saved.

MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_GPIO_OUTPUT_HIGH 

Pin is an output initially in the HIGH state. This state will be restored during system startup if the configuration is saved.

MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_PPS_INPUT 

Pin will receive the pulse-per-second signal. Only one pin can have this behavior. This will only work if the PPS Source command is configured to GPIO.

MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_PPS_OUTPUT 

Pin will transmit the pulse-per-second signal from the device.

MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_ENCODER_A 

Encoder "A" quadrature input. Only one pin can have this behavior. The last command to set this behavior will take precedence.

MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_ENCODER_B 

Encoder "B" quadrature input. Only one pin can have this behavior. The last command to set this behavior will take precedence.

MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_TIMESTAMP_RISING 

Rising edges will be timestamped.

MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_TIMESTAMP_FALLING 

Falling edges will be timestamped.

MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_TIMESTAMP_EITHER 

Both rising and falling edges will be timestamped.

MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_UART_PORT2_TX 

(0x21) UART port 2 transmit.

MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_UART_PORT2_RX 

(0x22) UART port 2 receive.

MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_UART_PORT3_TX 

(0x31) UART port 3 transmit.

MIP_3DM_GPIO_CONFIG_COMMAND_BEHAVIOR_UART_PORT3_RX 

(0x32) UART port 3 receive.

◆ mip_3dm_gpio_config_command_feature

Enumerator
MIP_3DM_GPIO_CONFIG_COMMAND_FEATURE_UNUSED 

The pin is not used. It may be technically possible to read the pin state in this mode, but this is not guaranteed to be true of all devices or pins.

MIP_3DM_GPIO_CONFIG_COMMAND_FEATURE_GPIO 

General purpose input or output. Use this for direct control of pin output state or to stream the state of the pin.

MIP_3DM_GPIO_CONFIG_COMMAND_FEATURE_PPS 

Pulse per second input or output.

MIP_3DM_GPIO_CONFIG_COMMAND_FEATURE_ENCODER 

Motor encoder/odometer input.

MIP_3DM_GPIO_CONFIG_COMMAND_FEATURE_TIMESTAMP 

Precision Timestamping. Use with Event Trigger Configuration (0x0C,0x2E).

MIP_3DM_GPIO_CONFIG_COMMAND_FEATURE_UART 

UART data or control lines.

Function Documentation

◆ extract_mip_3dm_gpio_config_command()

void mip::C::extract_mip_3dm_gpio_config_command ( microstrain_serializer serializer,
mip_3dm_gpio_config_command self 
)

◆ extract_mip_3dm_gpio_config_response()

void mip::C::extract_mip_3dm_gpio_config_response ( microstrain_serializer serializer,
mip_3dm_gpio_config_response self 
)

◆ insert_mip_3dm_gpio_config_command()

void mip::C::insert_mip_3dm_gpio_config_command ( microstrain_serializer serializer,
const mip_3dm_gpio_config_command self 
)

◆ insert_mip_3dm_gpio_config_response()

void mip::C::insert_mip_3dm_gpio_config_response ( microstrain_serializer serializer,
const mip_3dm_gpio_config_response self 
)

◆ mip_3dm_default_gpio_config()

mip_cmd_result mip::C::mip_3dm_default_gpio_config ( mip_interface device,
uint8_t  pin 
)

◆ mip_3dm_load_gpio_config()

mip_cmd_result mip::C::mip_3dm_load_gpio_config ( mip_interface device,
uint8_t  pin 
)

◆ mip_3dm_read_gpio_config()

mip_cmd_result mip::C::mip_3dm_read_gpio_config ( mip_interface device,
uint8_t  pin,
mip_3dm_gpio_config_command_feature feature_out,
mip_3dm_gpio_config_command_behavior behavior_out,
mip_3dm_gpio_config_command_pin_mode pin_mode_out 
)

◆ mip_3dm_save_gpio_config()

mip_cmd_result mip::C::mip_3dm_save_gpio_config ( mip_interface device,
uint8_t  pin 
)

◆ mip_3dm_write_gpio_config()

mip_cmd_result mip::C::mip_3dm_write_gpio_config ( mip_interface device,
uint8_t  pin,
mip_3dm_gpio_config_command_feature  feature,
mip_3dm_gpio_config_command_behavior  behavior,
mip_3dm_gpio_config_command_pin_mode  pin_mode 
)