AFEC enhanced resolution mode 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_12_BIT (4095UL) |
The maximal digital value. More... | |
#define | MENU_HEADER |
#define | STRING_EOL "\r" |
#define | STRING_HEADER |
#define | VOLT_REF (3300) |
Reference voltage for AFEC in mv. More... | |
Functions | |
static void | afec_data_ready (void) |
AFEC interrupt callback function. More... | |
static void | configure_console (void) |
Configure UART console. More... | |
static void | display_menu (void) |
Display main menu. More... | |
int | main (void) |
Application entry point. More... | |
static void | set_afec_resolution (void) |
Set AFEC resolution mode. More... | |
Variables | |
struct { | |
bool is_done | |
uint32_t value | |
} | g_afec_sample_data |
AFEC sample data. More... | |
static uint32_t | g_max_digital |
The maximal digital value. More... | |
#define MAX_DIGITAL_12_BIT (4095UL) |
The maximal digital value.
Referenced by main(), and set_afec_resolution().
#define MENU_HEADER |
Referenced by display_menu().
#define STRING_EOL "\r" |
#define STRING_HEADER |
Referenced by main().
#define VOLT_REF (3300) |
Reference voltage for AFEC in mv.
Referenced by main().
|
static |
AFEC interrupt callback function.
References afec_get_latest_value(), and g_afec_sample_data.
Referenced by main().
|
static |
Configure UART console.
References uart_rs232_options::baudrate, stdio_serial_init(), and sysclk_enable_peripheral_clock().
Referenced by main().
|
static |
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_data_ready(), afec_disable_interrupt(), afec_enable(), afec_enable_interrupt(), afec_get_config_defaults(), afec_get_interrupt_status(), afec_init(), afec_set_callback(), afec_set_trigger(), afec_start_software_conversion(), AFEC_TRIG_SW, board_init(), configure_console(), delay_ms, display_menu(), g_afec_sample_data, g_max_digital, MAX_DIGITAL_12_BIT, set_afec_resolution(), STRING_HEADER, sysclk_init(), uart_read(), and VOLT_REF.
|
static |
Set AFEC resolution mode.
References AFEC_12_BITS, AFEC_16_BITS, afec_set_resolution(), display_menu(), g_max_digital, MAX_DIGITAL_12_BIT, and uart_read().
Referenced by main().
struct { ... } g_afec_sample_data |
AFEC sample data.
Referenced by afec_data_ready(), and main().
|
static |
The maximal digital value.
Referenced by main(), and set_afec_resolution().
bool is_done |
uint32_t value |
Referenced by get_input_value(), hsmci_write_word(), http_decodeUrl(), ili9325_read_gram(), ili9325_read_ram(), ili93xx_read_gram(), ili93xx_read_ram(), ili93xx_read_register(), ili93xx_read_register_byte(), ISR(), phyReadRegister(), run_test_control_setting(), SDMMC_UNSTUFF_BITS(), spi_write(), tal_pib_get(), udi_cdc_ctrl_state_notify(), udi_cdc_multi_putc(), and usart_handler().