]> git.zerfleddert.de Git - fnordlicht-mini/blob - firmware/fnordlicht-controller/ir.h
reference eeprom contents
[fnordlicht-mini] / firmware / fnordlicht-controller / ir.h
1 /*
2 * ox - infrared to usb keyboard/mouse adapter
3 *
4 * by Alexander Neumann <alexander@lochraster.org>
5 *
6 * inspired by InfraHID by Alex Badea,
7 * see http://vamposdecampos.googlepages.com/infrahid.html
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 * For more information on the GPL, please go to:
23 * http://www.gnu.org/copyleft/gpl.html
24 */
25
26 #ifndef __IR_H
27 #define __IR_H
28
29 enum ir_mode_t
30 {
31 IR_DISABLED = 0,
32 IR_RAW = 1, /* just receive a code, disable ir afterwards (-> DISABLE) */
33 IR_DECODE = 2, /* just receive and decode vaules, disable ir afterwards (-> DISABLE) */
34 IR_RECEIVE = 3, /* receive, decode and process codes */
35 };
36
37 struct ir_global_t
38 {
39 enum ir_mode_t mode;
40 uint16_t last;
41 uint8_t length;
42
43 #define MAX_CODE_LENGTH 160
44 /* internal storage for received code: allocate 160*2 = 320 byte memory for
45 * storing a code, this means we can store 80 on/off sequence timings */
46
47 uint16_t time[MAX_CODE_LENGTH];
48 uint8_t pos;
49 };
50
51 extern volatile struct ir_global_t ir_global;
52
53 void ir_init(void);
54 void ir_poll(void);
55
56 void ir_set_mode(enum ir_mode_t mode);
57
58 #define ir_disable() ir_set_mode(IR_DISABLED);
59 #define ir_enable() ir_set_mode(IR_RECEIVE);
60
61 #endif
Impressum, Datenschutz