diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2012-09-29 16:49:56 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2012-09-29 16:49:56 +0200 |
commit | f35b446fabaad48020b57633a1e01bf6832b3f96 (patch) | |
tree | 0e6d8de17caf1fe91fecfc8bd9444fb28f2cb144 | |
parent | b0f007de6a8c9762026f015baade66747fb849bd (diff) |
Changed DAC.set_volume() to take channel argument.
-rw-r--r-- | main.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
@@ -99,19 +99,13 @@ class DAC { i2c.write_reg(0x4a, 0x02, 0x9e); i2c.write_reg(0x4a, 0x06, (0 << 7) | (1 << 6) | (0 << 4) | (1 << 2) | (3 << 0)); - set_volume(-0x40); - //i2c.write_reg(0x4a, 0x1a, 0); - //i2c.write_reg(0x4a, 0x1b, 0); - //i2c.write_reg(0x4a, 0x1a, -0x40 & 0x7f); - //i2c.write_reg(0x4a, 0x1b, -0x40 & 0x7f); } uint8_t get_volume() { return volume; } - void set_volume(uint8_t v) { + void set_volume(uint8_t c, uint8_t v) { volume = v; - i2c.write_reg(0x4a, 0x1a, volume & 0x7f); - i2c.write_reg(0x4a, 0x1b, volume & 0x7f); + i2c.write_reg(0x4a, 0x1a + c, volume & 0x7f); } }; |