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.
Dependencies: mbed
TPL0102.cpp
- Committer:
- JeongHoLee
- Date:
- 2019-01-23
- Revision:
- 0:54d71ce98029
File content as of revision 0:54d71ce98029:
#include "TPL0102.h"
TPL0102::TPL0102(PinName SDA,
PinName SCL) : i2c_(SDA, SCL)
{
i2c_.frequency(100000);
// i2c_.start();
wait_us(500);
}
int TPL0102::SlaveSelect(char address, char settings)
{
return oneByteWrite(address, settings);
}
int TPL0102::AccessControlRegister(char settings)
{
int tx=TPL0102_ACR;
return oneByteWrite(tx, settings);
}
int TPL0102::oneByteWrite(char address, char data)
{
int ack = 0;
char tx[2];
tx[0] = address;
tx[1] = data;
return ack | i2c_.write( TPL0102_Potentiometer_Address << 1 & 0xFE , tx, 2);
}