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