Changeset 192e299 in thomson for elec/CrO2/software/device.cpp
- Timestamp:
- Feb 3, 2012, 7:37:06 PM (12 years ago)
- Branches:
- main
- Children:
- c2a9854
- Parents:
- f9263dd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
elec/CrO2/software/device.cpp
rf9263dd r192e299 8 8 9 9 #include "device.h" 10 #include "k5.h" 10 11 11 12 bool Device::initOnce = false; … … 141 142 } 142 143 144 145 void Device::write(K5& file) 146 { 147 for (int k = 0; k < file.getBlockCount(); k++) 148 { 149 // wait for motor on 150 while (getStatus() & 8) 151 Sleep(1000); 152 153 K5::Block block = file.getBlock(k); 154 155 int nBytes = write(block.data, block.length - 1, block.type); 156 // TODO error handling 157 158 // TODO wait for correct time (read status from usb OR compute from size+type) 159 Sleep(1400); 160 } 161 } 162 143 163 uint8_t Device::getStatus() 144 164 { 145 165 uint8_t status; 146 166 usb_control_msg(handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, 147 PSCMD_STATUS, 0,0, (char*)&status, 1, 5000);167 PSCMD_STATUS, 0,0, (char*)&status, 1, 5000); 148 168 // TODO handle errors (return value) 149 169 return status;
Note:
See TracChangeset
for help on using the changeset viewer.