-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathmain.c
36 lines (33 loc) · 831 Bytes
/
main.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
typedef unsigned char *PUINT8;
typedef unsigned char __xdata *PUINT8X;
typedef const unsigned char __code *PUINT8C;
typedef unsigned char __xdata UINT8X;
typedef unsigned char __data UINT8D;
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "CH559.h"
#include "util.h"
#include "USBHost.h"
#include "uart.h"
SBIT(LED, 0x90, 6);
void main()
{
unsigned char s;
initClock();
initUART0(1000000, 1);
DEBUG_OUT("Startup\n");
resetHubDevices(0);
resetHubDevices(1);
initUSB_Host();
DEBUG_OUT("Ready\n");
sendProtocolMSG(MSG_TYPE_STARTUP,0, 0x00, 0x00, 0x00, 0);
while(1)
{
if(!(P4_IN & (1 << 6)))
runBootloader();
processUart();
s = checkRootHubConnections();
pollHIDdevice();
}
}