Functions

group group_sysclk_clk_peri_funcs

Functions

void Cy_SysClk_ClkPeriSetDivider(uint8_t divider)

Sets the clock divider for the peripheral clock tree.

All peripheral clock dividers are sourced from this clock. Also the Cortex M0+ clock divider is sourced from this clock. The source of this divider is clkHf[0]

note

Call SystemCoreClockUpdate after this function calling.

Function Usage

    /* Scenario: HFCLK0 is configured and enabled. The Peri clock sourcing the
                 majority of peripherals must run at a frequency that is 1/2
                 of HFCLK0. */

    if(1U != Cy_SysClk_ClkPeriGetDivider())
    {
        Cy_SysClk_ClkPeriSetDivider(1U);
    }

    /* Get the Peri clock output frequency */
    uint32_t clkPerifreq = Cy_SysClk_ClkPeriGetFrequency();

Parameters
  • divider: divider value between 0 and 255 Causes integer division of (divider value + 1), or division by 1 to 256.

uint32_t Cy_SysClk_ClkPeriGetFrequency(void)

Reports the frequency of the peri clock.

Return

The frequency, in Hz.

Function Usage

    /* Scenario: HFCLK0 is configured and enabled. The Peri clock sourcing the
                 majority of peripherals must run at a frequency that is 1/2
                 of HFCLK0. */

    if(1U != Cy_SysClk_ClkPeriGetDivider())
    {
        Cy_SysClk_ClkPeriSetDivider(1U);
    }

    /* Get the Peri clock output frequency */
    uint32_t clkPerifreq = Cy_SysClk_ClkPeriGetFrequency();

uint8_t Cy_SysClk_ClkPeriGetDivider(void)

Returns the clock divider of the peripheral (peri) clock.

Return

The divider value. The integer division done is by (divider value + 1), or division by 1 to 256.

Function Usage

    /* Scenario: HFCLK0 is configured and enabled. The Peri clock sourcing the
                 majority of peripherals must run at a frequency that is 1/2
                 of HFCLK0. */

    if(1U != Cy_SysClk_ClkPeriGetDivider())
    {
        Cy_SysClk_ClkPeriSetDivider(1U);
    }

    /* Get the Peri clock output frequency */
    uint32_t clkPerifreq = Cy_SysClk_ClkPeriGetFrequency();