Blame view

games/ninvaders/arduino.h 1.25 KB
9299dd74   root   Programmation nIn...
1
2
3
  #ifndef ARDUINO 
  #define ARDUINO
  
0ed3f148   root   terminé !
4
5
6
7
8
9
  #include <libusb-1.0/libusb.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <signal.h>
  #include <unistd.h>
  
9299dd74   root   Programmation nIn...
10
11
12
  #define ID_VENDOR 0x2341
  #define ID_PRODUCT 0x01
  #define ENDPOINTS_NUMBER 4
0ed3f148   root   terminé !
13
  #define TIMEOUT 10
9299dd74   root   Programmation nIn...
14
15
16
17
18
19
20
21
22
  #define MAX_DATA 50
  
  void init(libusb_context **context, libusb_device ***devices, ssize_t *devices_count);
  libusb_device* searchArduino(libusb_device **devices, ssize_t devices_count);
  void openConnection(libusb_device *arduino, libusb_device_handle **handle, struct libusb_config_descriptor **config_desc);
  void getEndpoints(struct libusb_config_descriptor *config_desc, struct libusb_endpoint_descriptor *endpoint_desc_list);
  void start(libusb_context **context, libusb_device ***devices, libusb_device_handle **handle, struct libusb_config_descriptor **config_desc, struct libusb_endpoint_descriptor *endpoint_desc_list);
  void stop(struct libusb_config_descriptor *config_desc, libusb_device_handle *handle, libusb_device **devices, libusb_context *context);
  void sendData(int endpoint_id, uint8_t data, libusb_device_handle *handle, struct libusb_endpoint_descriptor *endpoint_desc_list);
0ed3f148   root   terminé !
23
  void receiveData(int endpoint_id, uint8_t *data, libusb_device_handle *handle, struct libusb_endpoint_descriptor *endpoint_desc_list);
9299dd74   root   Programmation nIn...
24
25
  
  #endif