Hello everyone, would anyone know how to return multiple pieces of data from an RPC call function between two cores on the Arduino Giga. I'm trying to figure out how to eventually return multiple sensor data points in one request to the main core. My attempt so far is below. Thanks in advance to anyone who can help me!
PS the error I'm getting is: "error: 'const struct FOO' has no member named 'msgpack_object' "
#include "Arduino.h"
#include "RPC.h"
struct FOO{
int i;
int j;
};
void setup() {
RPC.begin(); //Boots the M4 core
Serial.begin(9600);
while(!Serial){};
if (currentCPU() == "M4") {
startM4();
}
if (currentCPU() == "M7") {
startM7();
}
}
void loop() {
}
String currentCPU() {
if (HAL_GetCurrentCPUID() == CM7_CPUID) {
return "M7";
} else {
return "M4";
}
}
#include "Arduino.h"
#include "RPC.h"
void startM7() {
setupM7();
loopM7();
}
void setupM7() {
}
void loopM7() {
for (;;) {
delay(1000);
long time = micros();
auto result = RPC.call("getI").as<FOO>();
long time2 = micros();
Serial.println(time2 - time);
Serial.println(result.i);
Serial.println(result.j);
Serial.println("");
}
}
#include "Arduino.h"
#include "RPC.h"
int i = 0;
void startM4(){
setupM4();
loopM4();
}
void setupM4(){
RPC.bind("getI", getI);
}
void loopM4(){
for(;;){
i++;
delay(1000);
}
}
FOO getI(){
FOO data;
data.i = i;
data.j = i+1;
return data;
}