Exemple #1
0
void USBGeneralInterrupt()
{
	u8 udint = UDINT;
	UDINT = 0;

	//	End of Reset
	if (udint & (1<<EORSTI))
	{
		InitEP(0,EP_TYPE_CONTROL,EP_SINGLE_64);	// init ep0
		_usbConfiguration = 0;			// not configured yet
	}

	//	Start of Frame - happens every millisecond so we use it for TX and RX LED one-shot timing, too
	if (udint & (1<<SOFI))
	{
#ifdef TXLED0
		// check whether the one-shot period has elapsed.  if so, turn off the LED
		if (TxLEDPulse && !(--TxLEDPulse))
			TXLED0;
		if (RxLEDPulse && !(--RxLEDPulse))
			RXLED0;
#endif

		if (!_ejected)
			_timeout = 0;
	}
}
Exemple #2
0
static
void InitEndpoints()
{
  DEBUG_OUT(F("USB InitEndpoints\r\n"));

  // init the first one as a control input
  for (u8 i = 1; i < sizeof(_initEndpoints); i++)
  {
    InitEP(i, pgm_read_byte(_initEndpoints+i), EP_DOUBLE_64); // NOTE:  EP_DOUBLE_64 allocates a 'double bank' of 64 bytes, with 64 byte max length
//    UENUM = i;
//    UECONX = 1;
//    UECFG0X = pgm_read_byte(_initEndpoints+i);
//    UECFG1X = EP_DOUBLE_64;
  }

//  UERST = 0x7E;  // And reset them
//  UERST = 0;

  // TODO:  how do I do this?
}