You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
2.1 KiB
60 lines
2.1 KiB
|
|
#include "main.h"
|
|
|
|
static uint8_t reportBuffer[64];
|
|
|
|
const PROGMEM char usbHidReportDescriptor[35] = { /* USB report descriptor */
|
|
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
|
|
0x09, 0x06, // USAGE (Keyboard)
|
|
0xa1, 0x01, // COLLECTION (Application)
|
|
0x05, 0x07, // USAGE_PAGE (Keyboard)
|
|
0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl)
|
|
0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI)
|
|
0x15, 0x00, // LOGICAL_MINIMUM (0)
|
|
0x25, 0x01, // LOGICAL_MAXIMUM (1)
|
|
0x75, 0x01, // REPORT_SIZE (1)
|
|
0x95, 0x08, // REPORT_COUNT (8)
|
|
0x81, 0x02, // INPUT (Data,Var,Abs)
|
|
0x95, 0x01, // REPORT_COUNT (1)
|
|
0x75, 0x08, // REPORT_SIZE (8)
|
|
0x25, 0x65, // LOGICAL_MAXIMUM (101)
|
|
0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated))
|
|
0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application)
|
|
0x81, 0x00, // INPUT (Data,Ary,Abs)
|
|
0xc0 // END_COLLECTION
|
|
};
|
|
|
|
usbMsgLen_t usbFunctionSetup(uchar data[8]) {
|
|
usbRequest_t *rq = (void *)data;
|
|
usbMsgPtr = reportBuffer;
|
|
if((rq->bmRequestType & USBRQ_TYPE_MASK) == USBRQ_TYPE_CLASS) { /* HID class request */
|
|
if(rq->bRequest == USBRQ_HID_GET_REPORT) { /* wValue: ReportType (highbyte), ReportID (lowbyte) */
|
|
/* since we have only one report type, we can ignore the report-ID */
|
|
//buildReport();
|
|
return sizeof(reportBuffer);
|
|
}/*else if(rq->bRequest == USBRQ_HID_GET_IDLE){
|
|
usbMsgPtr = &idleRate;
|
|
return 1;
|
|
}else if(rq->bRequest == USBRQ_HID_SET_IDLE){
|
|
idleRate = rq->wValue.bytes[1];
|
|
}*/
|
|
} else {
|
|
/* ignore vendor type requests, we don't use any */
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
int main(void){
|
|
usbDeviceDisconnect();
|
|
_delay_ms(200);
|
|
usbDeviceConnect();
|
|
usbInit();
|
|
//printf("OTP: %d\n", get_otp_from_cnt(7,6) );
|
|
for(;;){
|
|
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|