Loading...
Searching...
No Matches

FREQM peripheral driver interface. More...

Detailed Description

FREQM peripheral driver interface.

This interface allows to configure and use the Frequency Meter (FREQM) peripheral.

The Frequency Meter uses the frequency of a known reference clock to determine the frequency of a signal connected via GPIO.

Files

file  freqm.h
 FREQM peripheral driver interface definitions.
 

Typedefs

typedef void(* freqm_cb_t) (uint32_t result, bool overflow, void *context)
 Frequency meter callback function.
 
typedef uint_fast8_t freqm_t
 Define default Frequency meter type identifier.
 

Functions

void freqm_init (freqm_t idx)
 Initialize the frequency meter.
 
void freqm_frequency_get_async (freqm_t idx, freqm_cb_t freqm_cb, void *context, uint32_t period_us)
 Read number of periods of measured clock and calculate its frequency.
 
int freqm_frequency_get (freqm_t idx, uint32_t *result, uint32_t period_us)
 Read number of periods of measured clock and calculate its frequency.
 

Typedef Documentation

◆ freqm_cb_t

typedef void(* freqm_cb_t) (uint32_t result, bool overflow, void *context)

Frequency meter callback function.

When a measurement is done the callbackfunction is called.

Parameters
resultmeasured frequency in hz
overflowoverflow in sticky counter
contextpointer to user defined context data

Definition at line 50 of file freqm.h.

◆ freqm_t

typedef uint_fast8_t freqm_t

Define default Frequency meter type identifier.

Definition at line 56 of file freqm.h.

Function Documentation

◆ freqm_frequency_get()

int freqm_frequency_get ( freqm_t  idx,
uint32_t *  result,
uint32_t  period_us 
)

Read number of periods of measured clock and calculate its frequency.

This function uses a blocking mutex to wait for the measurement to finish.

Parameters
[in]idxindex of the configuration
[out]resultcalculated frequency
[in]period_usmeasurement duration in microseconds
Returns
-EOVERFLOW if FREQM sticky counter has an overflow
0 on success

◆ freqm_frequency_get_async()

void freqm_frequency_get_async ( freqm_t  idx,
freqm_cb_t  freqm_cb,
void *  context,
uint32_t  period_us 
)

Read number of periods of measured clock and calculate its frequency.

This function returns after triggering the measurement and calls freqm_callback , with the calculated result and context , when the measurement is done.

Parameters
[in]idxindex of the configuration
[in]freqm_cbcallback function when measurement is ready
[in]contextcontext for the callback function
[in]period_usmeasurement duration in microseconds

◆ freqm_init()

void freqm_init ( freqm_t  idx)

Initialize the frequency meter.

Parameters
[in]idxindex of the configuration