rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Enumerations | Functions
main_loop.h File Reference

Enumerations

enum class  LoopPeriod : uint8_t {
  None = 0 , Period1000hz = 1 << 0 , Period500hz = 1 << 1 , Period250hz = 1 << 2 ,
  Period200hz = 1 << 3 , Period20hz = 1 << 4
}
 

Functions

void initMainLoop ()
 
constexpr LoopPeriodoperator|= (LoopPeriod &a, const LoopPeriod &b)
 
constexpr bool operator& (LoopPeriod a, LoopPeriod b)
 
constexpr int hzForPeriod (LoopPeriod p)
 
constexpr float loopPeriodMs (LoopPeriod p)
 

Enumeration Type Documentation

◆ LoopPeriod

enum class LoopPeriod : uint8_t
strong
Enumerator
None 
Period1000hz 
Period500hz 
Period250hz 
Period200hz 
Period20hz 

Definition at line 7 of file main_loop.h.

7 : uint8_t {
8 None = 0,
9 Period1000hz = 1 << 0,
10 Period500hz = 1 << 1,
11 Period250hz = 1 << 2,
12 Period200hz = 1 << 3,
13 Period20hz = 1 << 4,
14};

Function Documentation

◆ hzForPeriod()

constexpr int hzForPeriod ( LoopPeriod  p)
constexpr

Definition at line 25 of file main_loop.h.

25 {
26 switch (p) {
27 case LoopPeriod::None: return 0;
28 case LoopPeriod::Period1000hz: return 1000;
29 case LoopPeriod::Period500hz: return 500;
30 case LoopPeriod::Period250hz: return 250;
31 case LoopPeriod::Period200hz: return 200;
32 case LoopPeriod::Period20hz: return 20;
33 }
34
35 return 0;
36}

Referenced by loopCounts(), and loopPeriodMs().

Here is the caller graph for this function:

◆ initMainLoop()

void initMainLoop ( )

Definition at line 67 of file main_loop.cpp.

67 {
68 // see test_periodic_thread_controller.cpp for explanation
69#if ! EFI_UNIT_TEST
70 mainLoop.start();
71#endif
72}

Referenced by runRusEfi().

Here is the caller graph for this function:

◆ loopPeriodMs()

constexpr float loopPeriodMs ( LoopPeriod  p)
constexpr

Definition at line 38 of file main_loop.h.

38 {
39 return 1000.0f / hzForPeriod(p);
40}
constexpr int hzForPeriod(LoopPeriod p)
Definition main_loop.h:25
Here is the call graph for this function:

◆ operator&()

constexpr bool operator& ( LoopPeriod  a,
LoopPeriod  b 
)
inlineconstexpr

Definition at line 21 of file main_loop.h.

21 {
22 return 0 != (static_cast<uint8_t>(a) & static_cast<uint8_t>(b));
23}

◆ operator|=()

constexpr LoopPeriod & operator|= ( LoopPeriod a,
const LoopPeriod b 
)
inlineconstexpr

Definition at line 16 of file main_loop.h.

16 {
17 a = static_cast<LoopPeriod>(static_cast<uint8_t>(a) | static_cast<uint8_t>(b));
18 return a;
19}
LoopPeriod
Definition main_loop.h:7

Go to the source code of this file.