Move push button and rotary encoder files to UI folder

This commit is contained in:
2021-05-22 17:05:56 +02:00
parent 8c0cfa4993
commit 90c6165278
7 changed files with 6 additions and 6 deletions

View File

@@ -0,0 +1,81 @@
/* Reflow Oven Controller
*
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
*
* This file is part of the Reflow Oven Controller Project.
*
* The reflow oven controller is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the reflow oven controller project.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __BUTTON_H__
#define __BUTTON_H__
/**
* @brief GPIO Port the button is connected to
*/
#define BUTTON_PORT GPIOD
/**
* @brief The RCC clock mask for @ref BUTTON_PORT
*/
#define BUTTON_RCC_MASK RCC_AHB1ENR_GPIODEN
/**
* @brief The GPIO pin number the button is connected to
*/
#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
/**
* @brief Time in ms the button has to be pressed to be counted as a long press
*/
#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};
/**
* @brief Init the push button
*/
void button_init();
/**
* @brief read if a push button event occured
* @return Button event
*/
enum button_state button_read_event();
/**
* @brief button_deinit
*/
void button_deinit();
/**
* @brief This function overrides the button event.
* @param state State to set
*/
void button_override_event(enum button_state state);
#endif /* __BUTTON_H__ */

View File

@@ -22,7 +22,7 @@
#define __MENU_H__
#include <stdint.h>
#include <reflow-controller/button.h>
#include <reflow-controller/ui/button.h>
#include <stdbool.h>
struct lcd_menu;

View File

@@ -0,0 +1,46 @@
/* Reflow Oven Controller
*
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
*
* This file is part of the Reflow Oven Controller Project.
*
* The reflow oven controller is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* GDSII-Converter is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the reflow oven controller project.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __ROTARY_ENCODER_H__
#define __ROTARY_ENCODER_H__
#include <stm32/stm32f4xx.h>
#define ROTARY_ENCODER_TIMER TIM5
#define ROTARY_ENCODER_TIMER_RCC_MASK RCC_APB1ENR_TIM5EN
#define ROTARY_ENCODER_PIN1 0
#define ROTARY_ENCODER_PIN2 1
#define ROTARY_ENCODER_PORT GPIOA
#define ROTARY_ENCODER_PORT_ALTFUNC 2
#define ROTARY_ENCODER_RCC_MASK RCC_AHB1ENR_GPIOAEN
void rotary_encoder_setup(void);
uint32_t rotary_encoder_get_abs_val(void);
int32_t rotary_encoder_get_change_val(void);
void rotary_encoder_stop(void);
void rotary_encoder_zero(void);
void rotary_encoder_override_delta(int16_t delta);
#endif /* __ROTARY_ENCODER_H__ */