Wire (using helper class)
accessing Wire (using helper class)
if (auto&& wrt = Wire.get_writer(...)) { // Object creation and device communication determination
// Within this scope (wave brackets) is the validity period of wrt.
wrt << 0x00; // Writes 0x00 with mwx::stream interface
}
// wrt is discarded at the point where the if clause is exited, and the use of the bus is terminatedloading
const uint8_t DEV_ADDR = 0x70;
uint8_t au8data[6];
if (auto&& rdr = Wire.get_reader(DEV_ADDR, 6)) {
for (auto&& c: au8data) {
c = rdr();
}
}
// same above
uint16_t u16temp, u16humd;
uint8_t u8temp_csum, u8humd_csum;
if (auto&& rdr = Wire.get_reader(SHTC3_ADDRESS, 6)) {
rdr >> u16temp;
rdr >> u8temp_csum;
rdr >> u16humd;
rdr >> u8humd_csum;
}get_reader(addr, read_count=0)
Parameters
Description
write (writer)
get_writer()
Parameters
Description
Worker object (writer)
<< operator
() operator
worker object (reader)
>> operator
() operator
Example
最終更新