#include <Arduino.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include <esp_ipc.h>

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Serial.println("Hello, ESP32!");
  Serial.print("O setup roda sobre o núcleo APP_CPU cujo id eh:");
  Serial.println(xPortGetCoreID());
  Serial.println();
  Serial.println();
}

void LoopOnProCpu(void *arg) {
    (void)arg;
    Serial.print("This LoopOnProCpu runs on PRO_CPU which id is:");
    Serial.println(xPortGetCoreID());
    Serial.println();
    Serial.println();
}

void loop() {
  // put your main code here, to run repeatedly:
  delay(1000); // this speeds up the simulation
  Serial.print("O loop roda sobre o núcleo APP_CPU cujo id eh:");
  Serial.println(xPortGetCoreID());
  Serial.println();
  Serial.println();

  //Execute LoopOnAppCpu on PRO_CPU
  esp_ipc_call(PRO_CPU_NUM, LoopOnProCpu, NULL);
}