Mercurial > hg > beaglert
comparison core/I2c_Codec.cpp @ 172:5f4408705eed
Cleanup
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Mon, 28 Dec 2015 04:00:12 +0100 |
parents | e63563507edd |
children | 4c5acd649d46 |
comparison
equal
deleted
inserted
replaced
171:e63563507edd | 172:5f4408705eed |
---|---|
269 else { | 269 else { |
270 // gain is adjustable from 0 to 59.5dB in steps of 0.5dB between 0x0 and 0x7f. | 270 // gain is adjustable from 0 to 59.5dB in steps of 0.5dB between 0x0 and 0x7f. |
271 // Values between 0b01110111 and 0b01111111 are clipped to 59.5dB | 271 // Values between 0b01110111 and 0b01111111 are clipped to 59.5dB |
272 value = (int)(newGain * 2 + 0.5) & 0x7f; | 272 value = (int)(newGain * 2 + 0.5) & 0x7f; |
273 } | 273 } |
274 printf("channel: %d, gain: %f, value: 0x%x, reg: 0x%x\n", channel, newGain, value, reg); | 274 return writeRegister(reg, value); |
275 int ret = writeRegister(reg, value); | |
276 printf("ret: %d\n", ret); | |
277 return ret; | |
278 } | 275 } |
279 | 276 |
280 // Set the volume of the DAC output | 277 // Set the volume of the DAC output |
281 int I2c_Codec::setDACVolume(int halfDbSteps) | 278 int I2c_Codec::setDACVolume(int halfDbSteps) |
282 { | 279 { |