Commit 00d9a3537a7a460b85447bdda9ee9d564b625cfa

Authored by dmohamed
1 parent 28da8e7b

UPDATE

Moteur/Moteur.c
... ... @@ -84,6 +84,7 @@ int main(void)
84 84 break;
85 85 case MOVE_RIGHT:
86 86 motor_right();
  87 + send_serial('a');
87 88 send_ack();
88 89 break;
89 90 case MOVE_LEFT:
... ...
USB/usb_driver
No preview for this file type
USB/usb_driver.c
1 1 #include <libusb-1.0/libusb.h> //bibliothèque USB
2 2 #include <stdio.h>
3 3 #include <stdlib.h>
4   -#include <termios.h>
  4 +
5 5 #include <fcntl.h>
6 6 #include <strings.h>
7 7 #include <unistd.h>
... ... @@ -150,7 +150,7 @@ void enumeration(libusb_context *context) //Enumération des périphériques USB
150 150  
151 151  
152 152  
153   -void envoie(unsigned char c)
  153 +void envoi(unsigned char c)
154 154 {
155 155 /* To send a char to the device simply initiate a bulk_transfer to the
156 156 * Endpoint with address ep_out_addr.
... ... @@ -187,7 +187,7 @@ int main()
187 187 {
188 188 //Initialisation de la bibliotheque libusb
189 189 libusb_context *context;
190   - unsigned char * buf;
  190 + unsigned char buf[65];
191 191 int len;
192 192  
193 193 int status=libusb_init(&context);
... ... @@ -208,9 +208,7 @@ int main()
208 208 }
209 209  
210 210  
211   -/* - set line encoding: here 9600 8N1
212   - * 9600 = 0x2580 ~> 0x80, 0x25 in little endian
213   - */
  211 +
214 212 //Configuration du port série.
215 213 unsigned char encoding[] = { 0x80, 0x25, 0x00, 0x00, 0x00, 0x00, 0x08 };
216 214 status = libusb_control_transfer(handle, 0x21, 0x20, 0, 0, encoding,
... ... @@ -239,33 +237,33 @@ int main()
239 237 return 0;
240 238 break;
241 239 case 'd':
242   - envoie(LED_ON);
  240 + envoi(LED_ON);
243 241 sleep(1);
244   - //len = read_chars(buf, 1);
245   -
  242 +
246 243 break;
247 244 case 'g':
248   - envoie(LED_OFF);
  245 + envoi(LED_OFF);
249 246 sleep(1);
250 247 break;
251 248 case 'h':
252   - envoie(MOVE_LEFT);
  249 + envoi(MOVE_LEFT);
253 250 sleep(1);
254 251 break;
255 252 case 'b':
256   - envoie(MOVE_RIGHT);
  253 + envoi(MOVE_RIGHT);
257 254 sleep(1);
258 255 break;
259 256 case 't' :
260   - envoie(MOVE_STOP);
  257 + envoi(MOVE_STOP);
261 258 sleep(1);
262 259 break;
263 260 default :
264 261 printf("Commande invalide ! Retaper :\n");
265 262 break;
266 263 }
267   - }
268   -
  264 +
  265 + sleep(1);
  266 +}
269 267  
270 268 return 0;
271 269 }
... ...
USB/usb_driver.o 0 → 100644
No preview for this file type
gadget/Descriptors.c
... ... @@ -185,13 +185,13 @@ const USB_Descriptor_String_t PROGMEM LanguageString = USB_STRING_DESCRIPTOR_ARR
185 185 * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
186 186 * Descriptor.
187 187 */
188   -const USB_Descriptor_String_t PROGMEM ManufacturerString = USB_STRING_DESCRIPTOR(L"Dean Camera");
  188 +const USB_Descriptor_String_t PROGMEM ManufacturerString = USB_STRING_DESCRIPTOR(L"Djamil MOHAMED");
189 189  
190 190 /** Product descriptor string. This is a Unicode string containing the product's details in human readable form,
191 191 * and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
192 192 * Descriptor.
193 193 */
194   -const USB_Descriptor_String_t PROGMEM ProductString = USB_STRING_DESCRIPTOR(L"LUFA USB-RS232 Adapter");
  194 +const USB_Descriptor_String_t PROGMEM ProductString = USB_STRING_DESCRIPTOR(L"USB gadget");
195 195  
196 196 /** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
197 197 * documentation) by the application code so that the address and size of a requested descriptor can be given
... ...