Commit b5b53ff1 authored by Alessio Igor Bogani's avatar Alessio Igor Bogani
Browse files

Force update every 1kHz

parent 8bb84bb2
......@@ -102,6 +102,8 @@ struct pru2pru_data_transfer {
} p2pdt;
volatile float OCnorm, OCnorm_previous;
#define REFRESH_RATE 1000
#define SAMPLES 100
struct pru2user_data_transfer {
float OCnorm;
......@@ -153,7 +155,7 @@ int main(void)
OCnorm_previous = FLT_MAX;
ADC2_previous = UINT_MAX;
int HEAD_index = 0;
int HEAD_index = 0, CC = 0 /* Cycle Counter */;
//init SPI
SetSPI();
......@@ -289,6 +291,17 @@ int main(void)
}
}
}
if (++CC >= REFRESH_RATE) {
if (HEAD_index) {
if (pru_rpmsg_send(&transport, dst, src, &p2udt,
sizeof(struct pru2user_data_transfer) * HEAD_index) != PRU_RPMSG_SUCCESS) {
// Notifications failed
}
HEAD_index = 0;
}
CC = 0;
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment