2020-01-26 21:07:54 +01:00
|
|
|
/*
|
|
|
|
* main.c
|
|
|
|
*
|
|
|
|
* Created on: Apr 25, 2015
|
|
|
|
* Author: mari
|
|
|
|
*/
|
|
|
|
#include <stm32f4xx.h>
|
2020-02-02 00:01:08 +01:00
|
|
|
#include <systick.h>
|
2020-01-26 21:07:54 +01:00
|
|
|
//#include <arm_math.h>
|
2020-02-02 20:24:44 +01:00
|
|
|
#include <stm32-gpio-macros.h>
|
2020-01-26 21:07:54 +01:00
|
|
|
#include <system_stm32f4xx.h>
|
|
|
|
#include <stdlib.h>
|
2020-02-02 00:01:08 +01:00
|
|
|
#include <string.h>
|
2020-02-02 01:49:37 +01:00
|
|
|
#include <adc-meas.h>
|
2020-02-03 19:40:59 +01:00
|
|
|
#include <clock-enable-manager.h>
|
2020-01-26 21:07:54 +01:00
|
|
|
|
2020-02-02 20:24:44 +01:00
|
|
|
static void setup_nvic_priorities()
|
2020-01-26 21:07:54 +01:00
|
|
|
{
|
2020-02-02 20:24:44 +01:00
|
|
|
/* No sub priorities */
|
|
|
|
NVIC_SetPriorityGrouping(2);
|
2020-01-26 21:07:54 +01:00
|
|
|
|
2020-02-02 20:24:44 +01:00
|
|
|
/* Setup Priorities */
|
2020-02-05 23:09:23 +01:00
|
|
|
NVIC_SetPriority(ADC_IRQn, 2);
|
|
|
|
NVIC_SetPriority(DMA2_Stream0_IRQn, 1);
|
2020-02-02 00:01:08 +01:00
|
|
|
}
|
|
|
|
|
2020-02-02 20:24:44 +01:00
|
|
|
static float pt1000_value;
|
|
|
|
static volatile int pt1000_value_status;
|
2020-02-02 00:01:08 +01:00
|
|
|
|
|
|
|
int main() {
|
2020-02-03 19:40:59 +01:00
|
|
|
rcc_manager_enable_clock(&RCC->AHB1ENR, BITMASK_TO_BITNO(RCC_AHB1ENR_GPIOBEN));
|
|
|
|
|
2020-01-26 21:07:54 +01:00
|
|
|
__DSB();
|
|
|
|
GPIOB->MODER = OUTPUT(2) | OUTPUT(3);
|
|
|
|
GPIOB->ODR |= (1<<2);
|
|
|
|
|
2020-02-02 20:24:44 +01:00
|
|
|
setup_nvic_priorities();
|
2020-02-02 00:01:08 +01:00
|
|
|
systick_setup();
|
|
|
|
|
2020-02-02 20:24:44 +01:00
|
|
|
//setup_dma(&adc_results, 3);
|
2020-02-02 01:49:37 +01:00
|
|
|
adc_pt1000_setup_meas();
|
2020-01-26 21:07:54 +01:00
|
|
|
|
|
|
|
while(1) {
|
2020-02-02 20:24:44 +01:00
|
|
|
pt1000_value_status = adc_pt1000_get_current_resistance(&pt1000_value);
|
2020-01-26 21:07:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-02-02 00:01:08 +01:00
|
|
|
|