Skip to content

Commit

Permalink
Minor - Add number separators
Browse files Browse the repository at this point in the history
  • Loading branch information
earlephilhower committed Sep 7, 2022
1 parent f79b086 commit 72f2655
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions cores/rp2040/PolledTimeout.h
Original file line number Diff line number Diff line change
Expand Up @@ -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, 1000 >;
using TimeFastMillis = TimeUnit< TimeSourceCycles, 1000 >;
using TimeFastMicros = TimeUnit< TimeSourceCycles, 1'000'000 >;
using TimeFastNanos = TimeUnit< TimeSourceCycles, 1'000'000'000 >;

} //TimePolicy

Expand Down
2 changes: 1 addition & 1 deletion cores/rp2040/RP2040Support.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class RP2040 {
// 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
Expand Down
2 changes: 1 addition & 1 deletion cores/rp2040/SerialUSB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion cores/rp2040/Tone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
8 changes: 4 additions & 4 deletions cores/rp2040/posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions cores/rp2040/wiring_analog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 72f2655

Please sign in to comment.