56 if (count !=
sizeof(cmd))
goto error;
82 if (count !=
sizeof(cmd))
goto error;
108 cmd[1] = (value ? 0x80 : 0x00);
111 if (count !=
sizeof(cmd))
goto error;
135 if (count !=
sizeof(cmd))
goto error;
167 if (count !=
sizeof(cmd))
goto error;
191 cmd[1] = (dir ? 0x80 : 0x00);
194 if (count !=
sizeof(cmd))
goto error;
200 return ((status >> 5) & 0x3);
222 if (count !=
sizeof(cmd))
goto error;
227 return ((count ==
sizeof(status)) && status.
RST);
253 config.
COMP = ~config;
260 if (count !=
sizeof(cmd))
goto error;
265 return ((count ==
sizeof(status)) && !status.
RST);
280 } __attribute__((packed));
297 cmd[1] = (uint8_t) addr;
300 if (count !=
sizeof(cmd))
goto error;
304 res = (count ==
sizeof(value));
323 if (chan > 7)
return (
false);
327 cmd[1] = (~chan << 4) | chan;
331 return (count ==
sizeof(cmd));
348 } __attribute__((packed));
405 for (
int i = 0; i <
POLL_MAX; i++) {
407 if (count ==
sizeof(status) && !status.
IWB)
return (
true);
bool write_configuration(bool apu=true, bool spu=false, bool iws=false)
bool one_wire_await(status_t &status)
uint8_t TSB
Triplet Second Bit.
uint8_t DIR
Branch Direction Taken.
bool one_wire_write_bit(bool value)
bool set_read_pointer(Register addr, uint8_t &value)
uint8_t APU
< Bitfield access (little endian).
uint8_t as_uint8
Unsigned byte access.
uint8_t as_uint8
Unsigned byte access.
DS2482(TWI &twi, uint8_t subaddr=0)
bool one_wire_write_byte(uint8_t value)
Hardware::TWI twi(100000UL)
bool channel_select(uint8_t chan)
uint8_t IWB
< Bitfield access (little endian).
uint8_t SPU
Strong Pullup.
static const int POLL_MAX
uint8_t SD
Short Detected.
uint8_t PPD
Presence-Pulse Detect.
bool one_wire_read_bit(bool &value)
uint8_t COMP
Complement of lower 4-bits.
int write(const void *buf, size_t count)
Device(TWI &twi, uint8_t addr)
int8_t one_wire_triplet(uint8_t &dir)
int read(void *buf, size_t count)
uint8_t SBR
Single Bit Result.
virtual bool one_wire_read_byte(uint8_t &value)