COSA
An Object-Oriented Platform for Arduino Programming
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
IR.hh
Go to the documentation of this file.
1
21
#ifndef COSA_IR_HH
22
#define COSA_IR_HH
23
24
#include "
Cosa/ExternalInterrupt.hh
"
25
#include "
Cosa/Periodic.hh
"
26
#include "
Cosa/IOStream.hh
"
27
44
class
IR
{
45
public
:
46
47
class
Receiver
:
private
ExternalInterrupt
,
public
Job
{
48
public
:
53
struct
keymap_t
{
54
uint16_t
code
;
55
char
key
;
56
};
57
typedef
const
keymap_t
*
keymap_P
;
58
67
virtual
void
on_interrupt
(uint16_t arg = 0);
68
69
public
:
84
Receiver
(
Board::ExternalInterruptPin
pin
,
85
uint8_t max, uint32_t threshold,
86
Job::Scheduler
* scheduler,
87
keymap_P keymap =
NULL
, uint8_t keys = 0,
88
uint16_t* sample =
NULL
) :
89
ExternalInterrupt
(pin,
ExternalInterrupt
::
ON_FALLING_MODE
),
90
Job
(scheduler),
91
m_threshold(threshold),
92
m_sample(sample),
93
m_start(0),
94
m_code(0),
95
m_ix(0),
96
m_max(max),
97
m_keymap(keymap),
98
m_keys(keys)
99
{}
100
104
void
reset
();
105
111
int
lookup
(uint16_t
code
);
112
113
private
:
114
static
const
uint16_t TIMEOUT = 512;
115
volatile
uint32_t m_threshold;
116
volatile
uint16_t* m_sample;
117
volatile
uint32_t m_start;
118
volatile
uint32_t m_code;
119
volatile
uint8_t m_ix;
120
const
uint8_t m_max;
121
const
keymap_P m_keymap;
122
const
uint8_t m_keys;
123
130
friend
IOStream
&
operator<<
(
IOStream
& outs,
Receiver
& receiver);
131
};
132
};
133
134
#endif
135
ExternalInterrupt
Definition:
ExternalInterrupt.hh:33
IR::Receiver::on_interrupt
virtual void on_interrupt(uint16_t arg=0)
Definition:
IR.cpp:26
IOStream
Definition:
IOStream.hh:30
IR
Definition:
IR.hh:44
Pin::pin
uint8_t pin() const
Definition:
Pin.hh:103
Periodic.hh
NULL
#define NULL
Definition:
Types.h:101
Job
Definition:
Job.hh:33
Job::Scheduler
Definition:
Job.hh:43
IOStream.hh
IR::Receiver::keymap_t
Definition:
IR.hh:53
IR::Receiver::lookup
int lookup(uint16_t code)
Definition:
IR.cpp:80
IR::Receiver::operator<<
friend IOStream & operator<<(IOStream &outs, Receiver &receiver)
Definition:
IR.cpp:89
ExternalInterrupt.hh
IR::Receiver::Receiver
Receiver(Board::ExternalInterruptPin pin, uint8_t max, uint32_t threshold, Job::Scheduler *scheduler, keymap_P keymap=NULL, uint8_t keys=0, uint16_t *sample=NULL)
Definition:
IR.hh:84
IR::Receiver::keymap_P
const keymap_t * keymap_P
Definition:
IR.hh:57
Board::ExternalInterruptPin
ExternalInterruptPin
Definition:
ATmega1284P.hh:190
ExternalInterrupt::ON_FALLING_MODE
Definition:
ExternalInterrupt.hh:38
IR::Receiver::keymap_t::key
char key
Definition:
IR.hh:55
IR::Receiver
Definition:
IR.hh:47
IR::Receiver::reset
void reset()
Definition:
IR.cpp:65
IR::Receiver::keymap_t::code
uint16_t code
Definition:
IR.hh:54
libraries
IR
IR.hh
Generated on Thu Aug 31 2017 17:02:03 for COSA by
1.8.11