#include <OWI.h>
|
| OWI (TWI &twi, uint8_t subaddr=0) |
|
virtual bool | reset () |
|
virtual uint8_t | read (uint8_t bits=CHARBITS) |
|
virtual void | write (uint8_t value, uint8_t bits=CHARBITS) |
|
virtual int8_t | triplet (uint8_t &dir) |
|
bool | device_reset () |
|
bool | device_configuration (bool apu=true, bool spu=false, bool iws=false) |
|
bool | channel_select (uint8_t chan) |
|
bool | read (void *buf, size_t count) |
|
void | write (uint8_t cmd, const void *buf, size_t count) |
|
int8_t | search_rom (uint8_t family, uint8_t *code, int8_t last=FIRST) |
|
bool | read_rom (uint8_t *code) |
|
bool | match_rom (uint8_t *code) |
|
bool | skip_rom () |
|
int8_t | alarm_search (uint8_t *code, int8_t last=FIRST) |
|
bool | match_label (uint8_t label) |
|
|
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) |
|
Definition at line 30 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.
Hardware::OWI::OWI |
( |
TWI & |
twi, |
|
|
uint8_t |
subaddr = 0 |
|
) |
| |
|
inline |
Construct one wire bus manager for DS2482.
- Parameters
-
[in] | twi | bus manager. |
[in] | subaddr | sub-address for device. |
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.
bool Hardware::OWI::channel_select |
( |
uint8_t |
chan | ) |
|
|
inline |
Select given channel (DS2482-800). Return true if successful otherwise false.
- Parameters
-
[in] | chan | channel number (0..7). |
- Returns
- bool.
Definition at line 142 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 Hardware::OWI::device_configuration |
( |
bool |
apu = true , |
|
|
bool |
spu = false , |
|
|
bool |
iws = false |
|
) |
| |
|
inline |
Configure one wire bus master with given parameters. Returns true if successful otherwise false.
- Parameters
-
[in] | apu | active pull-up (default true). |
[in] | spu | strong pull-up (default false). |
[in] | iws | one wire speed (default false). |
- Returns
- bool.
Definition at line 131 of file OWI.h.
bool Hardware::OWI::device_reset |
( |
| ) |
|
|
inline |
Global reset of device state machine logic. Returns true if successful otherwise false.
- Returns
- bool.
Definition at line 118 of file OWI.h.
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.
virtual uint8_t Hardware::OWI::read |
( |
uint8_t |
bits = CHARBITS | ) |
|
|
inlinevirtual |
Read the given number of bits from the one wire bus. Default number of bits is 8. Calculate partial check-sum.
- Parameters
-
- Returns
- value read.
Implements OWI.
Definition at line 60 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.
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.
virtual bool Hardware::OWI::reset |
( |
| ) |
|
|
inlinevirtual |
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 Hardware::OWI::triplet |
( |
uint8_t & |
dir | ) |
|
|
inlinevirtual |
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 from OWI.
Definition at line 108 of file OWI.h.
virtual void Hardware::OWI::write |
( |
uint8_t |
value, |
|
|
uint8_t |
bits = CHARBITS |
|
) |
| |
|
inlinevirtual |
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 86 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.
DS2482 Hardware::OWI::m_bridge |
|
protected |
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: