Exemplo n.º 1
0
static void init_usb() {
    // TODO the occupation does not work!
    // if (!occupyPin(UsbPinDPlus, PinUSB)) return;
    // if (!occupyPin(UsbPinDPlus, PinUSB)) return;
    
    // This is the hardware default, but make sure.
    setPinInput(UsbPinDPlus);
    setPinInput(UsbPinDMinus);
    disablePullup(UsbPinDPlus);
    disablePullup(UsbPinDMinus);

    usbInit();
    usbDeviceDisconnect();  // enforce re-enumeration, do this while interrupts are disabled
    delay_ms(250);          // fake USB disconnect for > 250 ms
    usbDeviceConnect();

    // We don't use late_init.kernel.c
    sei();
}
Exemplo n.º 2
0
void Interrupt::detach()
{
  detachInterrupt(digitalPinToInterrupt(pin_));
  disablePullup();
  mode_ptr_ = &interrupt::mode_detached;
}