Here's a short code example. There is only tile[0] and there should be no hidden use of any other tile.
Code: Select all
#include <platform.h>
#include <timer.h> // XS1_TIMER_HZ etc
typedef signed int time32_t;
interface ifa {
void but (int x);
};
[[combinable]]
void button (client interface ifa i_but) {
timer tmr;
time32_t time;
tmr :> time;
while (1) {
select {
case tmr when timerafter(time) :> void: {
i_but.but(time/XS1_TIMER_KHZ); // ms
time += XS1_TIMER_HZ;
break;
}
}
}
}
[[combinable]]
void handle (server interface ifa i_but[3]) {
while (1) {
select {
case i_but[int i].but (int val) : {
break;
}
}
}
}
int main (void) {
interface ifa i_but[3];
par {
on tile[0].core[0]: handle (i_but);
[[combine]]
par {
// ^~~~~ error: cannot apply [[combine]] to multi-tile par
on tile[0].core[0]: button (i_but[0]);
on tile[0].core[0]: button (i_but[1]);
on tile[0].core[0]: button (i_but[2]);
}
}
return 0;
}
Code: Select all
int main (void) {
interface ifa i_but[3];
[[combine]]
par {
// ^~~~~ error: cannot apply [[combine]] to multi-tile par
on tile[0].core[0]: handle (i_but);
on tile[0].core[0]: button (i_but[0]);
on tile[0].core[0]: button (i_but[1]);
on tile[0].core[0]: button (i_but[2]);
}
return 0;
}