Exemple #1
0
/// Configure the device for bootloader mode and loop responding to bootloader commands
void runBootloader(void){
	// Turn on LED
	LED_PORT.DIRSET = (1<<LED_PIN);
	LED_PORT.OUTCLR = (1<<LED_PIN);	// active low

	// power down RF section.  
	VCC_EN_PORT.DIRSET |= (1<<VCC_EN_PIN);	
	VCC_EN_PORT.OUTCLR = (1<<VCC_EN_PIN);	
	
	USB_ConfigureClock();
	
	_delay_us(100000); // 0.1s
		
	USB_Init();
	USB_ep_out_init(1, USB_EP_TYPE_BULK_gc, EP1_SIZE);
	sei();
	
	uint16_t i=0;
	
	while (1){
		USB_Task();
		pollEndpoint();
		
		if (++i == 0) LED_PORT.OUTTGL = (1 << LED_PIN);
	}
}
Exemple #2
0
void packetbuf_endpoint_init(void){
	USB_ep_in_init(1, USB_EP_TYPE_BULK_gc, IN_PACKET_SIZE);
	USB_ep_out_init(2, USB_EP_TYPE_BULK_gc, OUT_PACKET_SIZE);
	packetbuf_reset();
	
}