#define GPIO_IN_1 PIN7_bp // PortJ
u16 state = 0;
bool debounce() {
state = (state<<1) | (PORTJ.IN & (1<<GPIO_IN_1)) | 0xfe00;
return (state == 0xff00);
}
int main(void)
{
while(1)
{
if (debounce())
{
//PORTJ.OUT = 0b00100000;
if(ADC_Arc_Hit == 0)
{
ADC_Arc_Hit = 1;
}
else
{
ADC_Arc_Hit = 0;
}
}
}
댓글 없음:
댓글 쓰기