Skip to content

Commit

Permalink
usb clock 0.1% tolerance
Browse files Browse the repository at this point in the history
  • Loading branch information
TomSaw committed Mar 8, 2024
1 parent e551cb3 commit 54dd9df
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/modm/platform/usb/stm32/usb.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include <modm/platform/device.hpp>
#include <modm/platform/gpio/connector.hpp>
#include <modm/math/tolerance.hpp>

%% set name = "Usb" ~ port | capitalize

Expand All @@ -28,7 +29,7 @@ public:
static void
initialize(uint8_t priority=3)
{
static_assert(SystemClock::Usb == 48_MHz, "{{ name }} must have a 48MHz clock!");
static_assert(isValueInTolerance(48_MHz, SystemClock::Usb, 0.1_pct), "{{ name }} must have a 48MHz clock!");
%% if target.family in ["g0", "l4", "l5"]
#ifdef PWR_CR2_USV
PWR->CR2 |= PWR_CR2_USV;
Expand Down

0 comments on commit 54dd9df

Please sign in to comment.