From 5407edc5ad3d1481611a1fb62e6932d2fbcd3568 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Wed, 14 Aug 2002 12:54:38 +0000 Subject: Another strike against the evil distortion problem git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1732 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/dac.c | 18 ++++++++++++++++-- firmware/drivers/dac.h | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'firmware/drivers') diff --git a/firmware/drivers/dac.c b/firmware/drivers/dac.c index 9a40244292..72d4c40cf7 100644 --- a/firmware/drivers/dac.c +++ b/firmware/drivers/dac.c @@ -37,7 +37,7 @@ int dac_volume(unsigned int left, unsigned int right, bool deemph) buf[1] = (left & 0x3f) | (deemph ? 0x40 : 0); buf[2] = right & 0x3f; - /* send read command */ + /* send write command */ if (i2c_write(DAC_DEV_WRITE,buf,3)) { ret = -1; @@ -66,7 +66,7 @@ int dac_config(int value) buf[0] = DAC_REG_WRITE | DAC_GCFG; buf[1] = value; - /* send read command */ + /* send write command */ if (i2c_write(DAC_DEV_WRITE,buf,2)) { ret = -1; @@ -75,3 +75,17 @@ int dac_config(int value) i2c_end(); return ret; } + +void dac_init(void) +{ + unsigned char buf[2]; + + i2c_begin(); + + buf[0] = DAC_REG_WRITE | DAC_SR_REG; + buf[1] = 0x07; + + /* send write command */ + i2c_write(DAC_DEV_WRITE,buf,2); + i2c_end(); +} diff --git a/firmware/drivers/dac.h b/firmware/drivers/dac.h index 9530677bec..c0b2873fda 100644 --- a/firmware/drivers/dac.h +++ b/firmware/drivers/dac.h @@ -34,5 +34,6 @@ extern int dac_volume(unsigned int left, unsigned int right, bool deemph); extern int dac_config(int value); +extern void dac_init(void); #endif -- cgit v1.2.3