summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2012-09-29 16:56:38 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2012-09-29 16:56:38 +0200
commit9a95c5b6673e3833a05fab376a31b534d900508d (patch)
tree0a0a2afb8199b09fca7550fb35b87c0fb124bd43
parent10c33c518fdea638ffd64cb7cbd2e59ed8c0ed1d (diff)
Fixed volume values in set_volume and get_volume.
-rw-r--r--main.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/main.cpp b/main.cpp
index 6e46591..1cee450 100644
--- a/main.cpp
+++ b/main.cpp
@@ -102,10 +102,10 @@ class DAC {
uint8_t get_volume(uint8_t c) {
uint8_t buf;
i2c.read_reg(0x4a, 0x1a + c, 1, &buf);
- return buf & 0x7f;
+ return ((buf & 0x7f) - 0x19) & 0x7f;
}
void set_volume(uint8_t c, uint8_t v) {
- i2c.write_reg(0x4a, 0x1a + c, v & 0x7f);
+ i2c.write_reg(0x4a, 0x1a + c, (v + 0x19) & 0x7f);
}
};