|
| | TLV320AIC3104 () |
| |
| uint8_t | address () |
| | Provides the actual I2C address of the codec.
|
| |
| bool | begin (uint32_t sample_rate, uint8_t bits, codec_mode_t mode, i2s_format_t fmt, bool is_master, uint8_t channels) override |
| | Initializes the codec for I2S with the given sample rate and bits per sample.
|
| |
| bool | begin (uint32_t sample_rate=44100, uint8_t word_size=16, uint8_t channels=2, bool is_master=false, uint32_t mclk=0) |
| |
| bool | configureClocks (uint32_t sample_rate, uint8_t word_size, uint8_t channels, uint32_t mclk, bool is_master) |
| | Configure the PLL for the given MCLK/fS(ref) combination, then set the shared ADC/DAC NCODEC divider (and dual-rate mode) needed to reach the requested sample rate from that fS(ref).
|
| |
| bool | configureDai (uint8_t word_size) |
| | Configure the digital audio interface (I2S) word size and clock direction.
|
| |
| bool | configureInput () |
| | Configure the microphone/line input path to the Left/Right ADC PGA at 0dB and power up the ADC channels, set the microphone bias, and set the ADC PGA to its default gain, unmuted. ADC_INPUT_DIFFERENCE: Balanced inputs on Line1/Mic1, with Mic gain. ADC_INPUT_LINE1: Single ended inputs on Line1/Mic1, Line leve. ADC_INPUT_LINE2: Single ended inputs on Line2/Mic2, Line level ADC_INPUT_LINE3: Single ended inputs on Line2/Mic2, Mic gain. ADC_INPUT_ALL: Singled ended line inputs on Line1, Single ended mono Mic input on Mic2, Line2 off. No cross-mixing (eg: left to right)
|
| |
| bool | configureOutput () |
| | Configure the headphone (HPLOUT/HPROUT) and/or fully differential line (LOP/M) output paths, depending on the output device selected via setDevices(): power up the DAC, route the DAC output to the selected mixer(s) at default (0dB) volume, unmute and power up the corresponding output drivers.
|
| |
| virtual int | getInputVolume () |
| |
| virtual int | getVolume () |
| | Provides the output volume in % (0...100) that was set with setVolume()
|
| |
| i2c_bus_handle_t | getWire () |
| | Provides the actual I2C communication object.
|
| |
| virtual bool | isInputVolumeSupported () |
| | Returns true if the driver supports setting the input volume, false otherwise. By default we return false, but some drivers (e.g. WM8962) override this to return true.
|
| |
| bool | readPagedReg (RegAddr reg, uint8_t &value) |
| | Reads a register on the given page.
|
| |
| virtual bool | setActive (codec_mode_t mode) |
| |
| void | setAddress (uint8_t addr) |
| | Defines the I2C address of the codec.
|
| |
| bool | setDACMute (bool mute) |
| |
| bool | setDevices (input_device_t input_device, output_device_t output_device) override |
| | Stores the output device selection for use by configureOutput()
|
| |
| virtual bool | setInputVolume (int volume) |
| |
| bool | setMute (bool mute) override |
| | Mutes/unmutes all outputs.
|
| |
| bool | setOutputMute (bool mute, AIC3104Channel channel=AIC3104Channel::All) |
| | Mute / unmute the headphone and/or line output driver(s)
|
| |
| bool | setOutputVolume (int vol, AIC3104Channel channel=AIC3104Channel::All) |
| | Set the output (headphone / line out) volume.
|
| |
| bool | setVolume (int volume) override |
| |
| void | setWire (i2c_bus_handle_t w) |
| | Defines the I2C communication object.
|
| |
| bool | softReset () |
| | Soft reset of the codec.
|
| |
| bool | startOutput () |
| | Power up the DAC channels.
|
| |
| bool | stopOutput () |
| | Power down the DAC channels.
|
| |
| bool | updatePagedReg (RegAddr reg, uint8_t mask, uint8_t value) |
| | Read-Modify-Write of a register on the given page.
|
| |
| bool | writePagedReg (RegAddr reg, uint8_t value) |
| | Writes a register on the given page.
|
| |
|
| static constexpr RegAddr | ADC_DIG_FILT_CTRL_ADDR {0, 107} |
| |
| static constexpr RegAddr | ADC_FLAG_ADDR {0, 36} |
| |
| static constexpr uint8_t | ADC_PWR_ON = makeBit(2, 1) |
| |
| static constexpr uint8_t | AIC3104_IFTYPE_DSP = makeBits(7, 6, 0b01) |
| |
| static constexpr uint8_t | AIC3104_IFTYPE_I2S = makeBits(7, 6, 0b00) |
| |
| static constexpr uint8_t | AIC3104_IFTYPE_LJF = makeBits(7, 6, 0b11) |
| |
| static constexpr uint8_t | AIC3104_IFTYPE_RJF = makeBits(7, 6, 0b10) |
| |
| static constexpr RegAddr | ANALOG_BYPASS_CTRL_ADDR {0, 108} |
| |
| static constexpr RegAddr | ASD_INTF_CTRLA_ADDR {0, 8} |
| |
| static constexpr RegAddr | ASD_INTF_CTRLB_ADDR {0, 9} |
| |
| static constexpr RegAddr | ASD_INTF_CTRLC_ADDR {0, 10} |
| |
| static constexpr uint8_t | ASD_WLEN_16 = makeBits(5, 4, 0b00) |
| |
| static constexpr uint8_t | ASD_WLEN_20 = makeBits(5, 4, 0b01) |
| |
| static constexpr uint8_t | ASD_WLEN_24 = makeBits(5, 4, 0b10) |
| |
| static constexpr uint8_t | ASD_WLEN_32 = makeBits(5, 4, 0b11) |
| |
| static constexpr RegAddr | CLK_ADDR {0, 101} |
| |
| static constexpr RegAddr | CLK_GEN_ADDR {0, 102} |
| |
| static constexpr RegAddr | CODEC_DATAPATH_ADDR {0, 7} |
| |
| static constexpr int | CODEC_OUTPUT_VOLUME_MAX = 0 |
| | Output volume range, in 0.5dB steps (-63.5dB .. 0dB)
|
| |
| static constexpr int | CODEC_OUTPUT_VOLUME_MIN = -127 |
| |
| static constexpr RegAddr | D3D_ATTEN_LSB {1, 54} |
| |
| static constexpr RegAddr | D3D_ATTEN_MSB {1, 53} |
| |
| static constexpr RegAddr | DAC_PWR_ADDR {0, 37} |
| |
| static constexpr RegAddr | DAC_QUIESCENT_CURRENT_ADDR {0, 109} |
| |
| static constexpr RegAddr | DAC_SW_CTRL_ADDR {0, 41} |
| |
| static constexpr uint8_t | DAC_UNMUTE = makeBit(7, 1) |
| |
| static constexpr RegAddr | DACL1_HPLCOM_VOL_ADDR {0, 54} |
| |
| static constexpr RegAddr | DACL1_HPLOUT_VOL_ADDR {0, 47} |
| |
| static constexpr RegAddr | DACL1_HPRCOM_VOL_ADDR {0, 68} |
| |
| static constexpr RegAddr | DACL1_HPROUT_VOL_ADDR {0, 61} |
| |
| static constexpr RegAddr | DACL1_LLOPM_VOL_ADDR {0, 82} |
| |
| static constexpr RegAddr | DACL1_RLOPM_VOL_ADDR {0, 89} |
| |
| static constexpr RegAddr | DACR1_HPLCOM_VOL_ADDR {0, 57} |
| |
| static constexpr RegAddr | DACR1_HPLOUT_VOL_ADDR {0, 50} |
| |
| static constexpr RegAddr | DACR1_HPRCOM_VOL_ADDR {0, 71} |
| |
| static constexpr RegAddr | DACR1_HPROUT_VOL_ADDR {0, 64} |
| |
| static constexpr RegAddr | DACR1_LLOPM_VOL_ADDR {0, 85} |
| |
| static constexpr RegAddr | DACR1_RLOPM_VOL_ADDR {0, 92} |
| |
| static constexpr RegAddr | DIGI_FILT_CTRL_ADDR {0, 12} |
| |
| static constexpr uint8_t | DUAL_RATE_MODE = (makeBit(6, 1)) | (makeBit(5, 1)) |
| |
| static constexpr uint8_t | FSREF_44100 = makeBit(7, 1) |
| |
| static constexpr uint8_t | FSREF_48000 = 0 |
| |
| static constexpr RegAddr | HEADSET_BTN_PRESS_DETECTA_ADDR {0, 13} |
| |
| static constexpr RegAddr | HEADSET_BTN_PRESS_DETECTB_ADDR {0, 14} |
| |
| static constexpr uint8_t | HP_UNMUTE = makeBit(3, 1) |
| |
| static constexpr RegAddr | HPCOM_CMVOLT_ADDR {0, 40} |
| |
| static constexpr RegAddr | HPLCOM_CTRL_ADDR {0, 58} |
| |
| static constexpr RegAddr | HPLOUT_CTRL_ADDR {0, 51} |
| |
| static constexpr RegAddr | HPRCOM_CFG_ADDR {0, 38} |
| |
| static constexpr RegAddr | HPRCOM_CTRL_ADDR {0, 72} |
| |
| static constexpr RegAddr | HPROUT_CTRL_ADDR {0, 65} |
| |
| static constexpr uint8_t | I2C_ADDR = 0x18 |
| |
| static constexpr RegAddr | I2C_BUS_STATUS_ADDR {0, 107} |
| |
| static constexpr RegAddr | LADC_VOL_ADDR {0, 15} |
| |
| static constexpr RegAddr | LAGC_CTRLA_ADDR {0, 26} |
| |
| static constexpr RegAddr | LAGC_CTRLB_ADDR {0, 27} |
| |
| static constexpr RegAddr | LAGC_CTRLC_ADDR {0, 28} |
| |
| static constexpr RegAddr | LAGC_GAIN_ADDR {0, 32} |
| |
| static constexpr RegAddr | LAGC_NGATE_DEBOUNCE_ADDR {0, 34} |
| |
| static constexpr RegAddr | LAGC_PROG_ATTACK_ADDR {0, 103} |
| |
| static constexpr RegAddr | LAGC_PROG_DECAY_ADDR {0, 104} |
| |
| static constexpr RegAddr | LCH_ADC_HPF_D1_LSB_ADDR {1, 70} |
| |
| static constexpr RegAddr | LCH_ADC_HPF_D1_MSB_ADDR {1, 69} |
| |
| static constexpr RegAddr | LCH_ADC_HPF_N0_LSB_ADDR {1, 66} |
| |
| static constexpr RegAddr | LCH_ADC_HPF_N0_MSB_ADDR {1, 65} |
| |
| static constexpr RegAddr | LCH_ADC_HPF_N1_LSB_ADDR {1, 68} |
| |
| static constexpr RegAddr | LCH_ADC_HPF_N1_MSB_ADDR {1, 67} |
| |
| static constexpr RegAddr | LCH_DEEMP_D0_LSB_ADDR {1, 26} |
| |
| static constexpr RegAddr | LCH_DEEMP_D0_MSB_ADDR {1, 25} |
| |
| static constexpr RegAddr | LCH_DEEMP_N0_LSB_ADDR {1, 22} |
| |
| static constexpr RegAddr | LCH_DEEMP_N0_MSB_ADDR {1, 21} |
| |
| static constexpr RegAddr | LCH_DEEMP_N1_LSB_ADDR {1, 24} |
| |
| static constexpr RegAddr | LCH_DEEMP_N1_MSB_ADDR {1, 23} |
| |
| static constexpr RegAddr | LCH_FX_D1_LSB_ADDR {1, 14} |
| |
| static constexpr RegAddr | LCH_FX_D1_MSB_ADDR {1, 13} |
| |
| static constexpr RegAddr | LCH_FX_D2_LSB_ADDR {1, 16} |
| |
| static constexpr RegAddr | LCH_FX_D2_MSB_ADDR {1, 15} |
| |
| static constexpr RegAddr | LCH_FX_D4_LSB_ADDR {1, 18} |
| |
| static constexpr RegAddr | LCH_FX_D4_MSB_ADDR {1, 17} |
| |
| static constexpr RegAddr | LCH_FX_D5_LSB_ADDR {1, 20} |
| |
| static constexpr RegAddr | LCH_FX_D5_MSB_ADDR {1, 19} |
| |
| static constexpr RegAddr | LCH_FX_N0_LSB_ADDR {1, 2} |
| |
| static constexpr RegAddr | LCH_FX_N0_MSB_ADDR {1, 1} |
| |
| static constexpr RegAddr | LCH_FX_N1_LSB_ADDR {1, 4} |
| |
| static constexpr RegAddr | LCH_FX_N1_MSB_ADDR {1, 3} |
| |
| static constexpr RegAddr | LCH_FX_N2_LSB_ADDR {1, 6} |
| |
| static constexpr RegAddr | LCH_FX_N2_MSB_ADDR {1, 5} |
| |
| static constexpr RegAddr | LCH_FX_N3_LSB_ADDR {1, 8} |
| |
| static constexpr RegAddr | LCH_FX_N3_MSB_ADDR {1, 7} |
| |
| static constexpr RegAddr | LCH_FX_N4_LSB_ADDR {1, 10} |
| |
| static constexpr RegAddr | LCH_FX_N4_MSB_ADDR {1, 9} |
| |
| static constexpr RegAddr | LCH_FX_N5_LSB_ADDR {1, 12} |
| |
| static constexpr RegAddr | LCH_FX_N5_MSB_ADDR {1, 11} |
| |
| static constexpr uint8_t | LDAC2LCH = makeBit(3, 1) |
| |
| static constexpr uint8_t | LDAC_PWR_ON = makeBit(7, 1) |
| |
| static constexpr RegAddr | LDAC_VOL_ADDR {0, 43} |
| |
| static constexpr RegAddr | LINE1L_LADC_CTRL_ADDR {0, 19} |
| |
| static constexpr RegAddr | LINE1L_RADC_CTRL_ADDR {0, 24} |
| |
| static constexpr RegAddr | LINE1R_LADC_CTRL_ADDR {0, 21} |
| |
| static constexpr RegAddr | LINE1R_RADC_CTRL_ADDR {0, 22} |
| |
| static constexpr RegAddr | LLOPM_CTRL_ADDR {0, 86} |
| |
| static constexpr RegAddr | MIC2_LADC_CTRL_ADDR {0, 17} |
| |
| static constexpr RegAddr | MIC2_RADC_CTRL_ADDR {0, 18} |
| |
| static constexpr RegAddr | MICBIAS_CTRL_ADDR {0, 25} |
| |
| static constexpr uint8_t | NCODEC_1 = 0x0 |
| |
| static constexpr uint8_t | NCODEC_1_5 = 0x1 |
| |
| static constexpr uint8_t | NCODEC_2 = 0x2 |
| |
| static constexpr uint8_t | NCODEC_2_5 = 0x3 |
| |
| static constexpr uint8_t | NCODEC_3 = 0x4 |
| |
| static constexpr uint8_t | NCODEC_3_5 = 0x5 |
| |
| static constexpr uint8_t | NCODEC_4 = 0x6 |
| |
| static constexpr uint8_t | NCODEC_4_5 = 0x7 |
| |
| static constexpr uint8_t | NCODEC_5 = 0x8 |
| |
| static constexpr uint8_t | NCODEC_5_5 = 0x9 |
| |
| static constexpr uint8_t | NCODEC_6 = 0xA |
| |
| static constexpr uint8_t | OUT_PWR_ON = makeBit(0, 1) |
| |
| static constexpr RegAddr | OVRF_STATUS_PLLR_ADDR {0, 11} |
| |
| static constexpr RegAddr | PGAL_HPLCOM_VOL_ADDR {0, 53} |
| |
| static constexpr RegAddr | PGAL_HPLOUT_VOL_ADDR {0, 46} |
| |
| static constexpr RegAddr | PGAL_HPRCOM_VOL_ADDR {0, 67} |
| |
| static constexpr RegAddr | PGAL_HPROUT_VOL_ADDR {0, 60} |
| |
| static constexpr RegAddr | PGAL_LLOPM_VOL_ADDR {0, 81} |
| |
| static constexpr RegAddr | PGAL_RLOPM_VOL_ADDR {0, 88} |
| |
| static constexpr RegAddr | PGAR_HPLCOM_VOL_ADDR {0, 56} |
| |
| static constexpr RegAddr | PGAR_HPLOUT_VOL_ADDR {0, 49} |
| |
| static constexpr RegAddr | PGAR_HPRCOM_VOL_ADDR {0, 70} |
| |
| static constexpr RegAddr | PGAR_HPROUT_VOL_ADDR {0, 63} |
| |
| static constexpr RegAddr | PGAR_LLOPM_VOL_ADDR {0, 84} |
| |
| static constexpr RegAddr | PGAR_RLOPM_VOL_ADDR {0, 91} |
| |
| static constexpr RegAddr | PLL_PROGA_ADDR {0, 3} |
| |
| static constexpr RegAddr | PLL_PROGB_ADDR {0, 4} |
| |
| static constexpr RegAddr | PLL_PROGC_ADDR {0, 5} |
| |
| static constexpr RegAddr | PLL_PROGD_ADDR {0, 6} |
| |
| static constexpr RegAddr | POP_REDUCTION_ADDR {0, 42} |
| |
| static constexpr RegAddr | POWER_STATUS_ADDR {0, 94} |
| |
| static constexpr RegAddr | RADC_VOL_ADDR {0, 16} |
| |
| static constexpr RegAddr | RAGC_CTRLA_ADDR {0, 29} |
| |
| static constexpr RegAddr | RAGC_CTRLB_ADDR {0, 30} |
| |
| static constexpr RegAddr | RAGC_CTRLC_ADDR {0, 31} |
| |
| static constexpr RegAddr | RAGC_GAIN_ADDR {0, 33} |
| |
| static constexpr RegAddr | RAGC_NGATE_DEBOUNCE_ADDR {0, 35} |
| |
| static constexpr RegAddr | RAGC_PROG_ATTACK_ADDR {0, 105} |
| |
| static constexpr RegAddr | RAGC_PROG_DECAY_ADDR {0, 106} |
| |
| static constexpr RegAddr | RCH_ADC_HPF_D1_LSB_ADDR {1, 76} |
| |
| static constexpr RegAddr | RCH_ADC_HPF_D1_MSB_ADDR {1, 75} |
| |
| static constexpr RegAddr | RCH_ADC_HPF_N0_LSB_ADDR {1, 72} |
| |
| static constexpr RegAddr | RCH_ADC_HPF_N0_MSB_ADDR {1, 71} |
| |
| static constexpr RegAddr | RCH_ADC_HPF_N1_LSB_ADDR {1, 74} |
| |
| static constexpr RegAddr | RCH_ADC_HPF_N1_MSB_ADDR {1, 73} |
| |
| static constexpr RegAddr | RCH_DEEMP_D0_LSB_ADDR {1, 52} |
| |
| static constexpr RegAddr | RCH_DEEMP_D0_MSB_ADDR {1, 51} |
| |
| static constexpr RegAddr | RCH_DEEMP_N0_LSB_ADDR {1, 48} |
| |
| static constexpr RegAddr | RCH_DEEMP_N0_MSB_ADDR {1, 47} |
| |
| static constexpr RegAddr | RCH_DEEMP_N1_LSB_ADDR {1, 50} |
| |
| static constexpr RegAddr | RCH_DEEMP_N1_MSB_ADDR {1, 49} |
| |
| static constexpr RegAddr | RCH_FX_D1_LSB_ADDR {1, 40} |
| |
| static constexpr RegAddr | RCH_FX_D1_MSB_ADDR {1, 39} |
| |
| static constexpr RegAddr | RCH_FX_D2_LSB_ADDR {1, 42} |
| |
| static constexpr RegAddr | RCH_FX_D2_MSB_ADDR {1, 41} |
| |
| static constexpr RegAddr | RCH_FX_D4_LSB_ADDR {1, 44} |
| |
| static constexpr RegAddr | RCH_FX_D4_MSB_ADDR {1, 43} |
| |
| static constexpr RegAddr | RCH_FX_D5_LSB_ADDR {1, 46} |
| |
| static constexpr RegAddr | RCH_FX_D5_MSB_ADDR {1, 45} |
| |
| static constexpr RegAddr | RCH_FX_N0_LSB_ADDR {1, 28} |
| |
| static constexpr RegAddr | RCH_FX_N0_MSB_ADDR {1, 27} |
| |
| static constexpr RegAddr | RCH_FX_N1_LSB_ADDR {1, 30} |
| |
| static constexpr RegAddr | RCH_FX_N1_MSB_ADDR {1, 29} |
| |
| static constexpr RegAddr | RCH_FX_N2_LSB_ADDR {1, 32} |
| |
| static constexpr RegAddr | RCH_FX_N2_MSB_ADDR {1, 31} |
| |
| static constexpr RegAddr | RCH_FX_N3_LSB_ADDR {1, 34} |
| |
| static constexpr RegAddr | RCH_FX_N3_MSB_ADDR {1, 33} |
| |
| static constexpr RegAddr | RCH_FX_N4_LSB_ADDR {1, 36} |
| |
| static constexpr RegAddr | RCH_FX_N4_MSB_ADDR {1, 35} |
| |
| static constexpr RegAddr | RCH_FX_N5_LSB_ADDR {1, 38} |
| |
| static constexpr RegAddr | RCH_FX_N5_MSB_ADDR {1, 37} |
| |
| static constexpr uint8_t | RDAC2RCH = makeBit(1, 1) |
| |
| static constexpr uint8_t | RDAC_PWR_ON = makeBit(6, 1) |
| |
| static constexpr RegAddr | RDAC_VOL_ADDR {0, 44} |
| |
| static constexpr RegAddr | RLOPM_CTRL_ADDR {0, 93} |
| |
| static constexpr uint8_t | ROUTE_ON = makeBit(7, 1) |
| |
| static constexpr RegAddr | RT_IRQ_FLAGS_ADDR {0, 97} |
| |
| static constexpr RegAddr | SAMPLE_RATE_SEL_ADDR {0, 2} |
| |
| static constexpr RegAddr | SHORT_DETECT_ADDR {0, 95} |
| |
| static constexpr RegAddr | SOFT_RESET_ADDR {0, 1} |
| |
| static constexpr RegAddr | STICKY_IRQ_FLAGS_ADDR {0, 96} |
| |
Header only C++ driver for the TLV320AIC3104 audio codec.
The TLV320AIC3104 uses a paged 8 bit register map (page select register at page 0 / register 0, pages 0 and 1 are used by this device). Provides soft reset, PLL/clock configuration (P/Q/J/D PLL plus a shared ADC/DAC "NCODEC" divider), DAI (I2S) format configuration and output/input path configuration including volume and mute control for the headphone (HPLOUT/HPROUT) and fully differential line (LOP/M) outputs, and the microphone/line input PGAs.