Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // interval of calling do_stuff() in pru cycles
- #define INTERVAL 20000000
- // make sure do_stuff() never takes more than INTERVAL cycles!
- void do_stuff() {
- //...
- }
- int main() {
- timestamp_initialize();
- uint32_t next = timestamp();
- for(;;) {
- next += INTERVAL;
- do_stuff();
- while( (int)( timestamp() - next ) < 0 ) {}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement