Unverified Commit b0d0e292 authored by Earle F. Philhower, III's avatar Earle F. Philhower, III Committed by GitHub

Minor - Add number separators (#845)

parent e2b04e74
......@@ -129,10 +129,10 @@ struct TimeUnit {
}
};
using TimeMillis = TimeUnit< TimeSourceMillis, 1000 >;
using TimeFastMillis = TimeUnit< TimeSourceCycles, 1000 >;
using TimeFastMicros = TimeUnit< TimeSourceCycles, 1000000 >;
using TimeFastNanos = TimeUnit< TimeSourceCycles, 1000000000 >;
using TimeMillis = TimeUnit < TimeSourceMillis, 1'000 >;
using TimeFastMillis = TimeUnit < TimeSourceCycles, 1'000 >;
using TimeFastMicros = TimeUnit < TimeSourceCycles, 1'000'000 >;
using TimeFastNanos = TimeUnit < TimeSourceCycles, 1'000'000'000 >;
} //TimePolicy
......
......@@ -238,7 +238,7 @@ public:
// Convert from microseconds to PIO clock cycles
static int usToPIOCycles(int us) {
// Parenthesis needed to guarantee order of operations to avoid 32bit overflow
return (us * (clock_get_hz(clk_sys) / 1000000));
return (us * (clock_get_hz(clk_sys) / 1'000'000));
}
// Get current clock frequency
......
......@@ -147,7 +147,7 @@ size_t SerialUSB::write(const uint8_t *buf, size_t length) {
tud_task();
tud_cdc_write_flush();
if (!tud_cdc_connected() ||
(!tud_cdc_write_available() && time_us_64() > last_avail_time + 1000000 /* 1 second */)) {
(!tud_cdc_write_available() && time_us_64() > last_avail_time + 1'000'000 /* 1 second */)) {
break;
}
}
......
......@@ -62,7 +62,7 @@ void tone(uint8_t pin, unsigned int frequency, unsigned long duration) {
return; // Weird deadlock case
}
int us = 1000000 / frequency / 2;
int us = 1'000'000 / frequency / 2;
if (us < 5) {
us = 5;
}
......
......@@ -90,8 +90,8 @@ extern "C" int _gettimeofday(struct timeval *tv, void *tz) {
(void) tz;
uint64_t now_us = to_us_since_boot(get_absolute_time()) + __timedelta_us;
if (tv) {
tv->tv_sec = now_us / 1000000L;
tv->tv_usec = now_us % 1000000L;
tv->tv_sec = now_us / 1'000'000L;
tv->tv_usec = now_us % 1'000'000L;
}
return 0;
}
......@@ -101,7 +101,7 @@ extern "C" int settimeofday(const struct timeval *tv, const struct timezone *tz)
uint64_t now_us = to_us_since_boot(get_absolute_time());
if (tv) {
uint64_t newnow_us;
newnow_us = tv->tv_sec * 1000000L;
newnow_us = tv->tv_sec * 1'000'000L;
newnow_us += tv->tv_usec;
__timedelta_us = newnow_us - now_us;
}
......@@ -111,7 +111,7 @@ extern "C" int settimeofday(const struct timeval *tv, const struct timezone *tz)
// For NTP
extern "C" void __setSystemTime(unsigned long long sec, unsigned long usec) {
uint64_t now_us = to_us_since_boot(get_absolute_time());
uint64_t newnow_us = sec * 1000000LL + usec;
uint64_t newnow_us = sec * 1'000'000LL + usec;
__timedelta_us = newnow_us - now_us;
}
......
......@@ -42,9 +42,9 @@ extern "C" void analogWriteFreq(uint32_t freq) {
if (freq < 100) {
DEBUGCORE("ERROR: analogWriteFreq too low (%d)\n", freq);
analogFreq = 100;
} else if (freq > 1000000) {
} else if (freq > 1'000'000) {
DEBUGCORE("ERROR: analogWriteFreq too high (%d)\n", freq);
analogFreq = 1000000;
analogFreq = 1'000'000;
} else {
analogFreq = freq;
}
......
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