Skip to content

Commit

Permalink
fixed another typoe
Browse files Browse the repository at this point in the history
  • Loading branch information
naichenzhao committed May 25, 2024
1 parent 2f3fb2a commit a87452a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions core/platform/lf_STM32f4_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ static uint32_t _lf_num_nested_crit_sec = 0;
// Timer upper half (for overflow)
static uint32_t _lf_time_us_high = 0;

#define LF_MIN_SLEEP_NS 10

// Combine 2 32bit works to a 64 bit word (Takes from nrf52 support)
#define COMBINE_HI_LO(hi, lo) ((((uint64_t)hi) << 32) | ((uint64_t)lo))

Expand Down Expand Up @@ -84,15 +86,19 @@ int _lf_clock_now(instant_t *t)

/**
* Blocks the STM32 for set nanoseconds
* This implements a known function that is used in other
* parts of LF so it has to return int
*/
void lf_sleep(interval_t sleep_duration) {
int lf_sleep(interval_t sleep_duration) {
instant_t target_time;
instant_t current_time;

_lf_clock_now(&current_time);
target_time = current_time + sleep_duration;
while (current_time <= target_time)
_lf_clock_now(&current_time);

return 0;
}

/**
Expand All @@ -118,7 +124,7 @@ int _lf_interruptable_sleep_until_locked(environment_t *env, instant_t wakeup_ti
// Edge case handling for super small duration
if (duration <= 0) {
return 0;
} else if (duration < 10) {
} else if (duration < LF_MIN_SLEEP_NS) {
lf_busy_wait_until(wakeup_time);
return 0;
}
Expand Down

0 comments on commit a87452a

Please sign in to comment.