Commit 6fdc7e1
committed
pbio/drv/block_device: Drive ADC loop with fewer events.
We yielded and polled immediately after initiating the ADC transfer to give other awaitables a chance to start waiting on the transfer. This leads to many extra events and could theoretically introduce a race condition if the DMA operation completes before it gets into the right wait state.
Instead, higher level code can await new samples by waiting until the DMA completion timestamp has passed the time of interest, without inducing more events. While we do this, we can conveniently introduce a handle to wait until a specified future sample, which can be used if signals need to settle before measuring the ADC value.1 parent ee203b3 commit 6fdc7e1
File tree
5 files changed
+31
-32
lines changed- lib/pbio
- drv
- adc
- block_device
- include/pbdrv
- src
5 files changed
+31
-32
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
106 | 119 | | |
107 | 120 | | |
108 | 121 | | |
109 | 122 | | |
110 | 123 | | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
| 124 | + | |
115 | 125 | | |
116 | 126 | | |
117 | 127 | | |
118 | 128 | | |
119 | 129 | | |
120 | 130 | | |
121 | 131 | | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
| 132 | + | |
126 | 133 | | |
127 | 134 | | |
128 | 135 | | |
| |||
735 | 742 | | |
736 | 743 | | |
737 | 744 | | |
738 | | - | |
| 745 | + | |
739 | 746 | | |
740 | | - | |
741 | | - | |
| 747 | + | |
| 748 | + | |
742 | 749 | | |
743 | 750 | | |
744 | 751 | | |
| |||
887 | 894 | | |
888 | 895 | | |
889 | 896 | | |
890 | | - | |
891 | | - | |
892 | | - | |
893 | | - | |
894 | | - | |
| 897 | + | |
895 | 898 | | |
896 | 899 | | |
897 | 900 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
38 | 40 | | |
39 | | - | |
| 41 | + | |
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| |||
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
48 | | - | |
| 50 | + | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
374 | 374 | | |
375 | 375 | | |
376 | 376 | | |
377 | | - | |
378 | | - | |
| 377 | + | |
379 | 378 | | |
380 | 379 | | |
381 | 380 | | |
382 | 381 | | |
383 | | - | |
384 | | - | |
| 382 | + | |
385 | 383 | | |
386 | 384 | | |
387 | 385 | | |
| |||
412 | 410 | | |
413 | 411 | | |
414 | 412 | | |
415 | | - | |
416 | | - | |
| 413 | + | |
417 | 414 | | |
418 | 415 | | |
419 | 416 | | |
420 | | - | |
421 | | - | |
| 417 | + | |
422 | 418 | | |
423 | 419 | | |
424 | 420 | | |
425 | | - | |
426 | | - | |
| 421 | + | |
427 | 422 | | |
428 | 423 | | |
429 | 424 | | |
430 | | - | |
431 | | - | |
| 425 | + | |
432 | 426 | | |
433 | 427 | | |
434 | 428 | | |
| |||
0 commit comments