From fbd9ae4b67b74a9a215f8231d33e3b2f5509abd0 Mon Sep 17 00:00:00 2001 From: Joey Castillo Date: Mon, 30 Aug 2021 17:35:47 -0400 Subject: run watch at 4 MHz unless USB is enabled --- watch-library/hpl/core/hpl_core_m0plus_base.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'watch-library/hpl') diff --git a/watch-library/hpl/core/hpl_core_m0plus_base.c b/watch-library/hpl/core/hpl_core_m0plus_base.c index 1d32300a..cad2a662 100644 --- a/watch-library/hpl/core/hpl_core_m0plus_base.c +++ b/watch-library/hpl/core/hpl_core_m0plus_base.c @@ -167,7 +167,8 @@ static inline uint32_t _get_cycles_for_us_internal(const uint16_t us, const uint */ uint32_t _get_cycles_for_us(const uint16_t us) { - return _get_cycles_for_us_internal(us, CONF_CPU_FREQUENCY, CPU_FREQ_POWER); + int32_t freq = hri_usbdevice_get_CTRLA_ENABLE_bit(USB) ? 8000000 : 4000000; + return _get_cycles_for_us_internal(us, freq, CPU_FREQ_POWER); } /** @@ -196,5 +197,6 @@ static inline uint32_t _get_cycles_for_ms_internal(const uint16_t ms, const uint */ uint32_t _get_cycles_for_ms(const uint16_t ms) { - return _get_cycles_for_ms_internal(ms, CONF_CPU_FREQUENCY, CPU_FREQ_POWER); + int32_t freq = hri_usbdevice_get_CTRLA_ENABLE_bit(USB) ? 8000000 : 4000000; + return _get_cycles_for_ms_internal(ms, freq, CPU_FREQ_POWER); } -- cgit v1.2.3