| 274 | } |
| 275 | |
| 276 | int teensy_write( void *buf, int len, double timeout ) |
| 277 | { |
| 278 | int r; |
| 279 | |
| 280 | if ( !libusb_teensy_handle ) |
| 281 | return 0; |
| 282 | |
| 283 | while ( timeout > 0 ) { |
| 284 | r = libusb_control_transfer( libusb_teensy_handle, |
| 285 | 0x21, 9, 0x0200, 0, |
| 286 | (unsigned char *)buf, len, |
| 287 | (int)(timeout * 1000.0) ); |
| 288 | |
| 289 | if ( r >= 0 ) |
| 290 | return 1; |
| 291 | |
| 292 | //printf("teensy_write, r=%d\n", r); |
| 293 | usleep( 10000 ); |
| 294 | timeout -= 0.01; // TODO: subtract actual elapsed time |
| 295 | } |
| 296 | |
| 297 | return 0; |
| 298 | } |
| 299 | |
| 300 | void teensy_close() |
| 301 | { |
no outgoing calls
no test coverage detected
searching dependent graphs…