Microchip® Advanced Software Framework

afec_example3.c File Reference

AFEC automatic comparison example for SAM.

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

#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "asf.h"

Macros

#define MAX_DIGITAL   (4095UL)
 The maximal digital value. More...
 
#define STRING_EOL   "\r"
 
#define STRING_HEADER
 
#define VOLT_REF   (3300)
 Reference voltage for AFEC in mv. More...
 

Functions

static void afec_print_comp_result (void)
 Callback function for AFEC enter compasion window interrupt. More...
 
static void configure_console (void)
 Configure UART console. More...
 
int main (void)
 Application entry point. More...
 

Variables

static uint16_t gs_us_high_threshold = 0
 High threshold. More...
 
static uint16_t gs_us_low_threshold = 0
 Low threshold. More...
 

#define MAX_DIGITAL   (4095UL)

The maximal digital value.

Referenced by afec_print_comp_result().

#define STRING_EOL   "\r"
#define STRING_HEADER
Value:
"-- AFEC Automatic Comparison Example --\r\n" \
"-- "BOARD_NAME" --\r\n" \
"-- Compiled: "__DATE__" "__TIME__" --"STRING_EOL
#define BOARD_NAME
Definition: fatfs_access_example.c:112
#define STRING_EOL
Definition: afec_example3.c:89

Referenced by main().

#define VOLT_REF   (3300)

Reference voltage for AFEC in mv.

Referenced by afec_print_comp_result().

static void afec_print_comp_result ( void  )
static

Callback function for AFEC enter compasion window interrupt.

References afec_channel_get_value(), afec_disable_interrupt(), gs_us_high_threshold, gs_us_low_threshold, MAX_DIGITAL, and VOLT_REF.

Referenced by main().

static void configure_console ( void  )
static

Configure UART console.

References uart_rs232_options::baudrate, stdio_serial_init(), and sysclk_enable_peripheral_clock().

Referenced by main().

uint16_t gs_us_high_threshold = 0
static

High threshold.

Referenced by afec_print_comp_result(), and main().

uint16_t gs_us_low_threshold = 0
static

Low threshold.

Referenced by afec_print_comp_result(), and main().