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

Driver API for OSC32KCTRL (plib_osc32kctrl.h) More...

Typedefs

typedef uint16_t OSC32KCTRL_XOSC32K_CSUT
 XOSC32K startup time selection (CSUT field).
 
typedef uint32_t OSC32KCTRL_OSC32K_CSUT
 OSC32K startup time selection (CSUT field).
 
typedef void(* OSC32KCTRL_CALLBACK) (OSC32KCTRL_IRQ_SOURCE source)
 Callback function type for OSC32KCTRL events.
 

Enumerations

enum  OSC32KCTRL_IRQ_SOURCE { OSC32KCTRL_IRQ_XOSC32KRDY = 0U , OSC32KCTRL_IRQ_OSC32KRDY , OSC32KCTRL_IRQ_CLKFAIL }
 Interrupt Source Enumeration. More...
 

Functions

void OSC32KCTRL_Initialize (void)
 Initializes the OSC32KCTRL peripheral.
 
bool OSC32KCTRL_XOSC32K_IsReady (void)
 Checks if the XOSC32K oscillator is ready.
 
void OSC32KCTRL_XOSC32K_Enable (void)
 Enables the XOSC32K oscillator sub-peripheral.
 
void OSC32KCTRL_XOSC32K_Disable (void)
 Disables the XOSC32K oscillator sub-peripheral.
 
void OSC32KCTRL_XOSC32K_EnableCrystalOsc (void)
 Enables crystal oscillator source of XOSC32K.
 
void OSC32KCTRL_XOSC32K_DisableCrystalOsc (void)
 Disables crystal oscillator source of XOSC32K. External clock source is set. as default source.
 
void OSC32KCTRL_XOSC32K_EnableOnDemand (void)
 Enables On-Demand mode. XOSC32K Oscillators will keep running across resets when set. Except for POR (Power-On Reset).
 
void OSC32KCTRL_XOSC32K_DisableOnDemand (void)
 Disables On-Demand mode for the XOSC32K oscillator.
 
void OSC32KCTRL_XOSC32K_SetStartUpTime (OSC32KCTRL_XOSC32K_CSUT startup_time)
 Set the desired startup time for the XOSC32K oscillator. CFD is only effective after the startup time has elapsed.
 
void OSC32KCTRL_CFD_Enable (void)
 Enables the Clock Failure Detection (CFD) feature for XOSC32K.
 
void OSC32KCTRL_CFD_Disable (void)
 Disables the Clock Failure Detection (CFD) feature.
 
bool OSC32KCTRL_CFD_GetClockFailureStatus (void)
 Check for clock failure status. There must be at least one rising and one falling XOSC32K clock edge during 4 safe clockperiods to meet non-failure conditions.
 
bool OSC32KCTRL_CFD_ClockIsSwitched (void)
 When a clock failure is detected, the XOSC32K clock is replaced by the safe clock in order to maintain an active clock during the XOSC32K clock failure.
 
void OSC32KCTRL_OSC32K_SetCalibValue (uint32_t calib_value)
 The frequency of the OSC32K oscillator is controlled by OSC32K.CALIB. Before using the OSC32K, this Calibration field must be loaded with production calibration values.
 
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 register is set.
 
void OSC32KCTRL_OSC32K_EnableOsc (void)
 Enables the OSC32K oscillator sub-peripheral.
 
void OSC32KCTRL_OSC32K_DisableOsc (void)
 Disables the OSC32K oscillator sub-peripheral.
 
void OSC32KCTRL_OSC32K_Enable1K (void)
 Enables the 1 kHz output of the OSC32K oscillator.
 
void OSC32KCTRL_OSC32K_Disable1K (void)
 Disables the 1 kHz output of the OSC32K oscillator.
 
void OSC32KCTRL_OSC32K_Enable32K (void)
 Enables the 32 kHz output of the OSC32K oscillator.
 
void OSC32KCTRL_OSC32K_Disable32K (void)
 Disables the 32 kHz output of the OSC32K oscillator.
 
void OSC32KCTRL_OSC32K_EnableOnDemand (void)
 Enables On-Demand mode. OSC32K Oscillator will keep running across resets when set. Except for POR (Power-On Reset).
 
void OSC32KCTRL_OSC32K_DisableOnDemand (void)
 Disables On-Demand mode for 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 to the digital logic. Set the desired startup time.
 
void OSC32KCTRL_CFD_EnableEventOutput (void)
 Enables the clock failure event output for CFD. The CFD clock failure will be output on the Event Output.
 
void OSC32KCTRL_CFD_DisableEventOutput (void)
 Disables the clock failure event output for CFD.
 
void OSC32KCTRL_EnableInterrupt (OSC32KCTRL_IRQ_SOURCE irq_source)
 Enables the specified OSC32KCTRL interrupt source.
 
void OSC32KCTRL_DisableInterrupt (OSC32KCTRL_IRQ_SOURCE irq_source)
 Disables the specified OSC32KCTRL interrupt source.
 
bool OSC32KCTRL_InterruptFlagIsSet (OSC32KCTRL_IRQ_SOURCE irq_source)
 Reads the INTFLAG register for the specified OSC32KCTRL interrupt source.
 
void OSC32KCTRL_ClearInterruptFlag (OSC32KCTRL_IRQ_SOURCE irq_source)
 Clears the interrupt flag for the specified OSC32KCTRL interrupt source.
 
void OSC32KCTRL_SetCallbackHandler (OSC32KCTRL_CALLBACK callback)
 Registers a callback function for OSC32KCTRL interrupt events.
 

Description

Driver API for OSC32KCTRL (plib_osc32kctrl.h)

Typedef Documentation

◆ OSC32KCTRL_CALLBACK

typedef void(* OSC32KCTRL_CALLBACK) (OSC32KCTRL_IRQ_SOURCE source)

Callback function type for OSC32KCTRL events.

Parameters
sourceInterrupt source

◆ OSC32KCTRL_OSC32K_CSUT

OSC32K startup time selection (CSUT field).

This type is intended to be configured using the device family pack (DFP) field macros for the OSC32K STARTUP setting.

Valid values
Use one of the OSC32KCTRL_OSC32K_STARTUP_CYCLE* macros, for example:
  • OSC32KCTRL_OSC32K_STARTUP_CYCLE3 (short startup)
  • OSC32KCTRL_OSC32K_STARTUP_CYCLE10 (medium startup)
  • OSC32KCTRL_OSC32K_STARTUP_CYCLE34 (longer startup)
  • OSC32KCTRL_OSC32K_STARTUP_CYCLE130 (very long startup)

◆ OSC32KCTRL_XOSC32K_CSUT

XOSC32K startup time selection (CSUT field).

This type is intended to be configured using the device family pack (DFP) field macros for the XOSC32K STARTUP setting.

Valid values
Use one of the OSC32KCTRL_XOSC32K_STARTUP_CYCLE* macros, for example:
  • OSC32KCTRL_XOSC32K_STARTUP_CYCLE1 (short startup)
  • OSC32KCTRL_XOSC32K_STARTUP_CYCLE32 (medium startup)
  • OSC32KCTRL_XOSC32K_STARTUP_CYCLE2048 (longer startup)
  • OSC32KCTRL_XOSC32K_STARTUP_CYCLE32768 (very long startup)

Enumeration Type Documentation

◆ OSC32KCTRL_IRQ_SOURCE

Interrupt Source Enumeration.

Enumerator
OSC32KCTRL_IRQ_XOSC32KRDY 
OSC32KCTRL_IRQ_OSC32KRDY 
OSC32KCTRL_IRQ_CLKFAIL 

Function Documentation

◆ OSC32KCTRL_CFD_ClockIsSwitched()

bool OSC32KCTRL_CFD_ClockIsSwitched ( void )

When a clock failure is detected, the XOSC32K clock is replaced by the safe clock in order to maintain an active clock during the XOSC32K clock failure.

Parameters
None.
Returns
true if clock switched, false otherwise.

◆ OSC32KCTRL_CFD_Disable()

void OSC32KCTRL_CFD_Disable ( void )

Disables the Clock Failure Detection (CFD) feature.

Parameters
None.
Returns
None.

◆ OSC32KCTRL_CFD_DisableEventOutput()

void OSC32KCTRL_CFD_DisableEventOutput ( void )

Disables the clock failure event output for CFD.

Parameters
None.
Returns
None.

◆ OSC32KCTRL_CFD_Enable()

void OSC32KCTRL_CFD_Enable ( void )

Enables the Clock Failure Detection (CFD) feature for XOSC32K.

Parameters
None.
Returns
None.

◆ OSC32KCTRL_CFD_EnableEventOutput()

void OSC32KCTRL_CFD_EnableEventOutput ( void )

Enables the clock failure event output for CFD. The CFD clock failure will be output on the Event Output.

Parameters
None.
Returns
None.

◆ OSC32KCTRL_CFD_GetClockFailureStatus()

bool OSC32KCTRL_CFD_GetClockFailureStatus ( void )

Check for clock failure status. There must be at least one rising and one falling XOSC32K clock edge during 4 safe clockperiods to meet non-failure conditions.

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

◆ OSC32KCTRL_ClearInterruptFlag()

void OSC32KCTRL_ClearInterruptFlag ( OSC32KCTRL_IRQ_SOURCE irq_source)

Clears the interrupt flag for the specified OSC32KCTRL interrupt source.

Parameters
irq_sourceThe interrupt source for which to clear the flag (OSC32KCTRL_IRQ_SOURCE).
Returns
None.

◆ OSC32KCTRL_DisableInterrupt()

void OSC32KCTRL_DisableInterrupt ( OSC32KCTRL_IRQ_SOURCE irq_source)

Disables the specified OSC32KCTRL interrupt source.

Parameters
irq_sourceThe interrupt source to disable (OSC32KCTRL_IRQ_SOURCE).
Returns
None.

◆ OSC32KCTRL_EnableInterrupt()

void OSC32KCTRL_EnableInterrupt ( OSC32KCTRL_IRQ_SOURCE irq_source)

Enables the specified OSC32KCTRL interrupt source.

Parameters
irq_sourceThe interrupt source to enable (OSC32KCTRL_IRQ_SOURCE).
Returns
None.

◆ OSC32KCTRL_Initialize()

void OSC32KCTRL_Initialize ( void )

Initializes the OSC32KCTRL peripheral.

Parameters
None.
Returns
None.

◆ OSC32KCTRL_InterruptFlagIsSet()

bool OSC32KCTRL_InterruptFlagIsSet ( OSC32KCTRL_IRQ_SOURCE irq_source)

Reads the INTFLAG register for the specified OSC32KCTRL interrupt source.

Parameters
irq_sourceThe interrupt source to check (OSC32KCTRL_IRQ_SOURCE).
Returns
true if the interrupt flag is set, false otherwise.

◆ OSC32KCTRL_OSC32K_Disable1K()

void OSC32KCTRL_OSC32K_Disable1K ( void )

Disables the 1 kHz output of the OSC32K oscillator.

Parameters
None.
Returns
None.

◆ OSC32KCTRL_OSC32K_Disable32K()

void OSC32KCTRL_OSC32K_Disable32K ( void )

Disables the 32 kHz output of the OSC32K oscillator.

Parameters
None.
Returns
None.

◆ OSC32KCTRL_OSC32K_DisableOnDemand()

void OSC32KCTRL_OSC32K_DisableOnDemand ( void )

Disables On-Demand mode for the OSC32K oscillator.

Parameters
None.
Returns
None.

◆ OSC32KCTRL_OSC32K_DisableOsc()

void OSC32KCTRL_OSC32K_DisableOsc ( void )

Disables the OSC32K oscillator sub-peripheral.

Parameters
None.
Returns
None.

◆ OSC32KCTRL_OSC32K_Enable1K()

void OSC32KCTRL_OSC32K_Enable1K ( void )

Enables the 1 kHz output of the OSC32K oscillator.

Parameters
None.
Returns
None.

◆ OSC32KCTRL_OSC32K_Enable32K()

void OSC32KCTRL_OSC32K_Enable32K ( void )

Enables the 32 kHz output of the OSC32K oscillator.

Parameters
None.
Returns
None.

◆ OSC32KCTRL_OSC32K_EnableOnDemand()

void OSC32KCTRL_OSC32K_EnableOnDemand ( void )

Enables On-Demand mode. OSC32K Oscillator will keep running across resets when set. Except for POR (Power-On Reset).

Parameters
None.
Returns
None.

◆ OSC32KCTRL_OSC32K_EnableOsc()

void OSC32KCTRL_OSC32K_EnableOsc ( void )

Enables the OSC32K oscillator sub-peripheral.

Parameters
None.
Returns
None.

◆ OSC32KCTRL_OSC32K_IsReady()

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 register is set.

Parameters
None.
Returns
true if the OSC32K oscillator is ready, false otherwise.

◆ OSC32KCTRL_OSC32K_SetCalibValue()

void OSC32KCTRL_OSC32K_SetCalibValue ( uint32_t calib_value)

The frequency of the OSC32K oscillator is controlled by OSC32K.CALIB. Before using the OSC32K, this Calibration field must be loaded with production calibration values.

Parameters
calib_valueCalibration value.
Returns
None.

◆ OSC32KCTRL_OSC32K_SetStartUpTime()

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 to the digital logic. Set the desired startup time.

Parameters
startup_timeThe desired startup time (OSC32KCTRL_CSUT).
Returns
None.

◆ OSC32KCTRL_SetCallbackHandler()

void OSC32KCTRL_SetCallbackHandler ( OSC32KCTRL_CALLBACK callback)

Registers a callback function for OSC32KCTRL interrupt events.

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

◆ OSC32KCTRL_XOSC32K_Disable()

void OSC32KCTRL_XOSC32K_Disable ( void )

Disables the XOSC32K oscillator sub-peripheral.

Parameters
None.
Returns
None.

◆ OSC32KCTRL_XOSC32K_DisableCrystalOsc()

void OSC32KCTRL_XOSC32K_DisableCrystalOsc ( void )

Disables crystal oscillator source of XOSC32K. External clock source is set. as default source.

Parameters
None.
Returns
None.

◆ OSC32KCTRL_XOSC32K_DisableOnDemand()

void OSC32KCTRL_XOSC32K_DisableOnDemand ( void )

Disables On-Demand mode for the XOSC32K oscillator.

Parameters
None.
Returns
None.

◆ OSC32KCTRL_XOSC32K_Enable()

void OSC32KCTRL_XOSC32K_Enable ( void )

Enables the XOSC32K oscillator sub-peripheral.

Parameters
None.
Returns
None.

◆ OSC32KCTRL_XOSC32K_EnableCrystalOsc()

void OSC32KCTRL_XOSC32K_EnableCrystalOsc ( void )

Enables crystal oscillator source of XOSC32K.

Parameters
None.
Returns
None.

◆ OSC32KCTRL_XOSC32K_EnableOnDemand()

void OSC32KCTRL_XOSC32K_EnableOnDemand ( void )

Enables On-Demand mode. XOSC32K Oscillators will keep running across resets when set. Except for POR (Power-On Reset).

Parameters
None.
Returns
None.

◆ OSC32KCTRL_XOSC32K_IsReady()

bool OSC32KCTRL_XOSC32K_IsReady ( void )

Checks if the XOSC32K oscillator is ready.

Parameters
None.
Returns
true Once the external clock or crystal oscillator is stable and ready to be used. false otherwise.

◆ OSC32KCTRL_XOSC32K_SetStartUpTime()

void OSC32KCTRL_XOSC32K_SetStartUpTime ( OSC32KCTRL_XOSC32K_CSUT startup_time)

Set the desired startup time for the XOSC32K oscillator. CFD is only effective after the startup time has elapsed.

Parameters
startup_timeThe desired startup time (OSC32KCTRL_CSUT).
Returns
None.