CARME-M4 Sound controller.
More...
|
file | cs42l51.h |
| CS42L51 codec support functions.
|
|
file | cs42l51.c |
| CS42L51 codec support functions.
|
|
CARME-M4 Sound controller.
#define ADC_CONFIGURE 0x07 |
#define ADCX_ATTENUATOR 0x0D |
Cmd ADCx attenuator
Definition at line 97 of file cs42l51.h.
#define ADCX_MIXER_VOLUME_CONTROL 0x0F |
Cmd ADCx mixer volume ctrl
Definition at line 98 of file cs42l51.h.
#define ALC_ENABLE_AND_ATTACK 0x1C |
Cmd ALC enable and attack
Definition at line 111 of file cs42l51.h.
#define ALC_THRESHOLD 0x1E |
#define ALCA_AND_PGAA_CONTROL 0x0A |
Cmd ALCA and PGAA ctrl
Definition at line 95 of file cs42l51.h.
#define ALCB_AND_PGAB_CONTROL 0x0B |
Cmd ALCB and PGAB ctrl
Definition at line 96 of file cs42l51.h.
#define AOUTA_VOLUME_CONTROL 0x16 |
Cmd AOutA vol ctrl
Definition at line 105 of file cs42l51.h.
#define AOUTB_VOLUME_CONTROL 0x17 |
Cmd AOutB vol ctrl
Definition at line 106 of file cs42l51.h.
#define BEEP_AND_TONE_CONFIGURATION 0x14 |
Cmd Beep and tone cfg
Definition at line 103 of file cs42l51.h.
#define BEEP_FREQUENCY_AND_TIMING 0x12 |
Cmd Beep freq and timing
Definition at line 101 of file cs42l51.h.
#define BEEP_OFF_TIME_AND_VOLUME 0x13 |
Cmd Beep off time and vol
Definition at line 102 of file cs42l51.h.
#define CHARGE_PUMP_FREQUENCY 0x21 |
Cmd Charge pump freq
Definition at line 116 of file cs42l51.h.
#define CODEC_ADDRESS 0x94 |
I2C address of codec
Definition at line 84 of file cs42l51.h.
I2C bus to codec
Definition at line 80 of file cs42l51.h.
I2S bus to codec
Definition at line 81 of file cs42l51.h.
#define CODEC_I2S_CLK RCC_APB1Periph_SPI2 |
#define CODEC_I2S_EXT I2S2ext |
I2Sext to codec
Definition at line 82 of file cs42l51.h.
#define DAC_OUTPUT_CONTROL 0x08 |
Cmd DAC output ctrl
Definition at line 93 of file cs42l51.h.
#define INTERFACE_CONTROL 0x04 |
Cmd Interface ctrl
Definition at line 89 of file cs42l51.h.
#define LIMITER_ATTACK 0x1B |
Cmd Limiter attack
Definition at line 110 of file cs42l51.h.
#define LIMITER_RELEASE 0x1A |
Cmd Limiter release
Definition at line 109 of file cs42l51.h.
#define LIMITER_THRESHOLD 0x19 |
Cmd Limiter threshold
Definition at line 108 of file cs42l51.h.
#define MIC_POWER_AND_SPEED 0x03 |
Cmd Mic power and speed
Definition at line 88 of file cs42l51.h.
#define PCM_CHANNEL_MIXER 0x18 |
Cmd PCM channel mixer
Definition at line 107 of file cs42l51.h.
#define PCMA_MIXER_VOLUME_CONTROL 0x10 |
Cmd PCMA mixer volume ctrl
Definition at line 99 of file cs42l51.h.
#define PCMB_MIXER_VOLUME_CONTROL 0x11 |
Cmd PCMB mixer volume ctrl
Definition at line 100 of file cs42l51.h.
#define POWER_CONTROL 0x02 |
Cmd Power ctrl
Definition at line 87 of file cs42l51.h.
#define STATUS_REGISTER 0x20 |
Cmd Status register
Definition at line 115 of file cs42l51.h.
#define TONE_CONTROL 0x15 |
void CS42L51_AudioInterface_Init |
( |
void |
| ) |
|
Codec CS42L51 audio line configuration.
- Returns
- None
Definition at line 275 of file cs42l51.c.
void CS42L51_CtrlInterface_Init |
( |
void |
| ) |
|
Codec CS42L51 ctrl line configuration and register initialization.
- Returns
- None
Definition at line 263 of file cs42l51.c.
uint8_t CS42L51_Init |
( |
int8_t |
Volume | ) |
|
Codec CS42L51 low-layer and register initialization.
- Parameters
-
- Returns
- 1 if no codec is found, else 0.
Set mic power and speed
- Select single speed mode (4-50 kHz)
Configure the interface
- DAC and ADC interface is I2S
Set mic control
Set ADC control configuration
- Enable the high-pass filter
Set the ADC configuration
- Select the line in as source
Set DAC output configuration
Set DAC configuration
- Data selection is 00 for PCM or 01 for signal processing engine
- Soft ramp
Set PCMx mixer volume
Set PCM channel mixer AOUTA = Channel L AOUTB = Channel R ADCA = Channel L ADCB = Channel R
Set limiter threshold
- Maximum threshold = 0 dB
- Cushion threshold = 0 dB
Limiter release rate
- Disabled
- Both channel
- slowest release
Limiter attack rate
Enable periodic beep sound
- On time: 5.2 s
- Off time: 5.2 s
- Frequency: 260.87 Hz (C4)
- Volume: +12 dB
- Repeat beep
Definition at line 133 of file cs42l51.c.
void CS42L51_Mute |
( |
uint8_t |
on | ) |
|
Mute the CS42L51 output.
- Parameters
-
[in] | on | if 0 the codec will unmute the output, else it will mute it. |
- Returns
- None
Definition at line 369 of file cs42l51.c.
uint8_t CS42L51_ReadReg |
( |
uint8_t |
reg | ) |
|
Read a byte from a register of the cs42l51 codec.
- Parameters
-
[in] | reg | Register address to read |
- Returns
- Data
Definition at line 117 of file cs42l51.c.
uint8_t CS42L51_Status |
( |
void |
| ) |
|
Get the status of the cs42l51 codec.
- Returns
- Status register
Definition at line 315 of file cs42l51.c.
void CS42L51_VolumeOutCtrl |
( |
int8_t |
Volume | ) |
|
Codec CS42L51 output volume control.
- Parameters
-
[in] | Volume | Binary code volume setting
0001 1000 +12.0 dB
... ...
0000 0000 0.0 dB
1111 1111 -0.5 dB
1111 1110 -1.0 dB
... ...
0011 0100 -102 dB
... ...
0001 1001 -102 dB
|
- Returns
- None
Definition at line 337 of file cs42l51.c.
void CS42L51_WriteReg |
( |
uint8_t |
reg, |
|
|
uint8_t |
data |
|
) |
| |
Write a byte to a register of the cs42l51 codec.
- Parameters
-
[in] | reg | Register address to write |
[in] | data | Data |
- Returns
- None
Definition at line 104 of file cs42l51.c.