增加按钮驱动

This commit is contained in:
2026-07-30 21:01:38 +08:00
parent 06fc5714c4
commit d9cc6e1f3a
3 changed files with 137 additions and 2 deletions
+30
View File
@@ -0,0 +1,30 @@
#ifndef BUTTON_H_
#define BUTTON_H_
#include <stdint.h>
#include "state.h"
#define BUTTON_PASS_TIMES 50
#define BUTTON_LONGPASS_TIMES 1000
struct button {
uint8_t lock;
uint8_t pass;
uint8_t longpass;
uint8_t passread;
uint8_t pass_;
uint8_t longpassread;
uint32_t time;
};
void button_init(void);
void button_set_pass(struct button *b);
void button_set_longpass(struct button *b);
char button_pass(struct button *b);
char button_pass_(struct button *b);
char button_longpass(struct button *b);
void button_reset(struct button *b);
void button_updata(struct button *b, char a);
#endif