Code to run on second CPU
| 29 | |
| 30 | // Code to run on second CPU |
| 31 | void 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 |
nothing calls this directly
no test coverage detected