Hi Paul,
I was testing some CS42448 functions and found that some of the function overloads for .output() and .input() led to empty servicing code!
Here is the missing code for control_cs42448.cpp:
Also, in control_cs42448.h, I believe the correct return value for the return value for a gain of -127.5dB is 255, rather than 128. (CS4428 data sheet P 50.)
This is a cross post from 67298-Missing-CS42448-control-functions-written
Richard
I was testing some CS42448 functions and found that some of the function overloads for .output() and .input() led to empty servicing code!
Here is the missing code for control_cs42448.cpp:
Code:
bool AudioControlCS42448::volumeInteger(uint32_t n)
{
uint8_t data[9];
data[0] = 0;
for (int i=1; i < 9; i++) {
data[i] = n;
}
return write(CS42448_DAC_Channel_Mute, data, 9);
}
Cross post from [URL="https://forum.pjrc.com/threads/67298-Missing-CS42448-control-functions-written"]https://forum.pjrc.com/threads/67298-Missing-CS42448-control-functions-written[/URL]
bool AudioControlCS42448::volumeInteger(int channel, uint32_t n)
{
write(CS42448_DAC_Channel_Mute, 0); // unmute all channels
return write(CS42448_AOUT1_Volume_Control + channel -1, n); // set this channel
}
bool AudioControlCS42448::inputLevelInteger(int32_t n)
{
uint8_t data[6];
for (int i = 0; i < 6; i++)
data[i] = n;
return write(CS42448_AIN1_Volume_Control, data, 6); // set all channels (not 7 & 8)
}
bool AudioControlCS42448::inputLevelInteger(int channel, int32_t n)
{
return write(CS42448_AIN1_Volume_Control + channel -1, n); // set this channel
}
Also, in control_cs42448.h, I believe the correct return value for the return value for a gain of -127.5dB is 255, rather than 128. (CS4428 data sheet P 50.)
Code:
// convert level to volume byte, section 6.9.1, page 50
uint32_t volumebyte(float level) {
if (level >= 1.0) return 0;
if (level <= 0.0000003981) return 255;
return roundf(log10f(level) * -20.0);
}
This is a cross post from 67298-Missing-CS42448-control-functions-written
Richard