-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathEasyCon_API.c
136 lines (118 loc) · 2.51 KB
/
EasyCon_API.c
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#include "EasyCon_API.h"
/**********************************************************************/
// some incude files for funcs, you need change to your device framework files
/**********************************************************************/
#include <LUFA/Drivers/Board/LEDs.h>
#include "Common.h"
#include "HID.h"
/**********************************************************************/
// EasyCon API, you need to implement all of the AIP
/**********************************************************************/
/* EasyCon read 1 byte from E2Prom or flash
* need implement
*/
uint8_t EasyCon_read_byte(uint8_t* addr)
{
return eeprom_read_byte(addr);
}
/* EasyCon write 1 byte to E2Prom or flash
* need implement
*/
void EasyCon_write_byte(uint8_t* addr,uint8_t value)
{
eeprom_write_byte(addr,value);
}
/* EasyCon read 2 byte from E2Prom or flash
* need implement
*/
uint16_t EasyCon_read_2byte(uint16_t* addr)
{
return eeprom_read_word(addr);
}
/* EasyCon write 2 byte to E2Prom or flash
* need implement
*/
void EasyCon_write_2byte(uint16_t* addr,uint16_t value)
{
eeprom_write_word(addr,value);
}
/* running led on
* need implement
*/
void EasyCon_runningLED_on(void)
{
LEDs_TurnOnLEDs(LED_RX);
}
/* running led off
* need implement
*/
void EasyCon_runningLED_off(void)
{
LEDs_TurnOffLEDs(LED_RX);
}
/* data led blink
* need implement,no block
*/
void EasyCon_blink_led(void)
{
led_ms = LED_DURATION;
LEDs_TurnOnLEDs(LED_TX);
}
/* serial send 1 byte
* need implement,block
*/
void EasyCon_serial_send(const char DataByte)
{
Serial_SendByte(DataByte);
EasyCon_blink_led();
}
// about hid report
/* reset hid report to default.
* need implement
*/
void reset_hid_report(void)
{
ResetReport();
}
/* set left stick in hid report.
* need implement
*/
void set_left_stick(const uint8_t LX, const uint8_t LY)
{
SetLeftStick(LX,LY);
}
/* set right stick in hid report.
* need implement
*/
void set_right_ttick(const uint8_t RX, const uint8_t RY)
{
SetRightStick(RX,RY);
}
/* set button in hid report.
* need implement
*/
void set_buttons(const uint16_t Button)
{
SetButtons(Button);
}
/* set button press in hid report.
* need implement
*/
void press_buttons(const uint16_t Button)
{
PressButtons(Button);
}
/* set buttons release in hid report.
* need implement
*/
void release_buttons(const uint16_t Button)
{
ReleaseButtons(Button);
}
/* set HAT in hid report.
* need implement
*/
void set_HAT_switch(const uint8_t HAT)
{
SetHATSwitch(HAT);
}