version 1

This commit is contained in:
Your Name
2024-04-15 20:53:59 +03:00
parent fc727dfbfe
commit 23598a80db
8 changed files with 175 additions and 48 deletions

26
Core/Inc/DS_Button.h Normal file
View File

@@ -0,0 +1,26 @@
#ifndef DS_BUTTON_H
#define DS_BUTTON_H
#include "stm32f0xx_hal.h"
#include <stdbool.h>
typedef struct DS_Button
{
GPIO_TypeDef* Port;
uint16_t Pin;
bool Pressed, Released, PressedLong;
uint32_t PrevTick, PressStartTick;
uint8_t Storage;
}DS_Button;
void DS_ButtonInit(DS_Button* Button, GPIO_TypeDef* Port, uint16_t Pin);
void DS_ButtonUpdate(DS_Button* Button);
bool DS_ButtonPressed(DS_Button* Button);
bool DS_ButtonReleased(DS_Button* Button);
bool DS_Button_PressedLong(DS_Button* Button);
#endif //DS_BUTTON_H

View File

@@ -65,6 +65,8 @@ void Error_Handler(void);
#define Led3_GPIO_Port GPIOA
#define Led4_Pin GPIO_PIN_3
#define Led4_GPIO_Port GPIOA
#define Button_Pin GPIO_PIN_5
#define Button_GPIO_Port GPIOA
/* USER CODE BEGIN Private defines */