daily pastebin goal
53%
SHARE
TWEET

VUSBissuemain

a guest Oct 21st, 2016 10 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. #include <avr/io.h>
  2. #include <avr/interrupt.h>
  3. #include <avr/wdt.h>
  4.  
  5. #include "usbdrv.h"
  6.  
  7. #define F_CPU 16000000L
  8. #include <util/delay.h>
  9.  
  10. USB_PUBLIC uchar usbFunctionSetup(uchar data[8]) {
  11.         return 0; // do nothing for now
  12. }
  13.  
  14. int main() {
  15.         uchar i;
  16.  
  17.     wdt_enable(WDTO_1S); // enable 1s watchdog timer
  18.  
  19.     usbInit();
  20.  
  21.     usbDeviceDisconnect(); // enforce re-enumeration
  22.     for(i = 0; i<250; i++) { // wait 500 ms
  23.         wdt_reset(); // keep the watchdog happy
  24.         _delay_ms(2);
  25.     }
  26.     usbDeviceConnect();
  27.  
  28.     sei(); // Enable interrupts after re-enumeration
  29.  
  30.     while(1) {
  31.         wdt_reset(); // keep the watchdog happy
  32.         usbPoll();
  33.     }
  34.  
  35.     return 0;
  36. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top