MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / cmd_measure_speed

Function cmd_measure_speed

FluxEngine.cydsn/main.c:304–336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

302}
303
304static void cmd_measure_speed(struct measurespeed_frame* f)
305{
306 start_motor();
307
308 index_irq = false;
309 int start_clock = clock;
310 int elapsed = 0;
311 while (!index_irq)
312 {
313 elapsed = clock - start_clock;
314 if (elapsed > 1500)
315 {
316 elapsed = 0;
317 break;
318 }
319 }
320
321 if (elapsed != 0)
322 {
323 int target_pulse_count = f->hard_sector_count + 1;
324 start_clock = clock;
325 for (int x=0; x<target_pulse_count; x++)
326 {
327 index_irq = false;
328 while (!index_irq)
329 elapsed = clock - start_clock;
330 }
331 }
332
333 DECLARE_REPLY_FRAME(struct speed_frame, F_FRAME_MEASURE_SPEED_REPLY);
334 r.period_ms = elapsed;
335 send_reply((struct any_frame*) &r);
336}
337
338static void cmd_bulk_write_test(struct any_frame* f)
339{

Callers 1

handle_commandFunction · 0.85

Calls 2

start_motorFunction · 0.85
send_replyFunction · 0.85

Tested by

no test coverage detected