#include <DS2482.h>
TWI Device Driver for DS2482, Single-Channel 1-Wire Master, TWI to OWI Bridge Device.
Definition at line 28 of file DS2482.h.
Function Commands, pp. 9-15.
Enumerator |
---|
DEVICE_RESET |
Device Reset.
|
SET_READ_POINTER |
Set Read Pointer.
|
WRITE_CONGIFURATION |
Write Configuration.
|
CHANNEL_SELECT |
Channel Select.
|
ONE_WIRE_RESET |
1-Wire Reset.
|
ONE_WIRE_SINGLE_BIT |
1-Wire Single Bit.
|
ONE_WIRE_WRITE_BYTE |
1-Wire Write Byte.
|
ONE_WIRE_READ_BYTE |
1-Wire Read Byte.
|
ONE_WIRE_TRIPLET |
1-Wire Triplet.
|
Definition at line 338 of file DS2482.h.
Device Registers, pp. 5. Valid Pointer Codes, pp. 10.
Enumerator |
---|
STATUS_REGISTER |
|
READ_DATA_REGISTER |
|
CHANNEL_SELECTION_REGISTER |
|
CONFIGURATION_REGISTER |
|
Definition at line 275 of file DS2482.h.
DS2482::DS2482 |
( |
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 (0..3). |
Definition at line 35 of file DS2482.h.
bool TWI::Device::acquire |
( |
| ) |
|
|
inlineinherited |
Start transaction. Return true(1) if successful otherwise false(0).
- Returns
- bool.
Definition at line 52 of file TWI.h.
bool DS2482::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 317 of file DS2482.h.
bool DS2482::device_reset |
( |
| ) |
|
|
inline |
Global reset of device state machine logic. Returns true if successful otherwise false.
- Returns
- bool.
Definition at line 212 of file DS2482.h.
bool DS2482::one_wire_await |
( |
status_t & |
status | ) |
|
|
inlineprotected |
Wait for the one wire operation to complete. Poll the device status.
- Parameters
-
[out] | status | device status on completion. |
- Returns
- true(1) if successful otherwise false(0).
Definition at line 402 of file DS2482.h.
bool DS2482::one_wire_read_bit |
( |
bool & |
value | ) |
|
|
inline |
Read a single bit from one wire bus. Returns value and true(1) if successful otherwise false(0).
- Parameters
-
- Returns
- true(1) if successful otherwise false(0).
Definition at line 70 of file DS2482.h.
virtual bool DS2482::one_wire_read_byte |
( |
uint8_t & |
value | ) |
|
|
inlinevirtual |
Read byte (8-bits) from one wire bus. Returns value and true(1) if successful otherwise false(0).
- Parameters
-
- Returns
- true(1) if successful otherwise false(0).
Definition at line 125 of file DS2482.h.
bool DS2482::one_wire_reset |
( |
| ) |
|
|
inline |
Reset the one wire bus and check that at least one device is presence.
- Returns
- true(1) if successful otherwise false(0).
Definition at line 45 of file DS2482.h.
int8_t DS2482::one_wire_triplet |
( |
uint8_t & |
dir | ) |
|
|
inline |
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.
Definition at line 183 of file DS2482.h.
bool DS2482::one_wire_write_bit |
( |
bool |
value | ) |
|
|
inline |
Write a single bit to one wire bus. Returns true if successful otherwise false.
- Parameters
-
- Returns
- bool.
Definition at line 99 of file DS2482.h.
bool DS2482::one_wire_write_byte |
( |
uint8_t |
value | ) |
|
|
inline |
Write byte (8-bits) to one wire bus. Returns true(1) if successful otherwise false(0).
- Parameters
-
- Returns
- true(1) if successful otherwise false(0).
Definition at line 155 of file DS2482.h.
int TWI::Device::read |
( |
void * |
buf, |
|
|
size_t |
count |
|
) |
| |
|
inlineinherited |
Read data from device to given buffer.
- Parameters
-
[in] | buf | buffer pointer. |
[in] | count | buffer size in bytes. |
- Returns
- number of bytes read or negative error code.
Definition at line 73 of file TWI.h.
bool TWI::Device::release |
( |
| ) |
|
|
inlineinherited |
Stop transaction. Return true(1) if successful otherwise false(0).
- Returns
- bool.
Definition at line 62 of file TWI.h.
bool DS2482::set_read_pointer |
( |
Register |
addr, |
|
|
uint8_t & |
value |
|
) |
| |
|
inline |
Set the read pointer to the specified register. Return register value or negative error code.
- Parameters
-
[in] | addr | register address. |
[out] | value | read. |
- Returns
- true(1) if successful otherwise false(0).
Definition at line 289 of file DS2482.h.
int TWI::Device::write |
( |
const void * |
buf, |
|
|
size_t |
count |
|
) |
| |
|
inlineinherited |
Write data from the given buffer to device.
- Parameters
-
[in] | buf | buffer pointer. |
[in] | count | buffer size in bytes. |
- Returns
- number of bytes written or negative error code.
Definition at line 84 of file TWI.h.
int TWI::Device::write |
( |
iovec_t * |
vp | ) |
|
|
inlineinherited |
Write data to device with from given io vector.
- Parameters
-
- Returns
- number of bytes written or negative error code.
Definition at line 94 of file TWI.h.
bool DS2482::write_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 242 of file DS2482.h.
uint8_t TWI::Device::m_addr |
|
protectedinherited |
Two-Wire Interface Manager.
Definition at line 101 of file TWI.h.
const int DS2482::POLL_MAX = 20 |
|
staticprotected |
Number of one-wire polls
Definition at line 394 of file DS2482.h.
The documentation for this class was generated from the following file: