MetaWear C++ API  0.20.0
C++ implementation of the MetaWear protocol
gpio.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include "sensor_common.h"
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
15 const uint8_t MBL_MW_GPIO_UNUSED_PIN = 0xff;
16 
20 typedef enum {
21  MBL_MW_GPIO_PULL_MODE_UP= 0,
22  MBL_MW_GPIO_PULL_MODE_DOWN,
23  MBL_MW_GPIO_PULL_MODE_NONE
25 
29 typedef enum {
33 
37 typedef enum {
42 
48 typedef struct {
49  uint8_t pullup_pin;
50  uint8_t pulldown_pin;
51  uint8_t virtual_pin;
52  uint16_t delay_us;
54 
127 
128 #ifdef __cplusplus
129 }
130 #endif
struct MblMwDataSignal MblMwDataSignal
A event fired from the MetaWear board that also contains data.
Definition: datasignal_fwd.h:15
#define METAWEAR_API
Indicates the function should be exported to the symbol table
Definition: dllmarker.h:27
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 The monitor provides a callback anytime ...
METAWEAR_API MblMwDataSignal * mbl_mw_gpio_get_digital_input_data_signal(MblMwMetaWearBoard *board, uint8_t pin)
Retrieves a data signal representing digital data See MetaWear datasheet for allowed pin values.
const uint8_t MBL_MW_GPIO_UNUSED_PIN
Pin value indicating the pin setting is not used.
Definition: gpio.h:15
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 See MblMwGpioAnalogReadMode for allowed mode values ...
METAWEAR_API void mbl_mw_gpio_start_pin_monitoring(const MblMwMetaWearBoard *board, uint8_t pin)
Start pin monitoring.
MblMwGpioAnalogReadMode
Read modes for analog input.
Definition: gpio.h:29
@ MBL_MW_GPIO_ANALOG_READ_MODE_ADC
Read input voltage as a supply ratio.
Definition: gpio.h:31
@ MBL_MW_GPIO_ANALOG_READ_MODE_ABS_REF
Read input voltage as an absolute reference.
Definition: gpio.h:30
MblMwGpioPinChangeType
Pin change types.
Definition: gpio.h:37
@ MBL_MW_GPIO_PIN_CHANGE_TYPE_FALLING
Notify on falling edge of a change.
Definition: gpio.h:39
@ MBL_MW_GPIO_PIN_CHANGE_TYPE_ANY
Notify on any edge of a change.
Definition: gpio.h:40
@ MBL_MW_GPIO_PIN_CHANGE_TYPE_RISING
Notify on rising edge of a change.
Definition: gpio.h:38
METAWEAR_API void mbl_mw_gpio_set_pull_mode(const MblMwMetaWearBoard *board, uint8_t pin, MblMwGpioPullMode mode)
Sets the pin pull mode A GPIO pin can be pulled up (to high voltage), pulled down (to 0V),...
MblMwGpioPullMode
Pin configuration types.
Definition: gpio.h:20
METAWEAR_API void mbl_mw_gpio_clear_digital_output(const MblMwMetaWearBoard *board, uint8_t pin)
Clears the digital output state The GPIO pin is set as an output pin and turned off (0 voltage) See M...
METAWEAR_API void mbl_mw_gpio_stop_pin_monitoring(const MblMwMetaWearBoard *board, uint8_t pin)
Stop pin monitoring.
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 The monitor provides a callback anytime the value changes by MblM...
METAWEAR_API void mbl_mw_gpio_set_digital_output(const MblMwMetaWearBoard *board, uint8_t pin)
Sets the digital output state The GPIO pin is set as an output pin and turned on (high voltage) See M...
struct MblMwMetaWearBoard MblMwMetaWearBoard
Software representation of a physical MetaWear board.
Definition: metawearboard_fwd.h:17
Additional parameters required for an enhanced analog read.
Definition: gpio.h:48
uint8_t pullup_pin
GPIO pin to be pulled up before the read, set to MBL_MW_GPIO_UNUSED_PIN if not used.
Definition: gpio.h:49
uint8_t virtual_pin
GPIO pin the data identifies as, must match pin value for mbl_mw_gpio_get_analog_input_data_signal if...
Definition: gpio.h:51
uint16_t delay_us
How long to wait before reading from the pin, between [0, 1020]us, set to 0 if not used.
Definition: gpio.h:52
uint8_t pulldown_pin
GPIO pin to be pulled down before the read, set to MBL_MW_GPIO_UNUSED_PIN if not used.
Definition: gpio.h:50