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 |
Referenced by main().
#define VOLT_REF (3300) |
Reference voltage for AFEC in mv.
Referenced by afec_print_comp_result().
|
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 |
Configure UART console.
References uart_rs232_options::baudrate, stdio_serial_init(), and sysclk_enable_peripheral_clock().
Referenced by main().
int main | ( | void | ) |
Application entry point.
References afec_ch_get_config_defaults(), afec_ch_set_config(), afec_channel_enable(), afec_channel_set_analog_offset(), AFEC_CMP_MODE_2, afec_enable(), AFEC_GAINVALUE_0, afec_get_config_defaults(), afec_init(), afec_print_comp_result(), afec_set_callback(), afec_set_comparison_mode(), afec_set_comparison_window(), afec_set_trigger(), afec_start_software_conversion(), AFEC_TRIG_SW, board_init(), configure_console(), delay_ms, afec_ch_config::gain, gs_us_high_threshold, gs_us_low_threshold, STRING_HEADER, and sysclk_init().
|
static |
High threshold.
Referenced by afec_print_comp_result(), and main().
|
static |
Low threshold.
Referenced by afec_print_comp_result(), and main().