summaryrefslogtreecommitdiffstats
path: root/watch-library/hpl
diff options
context:
space:
mode:
authorJoey Castillo <jose.castillo@gmail.com>2021-08-30 17:35:47 -0400
committerJoey Castillo <jose.castillo@gmail.com>2021-08-30 17:35:47 -0400
commitfbd9ae4b67b74a9a215f8231d33e3b2f5509abd0 (patch)
treea2690877dd96d939cdb50e45610261489af683f7 /watch-library/hpl
parenteb3d9b26cbda2d2612f11eb39843b221224f1fa7 (diff)
downloadSensor-Watch-fbd9ae4b67b74a9a215f8231d33e3b2f5509abd0.tar.gz
Sensor-Watch-fbd9ae4b67b74a9a215f8231d33e3b2f5509abd0.tar.bz2
Sensor-Watch-fbd9ae4b67b74a9a215f8231d33e3b2f5509abd0.zip
run watch at 4 MHz unless USB is enabled
Diffstat (limited to 'watch-library/hpl')
-rw-r--r--watch-library/hpl/core/hpl_core_m0plus_base.c6
1 files changed, 4 insertions, 2 deletions
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);
}