Raspberry Pio Pico Drivers project
|
Analog Device ADAU1361A audio codec control class. More...
#include <adau1361.hpp>
Public Types | |
enum | CodecChannel { LineInput , AuxInput , LineOutput , HeadphoneOutput } |
Signal path definition. More... | |
Public Member Functions | |
Adau1361 (unsigned int fs, unsigned int master_clock, Adau1361Lower &adau1361_lower) | |
constructor. | |
virtual void | Start (void) |
Set up the ADAU1361 codec, and then, start the codec. | |
virtual void | SetGain (CodecChannel channel, float left_gain, float right_gain) |
Set channel gain. | |
virtual void | Mute (CodecChannel channel, bool mute=true) |
Mute the specific channel. | |
Analog Device ADAU1361A audio codec control class.
Control the ADAU1361A through the lower level controller class for example UmbAdau1361Lower. Such the lower level controller variable is passed through the adau1361_lower parameter of the constructor.
The following is an example code to create an Adau1361 variable.
In the case of the testing of the user program which uses this class, a programmer can use the pre-defined mock class rpp_driver::MockAdau1361 inside adau1361.hpp.
Signal path definition.
This type specify the CODEC input / output channel to change the gain and mute.
|
explicit |
constructor.
fs | Sampling frequency[Hz] |
master_clock | Input master clock frequency to the MCLK pin[Hz] |
adau1361_lower | Helper object. |
initialize the internal variables. This constructor assumes the codec receive a master clock from outside. And output the I2C clocks as clock master.
The fs parameter is the sampling frequency of the CODEC in Hz. This parameter is limited as one of the following :
The master_clock parameter is the MCLK input to the ADAU1361 in Hz. This parameter must be one of followings :
Note : Due to the limitation of the MCLK of hardware and PLL, only 8, 12, 13, 14.4, 12.288, 19.2MHz are tested
The analog signals are routed to the physical pins as following :
|
virtual |
Mute the specific channel.
channel | Channel to mute on / off |
mute | Mute-on if true. Mute-off if false. |
|
virtual |
Set channel gain.
channel | CODEC input output channels like line-in, line-out, aux-in, headphone-out |
left_gain | Gain by dB. [6 .. -12], The gain value outside of the acceptable range will be saturated. |
right_gain | Gain by dB. [6 .. -12], The gain value outside of the acceptable range will be saturated. |
|
virtual |
Set up the ADAU1361 codec, and then, start the codec.
This method starts the ADAU1361 AD/DA conversion and I2S communication.
The line in is configured to use the Single-End negative input. This is funny but ADAU1361 data sheet specifies to do it. The positive in and diff in are killed. All biases are set as "normal".
The CODEC is configured as master mode. That mean, BCLK and WS are given from ADAU1361 to the micro processor.
At initial state, ADAU1361 is set as :