COSA
An Object-Oriented Platform for Arduino Programming
|
#include <DS2482.hh>
Classes | |
union | config_t |
union | status_t |
Public Types | |
enum | Register { STATUS_REGISTER = 0xf0, READ_DATA_REGISTER = 0xe1, CHANNEL_SELECTION_REGISTER = 0xd2, CONFIGURATION_REGISTER = 0xc3 } |
Public Member Functions | |
DS2482 (uint8_t subaddr=0) | |
bool | device_reset () |
bool | device_config (bool apu=true, bool spu=false, bool iws=false) |
int | set_read_pointer (Register addr) |
bool | channel_select (uint8_t chan) |
bool | one_wire_reset () |
int | one_wire_read_bit () |
bool | one_wire_write_bit (bool value) |
bool | one_wire_write_byte (uint8_t value) |
int | one_wire_read_byte () |
int | one_wire_triplet (bool direction=false) |
Protected Types | |
enum | { DEVICE_RESET = 0xf0, SET_READ_POINTER = 0xe1, WRITE_CONGIFURATION = 0xd2, CHANNEL_SELECT = 0xc3, ONE_WIRE_RESET = 0xb4, ONE_WIRE_SINGLE_BIT = 0x87, ONE_WIRE_WRITE_BYTE = 0xa5, ONE_WIRE_READ_BYTE = 0x96, ONE_WIRE_TRIPLET = 0x78 } |
Static Protected Attributes | |
static const int | POLL_MAX = 20 |
Private Member Functions | |
bool | is_async () const |
void | sync_request () |
void | async_request () |
virtual void | on_completion (uint8_t type, int count) |
Private Attributes | |
uint8_t | m_addr |
bool | m_async |
TWI Device Driver for DS2482 I2C to 1-Wire Bridge. Low level device functions.
|
protected |
Function Commands, pp. 9-15.
enum DS2482::Register |
|
inline |
bool DS2482::channel_select | ( | uint8_t | chan | ) |
Select given channel (DS2482-800). Return true if successful otherwise false.
[in] | chan | channel number (0..7). |
Definition at line 102 of file DS2482.cpp.
bool DS2482::device_config | ( | bool | apu = true , |
bool | spu = false , |
||
bool | iws = false |
||
) |
Configure one wire bus master with given parameters. Returns true if successful otherwise false.
[in] | apu | active pull-up (default true). |
[in] | spu | strong pull-up (default false). |
[in] | iws | one wire speed (default false). |
Definition at line 47 of file DS2482.cpp.
bool DS2482::device_reset | ( | ) |
Global reset of device state machine logic. Returns true if successful otherwise false.
Definition at line 24 of file DS2482.cpp.
int DS2482::one_wire_read_bit | ( | ) |
Read a single bit from one wire bus. Returns bit value (0 or 1) or a negative error code.
Definition at line 146 of file DS2482.cpp.
int DS2482::one_wire_read_byte | ( | ) |
Read byte from one wire bus. Returns byte value or a negative error code.
Definition at line 228 of file DS2482.cpp.
bool DS2482::one_wire_reset | ( | ) |
Generates one wire reset/presence detect cycle. Should be used to initiate or end a one wire communication sequence. Return true if successful otherwise false.
Definition at line 120 of file DS2482.cpp.
int DS2482::one_wire_triplet | ( | bool | direction = false | ) |
Generate two read-time slots and one write-time slot. Returns status value (dir.nid.id) or a negative error code.
Definition at line 257 of file DS2482.cpp.
bool DS2482::one_wire_write_bit | ( | bool | value | ) |
Write a single bit to one wire bus. Returns true if successful otherwise false.
[in] | value | bit to write. |
Definition at line 174 of file DS2482.cpp.
bool DS2482::one_wire_write_byte | ( | uint8_t | value | ) |
Write a byte to one wire bus. Returns true if successful otherwise false.
[in] | value | byte to write. |
Definition at line 201 of file DS2482.cpp.
int DS2482::set_read_pointer | ( | Register | addr | ) |
Set the read pointer to the specified register. Return register value or negative error code.
[in] | addr | register address. |
Definition at line 78 of file DS2482.cpp.
|
staticprotected |