17 lines
274 B
C
17 lines
274 B
C
|
#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;
|
||
|
}
|