Compare commits
2 Commits
04389b1df6
...
2187c1a712
Author | SHA1 | Date | |
---|---|---|---|
2187c1a712 | |||
60602008d4 |
@ -34,15 +34,35 @@
|
|||||||
*/
|
*/
|
||||||
#define ADC_PT1000_CHANNEL 2U
|
#define ADC_PT1000_CHANNEL 2U
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief GPIO Port the ADC converter for the PT1000 measurement is connected to
|
||||||
|
*/
|
||||||
#define ADC_PT1000_PORT GPIOA
|
#define ADC_PT1000_PORT GPIOA
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The clock enable mask of the RCC register for ADC_PT1000_PORT
|
||||||
|
*/
|
||||||
#define ADC_PT1000_PORT_RCC_MASK RCC_AHB1ENR_GPIOAEN
|
#define ADC_PT1000_PORT_RCC_MASK RCC_AHB1ENR_GPIOAEN
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The GPIO pin number the PT1000 analog voltage is connected to
|
||||||
|
*/
|
||||||
#define ADC_PT1000_PIN 2U
|
#define ADC_PT1000_PIN 2U
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The cycle count the moving average filter is labeled 'instable' after startup of the measurement or changing
|
||||||
|
* the alpha value @ref ADC_PT1000_FILTER_WEIGHT
|
||||||
|
*/
|
||||||
#define ADC_FILTER_STARTUP_CYCLES 800U
|
#define ADC_FILTER_STARTUP_CYCLES 800U
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The delay value programmed into the sample timer
|
||||||
|
*/
|
||||||
#define ADC_PT1000_SAMPLE_CNT_DELAY 1000U
|
#define ADC_PT1000_SAMPLE_CNT_DELAY 1000U
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The amount of samples to take to prefilter the analog signal
|
||||||
|
*/
|
||||||
#define ADC_PT1000_DMA_AVG_SAMPLES 6U
|
#define ADC_PT1000_DMA_AVG_SAMPLES 6U
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -144,8 +164,14 @@ void adc_pt1000_convert_raw_value_array_to_resistance(float *resistance_dest, fl
|
|||||||
*/
|
*/
|
||||||
enum adc_pt1000_error adc_pt1000_check_error();
|
enum adc_pt1000_error adc_pt1000_check_error();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Clear the error status of the PT1000 measurement
|
||||||
|
*/
|
||||||
void adc_pt1000_clear_error();
|
void adc_pt1000_clear_error();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Disable the PT1000 measurement
|
||||||
|
*/
|
||||||
void adc_pt1000_disable();
|
void adc_pt1000_disable();
|
||||||
|
|
||||||
#endif // __ADCMEAS_H__
|
#endif // __ADCMEAS_H__
|
||||||
|
@ -21,19 +21,55 @@
|
|||||||
#ifndef __BUTTON_H__
|
#ifndef __BUTTON_H__
|
||||||
#define __BUTTON_H__
|
#define __BUTTON_H__
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief GPIO Port the button is connected to
|
||||||
|
*/
|
||||||
#define BUTTON_PORT GPIOD
|
#define BUTTON_PORT GPIOD
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The RCC clock mask for @ref BUTTON_PORT
|
||||||
|
*/
|
||||||
#define BUTTON_RCC_MASK RCC_AHB1ENR_GPIODEN
|
#define BUTTON_RCC_MASK RCC_AHB1ENR_GPIODEN
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The GPIO pin number the button is connected to
|
||||||
|
*/
|
||||||
#define BUTTON_PIN 4
|
#define BUTTON_PIN 4
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The time in ms the button has to stay pressed to be detected as a short press
|
||||||
|
*/
|
||||||
#define BUTTON_SHORT_ON_TIME_MS 50UL
|
#define BUTTON_SHORT_ON_TIME_MS 50UL
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Time in ms the button has to be pressed to be counted as a long press
|
||||||
|
*/
|
||||||
#define BUTTON_LONG_ON_TIME_MS 400UL
|
#define BUTTON_LONG_ON_TIME_MS 400UL
|
||||||
|
|
||||||
|
|
||||||
|
#if BUTTON_LONG_ON_TIME_MS <= BUTTON_SHORT_ON_TIME_MS
|
||||||
|
#error "Button BUTTON_SHORT_ON_TIME_MS time has to be shorter than BUTTON_LONG_ON_TIME_MS"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief States the puhsbutton of the rotary encoder can be in
|
||||||
|
*/
|
||||||
enum button_state {BUTTON_IDLE = 0, BUTTON_SHORT_RELEASED, BUTTON_LONG_RELEASED, BUTTON_SHORT, BUTTON_LONG};
|
enum button_state {BUTTON_IDLE = 0, BUTTON_SHORT_RELEASED, BUTTON_LONG_RELEASED, BUTTON_SHORT, BUTTON_LONG};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Init the push button
|
||||||
|
*/
|
||||||
void button_init();
|
void button_init();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief read if a push button event occured
|
||||||
|
* @return Button event
|
||||||
|
*/
|
||||||
enum button_state button_read_event();
|
enum button_state button_read_event();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief button_deinit
|
||||||
|
*/
|
||||||
void button_deinit();
|
void button_deinit();
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,6 +31,8 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#define LCD_CHAR_WIDTH 16
|
||||||
|
|
||||||
static void lcd_port_clear(void)
|
static void lcd_port_clear(void)
|
||||||
{
|
{
|
||||||
LCD_DPORT->ODR &= ~(LCD_E_MASK);
|
LCD_DPORT->ODR &= ~(LCD_E_MASK);
|
||||||
@ -421,7 +423,7 @@ enum lcd_fsm_ret lcd_fsm_write_buffer(const char (*display_buffer)[21])
|
|||||||
lcd_fsm_enable(false);
|
lcd_fsm_enable(false);
|
||||||
ret = LCD_FSM_WAIT_CALL;
|
ret = LCD_FSM_WAIT_CALL;
|
||||||
char_cnt++;
|
char_cnt++;
|
||||||
if (char_cnt < 16) {
|
if (char_cnt < LCD_CHAR_WIDTH) {
|
||||||
state_cnt = 5;
|
state_cnt = 5;
|
||||||
} else {
|
} else {
|
||||||
state_cnt = 0;
|
state_cnt = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user