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

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

Macros

#define OSC32KCTRL_WP_KEY   (0x4F5343U)
 Write Protection Key (device-specific, example value)
 

Typedefs

typedef void(* OSC32KCTRL_CALLBACK) (OSC32KCTRL_IRQ_SOURCE source)
 Callback function type for OSC32KCTRL events.
 

Enumerations

enum  OSC32KCTRL_RTC_CLOCK { OSC32KCTRL_RTCSEL_OSC1K = 0x02U , OSC32KCTRL_RTCSEL_OSC32K = 0x03U , OSC32KCTRL_RTCSEL_XOSC1K = 0x04U , OSC32KCTRL_RTCSEL_XOSC32K = 0x05U }
 RTC Clock Source Selection. More...
 
enum  OSC32KCTRL_XTAL_SOURCE { XOSC32K_EXTCLK = 0x00U , XOSC32K_CRYSTAL = 0x04U }
 XOSC32K Clock Source Selection. More...
 
enum  OSC32K_CFD_PRESCALER { OSC32K_DIV_1 = 0x0U , OSC32K_DIV_2 = 0x1U }
 CFD XOSC32K Prescaler Selection. More...
 
enum  OSC32KCTRL_CSUT { XOSC23K_1K_CYCLES = 0x0U , XOSC23K_16K_CYCLES = 0x1U , XOSC23K_32K_CYCLES = 0x2U }
 XOSC32K Startup Time Selection. More...
 
enum  OSC32KCTRL_IRQ_SOURCE { OSC32KCTRL_IRQ_XOSC32KRDY = 0U , OSC32KCTRL_IRQ_OSC32KRDY = 1U , OSC32KCTRL_IRQ_CLKFAIL = 2U }
 Interrupt Source Enumeration. More...
 

Functions

void OSC32KCTRL_Initialize (void)
 Initializes the OSC32KCTRL peripheral.
 
bool OSC32KCTRL_OSC32K_IsReady (void)
 Checks if the OSC32K oscillator is ready.
 
void OSC32KCTRL_OSC32K_EnableOnDemand (void)
 Enables On-Demand mode for the OSC32K oscillator.
 
void OSC32KCTRL_OSC32K_DisableOnDemand (void)
 Disables On-Demand mode for the OSC32K oscillator.
 
bool OSC32KCTRL_OSC32K_OnDemandIsEnabled (void)
 Reads the On-Demand mode status of the OSC32K oscillator.
 
void OSC32KCTRL_RTC_SelectClockSource (OSC32KCTRL_RTC_CLOCK rtc_sel)
 Sets the RTC clock source.
 
uint32_t OSC32KCTRL_RTC_GetClockSource (void)
 Gets the current RTC clock source selection.
 
bool OSC32KCTRL_XOSC32K_IsReady (void)
 Checks if the XOSC32K oscillator is ready.
 
void OSC32KCTRL_XOSC32K_SelectClockSource (OSC32KCTRL_XTAL_SOURCE xtal_source)
 Selects the external source for the XOSC32K oscillator.
 
void OSC32KCTRL_XOSC32K_Enable (void)
 Enables the XOSC32K oscillator.
 
void OSC32KCTRL_XOSC32K_Disable (void)
 Disables the XOSC32K oscillator.
 
void OSC32KCTRL_XOSC32K_EnableOnDemand (void)
 Enables On-Demand mode for the XOSC32K oscillator.
 
void OSC32KCTRL_XOSC32K_DisableOnDemand (void)
 Disables On-Demand mode for the XOSC32K oscillator.
 
bool OSC32KCTRL_XOSC32K_OnDemandIsEnabled (void)
 Reads the On-Demand mode status of the XOSC32K oscillator.
 
void OSC32KCTRL_XOSC32K_SetStartUpTime (OSC32KCTRL_CSUT startup_time)
 Sets the startup time for the XOSC32K oscillator.
 
uint32_t OSC32KCTRL_XOSC32K_GetStartUpTime (void)
 Gets the current startup time setting for the XOSC32K oscillator.
 
void OSC32KCTRL_XOSC32K_EnableLowPowerMode (void)
 Enables Low Power mode for the XOSC32K oscillator.
 
void OSC32KCTRL_XOSC32K_DisableLowPowerMode (void)
 Disables Low Power mode for the XOSC32K oscillator.
 
bool OSC32KCTRL_XOSC32K_LowPowerIsEnabled (void)
 Reads the Low Power mode status of the XOSC32K oscillator.
 
void OSC32KCTRL_CFD_Enable (void)
 Enables the Clock Failure Detection (CFD) feature for XOSC32K. Make sure the XOSC32K oscillator is disabled before calling this function. Not following this guideline can lead to a false clock failure detection.
 
void OSC32KCTRL_CFD_Disable (void)
 Disables the Clock Failure Detection (CFD) feature.
 
bool OSC32KCTRL_CFD_GetClockFailureStatus (void)
 Reads the clock failure status.
 
void OSC32KCTRL_CFD_EnableEventOutput (void)
 Enables the clock failure event output for CFD.
 
void OSC32KCTRL_CFD_DisableEventOutput (void)
 Disabled the clock failure event output for CFD.
 
bool OSC32KCTRL_CFD_ClockIsSwitched (void)
 Gets the switch back status for CFD.
 
void OSC32KCTRL_CFD_SetSwitchBack (void)
 Sets the switch back for CFD if CFD is enabled.
 
bool OSC32KCTRL_CFD_GetSwitchBack (void)
 Returns the status of the switch back field in CFDCTRL.
 
void OSC32KCTRL_CFD_SetOsc32kPrescaler (OSC32K_CFD_PRESCALER prescaler)
 Sets the OSC32K prescaler for CFD.
 
uint32_t OSC32KCTRL_CFD_GetOsc32kPrescaler (void)
 Gets the current OSC32K prescaler setting 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_InterruptIsEnabled (OSC32KCTRL_IRQ_SOURCE irq_source)
 Reads the interrupt enable status for the specified OSC32KCTRL interrupt source.
 
void OSC32KCTRL_SetReadyFlag (OSC32KCTRL_IRQ_SOURCE irq_source)
 Sets the ready flag for the specified OSC32KCTRL interrupt source.
 
bool OSC32KCTRL_IntFlagSetIsEnabled (OSC32KCTRL_IRQ_SOURCE irq_source)
 Reads the INTFLAGSET register for 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_EnableWriteProtection (void)
 Enables write protection for the OSC32KCTRL peripheral.
 
void OSC32KCTRL_DisableWriteProtection (void)
 Disables write protection for the OSC32KCTRL peripheral.
 
bool OSC32KCTRL_WriteProtectionIsEnabled (void)
 Reads the current write protection status for the OSC32KCTRL peripheral.
 
void OSC32KCTRL_WPCTRL_EnableWriteLock (void)
 Enables the write lock for the OSC32KCTRL write protection register.
 
void OSC32KCTRL_SetCallbackHandler (OSC32KCTRL_CALLBACK callback)
 Registers a callback function for OSC32KCTRL interrupt events.
 

Description

Driver API for OSC32KCTRL (plib_osc32kctrl.h)

Macro Definition Documentation

◆ OSC32KCTRL_WP_KEY

#define OSC32KCTRL_WP_KEY   (0x4F5343U)

Write Protection Key (device-specific, example value)

Typedef Documentation

◆ OSC32KCTRL_CALLBACK

typedef void(* OSC32KCTRL_CALLBACK) (OSC32KCTRL_IRQ_SOURCE source)

Callback function type for OSC32KCTRL events.

Parameters
sourceInterrupt source

Enumeration Type Documentation

◆ OSC32K_CFD_PRESCALER

CFD XOSC32K Prescaler Selection.

Enumerator
OSC32K_DIV_1 
OSC32K_DIV_2 

◆ OSC32KCTRL_CSUT

XOSC32K Startup Time Selection.

Enumerator
XOSC23K_1K_CYCLES 
XOSC23K_16K_CYCLES 
XOSC23K_32K_CYCLES 

◆ OSC32KCTRL_IRQ_SOURCE

Interrupt Source Enumeration.

Enumerator
OSC32KCTRL_IRQ_XOSC32KRDY 
OSC32KCTRL_IRQ_OSC32KRDY 
OSC32KCTRL_IRQ_CLKFAIL 

◆ OSC32KCTRL_RTC_CLOCK

RTC Clock Source Selection.

Enumerator
OSC32KCTRL_RTCSEL_OSC1K 
OSC32KCTRL_RTCSEL_OSC32K 
OSC32KCTRL_RTCSEL_XOSC1K 
OSC32KCTRL_RTCSEL_XOSC32K 

◆ OSC32KCTRL_XTAL_SOURCE

XOSC32K Clock Source Selection.

Enumerator
XOSC32K_EXTCLK 
XOSC32K_CRYSTAL 

Function Documentation

◆ OSC32KCTRL_CFD_ClockIsSwitched()

bool OSC32KCTRL_CFD_ClockIsSwitched ( void )

Gets the switch back status for CFD.

Parameters
None.
Returns
true if switch back occurred, 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 )

Disabled 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. Make sure the XOSC32K oscillator is disabled before calling this function. Not following this guideline can lead to a false clock failure detection.

Parameters
None.
Returns
None.

◆ OSC32KCTRL_CFD_EnableEventOutput()

void OSC32KCTRL_CFD_EnableEventOutput ( void )

Enables the clock failure event output for CFD.

Parameters
None.
Returns
None.

◆ OSC32KCTRL_CFD_GetClockFailureStatus()

bool OSC32KCTRL_CFD_GetClockFailureStatus ( void )

Reads the clock failure status.

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

◆ OSC32KCTRL_CFD_GetOsc32kPrescaler()

uint32_t OSC32KCTRL_CFD_GetOsc32kPrescaler ( void )

Gets the current OSC32K prescaler setting for CFD.

Parameters
None.
Returns
The current OSC32K prescaler setting (OSC32K_CFD_PRESCALER).

◆ OSC32KCTRL_CFD_GetSwitchBack()

bool OSC32KCTRL_CFD_GetSwitchBack ( void )

Returns the status of the switch back field in CFDCTRL.

Parameters
None.
Returns
true if switch back is completed, false otherwise.

◆ OSC32KCTRL_CFD_SetOsc32kPrescaler()

void OSC32KCTRL_CFD_SetOsc32kPrescaler ( OSC32K_CFD_PRESCALER prescaler)

Sets the OSC32K prescaler for CFD.

Parameters
prescalerThe prescaler value to set (OSC32K_CFD_PRESCALER).
Returns
None.

◆ OSC32KCTRL_CFD_SetSwitchBack()

void OSC32KCTRL_CFD_SetSwitchBack ( void )

Sets the switch back for CFD if CFD is enabled.

Parameters
None.
Returns
None.

◆ 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_DisableWriteProtection()

void OSC32KCTRL_DisableWriteProtection ( void )

Disables write protection for the OSC32KCTRL peripheral.

Parameters
None.
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_EnableWriteProtection()

void OSC32KCTRL_EnableWriteProtection ( void )

Enables write protection for the OSC32KCTRL peripheral.

Parameters
None.
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_InterruptIsEnabled()

bool OSC32KCTRL_InterruptIsEnabled ( OSC32KCTRL_IRQ_SOURCE irq_source)

Reads the interrupt enable status for the specified OSC32KCTRL interrupt source.

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

◆ OSC32KCTRL_IntFlagSetIsEnabled()

bool OSC32KCTRL_IntFlagSetIsEnabled ( OSC32KCTRL_IRQ_SOURCE irq_source)

Reads the INTFLAGSET 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_DisableOnDemand()

void OSC32KCTRL_OSC32K_DisableOnDemand ( void )

Disables On-Demand mode for the OSC32K oscillator.

Parameters
None.
Returns
None.

◆ OSC32KCTRL_OSC32K_EnableOnDemand()

void OSC32KCTRL_OSC32K_EnableOnDemand ( void )

Enables On-Demand mode for the OSC32K oscillator.

Parameters
None.
Returns
None.

◆ OSC32KCTRL_OSC32K_IsReady()

bool OSC32KCTRL_OSC32K_IsReady ( void )

Checks if the OSC32K oscillator is ready.

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

◆ OSC32KCTRL_OSC32K_OnDemandIsEnabled()

bool OSC32KCTRL_OSC32K_OnDemandIsEnabled ( void )

Reads the On-Demand mode status of the OSC32K oscillator.

Parameters
None.
Returns
true if On-Demand mode is enabled, false otherwise.

◆ OSC32KCTRL_RTC_GetClockSource()

uint32_t OSC32KCTRL_RTC_GetClockSource ( void )

Gets the current RTC clock source selection.

Parameters
None.
Returns
The current RTC clock source selection as an OSC32KCTRL_RTC_CLOCK value.

◆ OSC32KCTRL_RTC_SelectClockSource()

void OSC32KCTRL_RTC_SelectClockSource ( OSC32KCTRL_RTC_CLOCK rtc_sel)

Sets the RTC clock source.

Parameters
rtc_selThe clock source selection for the RTC.
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_SetReadyFlag()

void OSC32KCTRL_SetReadyFlag ( OSC32KCTRL_IRQ_SOURCE irq_source)

Sets the ready flag for the specified OSC32KCTRL interrupt source.

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

◆ OSC32KCTRL_WPCTRL_EnableWriteLock()

void OSC32KCTRL_WPCTRL_EnableWriteLock ( void )

Enables the write lock for the OSC32KCTRL write protection register.

Parameters
None.
Returns
None.

◆ OSC32KCTRL_WriteProtectionIsEnabled()

bool OSC32KCTRL_WriteProtectionIsEnabled ( void )

Reads the current write protection status for the OSC32KCTRL peripheral.

Parameters
None.
Returns
true if write protection is enabled, false otherwise.

◆ OSC32KCTRL_XOSC32K_Disable()

void OSC32KCTRL_XOSC32K_Disable ( void )

Disables the XOSC32K oscillator.

Parameters
None.
Returns
None.

◆ OSC32KCTRL_XOSC32K_DisableLowPowerMode()

void OSC32KCTRL_XOSC32K_DisableLowPowerMode ( void )

Disables Low Power mode for the XOSC32K oscillator.

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.

Parameters
None.
Returns
None.

◆ OSC32KCTRL_XOSC32K_EnableLowPowerMode()

void OSC32KCTRL_XOSC32K_EnableLowPowerMode ( void )

Enables Low Power mode for the XOSC32K oscillator.

Parameters
None.
Returns
None.

◆ OSC32KCTRL_XOSC32K_EnableOnDemand()

void OSC32KCTRL_XOSC32K_EnableOnDemand ( void )

Enables On-Demand mode for the XOSC32K oscillator.

Parameters
None.
Returns
None.

◆ OSC32KCTRL_XOSC32K_GetStartUpTime()

uint32_t OSC32KCTRL_XOSC32K_GetStartUpTime ( void )

Gets the current startup time setting for the XOSC32K oscillator.

Parameters
None.
Returns
The current startup time setting as an OSC32KCTRL_CSUT value.

◆ OSC32KCTRL_XOSC32K_IsReady()

bool OSC32KCTRL_XOSC32K_IsReady ( void )

Checks if the XOSC32K oscillator is ready.

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

◆ OSC32KCTRL_XOSC32K_LowPowerIsEnabled()

bool OSC32KCTRL_XOSC32K_LowPowerIsEnabled ( void )

Reads the Low Power mode status of the XOSC32K oscillator.

Parameters
None.
Returns
true if Low Power mode is enabled, false otherwise.

◆ OSC32KCTRL_XOSC32K_OnDemandIsEnabled()

bool OSC32KCTRL_XOSC32K_OnDemandIsEnabled ( void )

Reads the On-Demand mode status of the XOSC32K oscillator.

Parameters
None.
Returns
true if On-Demand mode is enabled, false otherwise.

◆ OSC32KCTRL_XOSC32K_SelectClockSource()

void OSC32KCTRL_XOSC32K_SelectClockSource ( OSC32KCTRL_XTAL_SOURCE xtal_source)

Selects the external source for the XOSC32K oscillator.

Parameters
xtal_sourceThe external crystal or clock source selection for XOSC32K.
Returns
None.

◆ OSC32KCTRL_XOSC32K_SetStartUpTime()

void OSC32KCTRL_XOSC32K_SetStartUpTime ( OSC32KCTRL_CSUT startup_time)

Sets the startup time for the XOSC32K oscillator.

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