doxy & clang
This commit is contained in:
parent
c000322716
commit
d433ad5dac
5 changed files with 934 additions and 833 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -2,7 +2,7 @@
|
||||||
* @file Adafruit_TLV320DAC3100.h
|
* @file Adafruit_TLV320DAC3100.h
|
||||||
*
|
*
|
||||||
* Arduino library for the TI TLV320DAC3100 stereo DAC with headphone amplifier
|
* Arduino library for the TI TLV320DAC3100 stereo DAC with headphone amplifier
|
||||||
*
|
*
|
||||||
* Adafruit invests time and resources providing this open source code,
|
* Adafruit invests time and resources providing this open source code,
|
||||||
* please support Adafruit and open-source hardware by purchasing
|
* please support Adafruit and open-source hardware by purchasing
|
||||||
* products from Adafruit!
|
* products from Adafruit!
|
||||||
|
|
@ -15,84 +15,98 @@
|
||||||
#ifndef _ADAFRUIT_TLV320DAC3100_H
|
#ifndef _ADAFRUIT_TLV320DAC3100_H
|
||||||
#define _ADAFRUIT_TLV320DAC3100_H
|
#define _ADAFRUIT_TLV320DAC3100_H
|
||||||
|
|
||||||
|
#include "Adafruit_TLV320DAC3100_typedefs.h"
|
||||||
#include <Adafruit_BusIO_Register.h>
|
#include <Adafruit_BusIO_Register.h>
|
||||||
#include <Adafruit_I2CDevice.h>
|
#include <Adafruit_I2CDevice.h>
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
#include "Adafruit_TLV320DAC3100_typedefs.h"
|
|
||||||
|
|
||||||
#define TLV320DAC3100_I2CADDR_DEFAULT 0x18 ///< Default I2C address
|
#define TLV320DAC3100_I2CADDR_DEFAULT 0x18 ///< Default I2C address
|
||||||
|
|
||||||
#define TLV320DAC3100_REG_PAGE_SELECT 0x00 ///< Page select register
|
#define TLV320DAC3100_REG_PAGE_SELECT 0x00 ///< Page select register
|
||||||
#define TLV320DAC3100_REG_RESET 0x01 ///< Reset register
|
#define TLV320DAC3100_REG_RESET 0x01 ///< Reset register
|
||||||
#define TLV320DAC3100_REG_OT_FLAG 0x03 ///< Over-temperature flag register
|
#define TLV320DAC3100_REG_OT_FLAG 0x03 ///< Over-temperature flag register
|
||||||
#define TLV320DAC3100_REG_CLOCK_MUX1 0x04 ///< Clock muxing control register 1
|
#define TLV320DAC3100_REG_CLOCK_MUX1 0x04 ///< Clock muxing control register 1
|
||||||
#define TLV320DAC3100_REG_PLL_PROG_PR 0x05 ///< PLL P and R values
|
#define TLV320DAC3100_REG_PLL_PROG_PR 0x05 ///< PLL P and R values
|
||||||
#define TLV320DAC3100_REG_PLL_PROG_J 0x06 ///< PLL J value
|
#define TLV320DAC3100_REG_PLL_PROG_J 0x06 ///< PLL J value
|
||||||
#define TLV320DAC3100_REG_PLL_PROG_D_MSB 0x07 ///< PLL D value MSB
|
#define TLV320DAC3100_REG_PLL_PROG_D_MSB 0x07 ///< PLL D value MSB
|
||||||
#define TLV320DAC3100_REG_PLL_PROG_D_LSB 0x08 ///< PLL D value LSB
|
#define TLV320DAC3100_REG_PLL_PROG_D_LSB 0x08 ///< PLL D value LSB
|
||||||
#define TLV320DAC3100_REG_NDAC 0x0B ///< NDAC divider value
|
#define TLV320DAC3100_REG_NDAC 0x0B ///< NDAC divider value
|
||||||
#define TLV320DAC3100_REG_MDAC 0x0C ///< MDAC divider value
|
#define TLV320DAC3100_REG_MDAC 0x0C ///< MDAC divider value
|
||||||
#define TLV320DAC3100_REG_DOSR 0x0D ///< DOSR divider value MSB/LSB
|
#define TLV320DAC3100_REG_DOSR 0x0D ///< DOSR divider value MSB/LSB
|
||||||
#define TLV320DAC3100_REG_DOSR_MSB 0x0D ///< DOSR divider value MSB
|
#define TLV320DAC3100_REG_DOSR_MSB 0x0D ///< DOSR divider value MSB
|
||||||
#define TLV320DAC3100_REG_DOSR_LSB 0x0E ///< DOSR divider value LSB
|
#define TLV320DAC3100_REG_DOSR_LSB 0x0E ///< DOSR divider value LSB
|
||||||
#define TLV320DAC3100_REG_CLKOUT_MUX 0x19 ///< CLKOUT MUX register
|
#define TLV320DAC3100_REG_CLKOUT_MUX 0x19 ///< CLKOUT MUX register
|
||||||
#define TLV320DAC3100_REG_CLKOUT_M 0x1A ///< CLKOUT M divider value
|
#define TLV320DAC3100_REG_CLKOUT_M 0x1A ///< CLKOUT M divider value
|
||||||
#define TLV320DAC3100_REG_CODEC_IF_CTRL1 0x1B ///< Codec Interface Control 1
|
#define TLV320DAC3100_REG_CODEC_IF_CTRL1 0x1B ///< Codec Interface Control 1
|
||||||
#define TLV320DAC3100_REG_DATA_SLOT_OFFSET 0x1C ///< Data-slot offset register
|
#define TLV320DAC3100_REG_DATA_SLOT_OFFSET 0x1C ///< Data-slot offset register
|
||||||
#define TLV320DAC3100_REG_BCLK_N 0x1E ///< BCLK N divider value
|
#define TLV320DAC3100_REG_BCLK_N 0x1E ///< BCLK N divider value
|
||||||
#define TLV320DAC3100_REG_DAC_FLAG 0x25 ///< DAC Flag register
|
#define TLV320DAC3100_REG_DAC_FLAG 0x25 ///< DAC Flag register
|
||||||
#define TLV320DAC3100_REG_DAC_FLAG2 0x26 ///< DAC Flag register 2
|
#define TLV320DAC3100_REG_DAC_FLAG2 0x26 ///< DAC Flag register 2
|
||||||
#define TLV320DAC3100_REG_INT1_CTRL 0x30 ///< INT1 Control Register
|
#define TLV320DAC3100_REG_INT1_CTRL 0x30 ///< INT1 Control Register
|
||||||
#define TLV320DAC3100_REG_INT2_CTRL 0x31 ///< INT2 Control Register
|
#define TLV320DAC3100_REG_INT2_CTRL 0x31 ///< INT2 Control Register
|
||||||
#define TLV320DAC3100_REG_GPIO1_CTRL 0x33 ///< GPIO1 In/Out Pin Control Register
|
#define TLV320DAC3100_REG_GPIO1_CTRL 0x33 ///< GPIO1 In/Out Pin Control Register
|
||||||
#define TLV320DAC3100_REG_DIN_CTRL 0x36 ///< DIN Pin Control Register
|
#define TLV320DAC3100_REG_DIN_CTRL 0x36 ///< DIN Pin Control Register
|
||||||
#define TLV320DAC3100_REG_DAC_PRB 0x3C ///< DAC Processing Block Selection Register
|
#define TLV320DAC3100_REG_DAC_PRB \
|
||||||
#define TLV320DAC3100_REG_DAC_DATAPATH 0x3F ///< DAC Data-Path Setup Register
|
0x3C ///< DAC Processing Block Selection Register
|
||||||
#define TLV320DAC3100_REG_DAC_VOL_CTRL 0x40 ///< DAC Volume Control Register
|
#define TLV320DAC3100_REG_DAC_DATAPATH 0x3F ///< DAC Data-Path Setup Register
|
||||||
#define TLV320DAC3100_REG_DAC_LVOL 0x41 ///< DAC Left Volume Control Register
|
#define TLV320DAC3100_REG_DAC_VOL_CTRL 0x40 ///< DAC Volume Control Register
|
||||||
#define TLV320DAC3100_REG_DAC_RVOL 0x42 ///< DAC Right Volume Control Register
|
#define TLV320DAC3100_REG_DAC_LVOL 0x41 ///< DAC Left Volume Control Register
|
||||||
#define TLV320DAC3100_REG_HEADSET_DETECT 0x43 ///< Headset Detection Register
|
#define TLV320DAC3100_REG_DAC_RVOL 0x42 ///< DAC Right Volume Control Register
|
||||||
#define TLV320DAC3100_REG_BEEP_L 0x47 ///< Left Beep Generator Register
|
#define TLV320DAC3100_REG_HEADSET_DETECT 0x43 ///< Headset Detection Register
|
||||||
#define TLV320DAC3100_REG_BEEP_R 0x48 ///< Right Beep Generator Register
|
#define TLV320DAC3100_REG_BEEP_L 0x47 ///< Left Beep Generator Register
|
||||||
#define TLV320DAC3100_REG_BEEP_LEN_MSB 0x49 ///< Beep Length MSB Register
|
#define TLV320DAC3100_REG_BEEP_R 0x48 ///< Right Beep Generator Register
|
||||||
#define TLV320DAC3100_REG_BEEP_LEN_MID 0x4A ///< Beep Length Middle Bits Register
|
#define TLV320DAC3100_REG_BEEP_LEN_MSB 0x49 ///< Beep Length MSB Register
|
||||||
#define TLV320DAC3100_REG_BEEP_LEN_LSB 0x4B ///< Beep Length LSB Register
|
#define TLV320DAC3100_REG_BEEP_LEN_MID \
|
||||||
#define TLV320DAC3100_REG_BEEP_SIN_MSB 0x4C ///< Beep Sin(x) MSB Register
|
0x4A ///< Beep Length Middle Bits Register
|
||||||
#define TLV320DAC3100_REG_BEEP_SIN_LSB 0x4D ///< Beep Sin(x) LSB Register
|
#define TLV320DAC3100_REG_BEEP_LEN_LSB 0x4B ///< Beep Length LSB Register
|
||||||
#define TLV320DAC3100_REG_BEEP_COS_MSB 0x4E ///< Beep Cos(x) MSB Register
|
#define TLV320DAC3100_REG_BEEP_SIN_MSB 0x4C ///< Beep Sin(x) MSB Register
|
||||||
#define TLV320DAC3100_REG_BEEP_COS_LSB 0x4F ///< Beep Cos(x) LSB Register
|
#define TLV320DAC3100_REG_BEEP_SIN_LSB 0x4D ///< Beep Sin(x) LSB Register
|
||||||
#define TLV320DAC3100_REG_VOL_ADC_CTRL 0x74 ///< VOL/MICDET-Pin SAR ADC Control Register
|
#define TLV320DAC3100_REG_BEEP_COS_MSB 0x4E ///< Beep Cos(x) MSB Register
|
||||||
#define TLV320DAC3100_REG_VOL_ADC_READ 0x75 ///< VOL/MICDET-Pin Gain Register
|
#define TLV320DAC3100_REG_BEEP_COS_LSB 0x4F ///< Beep Cos(x) LSB Register
|
||||||
|
#define TLV320DAC3100_REG_VOL_ADC_CTRL \
|
||||||
|
0x74 ///< VOL/MICDET-Pin SAR ADC Control Register
|
||||||
|
#define TLV320DAC3100_REG_VOL_ADC_READ 0x75 ///< VOL/MICDET-Pin Gain Register
|
||||||
|
|
||||||
// Page 1
|
// Page 1
|
||||||
#define TLV320DAC3100_REG_BCLK_CTRL2 0x1D
|
#define TLV320DAC3100_REG_BCLK_CTRL2 0x1D
|
||||||
#define TLV320DAC3100_REG_HP_SPK_ERR_CTL 0x1E ///< Headphone and Speaker Error Control Register
|
#define TLV320DAC3100_REG_HP_SPK_ERR_CTL \
|
||||||
#define TLV320DAC3100_REG_HP_DRIVERS 0x1F ///< Headphone Drivers Register
|
0x1E ///< Headphone and Speaker Error Control Register
|
||||||
#define TLV320DAC3100_REG_SPK_AMP 0x20 ///< Class-D Speaker Amplifier Register
|
#define TLV320DAC3100_REG_HP_DRIVERS 0x1F ///< Headphone Drivers Register
|
||||||
#define TLV320DAC3100_REG_HP_POP 0x21 ///< HP Output Drivers POP Removal Settings Register
|
#define TLV320DAC3100_REG_SPK_AMP 0x20 ///< Class-D Speaker Amplifier Register
|
||||||
#define TLV320DAC3100_REG_PGA_RAMP 0x22 ///< Output Driver PGA Ramp-Down Period Control Register
|
#define TLV320DAC3100_REG_HP_POP \
|
||||||
#define TLV320DAC3100_REG_OUT_ROUTING 0x23 ///< DAC Output Mixer Routing Register
|
0x21 ///< HP Output Drivers POP Removal Settings Register
|
||||||
#define TLV320DAC3100_REG_HPL_VOL 0x24 ///< Left Analog Volume to HPL Register
|
#define TLV320DAC3100_REG_PGA_RAMP \
|
||||||
#define TLV320DAC3100_REG_HPR_VOL 0x25 ///< Right Analog Volume to HPR Register
|
0x22 ///< Output Driver PGA Ramp-Down Period Control Register
|
||||||
#define TLV320DAC3100_REG_SPK_VOL 0x26 ///< Left Analog Volume to SPK Register
|
#define TLV320DAC3100_REG_OUT_ROUTING \
|
||||||
#define TLV320DAC3100_REG_HPL_DRIVER 0x28 ///< HPL Driver Register
|
0x23 ///< DAC Output Mixer Routing Register
|
||||||
#define TLV320DAC3100_REG_HPR_DRIVER 0x29 ///< HPR Driver Register
|
#define TLV320DAC3100_REG_HPL_VOL 0x24 ///< Left Analog Volume to HPL Register
|
||||||
#define TLV320DAC3100_REG_SPK_DRIVER 0x2A ///< Class-D Speaker Driver Register
|
#define TLV320DAC3100_REG_HPR_VOL 0x25 ///< Right Analog Volume to HPR Register
|
||||||
#define TLV320DAC3100_REG_HP_DRIVER_CTRL 0x2C ///< HP Driver Control Register
|
#define TLV320DAC3100_REG_SPK_VOL 0x26 ///< Left Analog Volume to SPK Register
|
||||||
#define TLV320DAC3100_REG_MICBIAS 0x2E ///< MICBIAS Configuration Register
|
#define TLV320DAC3100_REG_HPL_DRIVER 0x28 ///< HPL Driver Register
|
||||||
#define TLV320DAC3100_REG_INPUT_CM 0x32 ///< Input Common Mode Settings Register
|
#define TLV320DAC3100_REG_HPR_DRIVER 0x29 ///< HPR Driver Register
|
||||||
#define TLV320DAC3100_REG_TIMER_MCLK_DIV 0x10 ///< Timer Clock MCLK Divider Register
|
#define TLV320DAC3100_REG_SPK_DRIVER 0x2A ///< Class-D Speaker Driver Register
|
||||||
#define TLV320DAC3100_REG_IRQ_FLAGS_STICKY 0x2C ///< Interrupt Flags - Sticky Register
|
#define TLV320DAC3100_REG_HP_DRIVER_CTRL 0x2C ///< HP Driver Control Register
|
||||||
#define TLV320DAC3100_REG_IRQ_FLAGS 0x2E ///< Interrupt Flags - DAC Register
|
#define TLV320DAC3100_REG_MICBIAS 0x2E ///< MICBIAS Configuration Register
|
||||||
|
#define TLV320DAC3100_REG_INPUT_CM 0x32 ///< Input Common Mode Settings Register
|
||||||
|
#define TLV320DAC3100_REG_TIMER_MCLK_DIV \
|
||||||
|
0x10 ///< Timer Clock MCLK Divider Register
|
||||||
|
#define TLV320DAC3100_REG_IRQ_FLAGS_STICKY \
|
||||||
|
0x2C ///< Interrupt Flags - Sticky Register
|
||||||
|
#define TLV320DAC3100_REG_IRQ_FLAGS 0x2E ///< Interrupt Flags - DAC Register
|
||||||
|
|
||||||
// IRQ Flag bits
|
// IRQ Flag bits
|
||||||
#define TLV320DAC3100_IRQ_HPL_SHORT 0x80 ///< Short circuit detected at HPL / left class-D driver
|
#define TLV320DAC3100_IRQ_HPL_SHORT \
|
||||||
#define TLV320DAC3100_IRQ_HPR_SHORT 0x40 ///< Short circuit detected at HPR / right class-D driver
|
0x80 ///< Short circuit detected at HPL / left class-D driver
|
||||||
#define TLV320DAC3100_IRQ_BUTTON_PRESS 0x20 ///< Headset button pressed
|
#define TLV320DAC3100_IRQ_HPR_SHORT \
|
||||||
#define TLV320DAC3100_IRQ_HEADSET_DETECT 0x10 ///< Headset insertion detected (1) or removal detected (0)
|
0x40 ///< Short circuit detected at HPR / right class-D driver
|
||||||
#define TLV320DAC3100_IRQ_LEFT_DRC 0x08 ///< Left DAC signal power greater than DRC threshold
|
#define TLV320DAC3100_IRQ_BUTTON_PRESS 0x20 ///< Headset button pressed
|
||||||
#define TLV320DAC3100_IRQ_RIGHT_DRC 0x04 ///< Right DAC signal power greater than DRC threshold
|
#define TLV320DAC3100_IRQ_HEADSET_DETECT \
|
||||||
|
0x10 ///< Headset insertion detected (1) or removal detected (0)
|
||||||
|
#define TLV320DAC3100_IRQ_LEFT_DRC \
|
||||||
|
0x08 ///< Left DAC signal power greater than DRC threshold
|
||||||
|
#define TLV320DAC3100_IRQ_RIGHT_DRC \
|
||||||
|
0x04 ///< Right DAC signal power greater than DRC threshold
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Class to interact with TLV320DAC3100 DAC
|
* @brief Class to interact with TLV320DAC3100 DAC
|
||||||
|
|
@ -101,12 +115,11 @@ class Adafruit_TLV320DAC3100 {
|
||||||
public:
|
public:
|
||||||
Adafruit_TLV320DAC3100();
|
Adafruit_TLV320DAC3100();
|
||||||
bool begin(uint8_t i2c_addr = TLV320DAC3100_I2CADDR_DEFAULT,
|
bool begin(uint8_t i2c_addr = TLV320DAC3100_I2CADDR_DEFAULT,
|
||||||
TwoWire *wire = &Wire);
|
TwoWire *wire = &Wire);
|
||||||
|
|
||||||
bool reset(void);
|
bool reset(void);
|
||||||
bool isOvertemperature(void);
|
bool isOvertemperature(void);
|
||||||
|
|
||||||
|
|
||||||
bool setPLLClockInput(tlv320dac3100_pll_clkin_t clkin);
|
bool setPLLClockInput(tlv320dac3100_pll_clkin_t clkin);
|
||||||
tlv320dac3100_pll_clkin_t getPLLClockInput(void);
|
tlv320dac3100_pll_clkin_t getPLLClockInput(void);
|
||||||
bool setCodecClockInput(tlv320dac3100_codec_clkin_t clkin);
|
bool setCodecClockInput(tlv320dac3100_codec_clkin_t clkin);
|
||||||
|
|
@ -114,14 +127,14 @@ public:
|
||||||
bool setClockDividerInput(tlv320dac3100_cdiv_clkin_t clkin);
|
bool setClockDividerInput(tlv320dac3100_cdiv_clkin_t clkin);
|
||||||
tlv320dac3100_cdiv_clkin_t getClockDividerInput(void);
|
tlv320dac3100_cdiv_clkin_t getClockDividerInput(void);
|
||||||
|
|
||||||
|
|
||||||
bool powerPLL(bool on);
|
bool powerPLL(bool on);
|
||||||
bool isPLLpowered(void);
|
bool isPLLpowered(void);
|
||||||
bool setPLLValues(uint8_t P, uint8_t R, uint8_t J, uint16_t D);
|
bool setPLLValues(uint8_t P, uint8_t R, uint8_t J, uint16_t D);
|
||||||
bool getPLLValues(uint8_t *P, uint8_t *R, uint8_t *J, uint16_t *D);
|
bool getPLLValues(uint8_t *P, uint8_t *R, uint8_t *J, uint16_t *D);
|
||||||
bool getDACFlags(bool *left_dac_powered, bool *hpl_powered, bool *left_classd_powered,
|
bool getDACFlags(bool *left_dac_powered, bool *hpl_powered,
|
||||||
bool *right_dac_powered, bool *hpr_powered, bool *right_classd_powered,
|
bool *left_classd_powered, bool *right_dac_powered,
|
||||||
bool *left_pga_gain_ok, bool *right_pga_gain_ok);
|
bool *hpr_powered, bool *right_classd_powered,
|
||||||
|
bool *left_pga_gain_ok, bool *right_pga_gain_ok);
|
||||||
|
|
||||||
bool setNDAC(bool enable, uint8_t val);
|
bool setNDAC(bool enable, uint8_t val);
|
||||||
bool getNDAC(bool *enabled, uint8_t *val);
|
bool getNDAC(bool *enabled, uint8_t *val);
|
||||||
|
|
@ -135,24 +148,25 @@ public:
|
||||||
bool getBCLKoffset(uint8_t *offset);
|
bool getBCLKoffset(uint8_t *offset);
|
||||||
bool setBCLK_N(bool enable, uint8_t val);
|
bool setBCLK_N(bool enable, uint8_t val);
|
||||||
bool getBCLK_N(bool *enabled, uint8_t *val);
|
bool getBCLK_N(bool *enabled, uint8_t *val);
|
||||||
bool setBCLKConfig(bool invert_bclk, bool active_when_powered_down, tlv320dac3100_bclk_src_t source);
|
bool setBCLKConfig(bool invert_bclk, bool active_when_powered_down,
|
||||||
bool getBCLKConfig(bool *invert_bclk, bool *active_when_powered_down, tlv320dac3100_bclk_src_t *source);
|
tlv320dac3100_bclk_src_t source);
|
||||||
|
bool getBCLKConfig(bool *invert_bclk, bool *active_when_powered_down,
|
||||||
|
tlv320dac3100_bclk_src_t *source);
|
||||||
|
|
||||||
bool validatePLLConfig(uint8_t P, uint8_t R, uint8_t J, uint16_t D, float pll_clkin);
|
bool validatePLLConfig(uint8_t P, uint8_t R, uint8_t J, uint16_t D,
|
||||||
|
float pll_clkin);
|
||||||
|
|
||||||
bool setCodecInterface(tlv320dac3100_format_t format,
|
bool setCodecInterface(tlv320dac3100_format_t format,
|
||||||
tlv320dac3100_data_len_t len,
|
tlv320dac3100_data_len_t len, bool bclk_out = false,
|
||||||
bool bclk_out = false,
|
bool wclk_out = false);
|
||||||
bool wclk_out = false);
|
|
||||||
bool getCodecInterface(tlv320dac3100_format_t *format,
|
bool getCodecInterface(tlv320dac3100_format_t *format,
|
||||||
tlv320dac3100_data_len_t *len,
|
tlv320dac3100_data_len_t *len, bool *bclk_out,
|
||||||
bool *bclk_out,
|
bool *wclk_out);
|
||||||
bool *wclk_out);
|
|
||||||
|
|
||||||
bool setInt1Source(bool headset_detect, bool button_press, bool dac_drc,
|
bool setInt1Source(bool headset_detect, bool button_press, bool dac_drc,
|
||||||
bool agc_noise, bool over_current, bool multiple_pulse);
|
bool agc_noise, bool over_current, bool multiple_pulse);
|
||||||
bool setInt2Source(bool headset_detect, bool button_press, bool dac_drc,
|
bool setInt2Source(bool headset_detect, bool button_press, bool dac_drc,
|
||||||
bool agc_noise, bool over_current, bool multiple_pulse);
|
bool agc_noise, bool over_current, bool multiple_pulse);
|
||||||
|
|
||||||
bool setGPIO1Mode(tlv320_gpio1_mode_t mode);
|
bool setGPIO1Mode(tlv320_gpio1_mode_t mode);
|
||||||
tlv320_gpio1_mode_t getGPIO1Mode(void);
|
tlv320_gpio1_mode_t getGPIO1Mode(void);
|
||||||
|
|
@ -166,64 +180,73 @@ public:
|
||||||
bool setDACProcessingBlock(uint8_t block_number);
|
bool setDACProcessingBlock(uint8_t block_number);
|
||||||
uint8_t getDACProcessingBlock(void);
|
uint8_t getDACProcessingBlock(void);
|
||||||
|
|
||||||
bool setDACDataPath(bool left_dac_on, bool right_dac_on,
|
bool
|
||||||
tlv320_dac_path_t left_path = TLV320_DAC_PATH_NORMAL,
|
setDACDataPath(bool left_dac_on, bool right_dac_on,
|
||||||
tlv320_dac_path_t right_path = TLV320_DAC_PATH_NORMAL,
|
tlv320_dac_path_t left_path = TLV320_DAC_PATH_NORMAL,
|
||||||
tlv320_volume_step_t volume_step = TLV320_VOLUME_STEP_1SAMPLE);
|
tlv320_dac_path_t right_path = TLV320_DAC_PATH_NORMAL,
|
||||||
|
tlv320_volume_step_t volume_step = TLV320_VOLUME_STEP_1SAMPLE);
|
||||||
bool getDACDataPath(bool *left_dac_on, bool *right_dac_on,
|
bool getDACDataPath(bool *left_dac_on, bool *right_dac_on,
|
||||||
tlv320_dac_path_t *left_path, tlv320_dac_path_t *right_path,
|
tlv320_dac_path_t *left_path,
|
||||||
tlv320_volume_step_t *volume_step);
|
tlv320_dac_path_t *right_path,
|
||||||
|
tlv320_volume_step_t *volume_step);
|
||||||
|
|
||||||
bool setDACVolumeControl(bool left_mute, bool right_mute,
|
bool
|
||||||
tlv320_vol_control_t control = TLV320_VOL_INDEPENDENT);
|
setDACVolumeControl(bool left_mute, bool right_mute,
|
||||||
|
tlv320_vol_control_t control = TLV320_VOL_INDEPENDENT);
|
||||||
bool getDACVolumeControl(bool *left_mute, bool *right_mute,
|
bool getDACVolumeControl(bool *left_mute, bool *right_mute,
|
||||||
tlv320_vol_control_t *control);
|
tlv320_vol_control_t *control);
|
||||||
bool setChannelVolume(bool right_channel, float dB);
|
bool setChannelVolume(bool right_channel, float dB);
|
||||||
float getChannelVolume(bool right_channel);
|
float getChannelVolume(bool right_channel);
|
||||||
|
|
||||||
bool setHeadsetDetect(bool enable,
|
bool setHeadsetDetect(
|
||||||
tlv320_detect_debounce_t detect_debounce = TLV320_DEBOUNCE_16MS,
|
bool enable,
|
||||||
tlv320_button_debounce_t button_debounce = TLV320_BTN_DEBOUNCE_0MS);
|
tlv320_detect_debounce_t detect_debounce = TLV320_DEBOUNCE_16MS,
|
||||||
|
tlv320_button_debounce_t button_debounce = TLV320_BTN_DEBOUNCE_0MS);
|
||||||
tlv320_headset_status_t getHeadsetStatus(void);
|
tlv320_headset_status_t getHeadsetStatus(void);
|
||||||
|
|
||||||
bool isBeeping(void);
|
bool isBeeping(void);
|
||||||
bool enableBeep(bool enable);
|
bool enableBeep(bool enable);
|
||||||
bool setBeepVolume(int8_t left_dB, int8_t right_dB = -100); // -100 is sentinel value
|
bool setBeepVolume(int8_t left_dB,
|
||||||
|
int8_t right_dB = -100); // -100 is sentinel value
|
||||||
bool setBeepLength(uint32_t samples);
|
bool setBeepLength(uint32_t samples);
|
||||||
bool setBeepSinCos(uint16_t sin_val, uint16_t cos_val);
|
bool setBeepSinCos(uint16_t sin_val, uint16_t cos_val);
|
||||||
bool configureBeepTone(float frequency, uint32_t duration_ms, uint32_t sample_rate);
|
bool configureBeepTone(float frequency, uint32_t duration_ms,
|
||||||
|
uint32_t sample_rate);
|
||||||
|
|
||||||
bool configVolADC(bool pin_control, bool use_mclk,
|
bool configVolADC(bool pin_control, bool use_mclk,
|
||||||
tlv320_vol_hyst_t hysteresis,
|
tlv320_vol_hyst_t hysteresis, tlv320_vol_rate_t rate);
|
||||||
tlv320_vol_rate_t rate);
|
|
||||||
float readVolADCdB(void);
|
float readVolADCdB(void);
|
||||||
|
|
||||||
|
|
||||||
bool resetSpeakerOnSCD(bool reset);
|
bool resetSpeakerOnSCD(bool reset);
|
||||||
bool resetHeadphoneOnSCD(bool reset);
|
bool resetHeadphoneOnSCD(bool reset);
|
||||||
bool configureHeadphoneDriver(bool left_powered, bool right_powered,
|
bool
|
||||||
tlv320_hp_common_t common = TLV320_HP_COMMON_1_35V,
|
configureHeadphoneDriver(bool left_powered, bool right_powered,
|
||||||
bool powerDownOnSCD = false);
|
tlv320_hp_common_t common = TLV320_HP_COMMON_1_35V,
|
||||||
|
bool powerDownOnSCD = false);
|
||||||
bool isHeadphoneShorted(void);
|
bool isHeadphoneShorted(void);
|
||||||
bool enableSpeaker(bool en);
|
bool enableSpeaker(bool en);
|
||||||
bool speakerEnabled(void);
|
bool speakerEnabled(void);
|
||||||
bool isSpeakerShorted(void);
|
bool isSpeakerShorted(void);
|
||||||
|
|
||||||
bool configureHeadphonePop(bool wait_for_powerdown = true,
|
bool
|
||||||
tlv320_hp_time_t powerup_time = TLV320_HP_TIME_304MS,
|
configureHeadphonePop(bool wait_for_powerdown = true,
|
||||||
tlv320_ramp_time_t ramp_time = TLV320_RAMP_4MS);
|
tlv320_hp_time_t powerup_time = TLV320_HP_TIME_304MS,
|
||||||
|
tlv320_ramp_time_t ramp_time = TLV320_RAMP_4MS);
|
||||||
bool setSpeakerWaitTime(tlv320_spk_wait_t wait_time = TLV320_SPK_WAIT_0MS);
|
bool setSpeakerWaitTime(tlv320_spk_wait_t wait_time = TLV320_SPK_WAIT_0MS);
|
||||||
bool configureAnalogInputs(tlv320_dac_route_t left_dac = TLV320_DAC_ROUTE_NONE,
|
bool
|
||||||
tlv320_dac_route_t right_dac = TLV320_DAC_ROUTE_NONE,
|
configureAnalogInputs(tlv320_dac_route_t left_dac = TLV320_DAC_ROUTE_NONE,
|
||||||
bool left_ain1 = false, bool left_ain2 = false,
|
tlv320_dac_route_t right_dac = TLV320_DAC_ROUTE_NONE,
|
||||||
bool right_ain2 = false, bool hpl_routed_to_hpr = false);
|
bool left_ain1 = false, bool left_ain2 = false,
|
||||||
|
bool right_ain2 = false,
|
||||||
|
bool hpl_routed_to_hpr = false);
|
||||||
|
|
||||||
bool setHPLVolume(bool route_enabled, uint8_t gain = 0x7F);
|
bool setHPLVolume(bool route_enabled, uint8_t gain = 0x7F);
|
||||||
bool setHPRVolume(bool route_enabled, uint8_t gain = 0x7F);
|
bool setHPRVolume(bool route_enabled, uint8_t gain = 0x7F);
|
||||||
bool setSPKVolume(bool route_enabled, uint8_t gain = 0x7F);
|
bool setSPKVolume(bool route_enabled, uint8_t gain = 0x7F);
|
||||||
bool configureHPL_PGA(uint8_t gain_db = 0, bool unmute = true);
|
bool configureHPL_PGA(uint8_t gain_db = 0, bool unmute = true);
|
||||||
bool configureHPR_PGA(uint8_t gain_db = 0, bool unmute = true);
|
bool configureHPR_PGA(uint8_t gain_db = 0, bool unmute = true);
|
||||||
bool configureSPK_PGA(tlv320_spk_gain_t gain = TLV320_SPK_GAIN_6DB, bool unmute = true);
|
bool configureSPK_PGA(tlv320_spk_gain_t gain = TLV320_SPK_GAIN_6DB,
|
||||||
|
bool unmute = true);
|
||||||
bool isHPLGainApplied(void);
|
bool isHPLGainApplied(void);
|
||||||
bool isHPRGainApplied(void);
|
bool isHPRGainApplied(void);
|
||||||
bool isSPKGainApplied(void);
|
bool isSPKGainApplied(void);
|
||||||
|
|
@ -234,13 +257,11 @@ public:
|
||||||
|
|
||||||
bool configDelayDivider(bool use_mclk = true, uint8_t divider = 1);
|
bool configDelayDivider(bool use_mclk = true, uint8_t divider = 1);
|
||||||
|
|
||||||
|
bool configurePLL(uint32_t mclk_freq, uint32_t desired_freq,
|
||||||
bool configurePLL(uint32_t mclk_freq, uint32_t desired_freq, float max_error = 0.001);
|
float max_error = 0.001);
|
||||||
|
|
||||||
|
|
||||||
uint8_t readIRQflags(bool sticky = false);
|
uint8_t readIRQflags(bool sticky = false);
|
||||||
|
|
||||||
|
|
||||||
uint8_t readRegister(uint8_t page, uint8_t reg);
|
uint8_t readRegister(uint8_t page, uint8_t reg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -4,22 +4,22 @@
|
||||||
* @brief Headset detection debounce time options
|
* @brief Headset detection debounce time options
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TLV320_DEBOUNCE_16MS = 0b000, ///< 16ms debounce (2ms clock)
|
TLV320_DEBOUNCE_16MS = 0b000, ///< 16ms debounce (2ms clock)
|
||||||
TLV320_DEBOUNCE_32MS = 0b001, ///< 32ms debounce (4ms clock)
|
TLV320_DEBOUNCE_32MS = 0b001, ///< 32ms debounce (4ms clock)
|
||||||
TLV320_DEBOUNCE_64MS = 0b010, ///< 64ms debounce (8ms clock)
|
TLV320_DEBOUNCE_64MS = 0b010, ///< 64ms debounce (8ms clock)
|
||||||
TLV320_DEBOUNCE_128MS = 0b011, ///< 128ms debounce (16ms clock)
|
TLV320_DEBOUNCE_128MS = 0b011, ///< 128ms debounce (16ms clock)
|
||||||
TLV320_DEBOUNCE_256MS = 0b100, ///< 256ms debounce (32ms clock)
|
TLV320_DEBOUNCE_256MS = 0b100, ///< 256ms debounce (32ms clock)
|
||||||
TLV320_DEBOUNCE_512MS = 0b101, ///< 512ms debounce (64ms clock)
|
TLV320_DEBOUNCE_512MS = 0b101, ///< 512ms debounce (64ms clock)
|
||||||
} tlv320_detect_debounce_t;
|
} tlv320_detect_debounce_t;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Button press debounce time options
|
* @brief Button press debounce time options
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TLV320_BTN_DEBOUNCE_0MS = 0b00, ///< No debounce
|
TLV320_BTN_DEBOUNCE_0MS = 0b00, ///< No debounce
|
||||||
TLV320_BTN_DEBOUNCE_8MS = 0b01, ///< 8ms debounce (1ms clock)
|
TLV320_BTN_DEBOUNCE_8MS = 0b01, ///< 8ms debounce (1ms clock)
|
||||||
TLV320_BTN_DEBOUNCE_16MS = 0b10, ///< 16ms debounce (2ms clock)
|
TLV320_BTN_DEBOUNCE_16MS = 0b10, ///< 16ms debounce (2ms clock)
|
||||||
TLV320_BTN_DEBOUNCE_32MS = 0b11, ///< 32ms debounce (4ms clock)
|
TLV320_BTN_DEBOUNCE_32MS = 0b11, ///< 32ms debounce (4ms clock)
|
||||||
} tlv320_button_debounce_t;
|
} tlv320_button_debounce_t;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -35,217 +35,211 @@ typedef enum {
|
||||||
* @brief DAC channel data path options
|
* @brief DAC channel data path options
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TLV320_DAC_PATH_OFF = 0b00, ///< DAC data path off
|
TLV320_DAC_PATH_OFF = 0b00, ///< DAC data path off
|
||||||
TLV320_DAC_PATH_NORMAL = 0b01, ///< Normal path (L->L or R->R)
|
TLV320_DAC_PATH_NORMAL = 0b01, ///< Normal path (L->L or R->R)
|
||||||
TLV320_DAC_PATH_SWAPPED = 0b10, ///< Swapped path (R->L or L->R)
|
TLV320_DAC_PATH_SWAPPED = 0b10, ///< Swapped path (R->L or L->R)
|
||||||
TLV320_DAC_PATH_MIXED = 0b11, ///< Mixed L+R path
|
TLV320_DAC_PATH_MIXED = 0b11, ///< Mixed L+R path
|
||||||
} tlv320_dac_path_t;
|
} tlv320_dac_path_t;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief DAC volume control soft stepping options
|
* @brief DAC volume control soft stepping options
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TLV320_VOLUME_STEP_1SAMPLE = 0b00, ///< One step per sample
|
TLV320_VOLUME_STEP_1SAMPLE = 0b00, ///< One step per sample
|
||||||
TLV320_VOLUME_STEP_2SAMPLE = 0b01, ///< One step per two samples
|
TLV320_VOLUME_STEP_2SAMPLE = 0b01, ///< One step per two samples
|
||||||
TLV320_VOLUME_STEP_DISABLED = 0b10, ///< Soft stepping disabled
|
TLV320_VOLUME_STEP_DISABLED = 0b10, ///< Soft stepping disabled
|
||||||
} tlv320_volume_step_t;
|
} tlv320_volume_step_t;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief DAC volume control configuration options
|
* @brief DAC volume control configuration options
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TLV320_VOL_INDEPENDENT = 0b00, ///< Left and right channels independent
|
TLV320_VOL_INDEPENDENT = 0b00, ///< Left and right channels independent
|
||||||
TLV320_VOL_LEFT_TO_RIGHT = 0b01, ///< Left follows right volume
|
TLV320_VOL_LEFT_TO_RIGHT = 0b01, ///< Left follows right volume
|
||||||
TLV320_VOL_RIGHT_TO_LEFT = 0b10, ///< Right follows left volume
|
TLV320_VOL_RIGHT_TO_LEFT = 0b10, ///< Right follows left volume
|
||||||
} tlv320_vol_control_t;
|
} tlv320_vol_control_t;
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Clock source options for CODEC_CLKIN
|
* @brief Clock source options for CODEC_CLKIN
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TLV320DAC3100_CODEC_CLKIN_MCLK = 0b00, ///< MCLK pin is the source
|
TLV320DAC3100_CODEC_CLKIN_MCLK = 0b00, ///< MCLK pin is the source
|
||||||
TLV320DAC3100_CODEC_CLKIN_BCLK = 0b01, ///< BCLK pin is the source
|
TLV320DAC3100_CODEC_CLKIN_BCLK = 0b01, ///< BCLK pin is the source
|
||||||
TLV320DAC3100_CODEC_CLKIN_GPIO1 = 0b10, ///< GPIO1 pin is the source
|
TLV320DAC3100_CODEC_CLKIN_GPIO1 = 0b10, ///< GPIO1 pin is the source
|
||||||
TLV320DAC3100_CODEC_CLKIN_PLL = 0b11, ///< PLL_CLK pin is the source
|
TLV320DAC3100_CODEC_CLKIN_PLL = 0b11, ///< PLL_CLK pin is the source
|
||||||
} tlv320dac3100_codec_clkin_t;
|
} tlv320dac3100_codec_clkin_t;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Clock source options for PLL_CLKIN
|
* @brief Clock source options for PLL_CLKIN
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TLV320DAC3100_PLL_CLKIN_MCLK = 0b00, ///< MCLK pin is the source
|
TLV320DAC3100_PLL_CLKIN_MCLK = 0b00, ///< MCLK pin is the source
|
||||||
TLV320DAC3100_PLL_CLKIN_BCLK = 0b01, ///< BCLK pin is the source
|
TLV320DAC3100_PLL_CLKIN_BCLK = 0b01, ///< BCLK pin is the source
|
||||||
TLV320DAC3100_PLL_CLKIN_GPIO1 = 0b10, ///< GPIO1 pin is the source
|
TLV320DAC3100_PLL_CLKIN_GPIO1 = 0b10, ///< GPIO1 pin is the source
|
||||||
TLV320DAC3100_PLL_CLKIN_DIN = 0b11 ///< DIN pin is the source
|
TLV320DAC3100_PLL_CLKIN_DIN = 0b11 ///< DIN pin is the source
|
||||||
} tlv320dac3100_pll_clkin_t;
|
} tlv320dac3100_pll_clkin_t;
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Clock divider input source options
|
* @brief Clock divider input source options
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TLV320DAC3100_CDIV_CLKIN_MCLK = 0b000, ///< MCLK (device pin)
|
TLV320DAC3100_CDIV_CLKIN_MCLK = 0b000, ///< MCLK (device pin)
|
||||||
TLV320DAC3100_CDIV_CLKIN_BCLK = 0b001, ///< BCLK (device pin)
|
TLV320DAC3100_CDIV_CLKIN_BCLK = 0b001, ///< BCLK (device pin)
|
||||||
TLV320DAC3100_CDIV_CLKIN_DIN = 0b010, ///< DIN (for systems where DAC is not required)
|
TLV320DAC3100_CDIV_CLKIN_DIN =
|
||||||
TLV320DAC3100_CDIV_CLKIN_PLL = 0b011, ///< PLL_CLK (generated on-chip)
|
0b010, ///< DIN (for systems where DAC is not required)
|
||||||
TLV320DAC3100_CDIV_CLKIN_DAC = 0b100, ///< DAC_CLK (DAC DSP clock - generated on-chip)
|
TLV320DAC3100_CDIV_CLKIN_PLL = 0b011, ///< PLL_CLK (generated on-chip)
|
||||||
TLV320DAC3100_CDIV_CLKIN_DAC_MOD = 0b101, ///< DAC_MOD_CLK (generated on-chip)
|
TLV320DAC3100_CDIV_CLKIN_DAC =
|
||||||
|
0b100, ///< DAC_CLK (DAC DSP clock - generated on-chip)
|
||||||
|
TLV320DAC3100_CDIV_CLKIN_DAC_MOD = 0b101, ///< DAC_MOD_CLK (generated on-chip)
|
||||||
} tlv320dac3100_cdiv_clkin_t;
|
} tlv320dac3100_cdiv_clkin_t;
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Data length for I2S interface
|
* @brief Data length for I2S interface
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TLV320DAC3100_DATA_LEN_16 = 0b00, ///< 16 bits
|
TLV320DAC3100_DATA_LEN_16 = 0b00, ///< 16 bits
|
||||||
TLV320DAC3100_DATA_LEN_20 = 0b01, ///< 20 bits
|
TLV320DAC3100_DATA_LEN_20 = 0b01, ///< 20 bits
|
||||||
TLV320DAC3100_DATA_LEN_24 = 0b10, ///< 24 bits
|
TLV320DAC3100_DATA_LEN_24 = 0b10, ///< 24 bits
|
||||||
TLV320DAC3100_DATA_LEN_32 = 0b11, ///< 32 bits
|
TLV320DAC3100_DATA_LEN_32 = 0b11, ///< 32 bits
|
||||||
} tlv320dac3100_data_len_t;
|
} tlv320dac3100_data_len_t;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Data format for I2S interface
|
* @brief Data format for I2S interface
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TLV320DAC3100_FORMAT_I2S = 0b00, ///< I2S format
|
TLV320DAC3100_FORMAT_I2S = 0b00, ///< I2S format
|
||||||
TLV320DAC3100_FORMAT_DSP = 0b01, ///< DSP format
|
TLV320DAC3100_FORMAT_DSP = 0b01, ///< DSP format
|
||||||
TLV320DAC3100_FORMAT_RJF = 0b10, ///< Right justified format
|
TLV320DAC3100_FORMAT_RJF = 0b10, ///< Right justified format
|
||||||
TLV320DAC3100_FORMAT_LJF = 0b11, ///< Left justified format
|
TLV320DAC3100_FORMAT_LJF = 0b11, ///< Left justified format
|
||||||
} tlv320dac3100_format_t;
|
} tlv320dac3100_format_t;
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief GPIO1 pin mode options
|
* @brief GPIO1 pin mode options
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TLV320_GPIO1_DISABLED = 0b0000, ///< GPIO1 disabled (input and output buffers powered down)
|
TLV320_GPIO1_DISABLED =
|
||||||
TLV320_GPIO1_INPUT_MODE = 0b0001, ///< Input mode (secondary BCLK/WCLK/DIN input or ClockGen)
|
0b0000, ///< GPIO1 disabled (input and output buffers powered down)
|
||||||
TLV320_GPIO1_GPI = 0b0010, ///< General-purpose input
|
TLV320_GPIO1_INPUT_MODE =
|
||||||
TLV320_GPIO1_GPO = 0b0011, ///< General-purpose output
|
0b0001, ///< Input mode (secondary BCLK/WCLK/DIN input or ClockGen)
|
||||||
TLV320_GPIO1_CLKOUT = 0b0100, ///< CLKOUT output
|
TLV320_GPIO1_GPI = 0b0010, ///< General-purpose input
|
||||||
TLV320_GPIO1_INT1 = 0b0101, ///< INT1 output
|
TLV320_GPIO1_GPO = 0b0011, ///< General-purpose output
|
||||||
TLV320_GPIO1_INT2 = 0b0110, ///< INT2 output
|
TLV320_GPIO1_CLKOUT = 0b0100, ///< CLKOUT output
|
||||||
TLV320_GPIO1_BCLK_OUT = 0b1000, ///< Secondary BCLK output for codec interface
|
TLV320_GPIO1_INT1 = 0b0101, ///< INT1 output
|
||||||
TLV320_GPIO1_WCLK_OUT = 0b1001, ///< Secondary WCLK output for codec interface
|
TLV320_GPIO1_INT2 = 0b0110, ///< INT2 output
|
||||||
|
TLV320_GPIO1_BCLK_OUT = 0b1000, ///< Secondary BCLK output for codec interface
|
||||||
|
TLV320_GPIO1_WCLK_OUT = 0b1001, ///< Secondary WCLK output for codec interface
|
||||||
} tlv320_gpio1_mode_t;
|
} tlv320_gpio1_mode_t;
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief DIN pin mode options
|
* @brief DIN pin mode options
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TLV320_DIN_DISABLED = 0b00, ///< DIN disabled (input buffer powered down)
|
TLV320_DIN_DISABLED = 0b00, ///< DIN disabled (input buffer powered down)
|
||||||
TLV320_DIN_ENABLED = 0b01, ///< DIN enabled (for codec interface/ClockGen)
|
TLV320_DIN_ENABLED = 0b01, ///< DIN enabled (for codec interface/ClockGen)
|
||||||
TLV320_DIN_GPI = 0b10, ///< DIN used as general-purpose input
|
TLV320_DIN_GPI = 0b10, ///< DIN used as general-purpose input
|
||||||
} tlv320_din_mode_t;
|
} tlv320_din_mode_t;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Volume ADC hysteresis options
|
* @brief Volume ADC hysteresis options
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TLV320_VOL_HYST_NONE = 0b00, ///< No hysteresis
|
TLV320_VOL_HYST_NONE = 0b00, ///< No hysteresis
|
||||||
TLV320_VOL_HYST_1BIT = 0b01, ///< ±1 bit hysteresis
|
TLV320_VOL_HYST_1BIT = 0b01, ///< ±1 bit hysteresis
|
||||||
TLV320_VOL_HYST_2BIT = 0b10, ///< ±2 bit hysteresis
|
TLV320_VOL_HYST_2BIT = 0b10, ///< ±2 bit hysteresis
|
||||||
} tlv320_vol_hyst_t;
|
} tlv320_vol_hyst_t;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Volume ADC throughput rates
|
* @brief Volume ADC throughput rates
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TLV320_VOL_RATE_15_625HZ = 0b000, ///< 15.625 Hz (MCLK) or 10.68 Hz (RC)
|
TLV320_VOL_RATE_15_625HZ = 0b000, ///< 15.625 Hz (MCLK) or 10.68 Hz (RC)
|
||||||
TLV320_VOL_RATE_31_25HZ = 0b001, ///< 31.25 Hz (MCLK) or 21.35 Hz (RC)
|
TLV320_VOL_RATE_31_25HZ = 0b001, ///< 31.25 Hz (MCLK) or 21.35 Hz (RC)
|
||||||
TLV320_VOL_RATE_62_5HZ = 0b010, ///< 62.5 Hz (MCLK) or 42.71 Hz (RC)
|
TLV320_VOL_RATE_62_5HZ = 0b010, ///< 62.5 Hz (MCLK) or 42.71 Hz (RC)
|
||||||
TLV320_VOL_RATE_125HZ = 0b011, ///< 125 Hz (MCLK) or 85.2 Hz (RC)
|
TLV320_VOL_RATE_125HZ = 0b011, ///< 125 Hz (MCLK) or 85.2 Hz (RC)
|
||||||
TLV320_VOL_RATE_250HZ = 0b100, ///< 250 Hz (MCLK) or 170 Hz (RC)
|
TLV320_VOL_RATE_250HZ = 0b100, ///< 250 Hz (MCLK) or 170 Hz (RC)
|
||||||
TLV320_VOL_RATE_500HZ = 0b101, ///< 500 Hz (MCLK) or 340 Hz (RC)
|
TLV320_VOL_RATE_500HZ = 0b101, ///< 500 Hz (MCLK) or 340 Hz (RC)
|
||||||
TLV320_VOL_RATE_1KHZ = 0b110, ///< 1 kHz (MCLK) or 680 Hz (RC)
|
TLV320_VOL_RATE_1KHZ = 0b110, ///< 1 kHz (MCLK) or 680 Hz (RC)
|
||||||
TLV320_VOL_RATE_2KHZ = 0b111, ///< 2 kHz (MCLK) or 1.37 kHz (RC)
|
TLV320_VOL_RATE_2KHZ = 0b111, ///< 2 kHz (MCLK) or 1.37 kHz (RC)
|
||||||
} tlv320_vol_rate_t;
|
} tlv320_vol_rate_t;
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TLV320_HP_COMMON_1_35V = 0b00, ///< Common-mode voltage 1.35V
|
TLV320_HP_COMMON_1_35V = 0b00, ///< Common-mode voltage 1.35V
|
||||||
TLV320_HP_COMMON_1_50V = 0b01, ///< Common-mode voltage 1.50V
|
TLV320_HP_COMMON_1_50V = 0b01, ///< Common-mode voltage 1.50V
|
||||||
TLV320_HP_COMMON_1_65V = 0b10, ///< Common-mode voltage 1.65V
|
TLV320_HP_COMMON_1_65V = 0b10, ///< Common-mode voltage 1.65V
|
||||||
TLV320_HP_COMMON_1_80V = 0b11, ///< Common-mode voltage 1.80V
|
TLV320_HP_COMMON_1_80V = 0b11, ///< Common-mode voltage 1.80V
|
||||||
} tlv320_hp_common_t;
|
} tlv320_hp_common_t;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Headphone driver power-on time options
|
* @brief Headphone driver power-on time options
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TLV320_HP_TIME_0US = 0b0000, ///< 0 microseconds
|
TLV320_HP_TIME_0US = 0b0000, ///< 0 microseconds
|
||||||
TLV320_HP_TIME_15US = 0b0001, ///< 15.3 microseconds
|
TLV320_HP_TIME_15US = 0b0001, ///< 15.3 microseconds
|
||||||
TLV320_HP_TIME_153US = 0b0010, ///< 153 microseconds
|
TLV320_HP_TIME_153US = 0b0010, ///< 153 microseconds
|
||||||
TLV320_HP_TIME_1_5MS = 0b0011, ///< 1.53 milliseconds
|
TLV320_HP_TIME_1_5MS = 0b0011, ///< 1.53 milliseconds
|
||||||
TLV320_HP_TIME_15MS = 0b0100, ///< 15.3 milliseconds
|
TLV320_HP_TIME_15MS = 0b0100, ///< 15.3 milliseconds
|
||||||
TLV320_HP_TIME_76MS = 0b0101, ///< 76.2 milliseconds
|
TLV320_HP_TIME_76MS = 0b0101, ///< 76.2 milliseconds
|
||||||
TLV320_HP_TIME_153MS = 0b0110, ///< 153 milliseconds
|
TLV320_HP_TIME_153MS = 0b0110, ///< 153 milliseconds
|
||||||
TLV320_HP_TIME_304MS = 0b0111, ///< 304 milliseconds
|
TLV320_HP_TIME_304MS = 0b0111, ///< 304 milliseconds
|
||||||
TLV320_HP_TIME_610MS = 0b1000, ///< 610 milliseconds
|
TLV320_HP_TIME_610MS = 0b1000, ///< 610 milliseconds
|
||||||
TLV320_HP_TIME_1_2S = 0b1001, ///< 1.22 seconds
|
TLV320_HP_TIME_1_2S = 0b1001, ///< 1.22 seconds
|
||||||
TLV320_HP_TIME_3S = 0b1010, ///< 3.04 seconds
|
TLV320_HP_TIME_3S = 0b1010, ///< 3.04 seconds
|
||||||
TLV320_HP_TIME_6S = 0b1011, ///< 6.1 seconds
|
TLV320_HP_TIME_6S = 0b1011, ///< 6.1 seconds
|
||||||
} tlv320_hp_time_t;
|
} tlv320_hp_time_t;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Headphone driver ramp-up step time options
|
* @brief Headphone driver ramp-up step time options
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TLV320_RAMP_0MS = 0b00, ///< 0 milliseconds
|
TLV320_RAMP_0MS = 0b00, ///< 0 milliseconds
|
||||||
TLV320_RAMP_1MS = 0b01, ///< 0.98 milliseconds
|
TLV320_RAMP_1MS = 0b01, ///< 0.98 milliseconds
|
||||||
TLV320_RAMP_2MS = 0b10, ///< 1.95 milliseconds
|
TLV320_RAMP_2MS = 0b10, ///< 1.95 milliseconds
|
||||||
TLV320_RAMP_4MS = 0b11, ///< 3.9 milliseconds
|
TLV320_RAMP_4MS = 0b11, ///< 3.9 milliseconds
|
||||||
} tlv320_ramp_time_t;
|
} tlv320_ramp_time_t;
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Speaker power-up wait time options
|
* @brief Speaker power-up wait time options
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TLV320_SPK_WAIT_0MS = 0b000, ///< 0 milliseconds
|
TLV320_SPK_WAIT_0MS = 0b000, ///< 0 milliseconds
|
||||||
TLV320_SPK_WAIT_3MS = 0b001, ///< 3.04 milliseconds
|
TLV320_SPK_WAIT_3MS = 0b001, ///< 3.04 milliseconds
|
||||||
TLV320_SPK_WAIT_7MS = 0b010, ///< 7.62 milliseconds
|
TLV320_SPK_WAIT_7MS = 0b010, ///< 7.62 milliseconds
|
||||||
TLV320_SPK_WAIT_12MS = 0b011, ///< 12.2 milliseconds
|
TLV320_SPK_WAIT_12MS = 0b011, ///< 12.2 milliseconds
|
||||||
TLV320_SPK_WAIT_15MS = 0b100, ///< 15.3 milliseconds
|
TLV320_SPK_WAIT_15MS = 0b100, ///< 15.3 milliseconds
|
||||||
TLV320_SPK_WAIT_19MS = 0b101, ///< 19.8 milliseconds
|
TLV320_SPK_WAIT_19MS = 0b101, ///< 19.8 milliseconds
|
||||||
TLV320_SPK_WAIT_24MS = 0b110, ///< 24.4 milliseconds
|
TLV320_SPK_WAIT_24MS = 0b110, ///< 24.4 milliseconds
|
||||||
TLV320_SPK_WAIT_30MS = 0b111, ///< 30.5 milliseconds
|
TLV320_SPK_WAIT_30MS = 0b111, ///< 30.5 milliseconds
|
||||||
} tlv320_spk_wait_t;
|
} tlv320_spk_wait_t;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief DAC output routing options
|
* @brief DAC output routing options
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TLV320_DAC_ROUTE_NONE = 0b00, ///< DAC not routed
|
TLV320_DAC_ROUTE_NONE = 0b00, ///< DAC not routed
|
||||||
TLV320_DAC_ROUTE_MIXER = 0b01, ///< DAC routed to mixer amplifier
|
TLV320_DAC_ROUTE_MIXER = 0b01, ///< DAC routed to mixer amplifier
|
||||||
TLV320_DAC_ROUTE_HP = 0b10, ///< DAC routed directly to HP driver
|
TLV320_DAC_ROUTE_HP = 0b10, ///< DAC routed directly to HP driver
|
||||||
} tlv320_dac_route_t;
|
} tlv320_dac_route_t;
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief MICBIAS voltage options
|
* @brief MICBIAS voltage options
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TLV320_MICBIAS_OFF = 0b00, ///< MICBIAS powered down
|
TLV320_MICBIAS_OFF = 0b00, ///< MICBIAS powered down
|
||||||
TLV320_MICBIAS_2V = 0b01, ///< MICBIAS = 2V
|
TLV320_MICBIAS_2V = 0b01, ///< MICBIAS = 2V
|
||||||
TLV320_MICBIAS_2_5V = 0b10, ///< MICBIAS = 2.5V
|
TLV320_MICBIAS_2_5V = 0b10, ///< MICBIAS = 2.5V
|
||||||
TLV320_MICBIAS_AVDD = 0b11, ///< MICBIAS = AVDD
|
TLV320_MICBIAS_AVDD = 0b11, ///< MICBIAS = AVDD
|
||||||
} tlv320_micbias_volt_t;
|
} tlv320_micbias_volt_t;
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Speaker amplifier gain options
|
* @brief Speaker amplifier gain options
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TLV320_SPK_GAIN_6DB = 0b00, ///< 6 dB gain
|
TLV320_SPK_GAIN_6DB = 0b00, ///< 6 dB gain
|
||||||
TLV320_SPK_GAIN_12DB = 0b01, ///< 12 dB gain
|
TLV320_SPK_GAIN_12DB = 0b01, ///< 12 dB gain
|
||||||
TLV320_SPK_GAIN_18DB = 0b10, ///< 18 dB gain
|
TLV320_SPK_GAIN_18DB = 0b10, ///< 18 dB gain
|
||||||
TLV320_SPK_GAIN_24DB = 0b11, ///< 24 dB gain
|
TLV320_SPK_GAIN_24DB = 0b11, ///< 24 dB gain
|
||||||
} tlv320_spk_gain_t;
|
} tlv320_spk_gain_t;
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TLV320DAC3100_BCLK_SRC_DAC_CLK = 0,
|
TLV320DAC3100_BCLK_SRC_DAC_CLK = 0,
|
||||||
TLV320DAC3100_BCLK_SRC_DAC_MOD_CLK = 1,
|
TLV320DAC3100_BCLK_SRC_DAC_MOD_CLK = 1,
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
#include <Adafruit_TLV320DAC3100.h>
|
#include <Adafruit_TLV320DAC3100.h>
|
||||||
|
|
||||||
Adafruit_TLV320DAC3100 codec; // Create codec object
|
Adafruit_TLV320DAC3100 codec; // Create codec object
|
||||||
#define TLV_RESET 5
|
#define TLV_RESET 5
|
||||||
|
|
||||||
void halt(const char *message) {
|
void halt(const char *message) {
|
||||||
Serial.println(message);
|
Serial.println(message);
|
||||||
while (1) yield(); // Function to halt on critical errors
|
while (1)
|
||||||
|
yield(); // Function to halt on critical errors
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
|
@ -15,7 +16,7 @@ void setup() {
|
||||||
digitalWrite(TLV_RESET, LOW);
|
digitalWrite(TLV_RESET, LOW);
|
||||||
delay(100);
|
delay(100);
|
||||||
digitalWrite(TLV_RESET, HIGH);
|
digitalWrite(TLV_RESET, HIGH);
|
||||||
|
|
||||||
Serial.println("Init TLV DAC");
|
Serial.println("Init TLV DAC");
|
||||||
if (!codec.begin()) {
|
if (!codec.begin()) {
|
||||||
halt("Failed to initialize codec!");
|
halt("Failed to initialize codec!");
|
||||||
|
|
@ -23,8 +24,8 @@ void setup() {
|
||||||
delay(10);
|
delay(10);
|
||||||
|
|
||||||
// Interface Control
|
// Interface Control
|
||||||
if (!codec.setCodecInterface(TLV320DAC3100_FORMAT_I2S, // Format: I2S
|
if (!codec.setCodecInterface(TLV320DAC3100_FORMAT_I2S, // Format: I2S
|
||||||
TLV320DAC3100_DATA_LEN_16)) { // Length: 16 bits
|
TLV320DAC3100_DATA_LEN_16)) { // Length: 16 bits
|
||||||
halt("Failed to configure codec interface!");
|
halt("Failed to configure codec interface!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -33,88 +34,89 @@ void setup() {
|
||||||
!codec.setPLLClockInput(TLV320DAC3100_PLL_CLKIN_BCLK)) {
|
!codec.setPLLClockInput(TLV320DAC3100_PLL_CLKIN_BCLK)) {
|
||||||
halt("Failed to configure codec clocks!");
|
halt("Failed to configure codec clocks!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!codec.setPLLValues(1, 2, 32, 0)) { // P=2, R=2, J=32, D=0
|
if (!codec.setPLLValues(1, 2, 32, 0)) { // P=2, R=2, J=32, D=0
|
||||||
halt("Failed to configure PLL values!");
|
halt("Failed to configure PLL values!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// DAC/ADC Config
|
// DAC/ADC Config
|
||||||
if (!codec.setNDAC(true, 8) || // Enable NDAC with value 8
|
if (!codec.setNDAC(true, 8) || // Enable NDAC with value 8
|
||||||
!codec.setMDAC(true, 2)) { // Enable MDAC with value 2
|
!codec.setMDAC(true, 2)) { // Enable MDAC with value 2
|
||||||
halt("Failed to configure DAC dividers!");
|
halt("Failed to configure DAC dividers!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!codec.powerPLL(true)) { // Power up the PLL
|
if (!codec.powerPLL(true)) { // Power up the PLL
|
||||||
halt("Failed to power up PLL!");
|
halt("Failed to power up PLL!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// DAC Setup
|
// DAC Setup
|
||||||
if (!codec.setDACDataPath(true, true, // Power up both DACs
|
if (!codec.setDACDataPath(true, true, // Power up both DACs
|
||||||
TLV320_DAC_PATH_NORMAL, // Normal left path
|
TLV320_DAC_PATH_NORMAL, // Normal left path
|
||||||
TLV320_DAC_PATH_NORMAL, // Normal right path
|
TLV320_DAC_PATH_NORMAL, // Normal right path
|
||||||
TLV320_VOLUME_STEP_1SAMPLE)) { // Step: 1 per sample
|
TLV320_VOLUME_STEP_1SAMPLE)) { // Step: 1 per sample
|
||||||
halt("Failed to configure DAC data path!");
|
halt("Failed to configure DAC data path!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!codec.configureAnalogInputs(TLV320_DAC_ROUTE_MIXER, // Left DAC to mixer
|
if (!codec.configureAnalogInputs(TLV320_DAC_ROUTE_MIXER, // Left DAC to mixer
|
||||||
TLV320_DAC_ROUTE_MIXER, // Right DAC to mixer
|
TLV320_DAC_ROUTE_MIXER, // Right DAC to mixer
|
||||||
false, false, false, // No AIN routing
|
false, false, false, // No AIN routing
|
||||||
false)) { // No HPL->HPR
|
false)) { // No HPL->HPR
|
||||||
halt("Failed to configure DAC routing!");
|
halt("Failed to configure DAC routing!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// DAC Volume Control
|
// DAC Volume Control
|
||||||
if (!codec.setDACVolumeControl(false, false, TLV320_VOL_INDEPENDENT) || // Unmute both channels
|
if (!codec.setDACVolumeControl(
|
||||||
!codec.setChannelVolume(false, 18) || // Left DAC +0dB
|
false, false, TLV320_VOL_INDEPENDENT) || // Unmute both channels
|
||||||
!codec.setChannelVolume(true, 18)) { // Right DAC +0dB
|
!codec.setChannelVolume(false, 18) || // Left DAC +0dB
|
||||||
halt("Failed to configure DAC volumes!");
|
!codec.setChannelVolume(true, 18)) { // Right DAC +0dB
|
||||||
|
halt("Failed to configure DAC volumes!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Headphone and Speaker Setup
|
// Headphone and Speaker Setup
|
||||||
if (!codec.configureHeadphoneDriver(true, true, // Power up both drivers
|
if (!codec.configureHeadphoneDriver(
|
||||||
TLV320_HP_COMMON_1_35V, // Default common mode
|
true, true, // Power up both drivers
|
||||||
false) || // Don't power down on SCD
|
TLV320_HP_COMMON_1_35V, // Default common mode
|
||||||
!codec.configureHPL_PGA(0, true) || // Set HPL gain, unmute
|
false) || // Don't power down on SCD
|
||||||
!codec.configureHPR_PGA(0, true) || // Set HPR gain, unmute
|
!codec.configureHPL_PGA(0, true) || // Set HPL gain, unmute
|
||||||
!codec.setHPLVolume(true, 6) || // Enable and set HPL volume
|
!codec.configureHPR_PGA(0, true) || // Set HPR gain, unmute
|
||||||
!codec.setHPRVolume(true, 6)) { // Enable and set HPR volume
|
!codec.setHPLVolume(true, 6) || // Enable and set HPL volume
|
||||||
|
!codec.setHPRVolume(true, 6)) { // Enable and set HPR volume
|
||||||
halt("Failed to configure headphone outputs!");
|
halt("Failed to configure headphone outputs!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!codec.enableSpeaker(true) || // Dis/Enable speaker amp
|
if (!codec.enableSpeaker(true) || // Dis/Enable speaker amp
|
||||||
!codec.configureSPK_PGA(TLV320_SPK_GAIN_6DB, // Set gain to 6dB
|
!codec.configureSPK_PGA(TLV320_SPK_GAIN_6DB, // Set gain to 6dB
|
||||||
true) || // Unmute
|
true) || // Unmute
|
||||||
!codec.setSPKVolume(true, 0)) { // Enable and set volume to 0dB
|
!codec.setSPKVolume(true, 0)) { // Enable and set volume to 0dB
|
||||||
halt("Failed to configure speaker output!");
|
halt("Failed to configure speaker output!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!codec.configMicBias(false, true, TLV320_MICBIAS_AVDD) ||
|
||||||
if (!codec.configMicBias(false, true, TLV320_MICBIAS_AVDD) ||
|
|
||||||
!codec.setHeadsetDetect(true) ||
|
!codec.setHeadsetDetect(true) ||
|
||||||
!codec.setInt1Source(true, true, false, false, false, false) || // GPIO1 is detect headset or button press
|
!codec.setInt1Source(true, true, false, false, false,
|
||||||
|
false) || // GPIO1 is detect headset or button press
|
||||||
!codec.setGPIO1Mode(TLV320_GPIO1_INT1)) {
|
!codec.setGPIO1Mode(TLV320_GPIO1_INT1)) {
|
||||||
halt("Failed to configure headset detect");
|
halt("Failed to configure headset detect");
|
||||||
}
|
}
|
||||||
Serial.println("TLV config done!");
|
Serial.println("TLV config done!");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
static tlv320_headset_status_t last_status = TLV320_HEADSET_NONE;
|
static tlv320_headset_status_t last_status = TLV320_HEADSET_NONE;
|
||||||
|
|
||||||
tlv320_headset_status_t status = codec.getHeadsetStatus();
|
tlv320_headset_status_t status = codec.getHeadsetStatus();
|
||||||
|
|
||||||
if (last_status != status) {
|
if (last_status != status) {
|
||||||
switch(status) {
|
switch (status) {
|
||||||
case TLV320_HEADSET_NONE:
|
case TLV320_HEADSET_NONE:
|
||||||
Serial.println("Headset removed");
|
Serial.println("Headset removed");
|
||||||
break;
|
break;
|
||||||
case TLV320_HEADSET_WITHOUT_MIC:
|
case TLV320_HEADSET_WITHOUT_MIC:
|
||||||
Serial.println("Headphones detected");
|
Serial.println("Headphones detected");
|
||||||
break;
|
break;
|
||||||
case TLV320_HEADSET_WITH_MIC:
|
case TLV320_HEADSET_WITH_MIC:
|
||||||
Serial.println("Headset with mic detected");
|
Serial.println("Headset with mic detected");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
last_status = status;
|
last_status = status;
|
||||||
}
|
}
|
||||||
|
|
@ -127,11 +129,13 @@ void loop() {
|
||||||
Serial.println(F("IRQ Flags detected:"));
|
Serial.println(F("IRQ Flags detected:"));
|
||||||
|
|
||||||
if (flags & TLV320DAC3100_IRQ_HPL_SHORT) {
|
if (flags & TLV320DAC3100_IRQ_HPL_SHORT) {
|
||||||
Serial.println(F("- Short circuit detected at HPL / left class-D driver"));
|
Serial.println(
|
||||||
|
F("- Short circuit detected at HPL / left class-D driver"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & TLV320DAC3100_IRQ_HPR_SHORT) {
|
if (flags & TLV320DAC3100_IRQ_HPR_SHORT) {
|
||||||
Serial.println(F("- Short circuit detected at HPR / right class-D driver"));
|
Serial.println(
|
||||||
|
F("- Short circuit detected at HPR / right class-D driver"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & TLV320DAC3100_IRQ_BUTTON_PRESS) {
|
if (flags & TLV320DAC3100_IRQ_BUTTON_PRESS) {
|
||||||
|
|
@ -157,6 +161,5 @@ void loop() {
|
||||||
Serial.println();
|
Serial.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
delay(100);
|
delay(100);
|
||||||
}
|
}
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
// TODO: Add a simpletest example for TLV320DAC3100
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
|
|
||||||
}
|
|
||||||
Loading…
Reference in a new issue