Skip Rom always returns true
Wihan opened this issue · 4 comments
I think you meant to write:
return ow_write_byte_raw(ow, OW_CMD_SKIPROM); /* Write byte to match rom exactly */
That's Ok I believe. Function ow_write_byte_raw
always returns read byte over OW.
No I mean ow_skip_rom_raw
always returns true is that right?:
uint8_t
ow_skip_rom_raw(ow_t* const ow) {
OW_ASSERT0("ow != NULL", ow != NULL);
ow_write_byte_raw(ow, OW_CMD_SKIPROM); /* Write byte to match rom exactly */
return 1;
}
Always returns true, no matter what ow_write_byte returns, what if there are no devices connected and the command is issued?
That's OK if they are not connected in fact. There is no actual way to determine if devices are connected or not rather than sending reset command and wait for presence.
What I did is that there are now 3 new functions ending with _ex
, which return command status but return read data via pointer as parameter.
/* Raw functions */
owr_t ow_write_byte_ex_raw(ow_t* const ow, const uint8_t btw, uint8_t* const br);
owr_t ow_read_byte_ex_raw(ow_t* const ow, uint8_t* const br);
owr_t ow_read_bit_ex_raw(ow_t* const ow, uint8_t* const br);
/* Thread safe versions */
owr_t ow_write_byte_ex(ow_t* const ow, const uint8_t btw, uint8_t* const br);
owr_t ow_read_byte_ex(ow_t* const ow, uint8_t* const br);
owr_t ow_read_bit_ex(ow_t* const ow, uint8_t* const br);
Docs have been updated accordingly: https://docs.majerle.eu/projects/onewire-uart/
Ah this is useful.
Thanks :-)