COSA
An Object-Oriented Platform for Arduino Programming
|
#include <Alarm.hh>
Public Types | |
enum | InterruptMode { ON_LOW_LEVEL_MODE = 0, ON_CHANGE_MODE = _BV(ISC00), ON_FALLING_MODE = _BV(ISC01), ON_RISING_MODE = (_BV(ISC01) | _BV(ISC00)) } |
enum | Mode { OUTPUT_MODE = 0, INPUT_MODE = 1 } |
enum | Direction { MSB_FIRST = 0, LSB_FIRST = 1 } |
Public Member Functions | |
Clock (Board::ExternalInterruptPin pin, InterruptMode mode=ON_RISING_MODE, bool pullup=false) | |
virtual uint32_t | time () |
void | time (uint32_t sec) |
uint32_t | await () |
void | tick (uint16_t ms) |
void | calibration (int16_t ms) |
int16_t | calibration () |
void | adjust (int16_t ms) |
virtual bool | start (Job *job) |
virtual bool | stop (Job *job) |
virtual void | dispatch () |
virtual void | enable () |
virtual void | disable () |
virtual void | clear () |
void | clear () const |
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 | 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 |
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) |
Static Public 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) |
Protected Member Functions | |
virtual void | on_interrupt (uint16_t arg=0) |
volatile uint8_t * | PIN () const |
volatile uint8_t * | DDR () const |
volatile uint8_t * | PORT () const |
volatile uint8_t * | PCIMR () const |
Protected Attributes | |
int16_t | m_msec |
Milli-seconds fraction. More... | |
uint32_t | m_sec |
Seconds counter. More... | |
int16_t | m_cal |
Milli-seconds calibration. More... | |
Head | m_queue |
volatile uint8_t *const | m_sfr |
const uint8_t | m_mask |
const uint8_t | m_pin |
Alarm Clock is an external interrupt based job scheduler. The interrupt source should provide an interrupt every second to update the seconds counter and dispatch expired alarms.
|
inherited |
|
inherited |
Enumerator | |
---|---|
ON_LOW_LEVEL_MODE | |
ON_CHANGE_MODE | |
ON_FALLING_MODE | |
ON_RISING_MODE |
Definition at line 35 of file ExternalInterrupt.hh.
|
inherited |
|
inline |
|
inlineinherited |
Clear the output pin. Unprotected version.
Definition at line 114 of file OutputPin.hh.
|
inlineinherited |
Set the output pin. Unprotected version.
Definition at line 75 of file OutputPin.hh.
|
inlineinherited |
Set the output pin with the given value. Zero(0) to clear and non-zero to set. Unprotected version.
[in] | value | to set. |
Definition at line 184 of file OutputPin.hh.
|
inlineinherited |
Toggle the output pin. Unprotected version.
Definition at line 153 of file OutputPin.hh.
|
inlineinherited |
Set the output pin with the given value. Zero(0) to clear and non-zero to set. Unprotected version.
[in] | value | to set. |
Definition at line 219 of file OutputPin.hh.
|
inlinestaticinherited |
Set the given output pin with the given value. Zero(0) to clear and non-zero to set. Unprotected version when pin and value are constants.
[in] | pin | number (must be constant). |
[in] | value | to write (must be constant). |
Definition at line 345 of file OutputPin.hh.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
virtualinherited |
Clear external interrupt flag.
Reimplemented from Interrupt::Handler.
Definition at line 205 of file ExternalInterrupt.cpp.
|
inlineinherited |
|
inlinestaticinherited |
|
inlineprotectedinherited |
|
virtualinherited |
Disable external interrupt handler.
Reimplemented from Interrupt::Handler.
Definition at line 199 of file ExternalInterrupt.cpp.
|
virtualinherited |
Dispatch expired jobs. This member function is typically called from an interrupt service routine.
Reimplemented in RTT::Scheduler.
Definition at line 53 of file Job_Scheduler.cpp.
|
virtualinherited |
Enable external interrupt handler.
Reimplemented from Interrupt::Handler.
Definition at line 190 of file ExternalInterrupt.cpp.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlinestaticinherited |
|
inlineinherited |
|
inlinestaticinherited |
Set output pin to mode.
[in] | pin | number. |
[in] | initial | value. |
Definition at line 56 of file OutputPin.hh.
|
inlineinherited |
|
inlinestaticinherited |
|
inlinestaticinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineprotectedvirtual |
Increment the seconds counter and dispatch any expired alarms.
[in] | arg | argument from interrupt service routine (not used). |
Reimplemented from ExternalInterrupt.
|
inlineinherited |
|
inlineinherited |
Set the output pin with the given value. Zero(0) to clear and non-zero to set. Output operator syntax.
[in] | value | to write. |
Definition at line 364 of file OutputPin.hh.
|
inlineinherited |
|
inlineprotectedinherited |
|
inlinestaticinherited |
|
inlineinherited |
|
inlineprotectedinherited |
|
inlinestaticinherited |
|
inlineprotectedinherited |
|
inlineinherited |
Toggle the output pin to form a pulse with given width in micro-seconds.
[in] | us | pulse width in micro seconds |
Definition at line 378 of file OutputPin.hh.
|
inlineinherited |
|
inlinestaticinherited |
|
inlineinherited |
|
inlineinherited |
Set the output pin with the given value. Zero(0) to clear and non-zero to set.
[in] | value | to set. |
Definition at line 201 of file OutputPin.hh.
|
virtualinherited |
Start given job. Returns true(1) if successful otherwise false(0).
[in] | job | to start. |
Reimplemented in RTT::Scheduler.
Definition at line 24 of file Job_Scheduler.cpp.
|
virtualinherited |
Stop given job. Returns true(1) if successful otherwise false(0).
[in] | job | to stop. |
Definition at line 44 of file Job_Scheduler.cpp.
|
inlineinherited |
|
inlinevirtualinherited |
|
inlineinherited |
|
inlineinherited |
|
inlinestaticinherited |
Toggle the output pin. Atomic per definition
[in] | pin | number. |
Definition at line 173 of file OutputPin.hh.
|
inlineinherited |
Set the output pin with the given value. Zero(0) to clear and non-zero to set.
[in] | value | to write. |
Definition at line 236 of file OutputPin.hh.
|
inherited |
Shift out given byte to the output pin using the given clock output pin. Shift out according to given direction. Data (bits) are transfered on clock transition. Interrupts are allowed during the shift out.
[in] | value | to write. |
[in] | clk | output pin. |
[in] | order | bit first. |
Definition at line 24 of file OutputPin.cpp.
|
inherited |
Shift out given value and number of bits to the output pin using the given pulse length in micro-seconds. Shift out from LSB(0) to MSB(bits-1). This operation is synchronized and will turn off interrupt handling during the transmission period.
[in] | value | to write. |
[in] | bits | to write. |
[in] | us | micro-second bit period. |
Definition at line 46 of file OutputPin.cpp.
|
inlinestaticinherited |
Set the given output pin with the given value. Zero(0) to clear and non-zero to set.
[in] | pin | number. |
[in] | value | to write. |
Definition at line 306 of file OutputPin.hh.
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |