Module imxrt_hal::ccm::perclk_clk
source · Expand description
PERCLK clock.
The PERCLK clock controls GPT and PIT timers.
Example
Use the CCM to set the PERCLK clock selection and frequency. After this snippet runs, the PERCLK clock runs at 8MHz. To safely perform this switch, disable all clock gates to the PIT and GPT peripherals.
use imxrt_ral as ral;
use imxrt_hal as hal;
use hal::ccm::{self, clock_gate};
let mut ccm = unsafe { ral::ccm::CCM::instance() };
clock_gate::PERCLK_CLOCK_GATES
.iter()
.for_each(|clock_gate| clock_gate.set(&mut ccm, clock_gate::OFF));
// 24MHz...
ccm::perclk_clk::set_selection(&mut ccm, ccm::perclk_clk::Selection::Oscillator);
// ...divided by 3.
ccm::perclk_clk::set_divider(&mut ccm, 3);
clock_gate::PERCLK_CLOCK_GATES
.iter()
.for_each(|clock_gate| clock_gate.set(&mut ccm, clock_gate::ON));
Enums
- PERCLK clock selection.
Constants
- The largest PERCLK divider.
- The smallest PERCLK divider.
Functions
- Returns the PERCLK clock divider.
- Returns the PERCLK clock selection.
- Set the PERCLK clock divider.
- Set the PERCLK clock selection.