Skip to content

Commit 25c0107

Browse files
committed
cs43l22 volume range
1 parent c58427e commit 25c0107

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/Driver.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,10 @@ class AudioDriverCS43l22Class : public AudioDriver {
306306
setPAPower(true);
307307
// Setup enable pin for codec
308308
delay(100);
309-
int vol = map(volume, 0, 100, DEFAULT_VOLMIN, DEFAULT_VOLMAX);
310309
uint32_t freq = getFrequency(codec_cfg.i2s.rate);
311310
uint16_t outputDevice = getOutput(codec_cfg.output_device);
312311
AD_LOGD("cs43l22_Init");
313-
bool result = cs43l22_Init(deviceAddr, outputDevice, vol, freq, getI2C()) == 0;
312+
bool result = cs43l22_Init(deviceAddr, outputDevice, volume, freq, getI2C()) == 0;
314313
if (!result){
315314
AD_LOGE("error: cs43l22_Init");
316315
}
@@ -325,8 +324,7 @@ class AudioDriverCS43l22Class : public AudioDriver {
325324

326325
bool setVolume(int volume) {
327326
this->volume = volume;
328-
int vol = map(volume, 0, 100, DEFAULT_VOLMIN, DEFAULT_VOLMAX);
329-
return cs43l22_SetVolume(deviceAddr, vol) == 0;
327+
return cs43l22_SetVolume(deviceAddr, volume) == 0;
330328
}
331329
int getVolume() { return volume; }
332330

src/Driver/cs43l22/cs43l22.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,8 @@ uint32_t cs43l22_Stop(uint16_t DeviceAddr, uint32_t CodecPdwnMode)
337337
/**
338338
* @brief Sets higher or lower the codec volume level.
339339
* @param DeviceAddr: Device address on communication Bus.
340-
* @param Volume: a byte value from 0 to 255 (refer to codec registers
341-
* description for more details).
340+
* @param Volume: a byte value from 0 to 100 ( which is mapped to 0 - 255 ,
341+
* refer to codec registers description for more details).
342342
*
343343
* @retval 0 if correct communication, else wrong communication
344344
*/

0 commit comments

Comments
 (0)