summaryrefslogtreecommitdiff
path: root/firmware/drivers/button.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/button.c')
-rw-r--r--firmware/drivers/button.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index 58a9ab0b94..939f94884d 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -558,15 +558,20 @@ void button_close(void)
558 558
559#ifdef HAVE_LCD_FLIP 559#ifdef HAVE_LCD_FLIP
560/* 560/*
561 * helper function to swap LEFT/RIGHT, UP/DOWN (if present), and F1/F3 (Recorder) 561 * helper function to swap LEFT/RIGHT, UP/DOWN (if present)
562 */ 562 */
563static int button_flip(int button) 563static int button_flip(int button)
564{ 564{
565 int newbutton = button; 565 int newbutton = button;
566 566
567#if (CONFIG_PLATFORM & PLATFORM_NATIVE) 567#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
568 newbutton &= 568 newbutton &= ~(
569 ~(BUTTON_LEFT | BUTTON_RIGHT 569#if defined(BUTTON_LEFT) && defined(BUTTON_RIGHT)
570 BUTTON_LEFT | BUTTON_RIGHT
571#else
572#warning "LEFT/RIGHT not defined!"
573 0
574#endif
570#if defined(BUTTON_UP) && defined(BUTTON_DOWN) 575#if defined(BUTTON_UP) && defined(BUTTON_DOWN)
571 | BUTTON_UP | BUTTON_DOWN 576 | BUTTON_UP | BUTTON_DOWN
572#endif 577#endif
@@ -583,10 +588,15 @@ static int button_flip(int button)
583#endif 588#endif
584 ); 589 );
585 590
591#if defined(BUTTON_LEFT) && defined(BUTTON_RIGHT)
586 if (button & BUTTON_LEFT) 592 if (button & BUTTON_LEFT)
587 newbutton |= BUTTON_RIGHT; 593 newbutton |= BUTTON_RIGHT;
588 if (button & BUTTON_RIGHT) 594 if (button & BUTTON_RIGHT)
589 newbutton |= BUTTON_LEFT; 595 newbutton |= BUTTON_LEFT;
596#else
597#warning "LEFT/RIGHT not defined!"
598#endif
599
590#if defined(BUTTON_UP) && defined(BUTTON_DOWN) 600#if defined(BUTTON_UP) && defined(BUTTON_DOWN)
591 if (button & BUTTON_UP) 601 if (button & BUTTON_UP)
592 newbutton |= BUTTON_DOWN; 602 newbutton |= BUTTON_DOWN;