@@ -116,7 +116,7 @@ public:
116
116
Hsi16 = 0b10,
117
117
Hse = 0b11,
118
118
%% endif
119
- %% if hsi48 and target.family not in ["l4", "l5", "u5 "]
119
+ %% if hsi48 and target.family in ["f0 "]
120
120
/// High speed internal clock (48 MHz)
121
121
Hsi48 = RCC_CFGR_PLLSRC_HSI48_PREDIV,
122
122
InternalClockMHz48 = Hsi48,
@@ -171,7 +171,7 @@ public:
171
171
Hsi16 = Hsi,
172
172
%% endif
173
173
Hse = RCC_CFGR_SW_HSE,
174
- %% if hsi48 and target.family != "l4"
174
+ %% if hsi48 and target.family in ["f0"]
175
175
Hsi48 = RCC_CFGR_SW_HSI48,
176
176
InternalClockMHz48 = Hsi48,
177
177
%% endif
@@ -383,6 +383,12 @@ public:
383
383
Pll1Q = 0b10 << RCC_CCIPR1_ICLKSEL_Pos,
384
384
Msik = 0b11 << RCC_CCIPR1_ICLKSEL_Pos,
385
385
};
386
+ %% elif hsi48 and target.family in ["l0"]
387
+ enum class Clock48Source
388
+ {
389
+ PllQ = 0,
390
+ Hsi48 = RCC_CCIPR_HSI48SEL,
391
+ };
386
392
%% endif
387
393
388
394
%% if target.family in ["f2", "f4", "f7"]
@@ -456,7 +462,7 @@ public:
456
462
MultiSpeedInternalClockK = (0b1001 << RCC_{{cfgr_mco}}_MCOSEL_Pos), // MSIK
457
463
%% endif
458
464
};
459
- %% else
465
+ %% elif target.family in ["f0", "f1", "f3"]
460
466
enum class
461
467
ClockOutputSource : uint32_t
462
468
{
@@ -814,6 +820,12 @@ public:
814
820
{
815
821
RCC->CCIPR1 = (RCC->CCIPR1 & ~RCC_CCIPR1_ICLKSEL_Msk) | uint32_t(source);
816
822
}
823
+ %% elif hsi48 and target.family in ["l0"]
824
+ static inline void
825
+ setClock48Source(Clock48Source source)
826
+ {
827
+ RCC->CCIPR = (RCC->CCIPR & ~RCC_CCIPR_HSI48SEL_Msk) | uint32_t(source);
828
+ }
817
829
%% endif
818
830
819
831
%% if target.family == "h7"
@@ -830,6 +842,31 @@ public:
830
842
{
831
843
RCC->{{d2}}CCIP2R = (RCC->{{d2}}CCIP2R & ~RCC_{{d2}}CCIP2R_USBSEL_Msk) | uint32_t(source);
832
844
}
845
+ %% elif hsi48 and target.family in ["f0"] and (target.name in ["42", "48", "72", "78"])
846
+ enum class
847
+ UsbClockSource : uint32_t
848
+ {
849
+ Hsi48 = 0,
850
+ Pll = RCC_CFGR3_USBSW_PLLCLK,
851
+ };
852
+ static inline void
853
+ enableUsbClockSource(UsbClockSource source)
854
+ {
855
+ RCC->CFGR3 = (RCC->CFGR3 & ~RCC_CFGR3_USBSW_Msk) | uint32_t(source);
856
+ }
857
+ %% elif hsi48 and target.family in ["g0"]
858
+ enum class
859
+ UsbClockSource : uint32_t
860
+ {
861
+ Hsi48 = 0,
862
+ Hse = RCC_CCIPR2_USBSEL_0,
863
+ Pll = RCC_CCIPR2_USBSEL_1,
864
+ };
865
+ static inline void
866
+ enableUsbClockSource(UsbClockSource source)
867
+ {
868
+ RCC->CCIPR2 = (RCC->CCIPR2 & ~RCC_CCIPR2_USBSEL_Msk) | uint32_t(source);
869
+ }
833
870
%% endif
834
871
835
872
%% if target.family in ["f2", "f4", "f7"]
0 commit comments