From a2a92560615241b30ac135b3be76e01d7522de5a Mon Sep 17 00:00:00 2001 From: 7u83 <7u83@mail.ru> Date: Thu, 23 May 2024 22:49:07 +0200 Subject: [PATCH] Iinital commit --- getbutton.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 getbutton.c diff --git a/getbutton.c b/getbutton.c new file mode 100644 index 0000000..5ffcce5 --- /dev/null +++ b/getbutton.c @@ -0,0 +1,16 @@ +#include "mc8051fun.h" + +uint8_t getbutton_time = 100; +int getbutton(uint8_t pinval, uint8_t *button) +{ + if ( *button & 1 != pinval){ + *button += 2; + if (*button > getbutton_time){ + *button = pinval; + return pinval; + } + return -1; + } + *button = pinval; + return -1; +}