@@ -318,7 +318,7 @@ public:
318
318
};
319
319
%% endif
320
320
321
- %% if target.family in ["f2", "f4", "f7", "h7" ]
321
+ %% if target.family in ["f2", "f4", "f7"]
322
322
enum class
323
323
ClockOutput1Source : uint32_t
324
324
{
@@ -338,6 +338,27 @@ public:
338
338
Pll = RCC_CFGR_MCO2_1 | RCC_CFGR_MCO2_0,
339
339
};
340
340
%% endif
341
+ %% elif target.family in ["h7"]
342
+ enum class
343
+ ClockOutput1Source : uint32_t
344
+ {
345
+ Hsi = 0,
346
+ Lse = RCC_CFGR_MCO1_0,
347
+ Hse = RCC_CFGR_MCO1_1,
348
+ Pll1Q = RCC_CFGR_MCO1_1 | RCC_CFGR_MCO1_0,
349
+ Hsi48 = RCC_CFGR_MCO1_2
350
+ };
351
+
352
+ enum class
353
+ ClockOutput2Source : uint32_t
354
+ {
355
+ SystemClock = 0,
356
+ Pll2P = RCC_CFGR_MCO2_0,
357
+ Hse = RCC_CFGR_MCO2_1,
358
+ Pll = RCC_CFGR_MCO2_1 | RCC_CFGR_MCO2_0,
359
+ Csi = RCC_CFGR_MCO2_2,
360
+ Lsi = RCC_CFGR_MCO2_2 | RCC_CFGR_MCO2_0
361
+ };
341
362
%% elif target.family in ["l0", "l1", "l4", "l5", "g0", "g4"]
342
363
enum class
343
364
ClockOutputSource : uint32_t
@@ -654,7 +675,7 @@ public:
654
675
}
655
676
%% endif
656
677
657
- %% if target.family in ["f2", "f4", "f7", "h7" ]
678
+ %% if target.family in ["f2", "f4", "f7"]
658
679
static inline bool
659
680
enableClockOutput1(ClockOutput1Source src, uint8_t div)
660
681
{
@@ -674,7 +695,24 @@ public:
674
695
return true;
675
696
}
676
697
%% endif
698
+ %% elif target.family in ["h7"]
699
+ static inline bool
700
+ enableClockOutput1(ClockOutput1Source src, uint8_t div)
701
+ {
702
+ uint32_t tmp = RCC->CFGR & ~(RCC_CFGR_MCO1 | RCC_CFGR_MCO1PRE);
703
+ if (div > 1) tmp |= (div << 18);
704
+ RCC->CFGR = tmp | uint32_t(src);
705
+ return true;
706
+ }
677
707
708
+ static inline bool
709
+ enableClockOutput2(ClockOutput2Source src, uint8_t div)
710
+ {
711
+ uint32_t tmp = RCC->CFGR & ~(RCC_CFGR_MCO2 | RCC_CFGR_MCO2PRE);
712
+ if (div > 1) tmp |= (div << 25);
713
+ RCC->CFGR = tmp | uint32_t(src);
714
+ return true;
715
+ }
678
716
%% elif target.family in ["l0", "l1", "l4", "l5", "g0", "g4"]
679
717
enum class
680
718
ClockOutputPrescaler : uint32_t
0 commit comments