COSA
An Object-Oriented Platform for Arduino Programming
|
#include <OWI.hh>
Classes | |
class | Driver |
class | Search |
Public Types | |
enum | { SEARCH_ROM = 0xF0, READ_ROM = 0x33, MATCH_ROM = 0x55, SKIP_ROM = 0xCC, ALARM_SEARCH = 0xEC } |
Public Member Functions | |
OWI (Board::DigitalPin pin) | |
bool | reset () |
uint8_t | read (uint8_t bits=CHARBITS) |
bool | read (void *buf, uint8_t size) |
void | write (uint8_t value, uint8_t bits=CHARBITS, bool power=false) |
void | write (uint8_t value, void *buf, uint8_t size) |
void | power_off () |
Driver * | lookup (uint8_t *rom) |
bool | alarm_dispatch () |
Static Public Attributes | |
static const uint8_t | ROM_MAX = 8 |
static const uint8_t | ROMBITS = ROM_MAX * CHARBITS |
Private Types | |
enum | Mode { OUTPUT_MODE = 0, INPUT_MODE = 1 } |
enum | Direction { MSB_FIRST = 0, LSB_FIRST = 1 } |
Private Member Functions | |
void | mode (Mode mode) |
Mode | mode () const |
void | _set () const |
void | _set (int value) const |
void | set () const |
void | set (int value) const |
void | high () const |
void | on () const |
void | _clear () const |
void | clear () const |
void | low () const |
void | off () const |
void | _toggle () const |
void | toggle () const |
void | _write (int value) const |
void | write (int value) const |
void | write (uint8_t value, OutputPin &clk, Direction order=MSB_FIRST) const |
void | write (uint16_t value, uint8_t bits, uint16_t us) const |
OutputPin & | operator<< (int value) |
void | pulse (uint16_t us) const |
volatile uint8_t * | PIN () const |
volatile uint8_t * | DDR () const |
volatile uint8_t * | PORT () const |
uint8_t | pin () const |
bool | is_set () const |
bool | is_high () const |
bool | is_on () const |
bool | is_clear () const |
bool | is_low () const |
bool | is_off () const |
bool | read () const |
uint8_t | read (OutputPin &clk, Direction order=MSB_FIRST) const |
operator bool () const | |
Pin & | operator>> (uint8_t &var) |
volatile uint8_t * | PCIMR () const |
Static Private Member Functions | |
static void | mode (Board::DigitalPin pin, Mode mode) |
static Mode | mode (Board::DigitalPin pin) |
static void | mode (Board::DigitalPin pin, uint8_t initial=0) |
static void | toggle (Board::DigitalPin pin) |
static void | _write (Board::DigitalPin pin, uint8_t value) |
static void | write (Board::DigitalPin pin, int value) |
static uint8_t | MASK (uint8_t pin) |
static volatile uint8_t * | PIN (uint8_t pin) |
static volatile uint8_t * | DDR (uint8_t pin) |
static volatile uint8_t * | PORT (uint8_t pin) |
static bool | read (Board::DigitalPin pin) |
Private Attributes | |
volatile uint8_t *const | m_sfr |
const uint8_t | m_mask |
const uint8_t | m_pin |
1-wire device driver support class. Allows device rom search and connection to multiple devices on one-wire bus.
The driver will turn off interrupt handling during data read from the device.
anonymous enum |
|
inline |
bool OWI::alarm_dispatch | ( | ) |
OWI::Driver * OWI::lookup | ( | uint8_t * | rom | ) |
|
inline |
uint8_t OWI::read | ( | uint8_t | bits = CHARBITS | ) |
bool OWI::read | ( | void * | buf, |
uint8_t | size | ||
) |
bool OWI::reset | ( | ) |
void OWI::write | ( | uint8_t | value, |
uint8_t | bits = CHARBITS , |
||
bool | power = false |
||
) |
Write the given value to the one wire bus. The bits are written from LSB to MSB. Pass true(1) for power parameter to allow parasite devices to be powered. Should be turned off with power_off().
[in] | value | to write. |
[in] | bits | to be written. |
[in] | power | on for parasite device. |
void OWI::write | ( | uint8_t | value, |
void * | buf, | ||
uint8_t | size | ||
) |