MetaWear C++ API  0.18.0
C++ implementation of the MetaWear protocol
Classes | Enumerations | Functions | Variables
gpio.h File Reference

Interacts with the general purpose I/O pins on the board. More...

#include "sensor_common.h"

Go to the source code of this file.

Classes

struct  MblMwGpioAnalogReadParameters
 Additional parameters required for an enhanced analog read. More...
 

Enumerations

enum  MblMwGpioPullMode { MBL_MW_GPIO_PULL_MODE_UP = 0, MBL_MW_GPIO_PULL_MODE_DOWN, MBL_MW_GPIO_PULL_MODE_NONE }
 Pin configuration types.
 
enum  MblMwGpioAnalogReadMode { MBL_MW_GPIO_ANALOG_READ_MODE_ABS_REF = 0, MBL_MW_GPIO_ANALOG_READ_MODE_ADC }
 Read modes for analog input. More...
 
enum  MblMwGpioPinChangeType { MBL_MW_GPIO_PIN_CHANGE_TYPE_RISING = 1, MBL_MW_GPIO_PIN_CHANGE_TYPE_FALLING, MBL_MW_GPIO_PIN_CHANGE_TYPE_ANY }
 Pin change types. More...
 

Functions

METAWEAR_API MblMwDataSignalmbl_mw_gpio_get_analog_input_data_signal (MblMwMetaWearBoard *board, uint8_t pin, MblMwGpioAnalogReadMode mode)
 Retrieves a data signal representing analog data. More...
 
METAWEAR_API MblMwDataSignalmbl_mw_gpio_get_digital_input_data_signal (MblMwMetaWearBoard *board, uint8_t pin)
 Retrieves a data signal representing digital data. More...
 
METAWEAR_API MblMwDataSignalmbl_mw_gpio_get_pin_monitor_data_signal (MblMwMetaWearBoard *board, uint8_t pin)
 Retrieves a data signal representing changes in digital data. More...
 
METAWEAR_API void mbl_mw_gpio_set_pull_mode (const MblMwMetaWearBoard *board, uint8_t pin, MblMwGpioPullMode mode)
 Sets the pin pull mode. More...
 
METAWEAR_API void mbl_mw_gpio_set_digital_output (const MblMwMetaWearBoard *board, uint8_t pin)
 Sets the digital output state. More...
 
METAWEAR_API void mbl_mw_gpio_clear_digital_output (const MblMwMetaWearBoard *board, uint8_t pin)
 Clears the digital output state. More...
 
METAWEAR_API void mbl_mw_gpio_set_pin_change_type (const MblMwMetaWearBoard *board, uint8_t pin, MblMwGpioPinChangeType type)
 Sets the pin change type to monitor. More...
 
METAWEAR_API void mbl_mw_gpio_start_pin_monitoring (const MblMwMetaWearBoard *board, uint8_t pin)
 Start pin monitoring. More...
 
METAWEAR_API void mbl_mw_gpio_stop_pin_monitoring (const MblMwMetaWearBoard *board, uint8_t pin)
 Stop pin monitoring. More...
 

Variables

const uint8_t MBL_MW_GPIO_UNUSED_PIN = 0xff
 Pin value indicating the pin setting is not used.
 

Detailed Description

Interacts with the general purpose I/O pins on the board.

Enumeration Type Documentation

◆ MblMwGpioAnalogReadMode

Read modes for analog input.

Enumerator
MBL_MW_GPIO_ANALOG_READ_MODE_ABS_REF 

Read input voltage as an absolute reference.

MBL_MW_GPIO_ANALOG_READ_MODE_ADC 

Read input voltage as a supply ratio.

◆ MblMwGpioPinChangeType

Pin change types.

Enumerator
MBL_MW_GPIO_PIN_CHANGE_TYPE_RISING 

Notify on rising edge of a change.

MBL_MW_GPIO_PIN_CHANGE_TYPE_FALLING 

Notify on falling edge of a change.

MBL_MW_GPIO_PIN_CHANGE_TYPE_ANY 

Notify on any edge of a change.

Function Documentation

◆ mbl_mw_gpio_clear_digital_output()

METAWEAR_API void mbl_mw_gpio_clear_digital_output ( const MblMwMetaWearBoard board,
uint8_t  pin 
)

Clears the digital output state.

Parameters
boardBoard the pin is on
pinGPIO pin to clear

◆ mbl_mw_gpio_get_analog_input_data_signal()

METAWEAR_API MblMwDataSignal* mbl_mw_gpio_get_analog_input_data_signal ( MblMwMetaWearBoard board,
uint8_t  pin,
MblMwGpioAnalogReadMode  mode 
)

Retrieves a data signal representing analog data.

Parameters
boardBoard to receive data from
pinGPIO pin to read
modeRead mode to use

◆ mbl_mw_gpio_get_digital_input_data_signal()

METAWEAR_API MblMwDataSignal* mbl_mw_gpio_get_digital_input_data_signal ( MblMwMetaWearBoard board,
uint8_t  pin 
)

Retrieves a data signal representing digital data.

Parameters
boardBoard to receive data from
pinGPIO pin to read

◆ mbl_mw_gpio_get_pin_monitor_data_signal()

METAWEAR_API MblMwDataSignal* mbl_mw_gpio_get_pin_monitor_data_signal ( MblMwMetaWearBoard board,
uint8_t  pin 
)

Retrieves a data signal representing changes in digital data.

Parameters
boardBoard to receive data from
pinGPIO pin to monitor

◆ mbl_mw_gpio_set_digital_output()

METAWEAR_API void mbl_mw_gpio_set_digital_output ( const MblMwMetaWearBoard board,
uint8_t  pin 
)

Sets the digital output state.

Parameters
boardBoard the pin is on
pinGPIO pin to set

◆ mbl_mw_gpio_set_pin_change_type()

METAWEAR_API void mbl_mw_gpio_set_pin_change_type ( const MblMwMetaWearBoard board,
uint8_t  pin,
MblMwGpioPinChangeType  type 
)

Sets the pin change type to monitor.

Parameters
boardBoard the pin is on
pinGPIO pin to set
typeChange type to monitor

◆ mbl_mw_gpio_set_pull_mode()

METAWEAR_API void mbl_mw_gpio_set_pull_mode ( const MblMwMetaWearBoard board,
uint8_t  pin,
MblMwGpioPullMode  mode 
)

Sets the pin pull mode.

Parameters
boardBoard the pin is on
pinGPIO pin to modify
modeNew pull mode

◆ mbl_mw_gpio_start_pin_monitoring()

METAWEAR_API void mbl_mw_gpio_start_pin_monitoring ( const MblMwMetaWearBoard board,
uint8_t  pin 
)

Start pin monitoring.

Parameters
boardBoard the pin is on
pinGPIO pin to monitor

◆ mbl_mw_gpio_stop_pin_monitoring()

METAWEAR_API void mbl_mw_gpio_stop_pin_monitoring ( const MblMwMetaWearBoard board,
uint8_t  pin 
)

Stop pin monitoring.

Parameters
boardBoard the pin is on
pinGPIO pin to stop monitoring