123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #ifndef __BUTTON_H
- #define __BUTTON_H
- #include "stm32f0xx_hal.h"
- #include <stdbool.h>
- #define UPDATE_BUT_DELLAY (20)
- typedef enum
- {
- BUT_ON = 0,
- BUT_OFF,
- BUT_NO_DEFINE,
-
- } BUTTON_STATE_t;
- typedef struct
- {
- GPIO_TypeDef* GPIOx;
- uint16_t GPIO_Pin;
- uint16_t timeDelay;
-
-
- uint16_t counterDelay;
- BUTTON_STATE_t stateOld;
- BUTTON_STATE_t stateNew;
- void (*pressHandler)();
- void (*unpressHandler)();
- uint8_t ID;
- uint32_t counterActivation;
- uint16_t timeActivation;
- bool fActivation;
-
- } but_no_fix_t;
- void but_init(void);
- void button_run(void);
- void bu_no_fix_handler(but_no_fix_t* button);
- BUTTON_STATE_t but_get_state(but_no_fix_t *button);
- bool but_is_string(void);
- extern bool start_pressed;
- #endif
|