MetaWear C++ API  0.18.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 
74 
87 METAWEAR_API void mbl_mw_gpio_set_digital_output(const MblMwMetaWearBoard* board, uint8_t pin);
94 
113 METAWEAR_API void mbl_mw_gpio_stop_pin_monitoring(const MblMwMetaWearBoard* board, uint8_t pin);
114 
115 #ifdef __cplusplus
116 }
117 #endif
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
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.
METAWEAR_API void mbl_mw_gpio_clear_digital_output(const MblMwMetaWearBoard *board, uint8_t pin)
Clears the digital output state.
METAWEAR_API void mbl_mw_gpio_stop_pin_monitoring(const MblMwMetaWearBoard *board, uint8_t pin)
Stop pin monitoring.
struct MblMwMetaWearBoard MblMwMetaWearBoard
Software representation of a physical MetaWear board.
Definition: metawearboard_fwd.h:17
MblMwGpioAnalogReadMode
Read modes for analog input.
Definition: gpio.h:29
MblMwGpioPinChangeType
Pin change types.
Definition: gpio.h:37
const uint8_t MBL_MW_GPIO_UNUSED_PIN
Pin value indicating the pin setting is not used.
Definition: gpio.h:15
METAWEAR_API void mbl_mw_gpio_set_digital_output(const MblMwMetaWearBoard *board, uint8_t pin)
Sets the digital output state.
Notify on any edge of a change.
Definition: gpio.h:40
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.
METAWEAR_API void mbl_mw_gpio_set_pull_mode(const MblMwMetaWearBoard *board, uint8_t pin, MblMwGpioPullMode mode)
Sets the pin pull mode.
Additional parameters required for an enhanced analog read.
Definition: gpio.h:48
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 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
METAWEAR_API MblMwDataSignal * mbl_mw_gpio_get_digital_input_data_signal(MblMwMetaWearBoard *board, uint8_t pin)
Retrieves a data signal representing digital data.
MblMwGpioPullMode
Pin configuration types.
Definition: gpio.h:20
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
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.
Read input voltage as an absolute reference.
Definition: gpio.h:30
Notify on falling edge of a change.
Definition: gpio.h:39
#define METAWEAR_API
Indicates the function should be exported to the symbol table.
Definition: dllmarker.h:27
METAWEAR_API void mbl_mw_gpio_start_pin_monitoring(const MblMwMetaWearBoard *board, uint8_t pin)
Start pin monitoring.
Read input voltage as a supply ratio.
Definition: gpio.h:31
struct MblMwDataSignal MblMwDataSignal
A event fired from the MetaWear board that also contains data.
Definition: datasignal_fwd.h:15
Notify on rising edge of a change.
Definition: gpio.h:38