Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: TLV320AIC1110.cpp
- Revision:
- 2:e7c7c0177dd8
- Parent:
- 0:ec233f3b49d8
- Child:
- 3:4592d862ef88
--- a/TLV320AIC1110.cpp Fri May 10 21:14:19 2013 +0000
+++ b/TLV320AIC1110.cpp Wed May 15 21:07:55 2013 +0000
@@ -35,16 +35,16 @@
return;
}
-void TLV320AIC1110::init(void)
+void TLV320AIC1110::init(void) const
{
- writeRegister(0x00, 0x9B);
- writeRegister(0x01, 0x00);
- writeRegister(0x06, 0x81);
+ writeRegister(POWER_CONTROL, 0x9B);
+ writeRegister(MODE_CONTROL, 0x00);
+ writeRegister(AUX, 0x81);
return;
}
-void TLV320AIC1110::writeRegister(const uint8_t reg, const uint8_t value)
+void TLV320AIC1110::writeRegister(const TLV320AIC1110_REGISTERS reg, const uint8_t value) const
{
const uint8_t w_address = 0xE2;
uint8_t data[2] = {reg, value};
@@ -57,17 +57,18 @@
return;
}
-uint8_t TLV320AIC1110::readRegister(const uint8_t reg)
+uint8_t TLV320AIC1110::readRegister(const uint8_t reg) const
{
const uint8_t w_address = 0xE2;
const uint8_t r_address = 0xE3;
- uint8_t data[1] = {reg};
+ char data[1] = {reg};
- _i2c->write(w_address, (char *)data, 1);
- _i2c->start();
- _i2c->write(r_address);
- data[0] = _i2c->read(0);
- _i2c->stop();
+ _i2c->write(w_address, (char *)data, 1, 1);
+ _i2c->read (r_address, data, 1);
+// _i2c->start();
+// _i2c->write(r_address);
+// data[0] = _i2c->read(0);
+// _i2c->stop();
return data[0];
}