arduino-audio-driver
Loading...
Searching...
No Matches
DriverCommon.h File Reference
#include <stdint.h>
#include "ConfigAudioDriver.h"
#include "Platforms/AudioDriverLogger.h"
#include "Platforms/Logger.h"

Go to the source code of this file.

Classes

struct  codec_config_t
 Top-level codec configuration passed to the audio driver at init. More...
struct  I2SDefinition
 I2S interface parameters for the audio codec. More...

Namespaces

namespace  audio_driver
 Namespace for audio driver components.

Macros

#define DEFAULT_WIRE   nullptr
#define ERROR_INVALID_ARG   1
#define GPIO_TO_INT(pin)
#define GPIO_UNDEFINED   -1
#define HIGH   0x1
#define I2C_END   true
#define INPUT   0x0
#define INPUT_PULLDOWN   0x3
#define INPUT_PULLUP   0x2
#define IS_GPIO(pin)
#define LOW   0x0
#define LYRAT_MINI_DELAY_MS   5
#define LYRAT_MINI_RANGE   5
#define OUTPUT   0x1
#define RESULT_FAIL   -1
#define RESULT_OK   0
#define TOUCH_LIMIT   20

Typedefs

using ADCPin = int16_t
using error_t = int
using GpioPin = int16_t
using i2c_bus_handle_t = void*
using spi_bus_handle_t = void*

Enumerations

enum class  AudioDriverKey {
  KEY_REC = 0 , KEY_MODE , KEY_PLAY , KEY_SET ,
  KEY_VOLUME_DOWN , KEY_VOLUME_UP
}
 Logical key identifiers for hardware buttons. More...
enum  channels_t { CHANNELS2 = 2 , CHANNELS4 = 4 , CHANNELS8 = 8 , CHANNELS16 = 16 }
 Number of audio channels. More...
enum  codec_mode_t {
  CODEC_MODE_MIN = -1 , CODEC_MODE_NONE = 0x00 , CODEC_MODE_ENCODE = 0x01 , CODEC_MODE_DECODE = 0x02 ,
  CODEC_MODE_BOTH = 0x03 , CODEC_MODE_LINE_IN = 0x04 , CODEC_MODE_MAX
}
 Selects which codec path(s) are active. More...
enum  es_mic_gain_t {
  MIC_GAIN_MIN = -1 , MIC_GAIN_0DB = 0 , MIC_GAIN_3DB = 3 , MIC_GAIN_6DB = 6 ,
  MIC_GAIN_9DB = 9 , MIC_GAIN_12DB = 12 , MIC_GAIN_15DB = 15 , MIC_GAIN_18DB = 18 ,
  MIC_GAIN_21DB = 21 , MIC_GAIN_24DB = 24 , MIC_GAIN_MAX
}
 Microphone pre-amplifier gain. More...
enum  i2s_format_t { I2S_NORMAL = 0 , I2S_LEFT = 1 , I2S_RIGHT = 2 , I2S_DSP = 3 }
 I2S data format for the audio codec. More...
enum  i2s_master_slave_t { MODE_SLAVE = 0x00 , MODE_MASTER = 0x01 }
 I2S operating mode for the audio codec. Note: if the microcontroller is master, the codec must be slave. More...
enum  input_device_t {
  ADC_INPUT_NONE = 0x00 , ADC_INPUT_LINE1 , ADC_INPUT_LINE2 , ADC_INPUT_LINE3 ,
  ADC_INPUT_ALL , ADC_INPUT_DIFFERENCE
}
 Selects the ADC input source for the microphone signal. On single-ADC chips, this may select at the channel level. More...
enum  output_device_t { DAC_OUTPUT_NONE = 0x00 , DAC_OUTPUT_LINE1 , DAC_OUTPUT_LINE2 , DAC_OUTPUT_ALL }
 Selects the DAC output destination. On single-DAC devices, this may select at the channel level. More...
enum class  PinFunction {
  UNDEFINED = 0 , HEADPHONE_DETECT , AUXIN_DETECT , PA ,
  POWER , LED , KEY , SD ,
  CODEC , CODEC_ADC , LATCH , RESET ,
  MCLK_SOURCE , EXPANDER
}
 Logical function assigned to a GPIO pin. More...
enum class  PinLogic {
  InputActiveHigh , InputActiveLow , InputActiveTouch , Input ,
  Output , Inactive , OutputActiveLow
}
 Describes the electrical role and active level of a GPIO pin. More...
enum  sample_bits_t {
  BIT_LENGTH_MIN = -1 , BIT_LENGTH_16BITS = 0x03 , BIT_LENGTH_18BITS = 0x02 , BIT_LENGTH_20BITS = 0x01 ,
  BIT_LENGTH_24BITS = 0x00 , BIT_LENGTH_32BITS = 0x04 , BIT_LENGTH_MAX
}
 Number of bits per I2S sample. More...
enum  samplerate_t {
  RATE_8K = 0 , RATE_11K , RATE_16K , RATE_22K ,
  RATE_24K , RATE_32K , RATE_44K , RATE_48K ,
  RATE_64K , RATE_88K , RATE_96K , RATE_128K ,
  RATE_176K , RATE_192K
}
 I2S sample rate in samples per second. More...
enum  signal_t { SIGNAL_DIGITAL , SIGNAL_AMALOG , SIGNAL_PDM , SIGNAL_TDM }
 Signal type carried over the audio interface. More...

Macro Definition Documentation

◆ DEFAULT_WIRE

#define DEFAULT_WIRE   nullptr

◆ ERROR_INVALID_ARG

#define ERROR_INVALID_ARG   1

Invalid argument supplied

◆ GPIO_TO_INT

#define GPIO_TO_INT ( pin)
Value:
(pin)

◆ GPIO_UNDEFINED

#define GPIO_UNDEFINED   -1

◆ HIGH

#define HIGH   0x1

◆ I2C_END

#define I2C_END   true

Whether to send a stop bit at the end of an I2C transmission.

◆ INPUT

#define INPUT   0x0

◆ INPUT_PULLDOWN

#define INPUT_PULLDOWN   0x3

◆ INPUT_PULLUP

#define INPUT_PULLUP   0x2

◆ IS_GPIO

#define IS_GPIO ( pin)
Value:
((pin) != GPIO_UNDEFINED)
#define GPIO_UNDEFINED
Definition DriverCommon.h:131

◆ LOW

#define LOW   0x0

◆ LYRAT_MINI_DELAY_MS

#define LYRAT_MINI_DELAY_MS   5

◆ LYRAT_MINI_RANGE

#define LYRAT_MINI_RANGE   5

◆ OUTPUT

#define OUTPUT   0x1

◆ RESULT_FAIL

#define RESULT_FAIL   -1

Generic failure code

◆ RESULT_OK

#define RESULT_OK   0

Indicates success (no error)

◆ TOUCH_LIMIT

#define TOUCH_LIMIT   20