Mario Hüttel
69c00ff3d3
* Add digio module for controlling LEDs, Loudspeaker, and the Digital IOs * General code improvements
66 lines
1.2 KiB
C
66 lines
1.2 KiB
C
/*
|
|
* main.c
|
|
*
|
|
* Created on: Apr 25, 2015
|
|
* Author: mari
|
|
*/
|
|
#include <stm32f4xx.h>
|
|
#include <systick.h>
|
|
//#include <arm_math.h>
|
|
#include <stm32-gpio-macros.h>
|
|
#include <system_stm32f4xx.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <adc-meas.h>
|
|
#include <clock-enable-manager.h>
|
|
#include <uart/uart.h>
|
|
#include <shell.h>
|
|
#include <digio.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);
|
|
}
|
|
|
|
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;
|
|
|
|
setup_nvic_priorities();
|
|
systick_setup();
|
|
|
|
//setup_dma(&adc_results, 3);
|
|
adc_pt1000_setup_meas();
|
|
|
|
digio_setup_default_all();
|
|
led_setup();
|
|
loudspeaker_setup();
|
|
|
|
uart_init_with_dma();
|
|
|
|
shell_handle = shell_init();
|
|
|
|
while(1) {
|
|
pt1000_value_status = adc_pt1000_get_current_resistance(&pt1000_value);
|
|
|
|
if (uart_receive_data_with_dma(&uart_input, &uart_input_len) >= 0) {
|
|
shell_handle_input(shell_handle, uart_input, uart_input_len);
|
|
}
|
|
//systick_wait_ms(300);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|