-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.h
79 lines (60 loc) · 1.48 KB
/
common.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#pragma once
#include "MyArduboy2.h"
/* Defines */
#define FPS 25
enum MODE_T : uint8_t {
MODE_SENDER = 0,
MODE_RECEIVER,
};
enum ICON_T : uint8_t {
ICON_BUTTON_A = 0,
ICON_BUTTON_B,
ICON_BUTTON_UD,
ICON_BUTTON_LR,
};
enum IR_TYPE_T : uint8_t {
IR_TYPE_UNKNOWN = 0,
IR_TYPE_IRISOHYAMA_103,
IR_TYPE_NEC_6D82,
IR_TYPE_KASEIKYO_S_522C,
IR_TYPE_SONY_1,
IR_TYPE_SONY_1A,
IR_TYPE_SONY_77,
IR_TYPE_SONY_97,
IR_TYPE_SONY_A4,
IR_TYPE_SONY_1C5A,
IR_TYPE_SONY_1E5A,
IR_TYPE_PLUSMINUS0_76,
};
/* Typedefs */
typedef struct {
const __FlashStringHelper *protocol;
uint16_t vendor;
uint16_t address;
uint32_t command;
uint8_t nbits;
uint8_t flags;
uint64_t data;
uint16_t *pBuffer;
} IR_INFO_T;
/* Global Functions (Common) */
void handleDPad(void);
void drawButtonIcon(int16_t x, int16_t y, ICON_T icon);
/* Global Functions (IR control) */
void beginIRSender(void);
void sendIR(IR_TYPE_T type, uint32_t data);
void beginIRReceiver(void);
bool receiveIR(IR_INFO_T &info);
void endIRReceiver(void);
/* Global Functions (Each Mode) */
void initSender(void);
MODE_T updateSender(void);
void drawSender(void);
void initReceiver(void);
MODE_T updateReceiver(void);
void drawReceiver(void);
/* Global Variables */
extern MyArduboy2 arduboy;
extern uint8_t counter;
extern int8_t padX, padY, padRepeatCount;
extern bool isInvalid;