Driver API for FREQM (plib_freqm.h)
More...
Driver API for FREQM (plib_freqm.h)
Usage Example
The following example demonstrates typical usage of the FREQM peripheral:
#include <pic32c.h>
#include <stdint.h>
void freqmCallback(uint8_t flags)
{
static uint32_t cfg_ref_clk = 32768UL;
static uint32_t freq;
(void)flags;
{
}
else
{
(void)freq;
}
}
int32_t configure_freqm(void)
{
uint8_t refnum = 128;
NVIC_EnableIRQ(FREQM_IRQn);
return 0;
}
void FREQM_SetRefNum(uint8_t refnum)
Set REFNUM.
void FREQM_SetCallbackHandler(FREQM_CALLBACK_HANDLER callback)
Register a callback function for FREQM interrupt.
void FREQM_SoftwareReset(void)
Reset the FREQM peripheral.
void FREQM_EnableInterrupt(void)
Enable the Measurement Done Interrupt.
bool FREQM_StartMeasurement(void)
Start the frequency measurement.
uint32_t FREQM_GetFrequency(uint32_t ref_clk)
Get the frequency value.
void FREQM_Enable(void)
Enables the FREQM peripheral.
bool FREQM_GetStatus(FREQM_STATUS status)
Check the FREQM status.
@ FREQM_STATUS_OVERFLOW
Definition plib_freqm.h:66
FREQM Peripheral Library Common Definitions.
◆ FREQM_CALLBACK_HANDLER
| typedef void(* FREQM_CALLBACK_HANDLER) (uint8_t flags) |
FREQM interrupt callback function type.
◆ FREQM_STATUS
FREQM Status bits.
| Enumerator |
|---|
| FREQM_STATUS_BUSY | |
| FREQM_STATUS_OVERFLOW | |
◆ FREQM_ClearInterruptFlag()
| void FREQM_ClearInterruptFlag |
( |
void | | ) |
|
Clear the Measurement Done Interrupt Flag.
◆ FREQM_ClearOverflowStatus()
| void FREQM_ClearOverflowStatus |
( |
void | | ) |
|
Clear the overflow status bit.
◆ FREQM_Disable()
| void FREQM_Disable |
( |
void | | ) |
|
Disables the FREQM peripheral.
◆ FREQM_DisableInterrupt()
| void FREQM_DisableInterrupt |
( |
void | | ) |
|
Disable the Measurement Done Interrupt.
◆ FREQM_Enable()
| void FREQM_Enable |
( |
void | | ) |
|
Enables the FREQM peripheral.
◆ FREQM_EnableInterrupt()
| void FREQM_EnableInterrupt |
( |
void | | ) |
|
Enable the Measurement Done Interrupt.
◆ FREQM_GetFrequency()
| uint32_t FREQM_GetFrequency |
( |
uint32_t | ref_clk | ) |
|
Get the frequency value.
- Parameters
-
| ref_clk | Reference clock frequency |
◆ FREQM_GetStatus()
Check the FREQM status.
- Parameters
-
| status | Status to be checked |
- Returns
- true if the status bit is set, false otherwise.
◆ FREQM_SetCallbackHandler()
Register a callback function for FREQM interrupt.
- Parameters
-
| callback | Pointer to the callback function. |
◆ FREQM_SetRefNum()
| void FREQM_SetRefNum |
( |
uint8_t | refnum | ) |
|
Set REFNUM.
- Parameters
-
| refnum | Set the number of reference clock cycles |
◆ FREQM_SoftwareReset()
| void FREQM_SoftwareReset |
( |
void | | ) |
|
Reset the FREQM peripheral.
◆ FREQM_StartMeasurement()
| bool FREQM_StartMeasurement |
( |
void | | ) |
|
Start the frequency measurement.