Raspberry Pio Pico Drivers project
|
lower part of the Adau1361 CODEC controller class. More...
#include <adau1361lower.hpp>
Public Member Functions | |
Adau1361Lower (::rpp_driver::I2cMaster &controller, unsigned int i2c_device_addr) | |
Construct a new object. | |
virtual void | SendCommand (const uint8_t command[], int size) |
send one command to ADAU1361. | |
virtual void | SendCommandTable (const uint8_t table[][3], int rows) |
Send multiple commands to ADAU1361. | |
virtual bool | IsI2CDeviceExisting () |
Check whether I2C device exist or not. | |
virtual void | InitializeCore () |
Reset the core for fresh procedure. | |
virtual void | DisablePLL () |
stop PLL to re-program. | |
virtual void | WaitPllLock (void) |
wait until PLL locks. | |
virtual void | ConfigurePll (unsigned int fs, unsigned int master_clock) |
Initialize the PLL with given fs and master clock. | |
virtual void | ConfigureSrc (unsigned int fs) |
Initialize the SRC with given fs clock. | |
virtual void | EnableCore () |
Initialize the core part of the ADAU1361A. | |
virtual void | InitializeRegisters () |
Initialize registers for the chip operation. | |
virtual void | ConfigureSignalPath ()=0 |
Initialize registers for the signal routing. | |
virtual void | SetLineInputGain (float left_gain, float right_gain, bool mute) |
Set the line input gain and enable the relevant mixer. | |
virtual void | SetAuxInputGain (float left_gain, float right_gain, bool mute) |
Set the aux input gain and enable the relevant mixer. | |
virtual void | SetLineOutputGain (float left_gain, float right_gain, bool mute) |
Set the line output gain and enable the relevant mixer. | |
virtual void | SetHpOutputGain (float left_gain, float right_gain, bool mute) |
Set the headphone output gain and enable the relevant mixer. | |
Protected Attributes | |
::rpp_driver::I2cMaster & | i2c_ |
Internal variable to hold the I2C controller variable. | |
const unsigned int | device_addr_ |
Internal variable to hold the I2C device address. | |
lower part of the Adau1361 CODEC controller class.
This class is helper class for the Adau1361 class.
The ConfigureSignalPath() member function is a pure virtual method. This function is depend on the signal routing of the CODEC and it is depend on the circuit board. User must derive a subclass of this class to implement that function for his/her board. As an example of sub-class, UmbAdau1361Lower class is provided.
To initialize codec, follow the sequence. This is done by the Adau1361 class.
After these initialization, the ADC, DAC, Mixer and signals by the I2S protocols are alive. All volumes are muted.
rpp_driver::Adau1361Lower::Adau1361Lower | ( | ::rpp_driver::I2cMaster & | controller, |
unsigned int | i2c_device_addr | ||
) |
Construct a new object.
controller | I2C master controller. |
i2c_device_addr | ADAU1361A 7bits I2C device address. Refer device deta sheet for details. |
|
virtual |
Initialize the PLL with given fs and master clock.
fs | Sampling Frequency [Hz]. |
master_clock | Master Clock input to the CODEC [Hz]. |
At first, initialize the PLL based on the given fst and master clock. Then, setup the Converter sampling rate.
Must call after DisablePLL().
|
pure virtual |
Initialize registers for the signal routing.
This is baord dependent initialization.
Need to call after InitializeRegisters().
Implemented in rpp_driver::UmbAdau1361Lower.
|
virtual |
Initialize the SRC with given fs clock.
fs | Sampling frequency in Hz. |
Must call after EnableCore().
|
virtual |
stop PLL to re-program.
Must call after InitializeCore().
|
virtual |
Initialize the core part of the ADAU1361A.
Must call after ConfigurePLL(), followings WailtPLLLock().
|
virtual |
Reset the core for fresh procedure.
Must call at first when initialize codec.
|
virtual |
Initialize registers for the chip operation.
This is is board independent initialization.
The, gain, ADC, Mixer and I2S are set in this routine. Clock must working well before calling this routine.
This function clean-up. Need to call after ConfigureSrc() and before InitializeSignalPath()
|
virtual |
Check whether I2C device exist or not.
|
virtual |
send one command to ADAU1361.
Service function for the ADAu1361 board implementer.
command | Command data array. It have to have register address of ADAU1361 in first two bytes. |
size | Number of bytes in the command, including the register address. |
Send one complete command to ADAU3161 by I2C. In the typical case, the command length is 3.
|
virtual |
Send multiple commands to ADAU1361.
table | Command table. All commands are stored in one row. Each row has only 1 byte data after reg address. In other words, each row has 3 bytes length. |
rows | Number of the rows in the table. |
Service function for the ADAu1361 board implementer.
Send a list of command to ADAU1361. All commands has 3 bytes length. That mean, after two byte register address, only 1 byte data pay load is allowed. Commands are sent by I2C
|
virtual |
Set the aux input gain and enable the relevant mixer.
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. |
mute | True if mute-on, false if mute-off |
Other input lines are not killed. To kill it, user have to mute them explicitly.
|
virtual |
Set the headphone output gain and enable the relevant mixer.
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. |
mute | True if mute-on, false if mute-off |
Other out line like line in are not killed. To kill it, user have to mute them explicitly.
|
virtual |
Set the line input gain and enable the relevant mixer.
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. |
mute | True if mute-on, false if mute-off |
This gain control function uses the single-end negative input only. Other input signal of the line in like positive signal or diff signal are killed.
Other input line like aux are not killed. To kill it, user have to mute them explicitly.
|
virtual |
Set the line output gain and enable the relevant mixer.
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. |
mute | True if mute-on, false if mute-off |
Other output lines are not killed. To kill it, user have to mute them explicitly.
|
virtual |
wait until PLL locks.
Service function for the ADAu1361 board implementer.
Read the PLL status and repeat it until the PLL locks.