4#include <zephyr/drivers/gpio.h>
43 flags = GPIO_INPUT | GPIO_PULL_UP;
53 int rc = gpio_pin_configure_dt(&pin, flags);
55 AD_LOGE(
"Failed to configure GPIO pin: %d", rc);
65 int rc = gpio_pin_set_dt(&pin, value ? 1 : 0);
67 AD_LOGE(
"Failed to write GPIO pin: %d", rc);
79 int rc = gpio_pin_get_dt(&pin);
81 AD_LOGE(
"Failed to read GPIO pin: %d", rc);
89 int rc = adc_channel_setup_dt(&pin);
91 AD_LOGE(
"ADC channel setup failed: %d", rc);
95 struct adc_sequence sequence = {
97 .buffer_size =
sizeof(sample),
99 adc_sequence_init_dt(&pin, &sequence);
100 rc = adc_read_dt(&pin, &sequence);
102 AD_LOGE(
"ADC read failed: %d", rc);
#define INPUT
Definition DriverCommon.h:41
#define GPIO_UNDEFINED
Definition DriverCommon.h:131
#define OUTPUT
Definition DriverCommon.h:44
#define INPUT_PULLUP
Definition DriverCommon.h:47
#define AD_LOGE(...)
Definition Logger.h:15
Definition GPIO_Zephyr.h:20
bool begin(IDriverDeviceInfo &pins)
Definition GPIO_Zephyr.h:24
bool digitalWrite(GpioPin pin, bool value)
Definition GPIO_Zephyr.h:59
int analogRead(ADCPin pin)
Reads the raw ADC sample described by an adc_dt_spec device-tree node.
Definition GPIO_Zephyr.h:88
void pinMode(GpioPin pin, int mode)
Definition GPIO_Zephyr.h:28
void end()
Definition GPIO_Zephyr.h:26
bool digitalRead(GpioPin pin)
Definition GPIO_Zephyr.h:73
Definition IDriverDeviceInfo.h:171
Namespace for audio driver components.
Definition AudioBoard.h:5
int16_t GpioPin
Definition DriverCommon.h:153
int16_t ADCPin
Definition DriverCommon.h:154