ADC temperature sensor example for SAM.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | BUFFER_SIZE (100) |
Size of the receive buffer and transmit buffer. More... | |
#define | STRING_EOL "\r" |
The maximal digital value. More... | |
#define | STRING_HEADER |
#define | VOLT_REF (3300) |
Reference voltage for ADC,in mv. More... | |
Functions | |
void | ADC_Handler (void) |
ADC interrupt handler. More... | |
static uint32_t | adc_read_buffer (Adc *pADC, int16_t *pwBuffer, uint32_t dwSize) |
Read converted data through PDC channel. More... | |
static void | configure_console (void) |
Configure UART console. More... | |
int | main (void) |
adc_temp_sensor Application entry point. More... | |
static void | print_temp (float temp) |
Simple function to replace printf with float formatting. More... | |
void | SysTick_Handler (void) |
Systick handler, start new conversion. More... | |
Variables | |
static int16_t | gs_s_adc_values [BUFFER_SIZE] = { 0 } |
adc buffer More... | |
#define BUFFER_SIZE (100) |
Size of the receive buffer and transmit buffer.
Referenced by ADC_Handler(), and main().
#define STRING_EOL "\r" |
The maximal digital value.
#define STRING_HEADER |
Referenced by main().
#define VOLT_REF (3300) |
Reference voltage for ADC,in mv.
Referenced by ADC_Handler().
void ADC_Handler | ( | void | ) |
ADC interrupt handler.
References adc_get_status(), adc_read_buffer(), BUFFER_SIZE, gs_s_adc_values, MAX_DIGITAL, print_temp(), and VOLT_REF.
|
static |
Read converted data through PDC channel.
pADC | The pointer of adc peripheral. |
pwBuffer | The destination buffer. |
dwSize | The size of the buffer. |
Referenced by ADC_Handler(), main(), and start_adc().
|
static |
Configure UART console.
References uart_rs232_options::baudrate, stdio_serial_init(), and sysclk_enable_peripheral_clock().
Referenced by main().
int main | ( | void | ) |
adc_temp_sensor Application entry point.
Initialize adc to 12-bit, enable channel 15,turn on temp sensor, pdc channel interrupt for temp sensor and start conversion.
References adc_enable_channel(), adc_enable_interrupt(), adc_read_buffer(), adc_start(), ADC_TRIG_SW, board_init(), BUFFER_SIZE, configure_console(), gs_s_adc_values, pmc_enable_periph_clk(), SAM4C, SAM4CM, STRING_HEADER, sysclk_get_cpu_hz(), and sysclk_init().
|
static |
Simple function to replace printf with float formatting.
One decimal with rounding support.
References Assert.
Referenced by ADC_Handler().
void SysTick_Handler | ( | void | ) |
Systick handler, start new conversion.
References adc_get_status(), and adc_start().
|
static |
adc buffer
Referenced by ADC_Handler(), and main().