diff options
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/dac.c | 18 | ||||
-rw-r--r-- | firmware/drivers/dac.h | 1 |
2 files changed, 17 insertions, 2 deletions
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) | |||
37 | buf[1] = (left & 0x3f) | (deemph ? 0x40 : 0); | 37 | buf[1] = (left & 0x3f) | (deemph ? 0x40 : 0); |
38 | buf[2] = right & 0x3f; | 38 | buf[2] = right & 0x3f; |
39 | 39 | ||
40 | /* send read command */ | 40 | /* send write command */ |
41 | if (i2c_write(DAC_DEV_WRITE,buf,3)) | 41 | if (i2c_write(DAC_DEV_WRITE,buf,3)) |
42 | { | 42 | { |
43 | ret = -1; | 43 | ret = -1; |
@@ -66,7 +66,7 @@ int dac_config(int value) | |||
66 | buf[0] = DAC_REG_WRITE | DAC_GCFG; | 66 | buf[0] = DAC_REG_WRITE | DAC_GCFG; |
67 | buf[1] = value; | 67 | buf[1] = value; |
68 | 68 | ||
69 | /* send read command */ | 69 | /* send write command */ |
70 | if (i2c_write(DAC_DEV_WRITE,buf,2)) | 70 | if (i2c_write(DAC_DEV_WRITE,buf,2)) |
71 | { | 71 | { |
72 | ret = -1; | 72 | ret = -1; |
@@ -75,3 +75,17 @@ int dac_config(int value) | |||
75 | i2c_end(); | 75 | i2c_end(); |
76 | return ret; | 76 | return ret; |
77 | } | 77 | } |
78 | |||
79 | void dac_init(void) | ||
80 | { | ||
81 | unsigned char buf[2]; | ||
82 | |||
83 | i2c_begin(); | ||
84 | |||
85 | buf[0] = DAC_REG_WRITE | DAC_SR_REG; | ||
86 | buf[1] = 0x07; | ||
87 | |||
88 | /* send write command */ | ||
89 | i2c_write(DAC_DEV_WRITE,buf,2); | ||
90 | i2c_end(); | ||
91 | } | ||
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 @@ | |||
34 | 34 | ||
35 | extern int dac_volume(unsigned int left, unsigned int right, bool deemph); | 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 | extern void dac_init(void); | ||
37 | 38 | ||
38 | #endif | 39 | #endif |