Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void busyWait(long ms) {
- TickType_t currentTick = xTaskGetTickCount();
- TickType_t goalTick = currentTick + pdMS_TO_TICKS(ms);
- while (currentTick < goalTick) {
- currentTick = xTaskGetTickCount();
- }
- }
- void testTask(void *args) {
- for (;;) {
- printf("test\n");
- busyWait(500);
- }
- }
- extern int setup(void);
- int main() {
- setup();
- xTaskCreate(testTask, "busyWait", 100, NULL, 1, NULL);
- vTaskStartScheduler();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement