source: rtos_arduino/trunk/arduino_lib/libraries/RobotIRremote/src/IRremote.h@ 136

Last change on this file since 136 was 136, checked in by ertl-honda, 8 years ago

ライブラリとOS及びベーシックなサンプルの追加.

File size: 2.8 KB
Line 
1/*
2 * IRremote
3 * Version 0.1 July, 2009
4 * Copyright 2009 Ken Shirriff
5 * For details, see http://arcfn.com/2009/08/multi-protocol-infrared-remote-library.htm http://arcfn.com
6 * Edited by Mitra to add new controller SANYO
7 *
8 * Interrupt code based on NECIRrcv by Joe Knapp
9 * http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1210243556
10 * Also influenced by http://zovirl.com/2008/11/12/building-a-universal-remote-with-an-arduino/
11 *
12 * JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post)
13 */
14
15#ifndef IRremote_h
16#define IRremote_h
17
18// The following are compile-time library options.
19// If you change them, recompile the library.
20// If DEBUG is defined, a lot of debugging output will be printed during decoding.
21// TEST must be defined for the IRtest unittests to work. It will make some
22// methods virtual, which will be slightly slower, which is why it is optional.
23// #define DEBUG
24// #define TEST
25
26// Results returned from the decoder
27class decode_results {
28public:
29 int decode_type; // NEC, SONY, RC5, UNKNOWN
30 unsigned int panasonicAddress; // This is only used for decoding Panasonic data
31 unsigned long value; // Decoded value
32 int bits; // Number of bits in decoded value
33 volatile unsigned int *rawbuf; // Raw intervals in .5 us ticks
34 int rawlen; // Number of records in rawbuf.
35};
36
37// Values for decode_type
38#define NEC 1
39#define SONY 2
40#define RC5 3
41#define RC6 4
42#define DISH 5
43#define SHARP 6
44#define PANASONIC 7
45#define JVC 8
46#define SANYO 9
47#define MITSUBISHI 10
48#define UNKNOWN -1
49
50// Decoded value for NEC when a repeat code is received
51#define REPEAT 0xffffffff
52
53// main class for receiving IR
54class IRrecv
55{
56public:
57 IRrecv(int recvpin);
58 void blink13(int blinkflag);
59 int decode(decode_results *results);
60 void enableIRIn();
61 void resume();
62private:
63 // These are called by decode
64 int getRClevel(decode_results *results, int *offset, int *used, int t1);
65 long decodeNEC(decode_results *results);
66 //long decodeSony(decode_results *results);
67 //long decodeSanyo(decode_results *results);
68 //long decodeMitsubishi(decode_results *results);
69 //long decodeRC5(decode_results *results);
70 //long decodeRC6(decode_results *results);
71 //long decodePanasonic(decode_results *results);
72 //long decodeJVC(decode_results *results);
73 long decodeHash(decode_results *results);
74 int compare(unsigned int oldval, unsigned int newval);
75
76}
77;
78
79// Only used for testing; can remove virtual for shorter code
80#ifdef TEST
81#define VIRTUAL virtual
82#else
83#define VIRTUAL
84#endif
85// Some useful constants
86
87#define USECPERTICK 50 // microseconds per clock interrupt tick
88#define RAWBUF 100 // Length of raw duration buffer
89
90// Marks tend to be 100us too long, and spaces 100us too short
91// when received due to sensor lag.
92#define MARK_EXCESS 100
93
94#endif
Note: See TracBrowser for help on using the repository browser.