File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,16 @@ namespace klib::core::lpc175x::io::system {
4343 rtc = 2 ,
4444 };
4545
46+ /* *
47+ * @brief USB PLL clock divider if the USB pll is not used for USB
48+ *
49+ */
50+ enum class usb_pll_divider {
51+ mhz_288 = 5 ,
52+ mhz_384 = 7 ,
53+ mhz_480 = 9 ,
54+ };
55+
4656 /* *
4757 * @brief Check if a pll is connected
4858 *
@@ -268,6 +278,22 @@ namespace klib::core::lpc175x::io::system {
268278 // connect the usb pll
269279 clock::connect<clock::pll::usb, true >();
270280 }
281+
282+ /* *
283+ * @brief Set the USB clock input to the main pll with
284+ * a divider
285+ *
286+ * @tparam Freq
287+ */
288+ template <usb_pll_divider Freq>
289+ static void set_usb () {
290+ // disable the USB pll to switch to main pll
291+ // with a divider
292+ clock::enable<clock::pll::usb, false >();
293+
294+ // set the clock divider to the one provided
295+ SYSCON->USBCLKCFG = static_cast <uint32_t >(Freq);
296+ }
271297 };
272298
273299 class trace {
You can’t perform that action at this time.
0 commit comments