Raspberry Pio Pico Drivers project
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes
rpp_driver::Adau1361Lower Class Referenceabstract

lower part of the Adau1361 CODEC controller class. More...

#include <adau1361lower.hpp>

Inheritance diagram for rpp_driver::Adau1361Lower:
Inheritance graph
[legend]
Collaboration diagram for rpp_driver::Adau1361Lower:
Collaboration graph
[legend]

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::I2cMasteri2c_
 Internal variable to hold the I2C controller variable.
 
const unsigned int device_addr_
 Internal variable to hold the I2C device address.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Adau1361Lower()

rpp_driver::Adau1361Lower::Adau1361Lower ( ::rpp_driver::I2cMaster controller,
unsigned int  i2c_device_addr 
)

Construct a new object.

Parameters
controllerI2C master controller.
i2c_device_addrADAU1361A 7bits I2C device address. Refer device deta sheet for details.

Member Function Documentation

◆ ConfigurePll()

virtual void rpp_driver::Adau1361Lower::ConfigurePll ( unsigned int  fs,
unsigned int  master_clock 
)
virtual

Initialize the PLL with given fs and master clock.

Parameters
fsSampling Frequency [Hz].
master_clockMaster 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().

◆ ConfigureSignalPath()

virtual void rpp_driver::Adau1361Lower::ConfigureSignalPath ( )
pure virtual

Initialize registers for the signal routing.

This is baord dependent initialization.

Need to call after InitializeRegisters().

Implemented in rpp_driver::UmbAdau1361Lower.

◆ ConfigureSrc()

virtual void rpp_driver::Adau1361Lower::ConfigureSrc ( unsigned int  fs)
virtual

Initialize the SRC with given fs clock.

Parameters
fsSampling frequency in Hz.

Must call after EnableCore().

◆ DisablePLL()

virtual void rpp_driver::Adau1361Lower::DisablePLL ( )
virtual

stop PLL to re-program.

Must call after InitializeCore().

◆ EnableCore()

virtual void rpp_driver::Adau1361Lower::EnableCore ( )
virtual

Initialize the core part of the ADAU1361A.

Must call after ConfigurePLL(), followings WailtPLLLock().

◆ InitializeCore()

virtual void rpp_driver::Adau1361Lower::InitializeCore ( )
virtual

Reset the core for fresh procedure.

Must call at first when initialize codec.

◆ InitializeRegisters()

virtual void rpp_driver::Adau1361Lower::InitializeRegisters ( )
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()

◆ IsI2CDeviceExisting()

virtual bool rpp_driver::Adau1361Lower::IsI2CDeviceExisting ( )
virtual

Check whether I2C device exist or not.

Returns
true if device exist. false if not exist.

◆ SendCommand()

virtual void rpp_driver::Adau1361Lower::SendCommand ( const uint8_t  command[],
int  size 
)
virtual

send one command to ADAU1361.

Service function for the ADAu1361 board implementer.

Parameters
commandCommand data array. It have to have register address of ADAU1361 in first two bytes.
sizeNumber 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.

  • command[0] : USB of the register address. 0x40.
  • command[1] : LSB of the register address.
  • command[2] : Value to right the register.

◆ SendCommandTable()

virtual void rpp_driver::Adau1361Lower::SendCommandTable ( const uint8_t  table[][3],
int  rows 
)
virtual

Send multiple commands to ADAU1361.

Parameters
tableCommand 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.
rowsNumber 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

◆ SetAuxInputGain()

virtual void rpp_driver::Adau1361Lower::SetAuxInputGain ( float  left_gain,
float  right_gain,
bool  mute 
)
virtual

Set the aux input gain and enable the relevant mixer.

Parameters
left_gainGain by dB. [6 .. -12], The gain value outside of the acceptable range will be saturated.
right_gainGain by dB. [6 .. -12], The gain value outside of the acceptable range will be saturated.
muteTrue if mute-on, false if mute-off

Other input lines are not killed. To kill it, user have to mute them explicitly.

◆ SetHpOutputGain()

virtual void rpp_driver::Adau1361Lower::SetHpOutputGain ( float  left_gain,
float  right_gain,
bool  mute 
)
virtual

Set the headphone output gain and enable the relevant mixer.

Parameters
left_gainGain by dB. [6 .. -12], The gain value outside of the acceptable range will be saturated.
right_gainGain by dB. [6 .. -12], The gain value outside of the acceptable range will be saturated.
muteTrue 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.

◆ SetLineInputGain()

virtual void rpp_driver::Adau1361Lower::SetLineInputGain ( float  left_gain,
float  right_gain,
bool  mute 
)
virtual

Set the line input gain and enable the relevant mixer.

Parameters
left_gainGain by dB. [6 .. -12], The gain value outside of the acceptable range will be saturated.
right_gainGain by dB. [6 .. -12], The gain value outside of the acceptable range will be saturated.
muteTrue 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.

◆ SetLineOutputGain()

virtual void rpp_driver::Adau1361Lower::SetLineOutputGain ( float  left_gain,
float  right_gain,
bool  mute 
)
virtual

Set the line output gain and enable the relevant mixer.

Parameters
left_gainGain by dB. [6 .. -12], The gain value outside of the acceptable range will be saturated.
right_gainGain by dB. [6 .. -12], The gain value outside of the acceptable range will be saturated.
muteTrue if mute-on, false if mute-off

Other output lines are not killed. To kill it, user have to mute them explicitly.

◆ WaitPllLock()

virtual void rpp_driver::Adau1361Lower::WaitPllLock ( void  )
virtual

wait until PLL locks.

Service function for the ADAu1361 board implementer.

Read the PLL status and repeat it until the PLL locks.


The documentation for this class was generated from the following file: