COSA
An Object-Oriented Platform for Arduino Programming
|
#include <AnalogPins.hh>
Public Member Functions | |
AnalogPins (const Board::AnalogPin *pins, uint16_t *buffer, uint8_t count, Board::Reference ref=Board::AVCC_REFERENCE) | |
uint8_t | count () const |
Board::AnalogPin | pin_at (uint8_t ix) const |
bool | samples_request () |
virtual void | on_interrupt (uint16_t arg) |
virtual void | on_event (uint8_t type, uint16_t value) |
Private Member Functions | |
void | reference (Board::Reference ref) |
Board::Reference | reference () const |
Board::AnalogPin | pin () const |
uint16_t | value () const |
uint16_t | sample () |
AnalogPin & | operator>> (uint16_t &var) |
operator uint16_t () | |
bool | sample_request (uint8_t event=Event::NULL_TYPE) |
bool | sample_request (Board::AnalogPin pin, uint8_t ref) |
uint16_t | sample_await () |
virtual void | on_change (uint16_t value) |
virtual void | enable () |
virtual void | disable () |
virtual void | clear () |
Static Private Member Functions | |
static void | prescale (uint8_t factor) |
static uint16_t | sample (Board::AnalogPin pin, Board::Reference ref=Board::AVCC_REFERENCE) |
static uint16_t | bandgap (uint16_t vref=1100) |
static void | powerup () |
static void | powerdown () |
Private Attributes | |
const Board::AnalogPin | m_pin |
Analog channel number. More... | |
Board::Reference | m_reference |
ADC reference voltage type. More... | |
uint16_t | m_value |
Latest sample value. More... | |
uint8_t | m_event |
Event to push on completion. More... | |
Static Private Attributes | |
static AnalogPin * | sampling_pin = NULL |
Current sampling pin if any. More... | |
Abstract analog pin set. Allow sampling of a set of pins with interrupt or event handler when completed.
Definition at line 30 of file AnalogPins.hh.
|
inline |
Construct abstract analog pin set given vector and number of pins, interrupt handler and environment. The vector of pins should be defined in program memory using PROGMEM.
[in] | pins | vector with analog pins. |
[in] | buffer | analog pin value storage. |
[in] | count | number of pins in vector. |
[in] | ref | reference voltage. |
Definition at line 41 of file AnalogPins.hh.
|
inline |
|
inlinevirtual |
Default analog pin set event handler function.
[in] | type | the type of event. |
[in] | value | the event value. |
Reimplemented from AnalogPin.
Definition at line 91 of file AnalogPins.hh.
|
virtual |
Interrupt service on conversion completion.
[in] | arg | sample value. |
Reimplemented from AnalogPin.
Definition at line 31 of file AnalogPins.cpp.
|
inline |
Get analog pin in set.
[in] | ix | index. |
Definition at line 66 of file AnalogPins.hh.
bool AnalogPins::samples_request | ( | ) |
Request sample of analog pin set.
Definition at line 24 of file AnalogPins.cpp.