Bootloader rotary encoder working, added missing lcdRefreshWait(), only 783 bytes of FLASH left

This commit is contained in:
Damjan Adamic
2014-12-08 19:59:09 +01:00
parent d43a49d845
commit 2c591e810d
+23
View File
@@ -150,6 +150,11 @@ extern void init_spi(void);
extern void writeBlock(void); extern void writeBlock(void);
extern void usbPluggedIn(); extern void usbPluggedIn();
#if defined(REV9E)
typedef int32_t rotenc_t;
extern rotenc_t x9de_rotenc;
#endif
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
* Global functions * Global functions
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
@@ -201,6 +206,22 @@ void interrupt10ms(void)
keys[enuk].input(value); keys[enuk].input(value);
++enuk; ++enuk;
} }
#if defined(REV9E)
checkRotaryEncoder();
static rotenc_t rePreviousValue;
rotenc_t reNewValue = (x9de_rotenc / 2);
int8_t scrollRE = reNewValue - rePreviousValue;
if (scrollRE) {
rePreviousValue = reNewValue;
if (scrollRE < 0) {
putEvent(EVT_KEY_FIRST(KEY_MINUS));
}
else {
putEvent(EVT_KEY_FIRST(KEY_PLUS));
}
}
#endif
} }
#if defined(PCBSKY9X) #if defined(PCBSKY9X)
@@ -552,6 +573,7 @@ int main()
Tenms = 0; Tenms = 0;
lcdRefreshWait();
lcd_clear(); lcd_clear();
lcd_putsLeft(0, BOOTLOADER_TITLE); lcd_putsLeft(0, BOOTLOADER_TITLE);
lcd_invert_line(0); lcd_invert_line(0);
@@ -807,6 +829,7 @@ int main()
if ((~readKeys() & 0x7E) == 0) { if ((~readKeys() & 0x7E) == 0) {
lcd_clear(); lcd_clear();
lcdRefresh(); lcdRefresh();
lcdRefreshWait();
RCC->CSR |= RCC_CSR_RMVF; //clear the reset flags in RCC clock control & status register RCC->CSR |= RCC_CSR_RMVF; //clear the reset flags in RCC clock control & status register
NVIC_SystemReset(); NVIC_SystemReset();
} }