Iinital commit
This commit is contained in:
parent
18c6fc5220
commit
a2a9256061
16
getbutton.c
Normal file
16
getbutton.c
Normal file
@ -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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user