From a8f141978d91a979932af7f14cfb09646da99caf Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Thu, 27 Jun 2002 08:28:51 +0000 Subject: Added left/right/deemphasis functionality of dac_volume git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1227 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/dac.c | 13 ++++++++----- firmware/drivers/dac.h | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/firmware/drivers/dac.c b/firmware/drivers/dac.c index 0c12a8d912..9a40244292 100644 --- a/firmware/drivers/dac.c +++ b/firmware/drivers/dac.c @@ -16,23 +16,26 @@ * KIND, either express or implied. * ****************************************************************************/ +#include "stdbool.h" #include "i2c.h" #include "debug.h" #include "dac.h" -int dac_volume(unsigned int volume) +int dac_volume(unsigned int left, unsigned int right, bool deemph) { int ret = 0; unsigned char buf[3]; i2c_begin(); - if(volume > 0x38) - volume = 0x38; + if (left > 0x38) + left = 0x38; + if (right > 0x38) + right = 0x38; buf[0] = DAC_REG_WRITE | DAC_AVOL; - buf[1] = (volume & 0x3f) | 0x40; /* Deemphasis ON */ - buf[2] = volume & 0x3f; + buf[1] = (left & 0x3f) | (deemph ? 0x40 : 0); + buf[2] = right & 0x3f; /* send read command */ if (i2c_write(DAC_DEV_WRITE,buf,3)) diff --git a/firmware/drivers/dac.h b/firmware/drivers/dac.h index c860538a24..9530677bec 100644 --- a/firmware/drivers/dac.h +++ b/firmware/drivers/dac.h @@ -32,7 +32,7 @@ #define DAC_AVOL 2 #define DAC_GCFG 3 -extern int dac_volume(unsigned int volume); +extern int dac_volume(unsigned int left, unsigned int right, bool deemph); extern int dac_config(int value); #endif -- cgit v1.2.3