COSA
An Object-Oriented Platform for Arduino Programming
|
#include <InputCapture.hh>
Public Types | |
enum | InterruptMode { ON_FALLING_MODE, ON_RISING_MODE } |
Public Member Functions | |
InputCapture (InterruptMode mode=ON_FALLING_MODE) | |
InterruptMode | mode () const |
void | mode (InterruptMode mode) |
uint16_t | count () |
virtual void | on_interrupt (uint16_t arg=0) |
virtual void | enable () |
virtual void | disable () |
virtual void | clear () |
Static Public Member Functions | |
static void | begin () |
static void | end () |
Friends | |
void | TIMER1_CAPT_vect (void) |
Input Capture Unit. Allows timer capture and interrupt handling on the input capture pin value changes. The pin is hardwired (ICP1/PB0 on ATmega328p, D8).
Uses Timer1. Cannot be used with libraries that use the same Timer; Tone, VWI. Compiles for Mega but the ICP1 pin is not available on the Arduino Mega board.
Definition at line 40 of file InputCapture.hh.
Enumerator | |
---|---|
ON_FALLING_MODE | |
ON_RISING_MODE |
Definition at line 42 of file InputCapture.hh.
InputCapture::InputCapture | ( | InterruptMode | mode = ON_FALLING_MODE | ) |
Construct input capture unit with given capture mode and with no prescale. Pin is D8 on ATmega328 based boards.
[in] | mode | capture mode (Default ON_FALLING_MODE). |
Definition at line 27 of file InputCapture.cpp.
|
inlinestatic |
Start input capture timer.
Definition at line 57 of file InputCapture.hh.
|
virtual |
Clear input capture interrupt flag.
Reimplemented from Interrupt::Handler.
Definition at line 63 of file InputCapture.cpp.
|
inline |
|
virtual |
Disable input capture handler.
Reimplemented from Interrupt::Handler.
Definition at line 56 of file InputCapture.cpp.
|
virtual |
Enable input capture handler.
Reimplemented from Interrupt::Handler.
Definition at line 49 of file InputCapture.cpp.
|
inlinestatic |
Stop input capture timer.
Definition at line 65 of file InputCapture.hh.
|
inline |
|
inline |
|
virtual |
Interrupt service callback on input capture. The parameter arg contains the timer value. The timer is incremented with the system clock (prescale is 1).
[in] | arg | timer count on event. |
Reimplemented from Interrupt::Handler.
Definition at line 43 of file InputCapture.cpp.
|
friend |