Subversion Repositories group.electronics

Rev

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

Rev 90 Rev 91
Line 73... Line 73...
73
uchar	usbFunctionSetup(uchar data[8])
73
uchar	usbFunctionSetup(uchar data[8])
74
{
74
{
75
    usbRequest_t    *rq = (void *)data;
75
    usbRequest_t    *rq = (void *)data;
76
 
76
 
77
    //if((rq->bmRequestType & USBRQ_TYPE_MASK) == USBRQ_TYPE_CLASS){ 
77
    //if((rq->bmRequestType & USBRQ_TYPE_MASK) == USBRQ_TYPE_CLASS){ 
78
 
-
 
79
        switch (rq->bRequest ) {
78
        switch (rq->bRequest ) {
80
		case USBRQ_HID_GET_REPORT:
79
		case USBRQ_HID_GET_REPORT:
81
			return sizeof(reportBuffer);
80
			return sizeof(reportBuffer);
82
		case USBRQ_HID_GET_IDLE:
81
		case USBRQ_HID_GET_IDLE:
83
			usbMsgPtr = &idleRate;
82
			usbMsgPtr = &idleRate;
Line 85... Line 84...
85
		case USBRQ_HID_SET_IDLE:
84
		case USBRQ_HID_SET_IDLE:
86
			idleRate = rq->wValue.bytes[1];
85
			idleRate = rq->wValue.bytes[1];
87
			return 0;
86
			return 0;
88
		case USB_GET_LED_STATE: // send data to PC
87
		case USB_GET_LED_STATE: // send data to PC
89
			usbMsgPtr = currleds;
88
			usbMsgPtr = currleds;
-
 
89
			//currleds = 1;
90
			return sizeof(currleds);
90
			return sizeof(currleds);
91
		case USB_SET_LED_STATE: // modify reply buffer
91
		case USB_SET_LED_STATE: // modify reply buffer
92
			//currleds = rq->wValue.bytes[0];
92
			currleds = rq->wValue.bytes[0];
93
			//currleds = rq->wIndex.bytes[0];
-
 
94
			currleds = 0xaa;
-
 
95
			return 0;
93
			return 0;
96
        }
94
        }
97
    //}else{
-
 
98
 
-
 
99
    //}
95
    //}
-
 
96
 
100
	return 0;
97
	return 0;
101
}
98
}
102
 
99
 
103
 
100
 
104
void usbSendHidReport(uchar * data, uchar len) {
101
void usbSendHidReport(uchar * data, uchar len) {
105
	usbSetInterrupt(data, len);
102
	usbSetInterrupt(data, len);
106
}
103
}
107
 
104
 
108
/*
-
 
109
void usbSendHidReport(uchar * data, uchar len) {
-
 
110
        while(1)
-
 
111
        {
-
 
112
                usbPoll();
-
 
113
                if (usbInterruptIsReady())
-
 
114
                {
-
 
115
                        usbSetInterrupt(data, len);
-
 
116
                        break;
-
 
117
                }
-
 
118
        }
-
 
119
}
-
 
120
*/
-
 
121
 
-
 
122
 
-
 
123
int main(void) {
105
int main(void) {
124
 
106
 
125
	DIDR0 = 0x00;
107
	DIDR0 = 0x00;
126
 
108
 
127
  /*
109
  /*