1.1.2.6.13 DRV_AK4954_VolumeSet Function

void DRV_AK4954_VolumeSet(DRV_HANDLE handle, DRV_AK4954_CHANNEL channel, uint8_t volume);

Summary

This function sets the volume for AK4954 Codec.

Description

This functions sets the volume value from 0-255.

The codec has DAC value to volume range mapping as :- 00 H : +12dB FF H : -115dB

In order to make the volume value to dB mapping monotonically increasing from 00 to FF, re-mapping is introduced which reverses the volume value to dB mapping as well as normalizes the volume range to a more audible dB range.

The current driver implementation assumes that all dB values under -60 dB are inaudible to the human ear.

Re-Mapped values 00 H : -60 dB FF H : +12 dB

Preconditions

The DRV_AK4954_Initialize routine must have been called for the specified AK4954 driver instance.

DRV_AK4954_Open must have been called to obtain a valid opened device handle.

Parameters

ParametersDescription
handleA valid open-instance handle, returned from the driver's open routine
chanAudio channel volume to be set
volumevolume value specified in the range 0-255 (0x00 to 0xFF)

Returns

None.

Remarks

None.

Example

_\/\/ myAppObj is an application specific object._

MY_APP_OBJ myAppObj;

uint8_t mybuffer[MY_BUFFER_SIZE]; DRV_BUFFER_HANDLE bufferHandle;

_\/\/ myAK4954Handle is the handle returned \/\/ by the DRV_AK4954_Open function._

DRV_AK4954_VolumeSet(myAK4954Handle, DRV_AK4954_CHANNEL_LEFT, 120);

C

void DRV_AK4954_VolumeSet(DRV_HANDLE handle, DRV_AK4954_CHANNEL channel, uint8_t volume);