Parse the AutoResearchLpc pinToggleRx CSV reply. Format (defined in examples/AutoResearchLpc/AutoResearchLpc.ino): success,edges,periods,mean_ns,sigma_ns,min_ns,max_ns
(csv: str)
| 114 | |
| 115 | |
| 116 | def parse_csv_result(csv: str) -> dict[str, int]: |
| 117 | """Parse the AutoResearchLpc pinToggleRx CSV reply. |
| 118 | |
| 119 | Format (defined in examples/AutoResearchLpc/AutoResearchLpc.ino): |
| 120 | success,edges,periods,mean_ns,sigma_ns,min_ns,max_ns |
| 121 | """ |
| 122 | fields = ("success", "edges", "periods", "mean_ns", "sigma_ns", "min_ns", "max_ns") |
| 123 | parts = csv.split(",") |
| 124 | if len(parts) != len(fields): |
| 125 | return {} |
| 126 | try: |
| 127 | return {k: int(v) for k, v in zip(fields, parts)} |
| 128 | except ValueError: |
| 129 | return {} |
| 130 | |
| 131 | |
| 132 | def evaluate(case: BenchCase, parsed: dict[str, int]) -> tuple[bool, str]: |