Expand description
§Peripheral Channel Clocks
§Overview
Peripheral channel clocks, or Pclk
s, connect generic clock controllers
(Gclk
s) to various peripherals within the chip. Each Pclk
maps 1:1
with a corresponding peripheral.
The 48 possible Pclk
s are distinguished by their corresponding
PclkId
types. Ideally, each PclkId
type would be a relevant type
from a corresponding HAL module. For example, each of the eight different
Sercom
types implements PclkId
. However, the HAL does not yet
support all peripherals, nor have all existing HAL peripherals been
integrated with clock::v2
. In those cases, a dummy type is defined in the
clock::v2::types
module.
Pclk
s are typically leaves in the clock tree. The only exceptions are
Pclk
s used for the DFLL
or DPLL
peripherals. In those cases, the
Pclk
acts as a branch clock.
Each Pclk
powers only a single peripheral; they do not act as general
purpose clock Source
s for other clocks in the tree. As a result, they do
not need to be wrapped with Enabled
.
Pclk
s also do not have any meaningful configuration beyond identifying
which EnabledGclk
is its Source
. Consequently, PclkToken
s can be
directly converted into enabled Pclk
s with Pclk::enable
.
See the clock
module documentation for a more thorough explanation of
the various concepts discussed above.
§Example
The following example shows how to enable the Pclk
for Sercom0
. It
derives the Sercom0
clock from EnabledGclk0
, which is already
running at power-on reset. In doing so, the EnabledGclk0
counter is
Increment
ed.
use atsamd_hal::{
clock::v2::{clock_system_at_reset, pclk::Pclk},
pac::Peripherals,
};
let mut pac = Peripherals::take().unwrap();
let (buses, clocks, tokens) = clock_system_at_reset(
pac.oscctrl,
pac.osc32kctrl,
pac.gclk,
pac.mclk,
&mut pac.nvmctrl,
);
let (pclk_sercom0, gclk0) = Pclk::enable(tokens.pclks.sercom0, clocks.gclk0);
Modules§
Structs§
- Pclk
- Peripheral channel clock for a given peripheral
- Pclk
Token - Singleton token that can be exchanged for a
Pclk
- Pclk
Tokens - Set of
PclkToken
s representing the disabledPclk
s at power-on reset
Enums§
Traits§
- PclkId
- Type-level enum identifying one of the 48 possible
Pclk
s - Pclk
Source Id - Type-level enum of possible clock
Source
s for aPclk
Type Aliases§
- DynPclk
Source Id - Value-level enum of possible clock sources for a
Pclk