|
| | WM8960 ()=default |
| |
| bool | activate (void) |
| | This function powers up the modules the required for the features enabled using init. This function is called in conjunction with deactivate.
|
| |
| bool | adjustHeadphoneOutputVolume (uint8_t volume) |
| | This function updates the volume of both the left and right channels of the headphone output.
|
| |
| bool | adjustInputVolume (uint8_t volume) |
| | This function updates the volume of both the left and right channels of the microphone input.
|
| |
| bool | adjustSpeakerOutputVolume (uint8_t volume) |
| | This function updates the volume of both the left and right channels of the speaker output.
|
| |
| bool | adjustVolume (uint8_t volume, wm8960_reg_t left_vol_reg, wm8960_reg_t right_vol_reg, uint16_t update_bit, uint16_t volume_bits_mask) |
| |
| bool | clear (wm8960_reg_t reg, uint16_t mask) |
| | This function clears bits in a register.
|
| |
| bool | configDefault (uint8_t features) |
| |
| bool | configureClocking (uint32_t mclk_hz, bool enable_pll, wm8960_adc_dac_sample_rate_t sample_rate, wm8960_word_length_t word_length, wm8960_mode_t mode) |
| | This function configures the master clock and the digital interface for the audio codec.
|
| |
| bool | deactivate (void) |
| | This function powers down the modules the required for the features enabled using init.
|
| |
| void | deinit () |
| | Frees up any resources allocated by the driver as part of init().
|
| |
| bool | dump () |
| | This function dumps the actual register values.
|
| |
| bool | i2cWrite (uint8_t address, uint8_t data[2]) |
| |
| bool | init (uint8_t features) |
| | Initialize the I2C communication with the audio codec, reset the codec and apply default configuration based on the feature(s) requested.
|
| |
| bool | read (wm8960_reg_t reg, uint16_t *data) |
| | This function reads value of an audio codec register.
|
| |
| bool | set (wm8960_reg_t reg, uint16_t mask) |
| | This function sets bits in a register.
|
| |
| void | setAddress (int addr) |
| | Defines the I2C device address.
|
| |
| bool | setOutputVolume (uint8_t volume) |
| | This function updates the volume of both the left and right channels of the speaker and headphones.
|
| |
| bool | setupPll (uint32_t mclk_hz, wm8960_adc_dac_sample_rate_t sample_rate) |
| |
| void | setWire (i2c_bus_handle_t handle) |
| | Defines the I2C bus instance to be used.
|
| |
| void | setWriteRetryCount (uint32_t count) |
| | Defines the number of times we retry to update a register value via I2C. This might help if you have an instable I2C connection. By default we set it to 1 which will cause the initialization to fail when the register update fails.
|
| |
| bool | write (wm8960_reg_t enum_reg, uint16_t value) |
| | This function writes data to an audio codec register.
|
| |
| bool | writeEx (wm8960_reg_t enum_reg, uint16_t value) |
| |
Header-only driver class for the WM8960 audio codec chip.
- Author
- Phil Schatzmann
- Copyright
- GPLv3
| bool init |
( |
uint8_t |
features | ) |
|
|
inline |
Initialize the I2C communication with the audio codec, reset the codec and apply default configuration based on the feature(s) requested.
If either WM8960_FEATURE_MICROPHONE or WM8960_FEATURE_HEADPHONE is requested, the following operations will be performed, For either feature features,
- Set VMID=50K and Enable VREF
For WM8960_FEATURE_MICROPHONE,
- Enable AINL, AINR, ADCL and ADCR
- Enable left (LMIC) and right channel (RMIC) input PGA
- LINPUT1 to PGA (LMN1), Connect left input PGA to left input boost (LMIC2B), Left PGA Boost = 0dB
- RINPUT1 to PGA (RMN1), Connect right input PGA to right input boost (RMIC2B), Right PGA Boost = 0dB
- Unmute left input PGA (LINMUTE), Left Input PGA Vol = 0dB, Volume Update
- Unmute right input PGA (RINMUTE), Right Input PGA Vol = 0dB, Volume Update
- Left ADC Vol = 0dB, Volume Update
- Right ADC Vol = 0dB, Volume Update
For WM8960_FEATURE_HEADPHONE,
- Enable DACL, DACR, LOUT1 and ROUT1
- Enable left output mixer (LOMIX) and right output mixer (ROMIX)
- Left DAC to left output mixer enabled (LD2LO), 0dB
- Right DAC to right output mixer enabled (RD2RO), 0dB
- LOUT1 Vol = 0dB, volume update enabled
- ROUT1 Vol = 0dB, volume update enabled
- Unmute DAC digital soft mute
- Parameters
-
| [in] | features | Features to enabled during initialization. See wm8960_features_t |
- Returns
- true if properly initialized, else an error indicating what went wrong.