MCPcopy Create free account
hub / github.com/SmingHub/Sming / app2_main

Function app2_main

samples/Basic_Dual_Core/app/application.cpp:31–60  ·  view source on GitHub ↗

Code to run on second CPU

Source from the content-addressed store, hash-verified

29
30// Code to run on second CPU
31void IRAM_ATTR app2_main()
32{
33 static unsigned count;
34
35 // We're going to toggle an IO pin very fast to evaluate jitter
36 pinMode(outputPin, OUTPUT);
37
38 // Using a polled timer has virtually zero overhead as it accesses timing hardware directly
39 PeriodicFastUs timer(timerInterval);
40
41 for(;;) {
42 if(!timer.expired()) {
43 continue;
44 }
45
46 // NB. Can use SDK GPIO calls or direct hardware access if required
47 digitalWrite(outputPin, nextOutputState);
48 nextOutputState = !nextOutputState;
49
50 if(count % countsPerSecond == 0) {
51 System.queueCallback(handleNotification, count);
52
53 debug_i("TICK");
54
55 // ESP32: This is required if CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=y
56 // WDT.alive();
57 }
58 ++count;
59 }
60}
61
62} // namespace
63

Callers

nothing calls this directly

Calls 4

pinModeFunction · 0.50
digitalWriteFunction · 0.50
expiredMethod · 0.45
queueCallbackMethod · 0.45

Tested by

no test coverage detected