30#define DEFAULT_WIRE &Wire
32#define DEFAULT_WIRE nullptr
47#define INPUT_PULLUP 0x2
50#define INPUT_PULLDOWN 0x3
62#ifndef LYRAT_MINI_RANGE
63#define LYRAT_MINI_RANGE 5
66#ifndef LYRAT_MINI_DELAY_MS
67#define LYRAT_MINI_DELAY_MS 5
76#define ERROR_INVALID_ARG 1
91#include <zephyr/device.h>
92#include <zephyr/drivers/adc.h>
93#include <zephyr/drivers/gpio.h>
94#include <zephyr/kernel.h>
98#define IS_GPIO(pin) (pin.port != nullptr)
102#define GPIO_TO_INT(pin) pin.pin
109using ADCPin = ::adc_dt_spec;
115 return (a.port == b.port) && (a.pin == b.pin);
130#ifndef GPIO_UNDEFINED
131#define GPIO_UNDEFINED -1
135#define IS_GPIO(pin) ((pin) != GPIO_UNDEFINED)
139#define GPIO_TO_INT(pin) (pin)
409#if (defined(ARDUINO) && !defined(NO_USING_NAMESPACE_AUDIO_DRIVER)) || \
410 defined(USING_NAMESPACE_AUDIO_DRIVER)
#define KEY(key)
Definition AudioKitEs8388v1.h:5
#define GPIO_UNDEFINED
Definition DriverCommon.h:131
AudioDriverKey
Logical key identifiers for hardware buttons.
Definition DriverCommon.h:367
input_device_t
Selects the ADC input source for the microphone signal. On single-ADC chips, this may select at the c...
Definition DriverCommon.h:170
PinFunction
Logical function assigned to a GPIO pin.
Definition DriverCommon.h:344
output_device_t
Selects the DAC output destination. On single-DAC devices, this may select at the channel level.
Definition DriverCommon.h:186
@ KEY_MODE
Definition DriverCommon.h:369
@ KEY_PLAY
Definition DriverCommon.h:370
@ KEY_SET
Definition DriverCommon.h:371
@ KEY_REC
Definition DriverCommon.h:368
@ KEY_VOLUME_DOWN
Definition DriverCommon.h:372
@ KEY_VOLUME_UP
Definition DriverCommon.h:373
@ MCLK_SOURCE
Definition DriverCommon.h:357
@ PA
Definition DriverCommon.h:348
@ UNDEFINED
Definition DriverCommon.h:345
@ SD
Definition DriverCommon.h:352
@ CODEC
Definition DriverCommon.h:353
@ LED
Definition DriverCommon.h:350
@ HEADPHONE_DETECT
Definition DriverCommon.h:346
@ EXPANDER
Definition DriverCommon.h:358
@ RESET
Definition DriverCommon.h:356
@ LATCH
Definition DriverCommon.h:355
@ POWER
Definition DriverCommon.h:349
@ CODEC_ADC
Definition DriverCommon.h:354
@ AUXIN_DETECT
Definition DriverCommon.h:347
PinLogic
Describes the electrical role and active level of a GPIO pin.
Definition DriverCommon.h:328
sample_bits_t
Number of bits per I2S sample.
Definition DriverCommon.h:235
codec_mode_t
Selects which codec path(s) are active.
Definition DriverCommon.h:290
samplerate_t
I2S sample rate in samples per second.
Definition DriverCommon.h:213
channels_t
Number of audio channels.
Definition DriverCommon.h:274
es_mic_gain_t
Microphone pre-amplifier gain.
Definition DriverCommon.h:305
i2s_format_t
I2S data format for the audio codec.
Definition DriverCommon.h:250
i2s_master_slave_t
I2S operating mode for the audio codec. Note: if the microcontroller is master, the codec must be sla...
Definition DriverCommon.h:203
signal_t
Signal type carried over the audio interface.
Definition DriverCommon.h:262
@ Output
Definition DriverCommon.h:333
@ Input
Definition DriverCommon.h:332
@ OutputActiveLow
Definition DriverCommon.h:335
@ Inactive
Definition DriverCommon.h:334
@ InputActiveTouch
Definition DriverCommon.h:331
@ InputActiveHigh
Definition DriverCommon.h:329
@ InputActiveLow
Definition DriverCommon.h:330
Namespace for audio driver components.
Definition AudioBoard.h:5
void * spi_bus_handle_t
Definition DriverCommon.h:156
int16_t GpioPin
Definition DriverCommon.h:153
int16_t ADCPin
Definition DriverCommon.h:154
int error_t
Definition DriverCommon.h:150
void * i2c_bus_handle_t
Definition DriverCommon.h:155
@ ADC_INPUT_ALL
Definition DriverCommon.h:175
@ ADC_INPUT_NONE
Definition DriverCommon.h:171
@ ADC_INPUT_LINE1
Definition DriverCommon.h:172
@ ADC_INPUT_LINE3
Definition DriverCommon.h:174
@ ADC_INPUT_LINE2
Definition DriverCommon.h:173
@ ADC_INPUT_DIFFERENCE
Definition DriverCommon.h:176
@ BIT_LENGTH_24BITS
Definition DriverCommon.h:240
@ BIT_LENGTH_18BITS
Definition DriverCommon.h:238
@ BIT_LENGTH_20BITS
Definition DriverCommon.h:239
@ BIT_LENGTH_32BITS
Definition DriverCommon.h:241
@ BIT_LENGTH_MAX
Definition DriverCommon.h:242
@ BIT_LENGTH_MIN
Definition DriverCommon.h:236
@ BIT_LENGTH_16BITS
Definition DriverCommon.h:237
@ CODEC_MODE_MIN
Definition DriverCommon.h:291
@ CODEC_MODE_ENCODE
Definition DriverCommon.h:293
@ CODEC_MODE_NONE
Definition DriverCommon.h:292
@ CODEC_MODE_BOTH
Definition DriverCommon.h:295
@ CODEC_MODE_MAX
Definition DriverCommon.h:297
@ CODEC_MODE_DECODE
Definition DriverCommon.h:294
@ CODEC_MODE_LINE_IN
Definition DriverCommon.h:296
@ DAC_OUTPUT_LINE1
Definition DriverCommon.h:188
@ DAC_OUTPUT_ALL
Definition DriverCommon.h:190
@ DAC_OUTPUT_NONE
Definition DriverCommon.h:187
@ DAC_OUTPUT_LINE2
Definition DriverCommon.h:189
@ RATE_44K
Definition DriverCommon.h:220
@ RATE_24K
Definition DriverCommon.h:218
@ RATE_22K
Definition DriverCommon.h:217
@ RATE_128K
Definition DriverCommon.h:225
@ RATE_8K
Definition DriverCommon.h:214
@ RATE_88K
Definition DriverCommon.h:223
@ RATE_176K
Definition DriverCommon.h:226
@ RATE_32K
Definition DriverCommon.h:219
@ RATE_96K
Definition DriverCommon.h:224
@ RATE_11K
Definition DriverCommon.h:215
@ RATE_64K
Definition DriverCommon.h:222
@ RATE_16K
Definition DriverCommon.h:216
@ RATE_48K
Definition DriverCommon.h:221
@ RATE_192K
Definition DriverCommon.h:227
@ CHANNELS2
Definition DriverCommon.h:275
@ CHANNELS16
Definition DriverCommon.h:278
@ CHANNELS8
Definition DriverCommon.h:277
@ CHANNELS4
Definition DriverCommon.h:276
@ MIC_GAIN_15DB
Definition DriverCommon.h:312
@ MIC_GAIN_MIN
Definition DriverCommon.h:306
@ MIC_GAIN_6DB
Definition DriverCommon.h:309
@ MIC_GAIN_9DB
Definition DriverCommon.h:310
@ MIC_GAIN_24DB
Definition DriverCommon.h:315
@ MIC_GAIN_MAX
Definition DriverCommon.h:316
@ MIC_GAIN_0DB
Definition DriverCommon.h:307
@ MIC_GAIN_12DB
Definition DriverCommon.h:311
@ MIC_GAIN_18DB
Definition DriverCommon.h:313
@ MIC_GAIN_21DB
Definition DriverCommon.h:314
@ MIC_GAIN_3DB
Definition DriverCommon.h:308
@ I2S_RIGHT
Definition DriverCommon.h:253
@ I2S_DSP
Definition DriverCommon.h:254
@ I2S_LEFT
Definition DriverCommon.h:252
@ I2S_NORMAL
Definition DriverCommon.h:251
@ MODE_MASTER
Definition DriverCommon.h:205
@ MODE_SLAVE
Definition DriverCommon.h:204
@ SIGNAL_DIGITAL
Definition DriverCommon.h:263
@ SIGNAL_TDM
Definition DriverCommon.h:266
@ SIGNAL_PDM
Definition DriverCommon.h:265
@ SIGNAL_AMALOG
Definition DriverCommon.h:264
I2S interface parameters for the audio codec.
Definition DriverCommon.h:384
i2s_format_t fmt
Definition DriverCommon.h:386
samplerate_t rate
Definition DriverCommon.h:387
i2s_master_slave_t mode
Definition DriverCommon.h:385
channels_t channels
Definition DriverCommon.h:389
signal_t signal_type
Definition DriverCommon.h:390
sample_bits_t bits
Definition DriverCommon.h:388
Top-level codec configuration passed to the audio driver at init.
Definition DriverCommon.h:397
output_device_t output_device
Definition DriverCommon.h:399
I2SDefinition i2s
Definition DriverCommon.h:400
input_device_t input_device
Definition DriverCommon.h:398