/* * This code is based on seveal VUSB-Examples the * HID was taken from the CapsLocker code from macetech * http://macetech.com/blog/?q=node/46 * */ #include "main.h" #define SECRET {'J', 'e', 'f', 'e'}; #define SECLEN 20 #define MSG "what do ya want for nothing?" #include #include #include #include #include #include #include #include "usbdrv.h" #include "usb_key_codes.h" uint8_t reportBuffer[2]; /* buffer for HID reports */ uint8_t idleRate; void buildReport(uint8_t mod, uint8_t key){ reportBuffer[0] = mod; reportBuffer[1] = key; } int main(void){ #ifdef CALIB uint8_t calibrationValue; #endif uint8_t *p; uint16_t siz; uint8_t sec[SECLEN]=SECRET; /*InitializeMemory(); initUSART(); tx('+'); sendunum( get_otp_from_cnt(777,8,sec,SECLEN) );*/ #ifdef CALIB /* oszillator calibration */ calibrationValue = eeprom_read_byte(0); /* calibration value from last time */ if(calibrationValue != 0xff){ OSCCAL = calibrationValue; } #endif //CALLIB //odDebugInit(); usbDeviceDisconnect(); _delay_ms(300); /* mustn't be that exact */ usbDeviceConnect(); uint8_t foo=0; usbInit(); sei(); for(;;){ /* main event loop */ //usbPoll(); /* we can send another key */ if(usbInterruptIsReady()){ foo=!foo; if(foo) buildReport(0x00, USB_KEY_1); else buildReport(0x00, 0x00); usbSetInterrupt(reportBuffer, sizeof(reportBuffer)); } /*AnalyzeMemory(&p,&siz); sendunum(siz); _delay_ms(2000);*/ } return 0; }