71 const unsigned int frequency = DEFAULT_FREQUENCY) :
I2CBase(scl, sda, frequency) {
88 bool ping (
const uint8_t device)
const {
112 bool put (
const uint8_t device,
const T address,
const uint8_t byte)
const {
117 result &= this->send_address(address);
140 uint8_t
get (
const uint8_t device,
const T address)
const {
145 result &= this->send_address(address);
148 result &= this->
send_byte((uint8_t) (device | 0x01));
149 uint8_t dataByte = this->
read_byte(
false);
173 bool put (
const uint8_t device,
const T address,
const uint8_t bytes[],
const size_t size)
const {
177 result &= this->send_address(address);
179 for (
unsigned int i = 0; i < size; ++i)
208 bool get (
const uint8_t device,
const T address, uint8_t bytes[],
const size_t size)
const {
212 result &= this->send_address(address);
214 result &= this->
send_byte((uint8_t) (device | 0x01));
217 for (; i < size - 1; ++i)
244 bool put (
const uint8_t device,
const uint8_t byte)
const {
276 bool get (
const uint8_t device, uint8_t bytes[],
const size_t size)
const {
278 bool result = this->
send_byte((uint8_t) (device | 0x01));
281 for (i = 0; i < size - 1; ++i)
290 bool send_address (
const uint8_t address)
const {
294 bool send_address (
const uint16_t address)
const {
295 bool result = this->
send_byte((
const uint8_t) (address >> 8));
296 return result && this->
send_byte((
const uint8_t) address);
PropWare::I2C pwI2c
Global I2C instance for easy and shared use by Propeller applications (not thread safe!) ...
void start() const
Output a start condition on the I2C bus.
Generic definitions and functions for the Parallax Propeller.
I2C(const Pin::Mask scl=DEFAULT_SCL_MASK, const Pin::Mask sda=DEFAULT_SDA_MASK, const unsigned int frequency=DEFAULT_FREQUENCY)
Create a basic I2C instance.
bool put(const uint8_t device, const T address, const uint8_t bytes[], const size_t size) const
Put multiple bytes with the following format:
bool ping(const uint8_t device) const
Test for the Acknowledge of a device by sending start and the slave address.
bool send_byte(const uint8_t byte) const
Output a byte on the I2C bus.
void stop() const
Output a stop condition on the I2C bus.
bool put(const uint8_t device, const T address, const uint8_t byte) const
Put a single byte with the following format:
Low level I2C driver. Only does the most basic functions that all I2C devices implement.
uint8_t read_byte(const bool acknowledge) const
Get a byte from the bus.
bool put(const uint8_t device, const uint8_t byte) const
Put a single byte, no register address, on the bus.