diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2002-06-27 08:28:51 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2002-06-27 08:28:51 +0000 |
commit | a8f141978d91a979932af7f14cfb09646da99caf (patch) | |
tree | 1df6fec5fd7fa2db82d15a97f649373a09ad9bb1 | |
parent | e24a897de4a8f26c9425d66a7c5c5cec8decbd96 (diff) | |
download | rockbox-a8f141978d91a979932af7f14cfb09646da99caf.tar.gz rockbox-a8f141978d91a979932af7f14cfb09646da99caf.zip |
Added left/right/deemphasis functionality of dac_volume
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1227 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/drivers/dac.c | 13 | ||||
-rw-r--r-- | 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 @@ | |||
16 | * KIND, either express or implied. | 16 | * KIND, either express or implied. |
17 | * | 17 | * |
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | #include "stdbool.h" | ||
19 | #include "i2c.h" | 20 | #include "i2c.h" |
20 | #include "debug.h" | 21 | #include "debug.h" |
21 | #include "dac.h" | 22 | #include "dac.h" |
22 | 23 | ||
23 | int dac_volume(unsigned int volume) | 24 | int dac_volume(unsigned int left, unsigned int right, bool deemph) |
24 | { | 25 | { |
25 | int ret = 0; | 26 | int ret = 0; |
26 | unsigned char buf[3]; | 27 | unsigned char buf[3]; |
27 | 28 | ||
28 | i2c_begin(); | 29 | i2c_begin(); |
29 | 30 | ||
30 | if(volume > 0x38) | 31 | if (left > 0x38) |
31 | volume = 0x38; | 32 | left = 0x38; |
33 | if (right > 0x38) | ||
34 | right = 0x38; | ||
32 | 35 | ||
33 | buf[0] = DAC_REG_WRITE | DAC_AVOL; | 36 | buf[0] = DAC_REG_WRITE | DAC_AVOL; |
34 | buf[1] = (volume & 0x3f) | 0x40; /* Deemphasis ON */ | 37 | buf[1] = (left & 0x3f) | (deemph ? 0x40 : 0); |
35 | buf[2] = volume & 0x3f; | 38 | buf[2] = right & 0x3f; |
36 | 39 | ||
37 | /* send read command */ | 40 | /* send read command */ |
38 | if (i2c_write(DAC_DEV_WRITE,buf,3)) | 41 | 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 @@ | |||
32 | #define DAC_AVOL 2 | 32 | #define DAC_AVOL 2 |
33 | #define DAC_GCFG 3 | 33 | #define DAC_GCFG 3 |
34 | 34 | ||
35 | extern int dac_volume(unsigned int volume); | 35 | extern int dac_volume(unsigned int left, unsigned int right, bool deemph); |
36 | extern int dac_config(int value); | 36 | extern int dac_config(int value); |
37 | 37 | ||
38 | #endif | 38 | #endif |