Skip to content
Snippets Groups Projects
Commit 111ba2de authored by Marco Tinner's avatar Marco Tinner
Browse files

No commit message

No commit message
parent 5834a379
Branches
Tags
No related merge requests found
......@@ -64,7 +64,7 @@
#define USB_EP1_NUM EP_1 // Endpoint number (identifier)
#define USB_EP1_TYPE USB_EP_TYPE_INTERRUPT // Endpoint Type
#define USB_EP1_DIR USB_EP_DIR_IN
#define USB_EP1_SIZE EP_SIZE_256
#define USB_EP1_SIZE EP_SIZE_64
// descriptor values
#define USB_EP1_bEndpointAddress (USB_EP1_NUM | USB_EP_DIR_INbm) // Endpoint address
#define USB_EP1_bmAttributes USB_EP1_TYPE // Transfer type
......
......@@ -156,21 +156,21 @@ void handelEP1IRQ(){
if(Is_usb_in_ready())
{
uart_write_string("In");
Usb_ack_in_ready();
//Usb_send_control_in();
/*
uint16_t bytesToSend = getAvailableBytes(&outBuffer);
uint16_t bytesToSend = uart_avail_read();
if(bytesToSend>0){
uint16_t i = 0;
while(i<bytesToSend){
//Usb_write_byte(0x01);
//Usb_write_byte(0x60);
Usb_write_byte(getByteFromBuffer(&outBuffer));
Usb_write_byte(0x01);
Usb_write_byte(0x60);
Usb_write_byte(uart_read());
i++;
}
}
*/
Usb_ack_in_ready();
while(Is_usb_read_enabled()){
}
Usb_ack_fifocon();
......@@ -182,14 +182,14 @@ void handelEP2IRQ(){
{
uart_write_string("Out");
Usb_ack_receive_out();
// uint16_t bytesToReceive = Usb_frame_number();
// if(bytesToReceive>0){
// uint16_t i = 0;
// while(i < bytesToReceive){
// fillBuffer(&inBuffer,Usb_read_byte());
// i++;
// }
// }
uint16_t bytesToReceive = Usb_frame_number();
if(bytesToReceive>0){
uint16_t i = 0;
while(i < bytesToReceive){
uart_write(Usb_read_byte());
i++;
}
}
}
}
......@@ -314,30 +314,37 @@ ISR (USB_GEN_vect)
uart_write_string("End of reset, ");
usb_configuration_nb=0;
Usb_reset_endpoint(EP_CONTROL);
Usb_select_endpoint(EP_CONTROL);
Usb_enable_endpoint();
usb_configure_endpoint(EP_CONTROL,USB_EP_TYPE_CONTROL,USB_EP_DIR_OUT,EP_SIZE_64,EP_ONE_BANK,EP_NYET_DISABLED);
Usb_enable_receive_setup_interrupt();
// Endpoint 1
Usb_reset_endpoint(USB_EP1_NUM);
Usb_select_endpoint(USB_EP1_NUM);
Usb_enable_endpoint();
usb_configure_endpoint(USB_EP1_NUM, USB_EP1_TYPE, USB_EP1_DIR,USB_EP1_SIZE,EP_ONE_BANK,EP_NYET_ENABLED);
Usb_enable_in_ready_interrupt();
// Endpoint 2
Usb_reset_endpoint(USB_EP2_NUM);
Usb_select_endpoint(USB_EP2_NUM);
Usb_enable_endpoint();
usb_configure_endpoint(USB_EP2_NUM, USB_EP2_TYPE, USB_EP2_DIR, USB_EP2_SIZE, EP_ONE_BANK, EP_NYET_ENABLED);
Usb_enable_receive_out_interrupt();
// Endpoint 3
Usb_reset_endpoint(USB_EP3_NUM);
Usb_select_endpoint(USB_EP3_NUM);
Usb_enable_endpoint();
usb_configure_endpoint(USB_EP3_NUM, USB_EP3_TYPE, USB_EP3_DIR, USB_EP3_SIZE, EP_ONE_BANK, EP_NYET_ENABLED);
Usb_reset_endpoint(EP_CONTROL);
Usb_reset_endpoint(USB_EP1_NUM);
Usb_reset_endpoint(USB_EP2_NUM);
Usb_reset_endpoint(USB_EP3_NUM);
Usb_ack_reset();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment