MIP_SDK  v3.0.0-736-g212583cf
MicroStrain Communications Library for embedded systems
Classes | Typedefs | Enumerations | Functions | Variables
(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

static void mip::C::insert_mip_3dm_gpio_config_command_feature (microstrain_serializer *serializer, const mip_3dm_gpio_config_command_feature self)
 
static void mip::C::extract_mip_3dm_gpio_config_command_feature (microstrain_serializer *serializer, mip_3dm_gpio_config_command_feature *self)
 
static void mip::C::insert_mip_3dm_gpio_config_command_behavior (microstrain_serializer *serializer, const mip_3dm_gpio_config_command_behavior self)
 
static void mip::C::extract_mip_3dm_gpio_config_command_behavior (microstrain_serializer *serializer, mip_3dm_gpio_config_command_behavior *self)
 
static void mip::C::insert_mip_3dm_gpio_config_command_pin_mode (microstrain_serializer *serializer, const mip_3dm_gpio_config_command_pin_mode self)
 
static void mip::C::extract_mip_3dm_gpio_config_command_pin_mode (microstrain_serializer *serializer, mip_3dm_gpio_config_command_pin_mode *self)
 
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)
 

Variables

static const mip_3dm_gpio_config_command_pin_mode mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_PIN_MODE_NONE = 0x00
 
static const mip_3dm_gpio_config_command_pin_mode mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_PIN_MODE_OPEN_DRAIN = 0x01
 The pin will be an open-drain output. The state will be either LOW or FLOATING instead of LOW or HIGH, respectively. This is used to connect multiple open-drain outputs from several devices. An internal or external pull-up resistor is typically used in combination. The maximum voltage of an open drain output is subject to the device maximum input voltage range found in the specifications. More...
 
static const mip_3dm_gpio_config_command_pin_mode mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_PIN_MODE_PULLDOWN = 0x02
 The pin will have an internal pull-down resistor enabled. This is useful for connecting inputs to signals which can only be pulled high such as mechanical switches. Cannot be used in combination with pull-up. See the device specifications for the resistance value. More...
 
static const mip_3dm_gpio_config_command_pin_mode mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_PIN_MODE_PULLUP = 0x04
 The pin will have an internal pull-up resistor enabled. Useful for connecting inputs to signals which can only be pulled low such as mechanical switches, or in combination with an open drain output. Cannot be used in combination with pull-down. See the device specifications for the resistance value. Use of this mode may restrict the maximum allowed input voltage. See the device datasheet for details. More...
 
static const mip_3dm_gpio_config_command_pin_mode mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_PIN_MODE_ALL = 0x07
 

Detailed Description

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_feature

◆ mip_3dm_gpio_config_command_behavior

◆ mip_3dm_gpio_config_command_pin_mode

◆ mip_3dm_gpio_config_command

◆ mip_3dm_gpio_config_response

Enumeration Type Documentation

◆ 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.

◆ 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.

Function Documentation

◆ insert_mip_3dm_gpio_config_command_feature()

static void mip::C::insert_mip_3dm_gpio_config_command_feature ( microstrain_serializer serializer,
const mip_3dm_gpio_config_command_feature  self 
)
inlinestatic

◆ extract_mip_3dm_gpio_config_command_feature()

static void mip::C::extract_mip_3dm_gpio_config_command_feature ( microstrain_serializer serializer,
mip_3dm_gpio_config_command_feature self 
)
inlinestatic

◆ insert_mip_3dm_gpio_config_command_behavior()

static void mip::C::insert_mip_3dm_gpio_config_command_behavior ( microstrain_serializer serializer,
const mip_3dm_gpio_config_command_behavior  self 
)
inlinestatic

◆ extract_mip_3dm_gpio_config_command_behavior()

static void mip::C::extract_mip_3dm_gpio_config_command_behavior ( microstrain_serializer serializer,
mip_3dm_gpio_config_command_behavior self 
)
inlinestatic

◆ insert_mip_3dm_gpio_config_command_pin_mode()

static void mip::C::insert_mip_3dm_gpio_config_command_pin_mode ( microstrain_serializer serializer,
const mip_3dm_gpio_config_command_pin_mode  self 
)
inlinestatic

◆ extract_mip_3dm_gpio_config_command_pin_mode()

static void mip::C::extract_mip_3dm_gpio_config_command_pin_mode ( microstrain_serializer serializer,
mip_3dm_gpio_config_command_pin_mode self 
)
inlinestatic

◆ 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 
)

◆ extract_mip_3dm_gpio_config_command()

void mip::C::extract_mip_3dm_gpio_config_command ( microstrain_serializer serializer,
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 
)

◆ extract_mip_3dm_gpio_config_response()

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

◆ 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 
)

◆ 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_load_gpio_config()

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

◆ mip_3dm_default_gpio_config()

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

Variable Documentation

◆ MIP_3DM_GPIO_CONFIG_COMMAND_PIN_MODE_NONE

const mip_3dm_gpio_config_command_pin_mode mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_PIN_MODE_NONE = 0x00
static

◆ MIP_3DM_GPIO_CONFIG_COMMAND_PIN_MODE_OPEN_DRAIN

const mip_3dm_gpio_config_command_pin_mode mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_PIN_MODE_OPEN_DRAIN = 0x01
static

◆ MIP_3DM_GPIO_CONFIG_COMMAND_PIN_MODE_PULLDOWN

const mip_3dm_gpio_config_command_pin_mode mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_PIN_MODE_PULLDOWN = 0x02
static

◆ MIP_3DM_GPIO_CONFIG_COMMAND_PIN_MODE_PULLUP

const mip_3dm_gpio_config_command_pin_mode mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_PIN_MODE_PULLUP = 0x04
static

◆ MIP_3DM_GPIO_CONFIG_COMMAND_PIN_MODE_ALL

const mip_3dm_gpio_config_command_pin_mode mip::C::MIP_3DM_GPIO_CONFIG_COMMAND_PIN_MODE_ALL = 0x07
static