parent
c1ce485e63
commit
002fe29e1b
@ -0,0 +1,12 @@
|
||||
Dinge die zu tun sind:
|
||||
|
||||
- Schaltung entwerfen
|
||||
- Schaltung löten
|
||||
- blech sägen
|
||||
- brett sägen
|
||||
- brett aushölen
|
||||
- brett fasen
|
||||
- innenleben planen
|
||||
- impulsgeber befestigen
|
||||
- platte und heizelemente befestigen u. bohren
|
||||
- brett wachsen
|
||||
@ -0,0 +1,49 @@
|
||||
|
||||
// alter drehimpulsgebercode, aus marcus-thermometer
|
||||
void buttonpoll(){ // runs with 1.2kHz
|
||||
uint8_t l,r,t,flanks,dir;
|
||||
l=BUTTPIN & _BV(BUTTLPIN);
|
||||
r=BUTTPIN & _BV(BUTTRPIN);
|
||||
t=BUTTPIN & _BV(BUTTTPIN);
|
||||
|
||||
// debounce code
|
||||
if (t != butttold && !butttbounce ) {
|
||||
butttold = t;
|
||||
butttbounce = BUTT_BOUNCE;
|
||||
if (t == 0) { // active low
|
||||
buttonevent |= BUTTEV_PUSH;
|
||||
}
|
||||
}
|
||||
|
||||
flanks=0;
|
||||
dir=0;
|
||||
if (l != buttlold) {
|
||||
flanks += 1;
|
||||
}
|
||||
if (r != buttrold) {
|
||||
flanks += 1;
|
||||
dir = 1;
|
||||
}
|
||||
if (flanks == 1){ // we need to have exactly one flank, 0 flanks are no
|
||||
// change, and 2 flanks are too fast (error)
|
||||
if (l) {
|
||||
dir ^= 1;
|
||||
}
|
||||
if (r) {
|
||||
dir ^= 1;
|
||||
}
|
||||
if ((r && l) || (!r && !l)) {
|
||||
buttoninc += dir ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
buttlold = l;
|
||||
buttrold = r;
|
||||
|
||||
|
||||
if(butttbounce){
|
||||
butttbounce -= 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in new issue