Microchip® Advanced Software Framework

freqm.h File Reference

Frequency Meter driver for SAM4L.

Copyright (c) 2013-2018 Microchip Technology Inc. and its subsidiaries.

#include "compiler.h"
#include "status_codes.h"

Data Structures

struct  freqm_config
 Frequency Meter configuration structure. More...
 
struct  freqm_dev_inst
 Frequency Meter driver software instance structure. More...
 

Macros

#define FREQM_DURATION_DEFAULT   128
 The default duration value of a measurement, given in number of reference clock cycles. More...
 
#define FREQM_NUM_OF_ATTEMPTS   1000000
 Time out value (number of attempts) More...
 

Typedefs

typedef void(* freqm_callback_t )(void)
 
typedef enum freqm_interrupt_source freqm_interrupt_source_t
 FREQM interrupt source type. More...
 

Enumerations

enum  freqm_interrupt_source {
  FREQM_INTERRUPT_MEASURMENT_READY = FREQM_IER_DONE,
  FREQM_INTERRUPT_REFERENCE_CLOCK_READY = FREQM_IER_RCLKRDY,
  FREQM_INTERRUPT_SOURCE_N
}
 FREQM interrupt source type. More...
 

Functions

static void freqm_clear_interrupt_status (struct freqm_dev_inst *const dev_inst, freqm_interrupt_source_t source)
 Clear FREQM interrupt status. More...
 
enum status_code freqm_disable (struct freqm_dev_inst *const dev_inst)
 Disable FREQM. More...
 
static void freqm_disable_interrupt (struct freqm_dev_inst *const dev_inst, freqm_interrupt_source_t source)
 Disable FREQM interrupt. More...
 
static void freqm_disable_refclk (struct freqm_dev_inst *const dev_inst)
 Disable refclk. More...
 
void freqm_enable (struct freqm_dev_inst *const dev_inst)
 Enable FEQM. More...
 
static void freqm_enable_interrupt (struct freqm_dev_inst *const dev_inst, freqm_interrupt_source_t source)
 Enable FREQM interrupt. More...
 
static void freqm_enable_refclk (struct freqm_dev_inst *const dev_inst)
 Enable refclk. More...
 
void freqm_get_config_defaults (struct freqm_config *const cfg)
 Initializes Frequency Meter configuration structure to defaults. More...
 
static uint32_t freqm_get_interrupt_mask (struct freqm_dev_inst *const dev_inst)
 Get FREQM interrupt mask. More...
 
static uint32_t freqm_get_interrupt_status (struct freqm_dev_inst *const dev_inst)
 Get FREQM interrupt status. More...
 
enum status_code freqm_get_result_blocking (struct freqm_dev_inst *const dev_inst, uint32_t *p_result)
 Get measurement result. More...
 
static uint32_t freqm_get_result_value (struct freqm_dev_inst *const dev_inst)
 Get FREQM result value. More...
 
static uint32_t freqm_get_status (struct freqm_dev_inst *const dev_inst)
 Get FREQM status. More...
 
enum status_code freqm_init (struct freqm_dev_inst *const dev_inst, Freqm *const freqm, struct freqm_config *const cfg)
 Configure FREQM with specified value. More...
 
void freqm_set_callback (struct freqm_dev_inst *const dev_inst, freqm_interrupt_source_t source, freqm_callback_t callback, uint8_t irq_level)
 Set callback for FREQM interrupt handler. More...
 
static void freqm_start_measure (struct freqm_dev_inst *const dev_inst)
 Start a measurement. More...