Speeduino
Loading...
Searching...
No Matches
sensors_map_structs.h
Go to the documentation of this file.
1#pragma once
2
4#include <stdint.h>
5
6// These are private to the MAP sampling algorithms but are broken out here
7// to support unit testing of the algorithm implementations
8
9struct map_last_read_t {
12#if defined(__UINT24_MAX__)
13 // Maximum time between readings is ~3s (at min RPM). 24 bits is enough for that
15#else
17#endif
18};
19
20// A pair of ADC sensor readings
21struct map_adc_readings_t {
24};
25
26// Working state for the cycle average sampling algorithm
29#if defined(__UINT24_MAX__)
30 // Maximum revolution time is ~1.5s (at min RPM). At a 1KHz sampling rate & 2 revolutions,
31 // we'll store 3000 readings each at maximum of 1023 (~3000000 max). So a 24-bit value
32 // should be plenty.
35#else
38#endif
40};
41
42// Working state for the cycle minimum sampling algorithm
43struct map_cycle_min_t {
46};
47
48// Working state for the event average sampling algorithm
50#if defined(__UINT24_MAX__)
52#else
54#endif
57};
58
59// The overall MAP sampling system working state
60struct map_algorithm_t {
63
64 union {
68 };
69};
70
71
static uint32_t rshift(uint32_t a)
Bitwise right shift - generic, unoptimized, case.
Definition bit_shifts.h:349