Skip to content

Commit

Permalink
Merge pull request #246 from shorepine/ifdef
Browse files Browse the repository at this point in the history
fixing ifdef for sequencer
  • Loading branch information
bwhitman authored Nov 7, 2024
2 parents e60d41b + 3ec82ac commit 6667fd1
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/sequencer.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,19 +127,8 @@ static void sequencer_check_and_fill() {
}
}

// posix: called from a thread
#if defined _POSIX_THREADS
void * run_sequencer(void *vargs) {
// Loop forever, checking for time and sleeping
while(1) {
sequencer_check_and_fill();
// 500000nS = 500uS = 0.5mS
nanosleep((const struct timespec[]){{0, 500000L}}, NULL);
}
}

#ifdef ESP_PLATFORM
// ESP: do it with hardware timer
#elif defined ESP_PLATFORM
static void sequencer_timer_callback(void* arg) {
sequencer_check_and_fill();
}
Expand All @@ -154,6 +143,15 @@ void run_sequencer() {
// 500uS = 0.5mS
ESP_ERROR_CHECK(esp_timer_start_periodic(periodic_timer, 500));
}
#elif defined _POSIX_THREADS
void * run_sequencer(void *vargs) {
// Loop forever, checking for time and sleeping
while(1) {
sequencer_check_and_fill();
// 500000nS = 500uS = 0.5mS
nanosleep((const struct timespec[]){{0, 500000L}}, NULL);
}
}
#endif


Expand Down

0 comments on commit 6667fd1

Please sign in to comment.