First publishment of Shimabara Audio Codec Controller library. Including code for ADAU1361 and UMB-ADAU1361A. Working pretty fine. Checked with LPCXpresso 4337 and Unzen_lpc4337
Dependents: unzen_sample_LPC4088_quickstart unzen_sample_lpcxpresso_4337_callbacks unzen_sample_nucleo_f746 unzen_delay_sample_nucleo_f746 ... more
Adau1361 Class Reference
ADAU1361 audio codec controller. More...
#include <adau1361.h>
Inherits shimabara::BaseAudioCodec.
Inherited by UMB_ADAU1361A.
Public Member Functions | |
Adau1361 (Fs_Type Fs, I2C &controler, unsigned int Addr) | |
constructor. | |
virtual void | start (void) |
Set up the ADAU1361 codec, and then, start the codec. | |
virtual void | set_line_input_gain (float left_gain, float right_gain, bool mute=false) |
Set the line input gain and enable the relevant mixer. | |
virtual void | set_aux_input_gain (float left_gain, float right_gain, bool mute=false) |
Set the aux input gain and enable the relevant mixer. | |
virtual void | set_line_output_gain (float left_gain, float right_gain, bool mute=false) |
Set the line output gain and enable the relevant mixer. | |
virtual void | set_hp_output_gain (float left_gain, float right_gain, bool mute=false) |
Set the headphone output gain and enable the relevant mixer. | |
virtual void | set_mic_input_gain (float left_gain, float right_gain, bool mute=false) |
Set the mic input gain and enable the relevant mixer. | |
Protected Member Functions | |
virtual void | configure_pll (void)=0 |
configuration of PLL for the desired core clock | |
virtual void | configure_board (void)=0 |
configuration of the ADAU1361 for the codec board | |
virtual void | send_command (const char command[], int size) |
Service function for the ADAu1361 board implementer. | |
virtual void | send_command_table (const char table[][3], int rows) |
send one command to ADAU1361. | |
virtual void | wait_pll_lock (void) |
wait until PLL locks. |
Detailed Description
ADAU1361 audio codec controller.
This class sends a set of commands to control an ADAU1361 codec. This class is template for all ADAU1361 based codec board.
To implement the real board, you must override the configure_pll() method and configure_board method.
Definition at line 27 of file adau1361.h.
Constructor & Destructor Documentation
constructor.
- Parameters:
-
controler Pass the I2C controler object. Fs Sampling frequency. Addr I2C device address. value range is from 0 to 127
initialize the internal variables.
Definition at line 12 of file adau1361.cpp.
Member Function Documentation
virtual void configure_board | ( | void | ) | [protected, pure virtual] |
configuration of the ADAU1361 for the codec board
A pure virutal function.
This member function must be overriden by inherited class. Before the calling of this function, the codec is initialized as default state except PLL. PLL is set by configure_pll() method before calling this function.
This member funciton must configure the ADAU1361 registered based on the board circuit. For example, internal signal pass or bias.
Implemented in UMB_ADAU1361A.
virtual void configure_pll | ( | void | ) | [protected, pure virtual] |
configuration of PLL for the desired core clock
A pure virutal function.
This member function must be overriden by inherited class. Before the call of this function, R0 is initialized as 0 and then, set the clock source is PLL.
This member funciton must configure the PLL correctly, confirm the PLL lock status. And then set the SRC.
Note that the setting SRC before PLL lock may fail.
Implemented in UMB_ADAU1361A.
void send_command | ( | const char | command[], |
int | size | ||
) | [protected, virtual] |
Service function for the ADAu1361 board implementer.
send one command to ADAU1361.
- Parameters:
-
command command data array. It have to have register addess of ADAU1361 in first two bytes. size number of bytes in the command, including the regsiter address.
Send one complete command to ADAU3161 by I2C.
Definition at line 83 of file adau1361.cpp.
void send_command_table | ( | const char | table[][3], |
int | rows | ||
) | [protected, virtual] |
send one command to ADAU1361.
- Parameters:
-
table command table. All commands are stored in one row. Each row has only 1 byte data after reg address. 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 payload is allowed. Commadns are sent by I2C
Definition at line 90 of file adau1361.cpp.
void set_aux_input_gain | ( | float | left_gain, |
float | right_gain, | ||
bool | mute = false |
||
) | [virtual] |
Set the aux input gain and enable the relevant mixer.
- Parameters:
-
left_gain Gain by dB. The gain value outside of the acceptable range will be saturated. right_gain Gain by dB. The gain value outside of the acceptable range will be saturated. mute set true to mute
Other input lines are not killed. To kill it, user have to mute them explicitly.
Reimplemented from BaseAudioCodec.
Definition at line 171 of file adau1361.cpp.
void set_hp_output_gain | ( | float | left_gain, |
float | right_gain, | ||
bool | mute = false |
||
) | [virtual] |
Set the headphone output gain and enable the relevant mixer.
- Parameters:
-
left_gain Gain by dB. The gain value outside of the acceptable range will be saturated. right_gain Gain by dB. The gain value outside of the acceptable range will be saturated. mute set true to mute
Other out line like line in are not killed. To kill it, user have to mute them explicitly.
Reimplemented from BaseAudioCodec.
Definition at line 239 of file adau1361.cpp.
void set_line_input_gain | ( | float | left_gain, |
float | right_gain, | ||
bool | mute = false |
||
) | [virtual] |
Set the line input gain and enable the relevant mixer.
- Parameters:
-
left_gain Gain by dB. The gain value outside of the acceptable range will be saturated. right_gain Gain by dB. The gain value outside of the acceptable range will be saturated. mute set true to mute
As same as start(), 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.
Reimplemented from BaseAudioCodec.
Definition at line 135 of file adau1361.cpp.
void set_line_output_gain | ( | float | left_gain, |
float | right_gain, | ||
bool | mute = false |
||
) | [virtual] |
Set the line output gain and enable the relevant mixer.
- Parameters:
-
left_gain Gain by dB. The gain value outside of the acceptable range will be saturated. right_gain Gain by dB. The gain value outside of the acceptable range will be saturated. mute set true to mute
Other output lines are not killed. To kill it, user have to mute them explicitly.
Reimplemented from BaseAudioCodec.
Definition at line 209 of file adau1361.cpp.
void set_mic_input_gain | ( | float | left_gain, |
float | right_gain, | ||
bool | mute = false |
||
) | [virtual, inherited] |
Set the mic input gain and enable the relevant mixer.
- Parameters:
-
left_gain Gain by dB. The gain value outside of the acceptable range will be saturated. right_gain Gain by dB. The gain value outside of the acceptable range will be saturated. mute set true to mute
Definition at line 20 of file baseaudiocodec.cpp.
void start | ( | void | ) | [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 datasheet 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.
Implements BaseAudioCodec.
Definition at line 111 of file adau1361.cpp.
void wait_pll_lock | ( | void | ) | [protected, virtual] |
wait until PLL locks.
Service function for the ADAu1361 board implementer.
Read the PLL status and repeat it until the PLL locks.
Definition at line 100 of file adau1361.cpp.
Generated on Tue Jul 12 2022 15:39:04 by 1.7.2