63 lines
1.4 KiB
C
63 lines
1.4 KiB
C
#include <stdlib.h>
|
|
#include <string.h>
|
|
/* #include <arm_math.h> */
|
|
#include <stm32/stm32f4xx.h>
|
|
#include <cmsis/core_cm4.h>
|
|
#include <setup/system_stm32f4xx.h>
|
|
#include <reflow-controller/systick.h>
|
|
#include <reflow-controller/adc-meas.h>
|
|
#include <reflow-controller/shell.h>
|
|
#include <reflow-controller/digio.h>
|
|
#include <stm-periph/stm32-gpio-macros.h>
|
|
#include <stm-periph/clock-enable-manager.h>
|
|
#include <stm-periph/uart.h>
|
|
|
|
static void setup_nvic_priorities()
|
|
{
|
|
/* No sub priorities */
|
|
NVIC_SetPriorityGrouping(2);
|
|
|
|
/* Setup Priorities */
|
|
NVIC_SetPriority(ADC_IRQn, 2);
|
|
NVIC_SetPriority(DMA2_Stream0_IRQn, 1);
|
|
NVIC_SetPriority(DMA2_Stream7_IRQn, 3);
|
|
}
|
|
|
|
static float pt1000_value;
|
|
static volatile int pt1000_value_status;
|
|
|
|
int main()
|
|
{
|
|
const char *uart_input;
|
|
size_t uart_input_len;
|
|
shellmatta_handle_t shell_handle;
|
|
int uart_receive_status;
|
|
|
|
setup_nvic_priorities();
|
|
systick_setup();
|
|
|
|
adc_pt1000_setup_meas();
|
|
|
|
digio_setup_default_all();
|
|
led_setup();
|
|
loudspeaker_setup();
|
|
|
|
uart_init_with_dma();
|
|
|
|
shell_handle = shell_init();
|
|
|
|
/* Try random calibration */
|
|
adc_pt1000_set_resistance_calibration(-0.8f, 0.0f, true);
|
|
|
|
while(1) {
|
|
pt1000_value_status = adc_pt1000_get_current_resistance(&pt1000_value);
|
|
|
|
uart_receive_status = uart_receive_data_with_dma(&uart_input, &uart_input_len);
|
|
if (uart_receive_status >= 1)
|
|
shell_handle_input(shell_handle, uart_input, uart_input_len);
|
|
}
|
|
|
|
}
|
|
|
|
|