Start implementation of PT1000 ADC measurement
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stm32f4xx.h>
|
||||
/**
|
||||
* @brief Moving average filter coefficient for PT1000 measurement
|
||||
*/
|
||||
@@ -13,6 +14,13 @@
|
||||
*/
|
||||
#define ADC_PT1000_CHANNEL 2
|
||||
|
||||
#define ADC_PT1000_PORT GPIOA
|
||||
#define ADC_PT1000_PORT_RCC_MASK RCC_AHB1ENR_GPIOAEN
|
||||
|
||||
#define ADC_PT1000_PIN 2
|
||||
|
||||
#define ADC_FILTER_STARTUP_CYCLES 200
|
||||
|
||||
/**
|
||||
* @brief Lower value for valid input range for PT1000 measurement
|
||||
*
|
||||
@@ -112,4 +120,6 @@ void adc_pt1000_convert_raw_value_array_to_resistance(float *resistance_dest, ui
|
||||
*/
|
||||
enum adc_p1000_error adc_pt1000_check_error();
|
||||
|
||||
void adc_pt1000_clear_error();
|
||||
|
||||
#endif // __ADCMEAS_H__
|
||||
|
11
stm-firmware/include/stm32-gpio-macros.h
Normal file
11
stm-firmware/include/stm32-gpio-macros.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef __STM32GPIOMACROS_H__
|
||||
#define __STM32GPIOMACROS_H__
|
||||
|
||||
#define OUTPUT(pin) (0x01U << (pin * 2))
|
||||
#define PULLUP(pin) (0x1U << (pin* 2))
|
||||
#define ALTFUNC(pin) ((0x2) << (pin * 2))
|
||||
#define PINMASK(pin) ((0x3) << (pin * 2))
|
||||
#define SETAF(PORT,PIN,AF) PORT->AFR[(PIN < 8 ? 0 : 1)] |= AF << ((PIN < 8 ? PIN : (PIN - 8)) * 4)
|
||||
#define ANALOG(pin) (0x03 << (pin * 2))
|
||||
|
||||
#endif /* __STM32GPIOMACROS_H__ */
|
Reference in New Issue
Block a user