MakeBlock Drive Updated
Updated library for MakeBlock Ranger
Loading...
Searching...
No Matches
MeInfraredReceiver.h
Go to the documentation of this file.
1
44#ifndef MeInfraredReceiver_H
45#define MeInfraredReceiver_H
46
47#include <stdint.h>
48#include <stdbool.h>
49#include <Arduino.h>
50#include "MeConfig.h"
51#include "MeSerial.h"
52
53/* NEC Code table */
54#define IR_BUTTON_POWER (0x45)
55#define IR_BUTTON_A (0x45)
56#define IR_BUTTON_B (0x46)
57#define IR_BUTTON_MENU (0x47)
58#define IR_BUTTON_C (0x47)
59#define IR_BUTTON_TEST (0x44)
60#define IR_BUTTON_D (0x44)
61#define IR_BUTTON_PLUS (0x40)
62#define IR_BUTTON_UP (0x40)
63#define IR_BUTTON_RETURN (0x43)
64#define IR_BUTTON_E (0x43)
65#define IR_BUTTON_PREVIOUS (0x07)
66#define IR_BUTTON_LEFT (0x07)
67#define IR_BUTTON_PLAY (0x15)
68#define IR_BUTTON_SETTING (0x15)
69#define IR_BUTTON_NEXT (0x09)
70#define IR_BUTTON_RIGHT (0x09)
71#define IR_BUTTON_MINUS (0x19)
72#define IR_BUTTON_DOWN (0x19)
73#define IR_BUTTON_CLR (0x0D)
74#define IR_BUTTON_F (0x0D)
75#define IR_BUTTON_0 (0x16)
76#define IR_BUTTON_1 (0x0C)
77#define IR_BUTTON_2 (0x18)
78#define IR_BUTTON_3 (0x5E)
79#define IR_BUTTON_4 (0x08)
80#define IR_BUTTON_5 (0x1C)
81#define IR_BUTTON_6 (0x5A)
82#define IR_BUTTON_7 (0x42)
83#define IR_BUTTON_8 (0x52)
84#define IR_BUTTON_9 (0x4A)
85
86#ifdef ME_PORT_DEFINED
87#include "MePort.h"
88#endif /* ME_PORT_DEFINED */
89
95#ifndef ME_PORT_DEFINED
97#else // !ME_PORT_DEFINED
99#endif // !ME_PORT_DEFINED
100{
101public:
102#ifdef ME_PORT_DEFINED
109 MeInfraredReceiver(void);
110
117 MeInfraredReceiver(uint8_t port);
118#else // ME_PORT_DEFINED
129 MeInfraredReceiver(uint8_t receivePin, uint8_t transmitPin, bool inverse_logic);
130#endif // ME_PORT_DEFINED
131
145 void begin(void);
146
161 int read();
162
175 bool buttonState(void);
176
189 uint8_t getCode(void);
190
203 void loop(void);
204private:
205 volatile uint8_t _RxPin;
206 volatile uint8_t _KeyCheckPin;
207 uint8_t _irCode;
208 uint8_t _preIrCode;
209};
210
211#endif
212
Configuration file of library.
Header for MePort.cpp module.
Header for for MeSerial.cpp module.
Driver for Me Infrared Receiver device.
Definition MeInfraredReceiver.h:100
uint8_t getCode(void)
Definition MeInfraredReceiver.cpp:175
MeInfraredReceiver(void)
Definition MeInfraredReceiver.cpp:53
bool buttonState(void)
Definition MeInfraredReceiver.cpp:144
int read()
Definition MeInfraredReceiver.cpp:124
void loop(void)
Definition MeInfraredReceiver.cpp:192
void begin(void)
Definition MeInfraredReceiver.cpp:100
Driver for serial.
Definition MeSerial.h:67