CMSIS-Driver_PIC32CM-JH  
Peripheral Library (PLIB) Documentation
 
Loading...
Searching...
No Matches
OSCCTRL Interface

Driver API for OSCCTRL (plib_oscctrl.h) More...

Macros

#define EXTERNAL_GCLKIN_FREQ   (12000000UL)
 
#define EXTERNAL_XOSC_FREQ   (12000000UL)
 
#define EXTERNAL_FDPLL96M_FREQ   (96000000UL)
 

Typedefs

typedef void(* OSCCTRL_CALLBACK) (OSCCTRL_IRQ_SOURCE source)
 OSCCTRL callback function type.
 

Enumerations

enum  OSCCTRL_IRQ_SOURCE {
  OSCCTRL_IRQ_OSC48MRDY = 0U , OSCCTRL_IRQ_XOSCRDY = 1U , OSCCTRL_IRQ_XOSCFAIL = 2U , OSCCTRL_IRQ_DPLLLCKR = 3U ,
  OSCCTRL_IRQ_DPLLLCKF = 4U , OSCCTRL_IRQ_DPLLLTO = 5U , OSCCTRL_IRQ_DPLLLDRTO = 6U
}
 OSCCTRL interrupt source enumeration. More...
 

Functions

uint32_t CLOCK_GetPeripheralChannelFreq (uint32_t peripheral_channel_id)
 Fetches the clock frequency for a specific peripheral channel in Hz.
 
void OSCCTRL_Initialize (void)
 Initializes the OSCCTRL interrupt handling.
 
void OSCCTRL_OSC48M_Enable (void)
 Enables the OSC48M internal oscillator.
 
void OSCCTRL_OSC48M_Disable (void)
 Disables the OSC48M internal oscillator.
 
void OSCCTRL_OSC48M_SetDivider (uint8_t div_sel)
 Sets the OSC48M divider value.
 
uint32_t OSCCTRL_OSC48M_GetFrequency (void)
 Returns the current OSC48M output frequency in Hz.
 
void OSCCTRL_OSC48M_SetStartUpTime (uint8_t startup_sel)
 Sets the OSC48M startup delay.
 
bool OSCCTRL_OSC48M_GetDividerSyncBusy (void)
 Checks if OSC48M divider synchronization is busy.
 
void OSCCTRL_OSC48M_EnableOnDemand (void)
 Enables On-Demand mode for OSC48M.
 
void OSCCTRL_OSC48M_DisableOnDemand (void)
 Disables On-Demand mode for OSC48M.
 
void OSCCTRL_OSC48M_EnableRunInStandby (void)
 Enables Run-In-Standby mode for OSC48M.
 
void OSCCTRL_OSC48M_DisableRunInStandby (void)
 Disables Run-In-Standby mode for OSC48M.
 
bool OSCCTRL_OSC48M_IsReady (void)
 Checks if OSC48M is ready.
 
void OSCCTRL_EnableInterrupt (OSCCTRL_IRQ_SOURCE irq_source)
 Enables the specified OSCCTRL interrupt source.
 
void OSCCTRL_DisableInterrupt (OSCCTRL_IRQ_SOURCE irq_source)
 Disables the specified OSCCTRL interrupt source.
 
bool OSCCTRL_InterruptFlagIsSet (OSCCTRL_IRQ_SOURCE irq_source)
 Checks if the specified OSCCTRL interrupt flag is set.
 
void OSCCTRL_ClearInterruptFlag (OSCCTRL_IRQ_SOURCE irq_source)
 Clears the specified OSCCTRL interrupt flag.
 
void OSCCTRL_SetCallbackHandler (OSCCTRL_CALLBACK callback)
 Registers a callback function for OSCCTRL interrupt events.
 
void OSCCTRL_XOSC_Enable (void)
 Enables the external crystal oscillator (XOSC).
 
void OSCCTRL_XOSC_Disable (void)
 Disables the external crystal oscillator (XOSC).
 
void OSCCTRL_XOSC_EnableCrystal (void)
 Enables crystal mode for XOSC.
 
void OSCCTRL_XOSC_DisableCrystal (void)
 Disables crystal mode for XOSC.
 
void OSCCTRL_XOSC_EnableFailureDetector (void)
 Enables the XOSC clock failure detector.
 
void OSCCTRL_XOSC_DisableFailureDetector (void)
 Disables the XOSC clock failure detector.
 
void OSCCTRL_XOSC_EnableOnDemand (void)
 Enables On-Demand mode for XOSC.
 
void OSCCTRL_XOSC_DisableOnDemand (void)
 Disables On-Demand mode for XOSC.
 
void OSCCTRL_XOSC_EnableRunInStandby (void)
 Enables Run-In-Standby mode for XOSC.
 
void OSCCTRL_XOSC_DisableRunInStandby (void)
 Disables Run-In-Standby mode for XOSC.
 
void OSCCTRL_XOSC_SetGain (uint16_t gain)
 Sets the XOSC gain.
 
void OSCCTRL_XOSC_SetStartUpTime (uint16_t startup)
 Sets the XOSC startup time.
 
bool OSCCTRL_XOSC_IsReady (void)
 Checks if XOSC is ready.
 
bool OSCCTRL_XOSC_FailureIsDetected (void)
 Checks if XOSC failure is detected.
 
bool OSCCTRL_XOSC_ClockIsSwitchedToSafe (void)
 Checks if XOSC clock has switched to the safe clock.
 
void OSCCTRL_CFD_SetPrescaler (uint8_t presc)
 Sets the clock failure detector prescaler.
 
void OSCCTRL_CFD_EnableEventOutput (void)
 Enables clock failure detector event output.
 
void OSCCTRL_CFD_DisableEventOutput (void)
 Disables clock failure detector event output.
 
void OSCCTRL_DPLL_Enable (void)
 Enables the DPLL.
 
void OSCCTRL_DPLL_Disable (void)
 Disables the DPLL.
 
void OSCCTRL_DPLL_EnableOnDemand (void)
 Enables On-Demand mode for DPLL.
 
void OSCCTRL_DPLL_DisableOnDemand (void)
 Disables On-Demand mode for DPLL.
 
void OSCCTRL_DPLL_EnableRunInStandby (void)
 Enables Run-In-Standby mode for DPLL.
 
void OSCCTRL_DPLL_DisableRunInStandby (void)
 Disables Run-In-Standby mode for DPLL.
 
void OSCCTRL_DPLL_SetReference (uint32_t refclk)
 Sets the DPLL reference clock.
 
void OSCCTRL_DPLL_SetFilter (uint32_t filter)
 Sets the DPLL filter selection.
 
void OSCCTRL_DPLL_SetLockTime (uint32_t ltime)
 Sets the DPLL lock time.
 
void OSCCTRL_DPLL_EnableLowPowerMode (void)
 Enables DPLL low-power mode.
 
void OSCCTRL_DPLL_DisableLowPowerMode (void)
 Disables DPLL low-power mode.
 
void OSCCTRL_DPLL_SetRatio (uint16_t ldr, uint8_t ldrfrac)
 Sets the DPLL ratio.
 
void OSCCTRL_DPLL_SetDivider (uint16_t div)
 Sets the DPLL output divider.
 
void OSCCTRL_DPLL_SetPrescaler (uint8_t presc)
 Sets the DPLL prescaler.
 
bool OSCCTRL_DPLL_GetEnableSyncBusy (void)
 Checks if DPLL enable synchronization is busy.
 
bool OSCCTRL_DPLL_GetRatioSyncBusy (void)
 Checks if DPLL ratio synchronization is busy.
 
bool OSCCTRL_DPLL_GetPrescalerSyncBusy (void)
 Checks if DPLL prescaler synchronization is busy.
 
bool OSCCTRL_DPLL_IsLocked (void)
 Checks if the DPLL is locked.
 
bool OSCCTRL_DPLL_ClockIsReady (void)
 Checks if the DPLL clock output is ready.
 

Variables

uint32_t SystemCoreClock
 System core clock frequency. This global variable holds the current core (CPU) clock frequency in Hertz. Update the value with SystemCoreClockUpdate() whenever the core clock is changed.
 

Description

Driver API for OSCCTRL (plib_oscctrl.h)

Usage Example

The following example demonstrates typical usage of the OSCCTRL peripheral:

/********************************************************************************
* Copyright © 2026 Microchip Technology Inc. and its subsidiaries.
*
* Subject to your compliance with these terms, you may use Microchip software
* and any derivatives exclusively with Microchip products. It is your
* responsibility to comply with third party license terms applicable to your
* use of third party software (including open source software) that may
* accompany Microchip software.
*
* THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
* EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
* WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
* INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
* WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
* BEEN ADVISED OF THE POSSIBILITY OF THE DAMAGES ARE FORESEEABLE. TO THE
* FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
* ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
* THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
*******************************************************************************/
/******************************************************************************
* @file configure_clock.c
* @brief Clock configuration helper functions (template).
*
* @details This file provides small convenience APIs to configure OSCCTRL/GCLK/
* MCLK for common use-cases.
******************************************************************************/
#include "plib_clock.h"
/* Function prototypes */
uint32_t configure_CLOCK_GetSystemClockFreq(void);
void configure_OSCCTRL_Setup(void);
void configure_OSC32K_Setup(void);
void configure_GCLK_Setup(void);
void configure_GCLK_EnableSignalOutput(void);
void configure_MCLK_DivideCoreClock(void);
uint32_t configure_CLOCK_GetSystemClockFreq(void)
{
SystemCoreClockUpdate();
}
void configure_OSCCTRL_Setup(void)
{
OSCCTRL_OSC48M_SetDivider(OSCCTRL_OSC48MDIV_DIV_DIV1_Val);
{
}
{
}
}
void configure_OSC32K_Setup(void)
{
uint32_t calib_value = ((*(volatile uint32_t*)0x00806020) >> 12) & 0x7FU;
OSC32KCTRL_OSC32K_SetStartUpTime(OSC32KCTRL_OSC32K_STARTUP_CYCLE130);
}
void configure_GCLK_Setup(void)
{
uint16_t freq_divide_factor = 2U;
bool improve_duty_cycle = false;
//improve_duty_cycle = ((freq_divide_factor % 2U) == 0U) ? true : false;
GCLK_SetGeneratorSource(1U, GCLK_GENCTRL_SRC_OSC48M_Val);
GCLK_SetDivisionParameters(1U, freq_divide_factor, GCLK_GENCTRL_DIVSEL_DIV1_Val, improve_duty_cycle);
}
void configure_GCLK_EnableSignalOutput(void)
{
}
void configure_MCLK_DivideCoreClock(void)
{
while(!MCLK_ClockIsReady()){}
}
void GCLK_EnableStandbyRun(GCLK_GENERATOR_ID generator_id)
Enables GCLK generator operation in standby mode.
void GCLK_SetOutputOffValue(GCLK_GENERATOR_ID generator_id, uint32_t output_off_value)
Sets the output value when the GCLK generator is off.
void GCLK_SetGeneratorSource(GCLK_GENERATOR_ID generator_id, GCLK_SOURCE source)
Sets the clock source for a specified GCLK generator. Before changing the source in GENERATOR 0,...
void GCLK_SetDivisionParameters(GCLK_GENERATOR_ID generator_id, uint16_t divide_factor, GCLK_DIVIDE_TYPE divide_type, bool improve_duty_cycle)
Sets the division factor and type for a GCLK generator.
void GCLK_GeneratorEnable(GCLK_GENERATOR_ID generator_id)
Enables the specified GCLK generator.
void GCLK_SetOutputEnable(GCLK_GENERATOR_ID generator_id, bool output_enable)
Enables or disables output for a GCLK generator.
void MCLK_SetCPUClockDivider(MCLK_CPU_CLOCK_DIVIDER cpu_div)
Sets the CPU clock division factor.
bool MCLK_ClockIsReady(void)
Checks if the clock is ready (CKRDY flag).
@ MCLK_CPU_CLK_DIV_4
Definition plib_mclk.h:65
void OSC32KCTRL_OSC32K_EnableOsc(void)
Enables the OSC32K oscillator sub-peripheral.
void OSC32KCTRL_OSC32K_SetCalibValue(uint32_t calib_value)
The frequency of the OSC32K oscillator is controlled by OSC32K.CALIB. Before using the OSC32K,...
void OSC32KCTRL_OSC32K_Enable32K(void)
Enables the 32 kHz output of the OSC32K oscillator.
void OSC32KCTRL_OSC32K_SetStartUpTime(OSC32KCTRL_OSC32K_CSUT startup_time)
During the start-up time, the oscillator output is masked to ensure that no unstable clock propagates...
bool OSC32KCTRL_OSC32K_IsReady(void)
Once the oscillator is stable and ready to be used as a clock source, the OSC32KRDY bit in the STATUS...
void OSCCTRL_OSC48M_Enable(void)
Enables the OSC48M internal oscillator.
void OSCCTRL_OSC48M_DisableOnDemand(void)
Disables On-Demand mode for OSC48M.
uint32_t SystemCoreClock
System core clock frequency. This global variable holds the current core (CPU) clock frequency in Her...
bool OSCCTRL_OSC48M_GetDividerSyncBusy(void)
Checks if OSC48M divider synchronization is busy.
void OSCCTRL_OSC48M_SetDivider(uint8_t div_sel)
Sets the OSC48M divider value.
bool OSCCTRL_OSC48M_IsReady(void)
Checks if OSC48M is ready.

Macro Definition Documentation

◆ EXTERNAL_FDPLL96M_FREQ

#define EXTERNAL_FDPLL96M_FREQ   (96000000UL)

◆ EXTERNAL_GCLKIN_FREQ

#define EXTERNAL_GCLKIN_FREQ   (12000000UL)

◆ EXTERNAL_XOSC_FREQ

#define EXTERNAL_XOSC_FREQ   (12000000UL)

Typedef Documentation

◆ OSCCTRL_CALLBACK

typedef void(* OSCCTRL_CALLBACK) (OSCCTRL_IRQ_SOURCE source)

OSCCTRL callback function type.

Enumeration Type Documentation

◆ OSCCTRL_IRQ_SOURCE

OSCCTRL interrupt source enumeration.

Enumerator
OSCCTRL_IRQ_OSC48MRDY 
OSCCTRL_IRQ_XOSCRDY 
OSCCTRL_IRQ_XOSCFAIL 
OSCCTRL_IRQ_DPLLLCKR 
OSCCTRL_IRQ_DPLLLCKF 
OSCCTRL_IRQ_DPLLLTO 
OSCCTRL_IRQ_DPLLLDRTO 

Function Documentation

◆ CLOCK_GetPeripheralChannelFreq()

uint32_t CLOCK_GetPeripheralChannelFreq ( uint32_t peripheral_channel_id)

Fetches the clock frequency for a specific peripheral channel in Hz.

This function calculates and returns the frequency of a peripheral channel (GCLK peripheral control) by reading the assigned GCLK generator, its source, and division settings. It uses existing PLIB GCLK and OSCCTRL APIs to determine the actual frequency.

Parameters
peripheral_channel_idThe peripheral channel ID (e.g., SERCOM0_GCLK_ID_CORE, TC0_GCLK_ID). This must be a valid peripheral channel identifier from the device header.
Note
The peripheral channel must be enabled (via GCLK_EnablePeripheralChannel) and properly configured before calling this function. If the channel is disabled, this function may return 0.
Returns
The peripheral channel clock frequency in Hz. Returns 0 if the channel is disabled or if the frequency cannot be determined.

◆ OSCCTRL_CFD_DisableEventOutput()

void OSCCTRL_CFD_DisableEventOutput ( void )

Disables clock failure detector event output.

Parameters
None.
Returns
None.

◆ OSCCTRL_CFD_EnableEventOutput()

void OSCCTRL_CFD_EnableEventOutput ( void )

Enables clock failure detector event output.

Parameters
None.
Returns
None.

◆ OSCCTRL_CFD_SetPrescaler()

void OSCCTRL_CFD_SetPrescaler ( uint8_t presc)

Sets the clock failure detector prescaler.

Parameters
prescPrescaler value to be set (2^presc divider).
Returns
None.

◆ OSCCTRL_ClearInterruptFlag()

void OSCCTRL_ClearInterruptFlag ( OSCCTRL_IRQ_SOURCE irq_source)

Clears the specified OSCCTRL interrupt flag.

Parameters
irq_sourceInterrupt source.
Returns
None.

◆ OSCCTRL_DisableInterrupt()

void OSCCTRL_DisableInterrupt ( OSCCTRL_IRQ_SOURCE irq_source)

Disables the specified OSCCTRL interrupt source.

Parameters
irq_sourceInterrupt source.
Returns
None.

◆ OSCCTRL_DPLL_ClockIsReady()

bool OSCCTRL_DPLL_ClockIsReady ( void )

Checks if the DPLL clock output is ready.

Parameters
None.
Returns
true if DPLL clock is ready, false otherwise.

◆ OSCCTRL_DPLL_Disable()

void OSCCTRL_DPLL_Disable ( void )

Disables the DPLL.

Parameters
None.
Returns
None.

◆ OSCCTRL_DPLL_DisableLowPowerMode()

void OSCCTRL_DPLL_DisableLowPowerMode ( void )

Disables DPLL low-power mode.

Parameters
None.
Returns
None.

◆ OSCCTRL_DPLL_DisableOnDemand()

void OSCCTRL_DPLL_DisableOnDemand ( void )

Disables On-Demand mode for DPLL.

Parameters
None.
Returns
None.

◆ OSCCTRL_DPLL_DisableRunInStandby()

void OSCCTRL_DPLL_DisableRunInStandby ( void )

Disables Run-In-Standby mode for DPLL.

Parameters
None.
Returns
None.

◆ OSCCTRL_DPLL_Enable()

void OSCCTRL_DPLL_Enable ( void )

Enables the DPLL.

Parameters
None.
Returns
None.

◆ OSCCTRL_DPLL_EnableLowPowerMode()

void OSCCTRL_DPLL_EnableLowPowerMode ( void )

Enables DPLL low-power mode.

Parameters
None.
Returns
None.

◆ OSCCTRL_DPLL_EnableOnDemand()

void OSCCTRL_DPLL_EnableOnDemand ( void )

Enables On-Demand mode for DPLL.

Parameters
None.
Returns
None.

◆ OSCCTRL_DPLL_EnableRunInStandby()

void OSCCTRL_DPLL_EnableRunInStandby ( void )

Enables Run-In-Standby mode for DPLL.

Parameters
None.
Returns
None.

◆ OSCCTRL_DPLL_GetEnableSyncBusy()

bool OSCCTRL_DPLL_GetEnableSyncBusy ( void )

Checks if DPLL enable synchronization is busy.

Parameters
None.
Returns
true if synchronization is busy, false otherwise.

◆ OSCCTRL_DPLL_GetPrescalerSyncBusy()

bool OSCCTRL_DPLL_GetPrescalerSyncBusy ( void )

Checks if DPLL prescaler synchronization is busy.

Parameters
None.
Returns
true if synchronization is busy, false otherwise.

◆ OSCCTRL_DPLL_GetRatioSyncBusy()

bool OSCCTRL_DPLL_GetRatioSyncBusy ( void )

Checks if DPLL ratio synchronization is busy.

Parameters
None.
Returns
true if synchronization is busy, false otherwise.

◆ OSCCTRL_DPLL_IsLocked()

bool OSCCTRL_DPLL_IsLocked ( void )

Checks if the DPLL is locked.

Parameters
None.
Returns
true if DPLL is locked, false otherwise.

◆ OSCCTRL_DPLL_SetDivider()

void OSCCTRL_DPLL_SetDivider ( uint16_t div)

Sets the DPLL output divider.

Parameters
divDivider value to be set.
Returns
None.

◆ OSCCTRL_DPLL_SetFilter()

void OSCCTRL_DPLL_SetFilter ( uint32_t filter)

Sets the DPLL filter selection.

Parameters
filterFilter selection value to be set.
Returns
None.

◆ OSCCTRL_DPLL_SetLockTime()

void OSCCTRL_DPLL_SetLockTime ( uint32_t ltime)

Sets the DPLL lock time.

Parameters
ltimeLock time selection value to be set.
Returns
None.

◆ OSCCTRL_DPLL_SetPrescaler()

void OSCCTRL_DPLL_SetPrescaler ( uint8_t presc)

Sets the DPLL prescaler.

Parameters
prescPrescaler selection value to be set.
Returns
None.

◆ OSCCTRL_DPLL_SetRatio()

void OSCCTRL_DPLL_SetRatio ( uint16_t ldr,
uint8_t ldrfrac )

Sets the DPLL ratio.

Parameters
ldrLoop divider ratio value to be set.
ldrfracFractional part of the loop divider ratio.
Returns
None.

◆ OSCCTRL_DPLL_SetReference()

void OSCCTRL_DPLL_SetReference ( uint32_t refclk)

Sets the DPLL reference clock.

Parameters
refclkReference clock selection value to be set.
Returns
None.

◆ OSCCTRL_EnableInterrupt()

void OSCCTRL_EnableInterrupt ( OSCCTRL_IRQ_SOURCE irq_source)

Enables the specified OSCCTRL interrupt source.

Parameters
irq_sourceInterrupt source.
Returns
None.

◆ OSCCTRL_Initialize()

void OSCCTRL_Initialize ( void )

Initializes the OSCCTRL interrupt handling.

Note
Use DFP *_Val macros (unshifted) for configuration values passed to setters below. Do not pass shifted macros.
Parameters
None.
Returns
None.

◆ OSCCTRL_InterruptFlagIsSet()

bool OSCCTRL_InterruptFlagIsSet ( OSCCTRL_IRQ_SOURCE irq_source)

Checks if the specified OSCCTRL interrupt flag is set.

Parameters
irq_sourceInterrupt source.
Returns
true if flag is set, false otherwise.

◆ OSCCTRL_OSC48M_Disable()

void OSCCTRL_OSC48M_Disable ( void )

Disables the OSC48M internal oscillator.

Parameters
None.
Returns
None.

◆ OSCCTRL_OSC48M_DisableOnDemand()

void OSCCTRL_OSC48M_DisableOnDemand ( void )

Disables On-Demand mode for OSC48M.

Parameters
None.
Returns
None.

◆ OSCCTRL_OSC48M_DisableRunInStandby()

void OSCCTRL_OSC48M_DisableRunInStandby ( void )

Disables Run-In-Standby mode for OSC48M.

Parameters
None.
Returns
None.

◆ OSCCTRL_OSC48M_Enable()

void OSCCTRL_OSC48M_Enable ( void )

Enables the OSC48M internal oscillator.

Parameters
None.
Returns
None.

◆ OSCCTRL_OSC48M_EnableOnDemand()

void OSCCTRL_OSC48M_EnableOnDemand ( void )

Enables On-Demand mode for OSC48M.

Parameters
None.
Returns
None.

◆ OSCCTRL_OSC48M_EnableRunInStandby()

void OSCCTRL_OSC48M_EnableRunInStandby ( void )

Enables Run-In-Standby mode for OSC48M.

Parameters
None.
Returns
None.

◆ OSCCTRL_OSC48M_GetDividerSyncBusy()

bool OSCCTRL_OSC48M_GetDividerSyncBusy ( void )

Checks if OSC48M divider synchronization is busy.

Parameters
None.
Returns
true if synchronization is busy, false otherwise.

◆ OSCCTRL_OSC48M_GetFrequency()

uint32_t OSCCTRL_OSC48M_GetFrequency ( void )

Returns the current OSC48M output frequency in Hz.

Parameters
None.
Returns
The current frequency in Hz.

◆ OSCCTRL_OSC48M_IsReady()

bool OSCCTRL_OSC48M_IsReady ( void )

Checks if OSC48M is ready.

Parameters
None.
Returns
true if OSC48M is ready, false otherwise.

◆ OSCCTRL_OSC48M_SetDivider()

void OSCCTRL_OSC48M_SetDivider ( uint8_t div_sel)

Sets the OSC48M divider value.

Parameters
div_selDivider selection value to be set.
Returns
None.

◆ OSCCTRL_OSC48M_SetStartUpTime()

void OSCCTRL_OSC48M_SetStartUpTime ( uint8_t startup_sel)

Sets the OSC48M startup delay.

Parameters
startup_selStartup time selection value to be set.
Returns
None.

◆ OSCCTRL_SetCallbackHandler()

void OSCCTRL_SetCallbackHandler ( OSCCTRL_CALLBACK callback)

Registers a callback function for OSCCTRL interrupt events.

Parameters
callbackPointer to the callback function to be registered.
Returns
None.

◆ OSCCTRL_XOSC_ClockIsSwitchedToSafe()

bool OSCCTRL_XOSC_ClockIsSwitchedToSafe ( void )

Checks if XOSC clock has switched to the safe clock.

Parameters
None.
Returns
true if clock switch is active, false otherwise.

◆ OSCCTRL_XOSC_Disable()

void OSCCTRL_XOSC_Disable ( void )

Disables the external crystal oscillator (XOSC).

Parameters
None.
Returns
None.

◆ OSCCTRL_XOSC_DisableCrystal()

void OSCCTRL_XOSC_DisableCrystal ( void )

Disables crystal mode for XOSC.

Parameters
None.
Returns
None.

◆ OSCCTRL_XOSC_DisableFailureDetector()

void OSCCTRL_XOSC_DisableFailureDetector ( void )

Disables the XOSC clock failure detector.

Parameters
None.
Returns
None.

◆ OSCCTRL_XOSC_DisableOnDemand()

void OSCCTRL_XOSC_DisableOnDemand ( void )

Disables On-Demand mode for XOSC.

Parameters
None.
Returns
None.

◆ OSCCTRL_XOSC_DisableRunInStandby()

void OSCCTRL_XOSC_DisableRunInStandby ( void )

Disables Run-In-Standby mode for XOSC.

Parameters
None.
Returns
None.

◆ OSCCTRL_XOSC_Enable()

void OSCCTRL_XOSC_Enable ( void )

Enables the external crystal oscillator (XOSC).

Parameters
None.
Returns
None.

◆ OSCCTRL_XOSC_EnableCrystal()

void OSCCTRL_XOSC_EnableCrystal ( void )

Enables crystal mode for XOSC.

Parameters
None.
Returns
None.

◆ OSCCTRL_XOSC_EnableFailureDetector()

void OSCCTRL_XOSC_EnableFailureDetector ( void )

Enables the XOSC clock failure detector.

Parameters
None.
Returns
None.

◆ OSCCTRL_XOSC_EnableOnDemand()

void OSCCTRL_XOSC_EnableOnDemand ( void )

Enables On-Demand mode for XOSC.

Parameters
None.
Returns
None.

◆ OSCCTRL_XOSC_EnableRunInStandby()

void OSCCTRL_XOSC_EnableRunInStandby ( void )

Enables Run-In-Standby mode for XOSC.

Parameters
None.
Returns
None.

◆ OSCCTRL_XOSC_FailureIsDetected()

bool OSCCTRL_XOSC_FailureIsDetected ( void )

Checks if XOSC failure is detected.

Parameters
None.
Returns
true if failure is detected, false otherwise.

◆ OSCCTRL_XOSC_IsReady()

bool OSCCTRL_XOSC_IsReady ( void )

Checks if XOSC is ready.

Parameters
None.
Returns
true if XOSC is ready, false otherwise.

◆ OSCCTRL_XOSC_SetGain()

void OSCCTRL_XOSC_SetGain ( uint16_t gain)

Sets the XOSC gain.

Parameters
gainGain selection value to be set.
Returns
None.

◆ OSCCTRL_XOSC_SetStartUpTime()

void OSCCTRL_XOSC_SetStartUpTime ( uint16_t startup)

Sets the XOSC startup time.

Parameters
startupStartup time selection value to be set.
Returns
None.

Variable Documentation

◆ SystemCoreClock

uint32_t SystemCoreClock
extern

System core clock frequency. This global variable holds the current core (CPU) clock frequency in Hertz. Update the value with SystemCoreClockUpdate() whenever the core clock is changed.