This commit is contained in:
2024-05-18 20:09:21 +02:00
parent eb75e31577
commit ccd395d6ab
11 changed files with 152 additions and 32 deletions

View File

@ -20,6 +20,14 @@ static uint8_t buttonsMoveLeftPressed() {
return res;
}
bool isConfigMode() {
return (P2IN & BIT4);
}
bool buttonsConfig1Pressed() {
return buttonsMoveLeftPressed();
}
static uint8_t buttonsMoveRightPressed() {
static uint8_t last = 0;
uint8_t current = (P2IN & BIT0);
@ -28,6 +36,10 @@ static uint8_t buttonsMoveRightPressed() {
return res;
}
bool buttonsConfig4Pressed() {
return buttonsMoveRightPressed();
}
static uint8_t buttonsRotateLeftPressed() {
static uint8_t last = 0;
uint8_t current = (P2IN & BIT3);
@ -36,6 +48,10 @@ static uint8_t buttonsRotateLeftPressed() {
return res;
}
bool buttonsConfig2Pressed() {
return buttonsRotateLeftPressed();
}
static uint8_t buttonsRotateRightPressed() {
static uint8_t last = 0;
uint8_t current = (P2IN & BIT1);
@ -44,6 +60,11 @@ static uint8_t buttonsRotateRightPressed() {
return res;
}
bool buttonsConfig3Pressed() {
return buttonsRotateRightPressed();
}
static uint8_t buttonsMoveDownPressed() {
return P2IN & BIT2;
}
@ -104,7 +125,9 @@ void buttonsExec(void *handle) {
void buttonsInit() {
P2DIR &= ~(BIT0|BIT1|BIT2|BIT3|BIT4);
}
void buttonsStart() {
schAdd(buttonsExec, NULL, 0, 25);
}