|
COSA
An Object-Oriented Platform for Arduino Programming
|
#include <PCF8591.hh>


Public Types | |
| enum | { AIN0 = 0x00, AIN1 = 0x01, AIN2 = 0x02, AIN3 = 0x03, CHANNEL_MASK = 0x03, AUTO_INCREMENT = 0x04, FOUR_INPUTS = 0x00, THREE_DIFF_INPUTS = 0x10, TWO_MIXED_INPUTS = 0x20, TWO_DIFF_INPUTS = 0x30, OUTPUT_ENABLE = 0x40 } |
Public Member Functions | |
| PCF8591 (uint8_t addr=0) | |
| bool | begin (uint8_t cntl) |
| void | end () |
| uint8_t | sample () |
| uint8_t | sample (uint8_t cntl) |
| int | sample (uint8_t *buf, uint8_t size) |
| bool | convert (uint8_t value) |
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 |
Driver for the PCF8591 2-Wire 8-bit A/D and D/A converter.
PCF8591 module with potentiometer, photoresistor and thermistor.
Definition at line 48 of file PCF8591.hh.
| anonymous enum |
Control byte; selection of input channel and mode of operation Fig. 5 Control byte, pp. 6.
| Enumerator | |
|---|---|
| AIN0 | |
| AIN1 | |
| AIN2 | |
| AIN3 | |
| CHANNEL_MASK | |
| AUTO_INCREMENT | |
| FOUR_INPUTS | |
| THREE_DIFF_INPUTS | |
| TWO_MIXED_INPUTS | |
| TWO_DIFF_INPUTS | |
| OUTPUT_ENABLE | |
Definition at line 54 of file PCF8591.hh.
|
inline |
Construct PCF8591 TWI A/D, D/A converter device access to given chip address.
| [in] | addr | chip address (0..7) |
Definition at line 73 of file PCF8591.hh.
| bool PCF8591::begin | ( | uint8_t | cntl | ) |
Begin a sampling sequence for the channel given by the control parameter. Return true(1) if successful otherwise false(0).
| [in] | cntl | control byte |
Definition at line 24 of file PCF8591.cpp.
| bool PCF8591::convert | ( | uint8_t | value | ) |
Convert given value to analog output (voltage). Return true(1) if successful otherwise false(0).
| [in] | value | output value. |
Definition at line 34 of file PCF8591.cpp.
|
inline |
End sampling sequence.
Definition at line 89 of file PCF8591.hh.
|
inline |
Sample the channel defined by the latest begin() call. Return sample value.
Definition at line 99 of file PCF8591.hh.
|
inline |
Sample the given channel and return converted value.
| [in] | cntl | control byte |
Definition at line 112 of file PCF8591.hh.
|
inline |
Read a sequence of samples the channel defined by the latest begin() call.
| [in] | buf | sample buffer. |
| [in] | size | of sample buffer. |
Definition at line 128 of file PCF8591.hh.