MCPcopy Create free account
hub / github.com/0x1abin/MultiTimer / main

Function main

examples/test_linux.c:33–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33int main() {
34 multiTimerInstall(getPlatformTicks);
35
36 MultiTimer timer1, timer2, timer3, timer4;
37
38 multiTimerStart(&timer1, 500, timerCallback1, NULL); // 500 ms repeating
39 multiTimerStart(&timer2, 1000, timerCallback2, NULL); // 1000 ms repeating
40 multiTimerStart(&timer3, 2000, timerCallback3, NULL); // 2000 ms one-shot
41 multiTimerStart(&timer4, 3000, timerCallback4, &timer1); // 3000 ms, stops timer1
42
43 // Main loop to simulate time passage and process timers
44 while (1) {
45 multiTimerYield();
46 usleep(1000); // Sleep for 1 ms
47 }
48
49 return 0;
50}

Callers

nothing calls this directly

Calls 3

multiTimerInstallFunction · 0.85
multiTimerStartFunction · 0.85
multiTimerYieldFunction · 0.85

Tested by

no test coverage detected