#include <OWI.h>
|
static uint8_t | crc_update (uint8_t crc, uint8_t data) |
|
static uint8_t | crc (const void *buf, size_t count) |
|
static uint8_t | crc_P (const void *buf, size_t count) |
|
template<BOARD::pin_t PIN>
class Software::OWI< PIN >
Definition at line 31 of file OWI.h.
Standard 1-Wire ROM Commands.
Enumerator |
---|
SEARCH_ROM |
Initiate device search.
|
READ_ROM |
Read device family code and serial number.
|
MATCH_ROM |
Select device with 64-bit rom code.
|
SKIP_ROM |
Broadcast or single device.
|
ALARM_SEARCH |
Initiate device alarm search.
|
LABEL_ROM |
Set short address (8-bit).
|
MATCH_LABEL |
Select device with 8-bit short address.
|
Definition at line 128 of file OWI.h.
Search position and return values.
Enumerator |
---|
FIRST |
Start position of search.
|
ERROR |
Error during search.
|
LAST |
Last position, search completed.
|
Definition at line 190 of file OWI.h.
template<BOARD::pin_t PIN>
Construct one wire bus connected to the given template pin parameter.
Definition at line 37 of file OWI.h.
int8_t OWI::alarm_search |
( |
uint8_t * |
code, |
|
|
int8_t |
last = FIRST |
|
) |
| |
|
inlineinherited |
Search alarming device given the last position of discrepancy.
- Parameters
-
[in] | code | device identity. |
[in] | last | position of discrepancy (default FIRST). |
- Returns
- position of difference or negative error code.
Definition at line 261 of file OWI.h.
static uint8_t OWI::crc |
( |
const void * |
buf, |
|
|
size_t |
count |
|
) |
| |
|
inlinestaticinherited |
Optimized Dallas/Maxim iButton 8-bit Cyclic Redundancy Check calculation. Polynomial: x^8 + x^5 + x^4 + 1 (0x8C).
- Parameters
-
[in] | buf | buffer pointer. |
[in] | count | number of bytes. |
- Returns
- crc.
Definition at line 166 of file OWI.h.
static uint8_t OWI::crc_P |
( |
const void * |
buf, |
|
|
size_t |
count |
|
) |
| |
|
inlinestaticinherited |
Optimized Dallas/Maxim iButton 8-bit Cyclic Redundancy Check calculation. Polynomial: x^8 + x^5 + x^4 + 1 (0x8C).
- Parameters
-
[in] | buf | buffer pointer (program memory). |
[in] | count | number of bytes. |
- Returns
- crc.
Definition at line 181 of file OWI.h.
static uint8_t OWI::crc_update |
( |
uint8_t |
crc, |
|
|
uint8_t |
data |
|
) |
| |
|
inlinestaticinherited |
bool OWI::match_label |
( |
uint8_t |
label | ) |
|
|
inlineinherited |
Match device label. Address the device with the given label. Device specific function command should follow.
- Parameters
-
[in] | label | device short address. |
- Returns
- true(1) if successful otherwise false(0).
Definition at line 274 of file OWI.h.
bool OWI::match_rom |
( |
uint8_t * |
code | ) |
|
|
inlineinherited |
Match device rom. Address the device with the rom code. Device specific function command should follow. May be used to verify rom code.
- Parameters
-
- Returns
- true(1) if successful otherwise false(0).
Definition at line 236 of file OWI.h.
bool OWI::read |
( |
void * |
buf, |
|
|
size_t |
count |
|
) |
| |
|
inlineinherited |
Read given number of bytes from one wire bus (device) to given buffer. Calculates 8-bit Cyclic Redundancy Check sum and return result of check.
- Parameters
-
[in] | buf | buffer pointer. |
[in] | count | number of bytes to read. |
- Returns
- true(1) if check sum is correct otherwise false(0).
Definition at line 62 of file OWI.h.
template<BOARD::pin_t PIN>
Read the given number of bits from the one wire bus. Default number of bits is 8.
- Parameters
-
- Returns
- value read.
Implements OWI.
Definition at line 72 of file OWI.h.
bool OWI::read_rom |
( |
uint8_t * |
code | ) |
|
|
inlineinherited |
Read device rom. This can only be used when there is only one device on the bus.
- Parameters
-
- Returns
- true(1) if successful otherwise false(0).
Definition at line 222 of file OWI.h.
template<BOARD::pin_t PIN>
Reset the one wire bus and check that at least one device is presence.
- Returns
- true(1) if successful otherwise false(0).
Implements OWI.
Definition at line 48 of file OWI.h.
int8_t OWI::search |
( |
uint8_t * |
code, |
|
|
int8_t |
last = FIRST |
|
) |
| |
|
inlineprotectedinherited |
Search device rom given the last position of discrepancy and partial or full rom code.
- Parameters
-
[in] | code | device identity rom. |
[in] | last | position of discrepancy (default FIRST). |
- Returns
- position of difference or negative error code.
Definition at line 357 of file OWI.h.
int8_t OWI::search_rom |
( |
uint8_t |
family, |
|
|
uint8_t * |
code, |
|
|
int8_t |
last = FIRST |
|
) |
| |
|
inlineinherited |
Search device rom given the last position of discrepancy. Return position of difference or negative error code.
- Parameters
-
[in] | family | code. |
[in] | code | device identity. |
[in] | last | position of discrepancy (default FIRST). |
- Returns
- position of difference or negative error code.
Definition at line 204 of file OWI.h.
Skip device rom for boardcast or single device access. Device specific function command should follow.
- Returns
- true(1) if successful otherwise false(0).
Definition at line 248 of file OWI.h.
virtual int8_t OWI::triplet |
( |
uint8_t & |
dir | ) |
|
|
inlinevirtualinherited |
Search (rom and alarm) support function. Reads 2-bits and writes given direction 1-bit value when discrepancy 0b00 read. Writes one(1) when 0b01 read, zero(0) on 0b10. Reading 0b11 is an error state.
- Parameters
-
[in,out] | dir | bit to write when discrepancy read. |
- Returns
- 2-bits read and bit written.
Reimplemented in Hardware::OWI.
Definition at line 106 of file OWI.h.
void OWI::write |
( |
uint8_t |
cmd, |
|
|
const void * |
buf, |
|
|
size_t |
count |
|
) |
| |
|
inlineinherited |
Write the given command and given number of bytes from buffer to the one wire bus (device).
- Parameters
-
[in] | cmd | command to write. |
[in] | buf | buffer pointer. |
[in] | count | number of bytes to write. |
Definition at line 90 of file OWI.h.
template<BOARD::pin_t PIN>
Write the given value to the one wire bus. The bits are written from LSB to MSB.
- Parameters
-
[in] | value | to write. |
[in] | bits | to be written. |
Implements OWI.
Definition at line 98 of file OWI.h.
template<BOARD::pin_t PIN>
1-Wire bus pin.
Definition at line 123 of file OWI.h.
const uint8_t OWI::RESET_RETRY_MAX = 4 |
|
staticprotectedinherited |
Maximum number of reset retries.
Definition at line 348 of file OWI.h.
const size_t OWI::ROM_MAX = 8 |
|
staticinherited |
One Wire device identity ROM size in bytes.
Definition at line 32 of file OWI.h.
One Wire device identity ROM size in bits.
Definition at line 35 of file OWI.h.
The documentation for this class was generated from the following file: