From 9a95c5b6673e3833a05fab376a31b534d900508d Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Sat, 29 Sep 2012 16:56:38 +0200 Subject: Fixed volume values in set_volume and get_volume. --- main.cpp | 4 ++-- 1 file 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); } }; -- cgit v1.2.3