Subversion Repositories group.electronics

Rev

Rev 87 | Rev 89 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 87 Rev 88
Line 9... Line 9...
9
 
9
 
10
#ifndef NULL
10
#ifndef NULL
11
#define NULL    ((void *)0)
11
#define NULL    ((void *)0)
12
#endif
12
#endif
13
 
13
 
-
 
14
#define USB_GET_LED_STATE  100
-
 
15
#define USB_SET_LED_STATE  101
-
 
16
 
14
/* ------------------------------------------------------------------------- */
17
/* ------------------------------------------------------------------------- */
15
 
18
 
16
uint8_t getKey(void);
19
uint8_t getKey(void);
17
void doButtons(uint8_t);
20
void doButtons(uint8_t);
18
inline void setLeds(uint8_t);
21
inline void setLeds(uint8_t);
Line 69... Line 72...
69
 
72
 
70
uchar	usbFunctionSetup(uchar data[8])
73
uchar	usbFunctionSetup(uchar data[8])
71
{
74
{
72
    usbRequest_t    *rq = (void *)data;
75
    usbRequest_t    *rq = (void *)data;
73
 
76
 
74
    if((rq->bmRequestType & USBRQ_TYPE_MASK) == USBRQ_TYPE_CLASS){ 
77
    //if((rq->bmRequestType & USBRQ_TYPE_MASK) == USBRQ_TYPE_CLASS){ 
-
 
78
		
-
 
79
        switch (rq->bRequest ) {
75
        if(rq->bRequest == USBRQ_HID_GET_REPORT){ 
80
			case USBRQ_HID_GET_REPORT):
76
            return sizeof(reportBuffer);
81
				return sizeof(reportBuffer);
77
        }else if(rq->bRequest == USBRQ_HID_GET_IDLE){
82
			case USBRQ_HID_GET_IDLE:
78
            //usbMsgPtr = &idleRate;
83
				usbMsgPtr = &idleRate;
79
            return 1;
84
				return 1;
80
        }else if(rq->bRequest == USBRQ_HID_SET_IDLE){
85
			case USBRQ_HID_SET_IDLE:
81
            idleRate = rq->wValue.bytes[1];
86
				idleRate = rq->wValue.bytes[1];
-
 
87
				return 0;
-
 
88
			case USB_GET_LED_STATE: // send data to PC
-
 
89
				usbMsgPtr = currleds;
-
 
90
				return sizeof(currleds);
-
 
91
			case USB_SET_LED_STATE: // modify reply buffer
-
 
92
				currleds = rq->wValue.bytes[0];
-
 
93
				//currleds = rq->wIndex.bytes[0];
-
 
94
				return 0;
82
        }
95
        }
83
    }else{
96
    //}else{
84
 
97
 
85
    }
98
    //}
86
	return 0;
99
	return 0;
87
}
100
}
88
 
101
 
89
 
102
 
90
void usbSendHidReport(uchar * data, uchar len) {
103
void usbSendHidReport(uchar * data, uchar len) {