@@ -593,91 +593,6 @@ public:
593
593
enablePllSai(const PllSaiFactors& pllFactors, uint32_t waitCycles = 2048);
594
594
%% endif
595
595
596
- // DEPRECATE: 2022q1
597
- %% if target.family in ["f2", "f4", "f7", "l4", "g0", "g4"]
598
- /**
599
- * Enable PLL.
600
- *
601
- * \code
602
- * VCO input frequency = PLL input clock frequency / PLLM [with 2 <= PLLM <= 63]
603
- * VCO output frequency = VCO input frequency × PLLN [with 64 <= PLLN <= 432]
604
- * \endcode
605
- *
606
- * \param source
607
- * Source select for PLL and for plli2s. If you are using
608
- * HSE you must enable it first (see enableHse()).
609
- *
610
- * \param pllM
611
- * Division factor for the main PLL (PLL) and
612
- * audio PLL (PLLI2S) input clock (with 2 <= pllM <= 63).
613
- * The software has to set these bits correctly to ensure
614
- * that frequency of selected source divided by pllM
615
- * is in ranges from 1 to 2 MHz.
616
- *
617
- * \param pllN
618
- * Main PLL (PLL) multiplication factor for VCO (with 64 <= pllN <= 432).
619
- * The software has to set these bits correctly to ensure
620
- * that the VCO output frequency is
621
- * - 336 MHz for ST32F4. Core will run at 168 MHz.
622
- * - 240 MHz for ST32F2. Core will run at 120 MHz.
623
- *
624
- * Example:
625
- *
626
- */
627
- [[deprecated("Use PllFactors as argument instead")]] static bool
628
- enablePll(PllSource source, uint8_t pllM, uint16_t pllN,
629
- %% if target.family in ["l4", "g0", "g4"]
630
- uint8_t pllR,
631
- %% else
632
- uint8_t pllP,
633
- %% endif
634
- uint32_t waitCycles = 2048)
635
- {
636
- PllFactors pllFactors{
637
- .pllM = pllM,
638
- .pllN = pllN,
639
- %% if target.family in ["l4", "g0", "g4"]
640
- .pllR = pllR,
641
- %% else
642
- .pllP = pllP,
643
- %% endif
644
- };
645
- return enablePll(source, pllFactors, waitCycles);
646
- }
647
- %% elif target.family in ["l1"]
648
- [[deprecated("Use PllFactors as argument instead")]] static bool
649
- enablePll(PllSource source, PllMultiplier pllMul, uint8_t pllDiv,
650
- uint32_t waitCycles = 2048)
651
- {
652
- PllFactors pllFactors{
653
- .pllMul = pllMul,
654
- .pllDiv = pllDiv,
655
- };
656
- return enablePll(source, pllFactors, waitCycles);
657
- }
658
- %% elif target.family in ["f0", "f1", "f3"]
659
- [[deprecated("Use PllFactors as argument instead")]] static bool
660
- enablePll(PllSource source,
661
- uint8_t pllMul,
662
- %% if pllprediv2
663
- uint8_t pllPrediv, uint8_t pllPrediv2,
664
- %% elif pllprediv
665
- uint8_t pllPrediv,
666
- %% endif
667
- uint32_t waitCycles = 2048)
668
- {
669
- PllFactors pllFactors{
670
- .pllMul = pllMul,
671
- %% if pllprediv2
672
- .pllPrediv = pllPrediv,
673
- .pllPrediv2 = pllPrediv2,
674
- %% elif pllprediv
675
- .pllPrediv = pllPrediv,
676
- %% endif
677
- };
678
- return enablePll(source, pllFactors, waitCycles);
679
- }
680
- %% endif
681
596
%% if target.family == "l0"
682
597
static inline bool
683
598
isHsiPredivider4Active()
@@ -689,6 +604,48 @@ public:
689
604
setHsiPredivider4Enabled(bool divideBy4, uint32_t waitCycles = 2048);
690
605
%% endif
691
606
607
+ %% if target["family"] == "f4"
608
+ /**
609
+ * Input clock for I2S Pll is the HSE or HSI divided by M.
610
+ *
611
+ * f(VCO clock) = f(PLLI2S clock input) × (PLLI2SN / PLLM)
612
+ *
613
+ * f(PLL I2S clock output) = f(VCO clock) / PLLI2SR
614
+ */
615
+ struct PllI2sFactors
616
+ {
617
+ /**
618
+ * @brief multiplication factor for VCO
619
+ *
620
+ * Caution: The software has to set these bits correctly
621
+ * to ensure that the VCO output frequency
622
+ * is between 100 and 432 MHz.
623
+ *
624
+ * 50 <= `pllN` <= 432
625
+ */
626
+ const uint16_t pllN;
627
+
628
+ /**
629
+ * @brief division factor for I2S clocks
630
+ *
631
+ * Caution: The I2Ss requires a frequency lower than
632
+ * or equal to 192 MHz to work correctly.
633
+ *
634
+ * 2 <= `pllR` <= 7
635
+ */
636
+ const uint16_t pllR;
637
+ };
638
+
639
+ /**
640
+ * @brief Configure factors for I2S pll and enable.
641
+ *
642
+ * @param pllFactors See `PllI2sFactors`
643
+ * @param waitCycles Number of cycles to wait for pll to become stable. Defaults to 2048.
644
+ */
645
+ static bool
646
+ enablePllI2s(const PllI2sFactors& pllFactors, uint32_t waitCycles = 2048);
647
+ %% endif
648
+
692
649
// sinks
693
650
static bool
694
651
enableSystemClock(SystemClockSource src, uint32_t waitCycles = 2048);
0 commit comments