COSA
An Object-Oriented Platform for Arduino Programming
|
#include <AnalogComparator.hh>
Public Types | |
enum | Mode { ON_TOGGLE_MODE = 0, ON_FALLING_MODE = _BV(ACIS1), ON_RISING_MODE = (_BV(ACIS1) | _BV(ACIS0)) } |
Public Member Functions | |
AnalogComparator (Mode mode=ON_TOGGLE_MODE, bool bandgap=false) | |
AnalogComparator (Board::AnalogPin pin, Mode mode=ON_TOGGLE_MODE) | |
virtual void | enable () |
virtual void | disable () |
virtual void | on_interrupt (uint16_t arg=0) |
virtual void | clear () |
virtual void | on_event (uint8_t type, uint16_t value) |
Protected Attributes | |
Mode | m_mode |
Compare mode. More... | |
uint8_t | m_pin |
Analog channel. More... | |
Static Protected Attributes | |
static AnalogComparator * | s_comparator = NULL |
Current comparator. More... | |
static const uint8_t | AIN1 = 254 |
Default reference voltage. More... | |
static const uint8_t | VBG = 255 |
Bandgap voltage reference. More... | |
Friends | |
void | ANALOG_COMP_vect (void) |
Analog Comparator; compare input values on the positive pin AIN0 (D6) and negative pin AIN1 (D7), bandgap voltage or ADCn. Note: only one instance can be active/enabled at a time.
Definition at line 32 of file AnalogComparator.hh.
Enumerator | |
---|---|
ON_TOGGLE_MODE | |
ON_FALLING_MODE | |
ON_RISING_MODE |
Definition at line 34 of file AnalogComparator.hh.
|
inline |
Construct analog comparator handler. Compare AIN0 (D6) with AIN1 (D7) or bandgap voltage (1V1).
[in] | mode | comparator mode. |
Definition at line 45 of file AnalogComparator.hh.
|
inline |
Construct analog comparator handler. Compare AIN0 (D6) with given analog pin (ADCn).
[in] | pin | analog pin to compare with. |
[in] | mode | comparator mode. |
Definition at line 56 of file AnalogComparator.hh.
|
inlinevirtualinherited |
Clear interrupt.
Reimplemented in InputCapture, and ExternalInterrupt.
Definition at line 59 of file Interrupt.hh.
|
inlinevirtual |
Disable analog comparator handler.
Reimplemented from Interrupt::Handler.
Definition at line 83 of file AnalogComparator.hh.
|
inlinevirtual |
Enable analog comparator handler.
Reimplemented from Interrupt::Handler.
Definition at line 66 of file AnalogComparator.hh.
|
inlinevirtualinherited |
Default null event handler. Should be redefined by sub-classes. Called by Event::dispatch().
[in] | type | the event type. |
[in] | value | the event value. |
Reimplemented in Menu::RotaryController, Rotary::Dial< T >, AnalogPin, Job, TWI::Slave, ProtoThread, AnalogPins, and Periodic.
|
virtual |
Default interrupt service on comparator output rise, fall or toggle.
[in] | arg | argument from interrupt service routine. |
Reimplemented from Interrupt::Handler.
Definition at line 26 of file AnalogComparator.cpp.
|
friend |
Interrupt Service Routine
|
staticprotected |
Default reference voltage.
Definition at line 100 of file AnalogComparator.hh.
|
protected |
Compare mode.
Definition at line 102 of file AnalogComparator.hh.
|
protected |
Analog channel.
Definition at line 103 of file AnalogComparator.hh.
|
staticprotected |
Current comparator.
Definition at line 99 of file AnalogComparator.hh.
|
staticprotected |
Bandgap voltage reference.
Definition at line 101 of file AnalogComparator.hh.