]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - embedded/app/usbcan/main.c
Use common USB standard requests handling.
[lincan.git] / embedded / app / usbcan / main.c
index fd12f59bf9e5c603b604769a7ec2e629184f2933..657b9e38e7b5315f270826d0cff2426f90cb4f14 100644 (file)
@@ -31,6 +31,7 @@
 #include "./can/ul_usb1.h"
 //#include "./can/setup.h"
 
+#include "./usb/usb_defs.h"
 #include "./usb/usb_vend.h"
 
 #define MASK_EP1RX  0x01
@@ -56,7 +57,7 @@
 /***********************************************************************
  * Note:
  * Code is wittingly complex in order to ease future changes in hardware
- * configuration and to make it as much similar as the code of LinCAN
+ * configuration and to make it as much similar as the code of LinCAN
  ***********************************************************************/
 
 LT_TIMER_DEC(lt_10msec)
@@ -69,13 +70,13 @@ LT_TIMER_IMP(lt_2sec)
 typedef void (*FNC)(); //function ptr
 
 /***********************************************************************
      * global variables
      ***********************************************************************/
+ * global variables
+ ***********************************************************************/
 
 
 usb_device_t usb_device;
 
-usb_ep_t eps[2];
+usb_ep_t eps[NUM_ENDPOINTS];
 unsigned char ep1_rx_buff[USB_MAX_PACKET];
 unsigned char ep1_tx_buff[USB_MAX_PACKET];
 uint8_t timer_str,timer_rx_off,timer_tx_off,timer_configured;
@@ -317,9 +318,10 @@ int main(void)
 
        memset( &usb_device, 0, sizeof( usb_device));
        usb_device.id = 1;
+       usb_device.devdes_table = &usb_devdes_table;
        usb_device.init = usb_lpc_init;
        usb_debug_set_level(DEBUG_LEVEL_NONE);
-       usb_device.cntep = 3;
+       usb_device.cntep = NUM_ENDPOINTS;
        usb_device.ep = eps;
 
        eps[0].max_packet_size = USB_MAX_PACKET;
@@ -331,7 +333,7 @@ int main(void)
        eps[0].udev = &usb_device;
        eps[1].udev = &usb_device;
 
-  usb_device.vendor_fnc=usbcan_vendor;
+       usb_device.vendor_fnc=usbcan_vendor;
 
        usb_init(&usb_device);
        usb_connect(&usb_device);
@@ -341,7 +343,7 @@ int main(void)
         * Start
         ***********************************************************************/
 
-  timer_rx_off=timer_tx_off=timer_str=timer_configured=0;
+       timer_rx_off=timer_tx_off=timer_str=timer_configured=0;
        while (1) {
 
                usb_check_events(&usb_device);