24 #include <simpletools.h> 26 const uint8_t MAGIC_ARRAY[] =
"DCBA0";
27 const size_t ARRAY_SIZE =
sizeof(MAGIC_ARRAY);
29 const uint8_t SHIFTED_DEVICE_ADDR = EEPROM_ADDR << 1;
30 const uint16_t TEST_ADDRESS = 32 * 1024;
41 pwOut <<
"EEPROM ack = " << pwI2C.
ping(SHIFTED_DEVICE_ADDR) <<
'\n';
43 bool success = pwI2C.
put(SHIFTED_DEVICE_ADDR, TEST_ADDRESS, MAGIC_ARRAY, ARRAY_SIZE);
44 pwOut <<
"Put status: " << success <<
'\n';
47 while (!pwI2C.
ping(SHIFTED_DEVICE_ADDR));
49 uint8_t buffer[ARRAY_SIZE];
50 success &= pwI2C.
get(SHIFTED_DEVICE_ADDR, TEST_ADDRESS, buffer, ARRAY_SIZE);
51 pwOut <<
"Get status: " << success <<
'\n';
53 pwOut <<
"Returned string = '" << (
char *) buffer <<
"'\n";
const PropWare::Printer pwOut
Most common use of printing in PropWare applications (not thread safe; see PropWare::pwSyncOut for mu...
bool ping(const uint8_t device) const
Test for the Acknowledge of a device by sending start and the slave address.
uint8_t get(const uint8_t device, const T address) const
Get a single byte with the following format:
bool put(const uint8_t device, const T address, const uint8_t byte) const
Put a single byte with the following format: