Changeset 41d46ae in avrstuff
- Timestamp:
- Sep 3, 2012, 11:09:37 PM (12 years ago)
- Branches:
- main
- Children:
- 0262b6e
- Parents:
- c8ec8ce
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
V-USB_Dev/firmwares/herePic/driver/icsp.h
rc8ec8ce r41d46ae 5 5 */ 6 6 7 #include <assert.h> 8 #include <errno.h> 7 9 #include <string.h> 8 10 … … 17 19 uint16_t Execute(ICSPCommands command, uint16_t param = 0) 18 20 { 19 // TODO send the command to the device 21 //std::cout << "Sending command " << command << " " << param << " to the device" << std::endl; 22 23 // send the command to the device 20 24 uint16 length; 21 25 uint8 reqType = USB_REQTYPE_VENDOR; … … 23 27 { 24 28 length = 2; 25 reqType |= USB_REQTYPE_DEVICE_ OUT;29 reqType |= USB_REQTYPE_DEVICE_IN; // Device to host 26 30 } else { 27 31 length = 0; 28 reqType |= USB_REQTYPE_DEVICE_ IN;32 reqType |= USB_REQTYPE_DEVICE_OUT; // Host to device 29 33 } 30 34 31 35 ssize_t result = fDevice.ControlTransfer(reqType, command, param, 0, 32 length, ¶m);36 length, length == 0 ? NULL:¶m); 33 37 if (result == length) { 34 38 // We transferred as much bytes as we wanted. … … 37 41 } else { 38 42 // Not enough bytes transferred, or the result is an error code 39 std::cerr << "USB communication error " << result40 << "(" << strerror( result) << ")" << std::endl;;43 std::cerr << "USB communication error " << errno 44 << "(" << strerror(errno) << ")" << std::endl;; 41 45 return result; 42 46 }
Note:
See TracChangeset
for help on using the changeset viewer.