Version 1.0
This commit is contained in:
35
Inc/DS_Button.h
Normal file
35
Inc/DS_Button.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef DS_BUTTON_H
|
||||
#define DS_BUTTON_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "stm32f0xx_hal.h"
|
||||
|
||||
typedef struct DS_Button
|
||||
{
|
||||
GPIO_TypeDef* Port;
|
||||
uint16_t Pin;
|
||||
bool Presed, Released, PresedLong, PresedLongLong;
|
||||
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_ButtonPressedLong(DS_Button* Button);
|
||||
|
||||
bool DS_ButtonPressedLongLong(DS_Button* Button);
|
||||
|
||||
bool DS_ButtonRisingEdge(DS_Button* Button);
|
||||
|
||||
bool DS_ButtonFalingEdge(DS_Button* Button);
|
||||
|
||||
#endif //DS_BUTTON_H
|
||||
Reference in New Issue
Block a user