| 315 | } |
| 316 | |
| 317 | void measureVoltages(struct voltages_frame* voltages) override |
| 318 | { |
| 319 | struct any_frame f = { |
| 320 | {.type = F_FRAME_MEASURE_VOLTAGES_CMD, .size = sizeof(f)}, |
| 321 | }; |
| 322 | usb_cmd_send(&f, f.f.size); |
| 323 | |
| 324 | auto convert_voltages_from_usb = |
| 325 | [&](const struct voltages& vin, struct voltages& vout) |
| 326 | { |
| 327 | vout.logic0_mv = read_short_from_usb(vin.logic0_mv); |
| 328 | vout.logic1_mv = read_short_from_usb(vin.logic1_mv); |
| 329 | }; |
| 330 | |
| 331 | struct voltages_frame* r = |
| 332 | await_reply<struct voltages_frame>(F_FRAME_MEASURE_VOLTAGES_REPLY); |
| 333 | convert_voltages_from_usb(r->input_both_off, voltages->input_both_off); |
| 334 | convert_voltages_from_usb( |
| 335 | r->input_drive_0_selected, voltages->input_drive_0_selected); |
| 336 | convert_voltages_from_usb( |
| 337 | r->input_drive_1_selected, voltages->input_drive_1_selected); |
| 338 | convert_voltages_from_usb( |
| 339 | r->input_drive_0_running, voltages->input_drive_0_running); |
| 340 | convert_voltages_from_usb( |
| 341 | r->input_drive_1_running, voltages->input_drive_1_running); |
| 342 | convert_voltages_from_usb( |
| 343 | r->output_both_off, voltages->output_both_off); |
| 344 | convert_voltages_from_usb( |
| 345 | r->output_drive_0_selected, voltages->output_drive_0_selected); |
| 346 | convert_voltages_from_usb( |
| 347 | r->output_drive_1_selected, voltages->output_drive_1_selected); |
| 348 | convert_voltages_from_usb( |
| 349 | r->output_drive_0_running, voltages->output_drive_0_running); |
| 350 | convert_voltages_from_usb( |
| 351 | r->output_drive_1_running, voltages->output_drive_1_running); |
| 352 | } |
| 353 | }; |
| 354 | |
| 355 | USB* createFluxengineUsb(libusbp::device& device) |
no test coverage detected