Introduction
CircuitPython driver for the TLV320DAC3100 I2S DAC
Dependencies
This driver depends on:
Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle or individual libraries can be installed using circup.
Installing from PyPI
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:
pip3 install adafruit-circuitpython-tlv320
To install system-wide (this may be required in some cases):
sudo pip3 install adafruit-circuitpython-tlv320
To install in a virtual environment in your current project:
mkdir project-name && cd project-name
python3 -m venv .venv
source .env/bin/activate
pip3 install adafruit-circuitpython-tlv320
Installing to a Connected CircuitPython Device with Circup
Make sure that you have circup
installed in your Python environment.
Install it with the following command if necessary:
pip3 install circup
With circup
installed and your CircuitPython device connected use the
following command to install:
circup install adafruit_tlv320
Or the following command to update an existing version:
circup update
Usage Example
import audiobusio
import audiocore
import board
import adafruit_tlv320
i2c = board.I2C()
dac = adafruit_tlv320.TLV320DAC3100(i2c)
# set mclk, sample rate & bit depth
dac.configure_clocks(sample_rate=44100, bit_depth=16)
# use headphones
# helper function for default settings
dac.headphone_output = True
dac.headphone_volume = -20 # dB
# or use speaker
# helper function for default settings
# dac.speaker_output = True
# dac.speaker_volume = -15 # dB
audio = audiobusio.I2SOut(board.I2S_BCLK, board.I2S_WS, board.I2S_DIN)
Documentation
API documentation for this library can be found on Read the Docs.
For information on building library documentation, please check out this guide.
Contributing
Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.
Table of Contents
Examples
API Reference
- API Reference
adafruit_tlv320
Page0Registers
Page1Registers
Page3Registers
PagedRegisterBase
TLV320DAC3100
TLV320DAC3100.bit_depth
TLV320DAC3100.codec_interface
TLV320DAC3100.config_delay_divider()
TLV320DAC3100.config_mic_bias()
TLV320DAC3100.configure_analog_inputs()
TLV320DAC3100.configure_clocks()
TLV320DAC3100.configure_headphone_pop()
TLV320DAC3100.dac_flags
TLV320DAC3100.dac_volume_control_mode
TLV320DAC3100.dac_volume_step
TLV320DAC3100.din_input
TLV320DAC3100.gpio1_mode
TLV320DAC3100.headphone_left_gain
TLV320DAC3100.headphone_left_mute
TLV320DAC3100.headphone_lineout
TLV320DAC3100.headphone_output
TLV320DAC3100.headphone_right_gain
TLV320DAC3100.headphone_right_mute
TLV320DAC3100.headphone_shorted
TLV320DAC3100.headphone_volume
TLV320DAC3100.headset_status
TLV320DAC3100.hpl_gain_applied
TLV320DAC3100.hpr_gain_applied
TLV320DAC3100.int1_source()
TLV320DAC3100.int2_sources()
TLV320DAC3100.left_dac
TLV320DAC3100.left_dac_channel_volume
TLV320DAC3100.left_dac_mute
TLV320DAC3100.left_dac_path
TLV320DAC3100.manual_headphone_driver()
TLV320DAC3100.manual_headphone_left_volume()
TLV320DAC3100.manual_headphone_right_volume()
TLV320DAC3100.mclk_freq
TLV320DAC3100.overtemperature
TLV320DAC3100.reset()
TLV320DAC3100.reset_headphone_on_scd
TLV320DAC3100.reset_speaker_on_scd
TLV320DAC3100.right_dac
TLV320DAC3100.right_dac_channel_volume
TLV320DAC3100.right_dac_mute
TLV320DAC3100.right_dac_path
TLV320DAC3100.sample_rate
TLV320DAC3100.set_headset_detect()
TLV320DAC3100.set_input_common_mode()
TLV320DAC3100.speaker_gain
TLV320DAC3100.speaker_gain_applied
TLV320DAC3100.speaker_mute
TLV320DAC3100.speaker_output
TLV320DAC3100.speaker_shorted
TLV320DAC3100.speaker_volume
TLV320DAC3100.speaker_wait_time
TLV320DAC3100.vol_adc_db
TLV320DAC3100.vol_adc_hysteresis
TLV320DAC3100.vol_adc_pin_control
TLV320DAC3100.vol_adc_rate
TLV320DAC3100.vol_adc_use_mclk