Files
MAX7219/Core/Inc/DS_Button.h
2024-04-29 19:57:00 +03:00

34 lines
761 B
C

#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, PressedLongLong;
uint32_t PrevTick, PressStartTick, PressStartTickLong;
uint8_t Storage;
bool FallingEdge, RisingEdge;
}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);
bool DS_Button_PressedLongLong(DS_Button* Button);
bool DS_ButtonRisingEdge(DS_Button* Button);
bool DS_ButtonFallingEdge(DS_Button* Button);
#endif //DS_BUTTON_H