[ACT] Navigation & Menus
This commit is contained in:
@@ -36,8 +36,14 @@
|
||||
|
||||
void pwrInit();
|
||||
void eepromInit();
|
||||
|
||||
#if defined(DEBUG) && !defined(SIMU)
|
||||
void DEBUG_UART_Configure( uint32_t baudrate, uint32_t masterClock);
|
||||
void DEBUG_UART_Stop();
|
||||
#else
|
||||
#define DEBUG_UART_Stop()
|
||||
#define DEBUG_UART_Configure(...)
|
||||
#endif
|
||||
|
||||
uint32_t Master_frequency ;
|
||||
volatile uint32_t Tenms ;
|
||||
|
||||
@@ -49,6 +49,34 @@ extern void init_SDcard();
|
||||
extern void sdInit();
|
||||
}
|
||||
|
||||
#if defined(REVA)
|
||||
#define GPIO_BUTTON_MENU PIOB->PIO_PDSR
|
||||
#define GPIO_BUTTON_EXIT PIOA->PIO_PDSR
|
||||
#define GPIO_BUTTON_UP PIOC->PIO_PDSR
|
||||
#define GPIO_BUTTON_DOWN PIOC->PIO_PDSR
|
||||
#define GPIO_BUTTON_RIGHT PIOC->PIO_PDSR
|
||||
#define GPIO_BUTTON_LEFT PIOC->PIO_PDSR
|
||||
#define PIN_BUTTON_MENU 0x00000040
|
||||
#define PIN_BUTTON_EXIT 0x80000000
|
||||
#define PIN_BUTTON_UP 0x00000004
|
||||
#define PIN_BUTTON_DOWN 0x00000008
|
||||
#define PIN_BUTTON_RIGHT 0x00000010
|
||||
#define PIN_BUTTON_LEFT 0x00000020
|
||||
#else
|
||||
#define GPIO_BUTTON_MENU PIOB->PIO_PDSR
|
||||
#define GPIO_BUTTON_EXIT PIOC->PIO_PDSR
|
||||
#define GPIO_BUTTON_UP PIOC->PIO_PDSR
|
||||
#define GPIO_BUTTON_DOWN PIOC->PIO_PDSR
|
||||
#define GPIO_BUTTON_RIGHT PIOC->PIO_PDSR
|
||||
#define GPIO_BUTTON_LEFT PIOC->PIO_PDSR
|
||||
#define PIN_BUTTON_MENU 0x00000020
|
||||
#define PIN_BUTTON_EXIT 0x01000000
|
||||
#define PIN_BUTTON_UP 0x00000002
|
||||
#define PIN_BUTTON_DOWN 0x00000020
|
||||
#define PIN_BUTTON_RIGHT 0x00000010
|
||||
#define PIN_BUTTON_LEFT 0x00000008
|
||||
#endif
|
||||
|
||||
#define sdPoll10ms()
|
||||
|
||||
void usbMassStorage();
|
||||
|
||||
+29
-24
@@ -47,36 +47,41 @@
|
||||
uint32_t readKeys()
|
||||
{
|
||||
register uint32_t x;
|
||||
register uint32_t y;
|
||||
register uint32_t result = 0;
|
||||
|
||||
x = lcdLock ? lcdInputs : PIOC->PIO_PDSR; // 6 LEFT, 5 RIGHT, 4 DOWN, 3 UP ()
|
||||
x <<= 1;
|
||||
|
||||
#if defined(REVA)
|
||||
y = (x & 0x00000060);
|
||||
if (x & 0x00000008)
|
||||
y |= 0x10;
|
||||
if (x & 0x00000010)
|
||||
y |= 0x08;
|
||||
if (PIOA->PIO_PDSR & 0x80000000)
|
||||
y |= 0x04; // EXIT
|
||||
if (PIOB->PIO_PDSR & 0x000000040)
|
||||
y |= 0x02; // MENU
|
||||
if (x & PIN_BUTTON_RIGHT)
|
||||
result |= 0x02 << KEY_RIGHT;
|
||||
if (x & PIN_BUTTON_LEFT)
|
||||
result |= 0x02 << KEY_LEFT;
|
||||
if (x & PIN_BUTTON_UP)
|
||||
result |= 0x02 << KEY_UP;
|
||||
if (x & PIN_BUTTON_DOWN)
|
||||
result |= 0x02 << KEY_DOWN;
|
||||
if (GPIO_BUTTON_EXIT & PIN_BUTTON_EXIT)
|
||||
result |= 0x02 << KEY_EXIT;
|
||||
if (GPIO_BUTTON_MENU & 0x000000040)
|
||||
result |= 0x02 << KEY_MENU;
|
||||
#else
|
||||
y = (x & 0x00000020); // RIGHT
|
||||
if (x & 0x00000004)
|
||||
y |= 0x02 << KEY_UP; // UP
|
||||
if (x & 0x00000010)
|
||||
y |= 0x02 << KEY_LEFT; // LEFT
|
||||
if (x & 0x00000040)
|
||||
y |= 0x02 << KEY_DOWN; // DOWN
|
||||
if (x & 0x02000000)
|
||||
y |= 0x02 << KEY_EXIT; // EXIT
|
||||
if (PIOB->PIO_PDSR & 0x000000020)
|
||||
y |= 0x02 << KEY_MENU; // MENU
|
||||
if (x & PIN_BUTTON_RIGHT)
|
||||
result |= 0x02 << KEY_RIGHT;
|
||||
if (x & PIN_BUTTON_UP)
|
||||
result |= 0x02 << KEY_UP;
|
||||
if (x & PIN_BUTTON_LEFT)
|
||||
result |= 0x02 << KEY_LEFT;
|
||||
if (x & PIN_BUTTON_DOWN)
|
||||
result |= 0x02 << KEY_DOWN;
|
||||
if (x & PIN_BUTTON_EXIT)
|
||||
result |= 0x02 << KEY_EXIT;
|
||||
if (GPIO_BUTTON_MENU & PIN_BUTTON_MENU)
|
||||
result |= 0x02 << KEY_MENU;
|
||||
#endif
|
||||
|
||||
return y ;
|
||||
// printf("readKeys(): %x => %x\n", x, result); fflush(stdout);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
uint32_t readTrims()
|
||||
@@ -180,7 +185,7 @@ void readKeysAndTrims()
|
||||
}
|
||||
}
|
||||
|
||||
extern uint32_t keyState(EnumKeys enuk)
|
||||
uint32_t switchState(EnumKeys enuk)
|
||||
{
|
||||
register uint32_t a;
|
||||
register uint32_t c;
|
||||
|
||||
@@ -253,7 +253,7 @@ void lcdRefresh()
|
||||
#else
|
||||
x = *p;
|
||||
#endif
|
||||
for (z = 0; z < DISPLAY_W; z += 1) {
|
||||
for (z = 0; z < LCD_W; z += 1) {
|
||||
|
||||
// The following 7 lines replaces by a lookup table
|
||||
// x = __RBIT( *p++ ) ;
|
||||
|
||||
Reference in New Issue
Block a user