[MEGA2560] Add KS108 lcd + voice + "far" splash for firmware > 64Kb (#3515)

This commit is contained in:
Bertrand Songis
2016-05-25 21:21:51 +02:00
parent 907b6337fc
commit 5f65217124
25 changed files with 1250 additions and 726 deletions
+22 -17
View File
@@ -1371,24 +1371,29 @@ void lcdInvertLine(int8_t y)
}
}
#if !defined(BOOT)
void lcd_img(coord_t x, coord_t y, const pm_uchar * img, uint8_t idx, LcdFlags att)
{
const pm_uchar *q = img;
uint8_t w = pgm_read_byte(q++);
uint8_t hb = (pgm_read_byte(q++)+7)/8;
bool inv = (att & INVERS) ? true : (att & BLINK ? BLINK_ON_PHASE : false);
q += idx*w*hb;
for (uint8_t yb = 0; yb < hb; yb++) {
uint8_t *p = &displayBuf[ (y / 8 + yb) * LCD_W + x ];
for (coord_t i=0; i<w; i++){
uint8_t b = pgm_read_byte(q);
q++;
ASSERT_IN_DISPLAY(p);
*p++ = inv ? ~b : b;
}
}
#define LCD_IMG_FUNCTION(NAME, TYPE, READ_BYTE) \
void NAME(coord_t x, coord_t y, TYPE img, uint8_t idx, LcdFlags att) \
{ \
TYPE q = img; \
uint8_t w = READ_BYTE(q++); \
uint8_t hb = (READ_BYTE(q++)+7)/8; \
bool inv = (att & INVERS) ? true : (att & BLINK ? BLINK_ON_PHASE : false); \
q += idx*w*hb; \
for (uint8_t yb = 0; yb < hb; yb++) { \
uint8_t *p = &displayBuf[ (y / 8 + yb) * LCD_W + x ]; \
for (coord_t i=0; i<w; i++){ \
uint8_t b = READ_BYTE(q); \
q++; \
ASSERT_IN_DISPLAY(p); \
*p++ = inv ? ~b : b; \
} \
} \
}
#if defined(PCBMEGA2560) && !defined(SIMU)
LCD_IMG_FUNCTION(lcd_imgfar, uint_farptr_t, pgm_read_byte_far)
#endif
LCD_IMG_FUNCTION(lcd_img, const pm_uchar *, pgm_read_byte)
#endif
+4
View File
@@ -237,6 +237,10 @@ void lcdDrawTelemetryTopBar();
lcdDrawSolidVerticalLine(xx ,yy-ll,ll); \
lcdDrawSolidVerticalLine(xx+1,yy-ll,ll)
#if defined(PCBMEGA2560) && !defined(SIMU)
void lcd_imgfar(coord_t x, coord_t y, const uint_farptr_t img, uint8_t idx, LcdFlags att); // progmem "far"
#endif
void lcd_img(coord_t x, coord_t y, const pm_uchar * img, uint8_t idx, LcdFlags att=0);
void lcdSetRefVolt(unsigned char val);
+5 -3
View File
@@ -292,11 +292,13 @@ void menuModelSetup(uint8_t event)
timer->start = qr.rem + qr.quot*60;
break;
case 2:
qr.rem -= checkIncDecModel(event, qr.rem+2, 1, 62)-2;
if (timer->start >= qr.rem) {
qr.rem -= checkIncDecModel(event, qr.rem+2, 1, 62) - 2;
if ((int16_t)timer->start >= qr.rem) {
timer->start -= qr.rem ;
}
if ((int32_t)timer->start > 3599) timer->start=3599; // 59:59
if ((int16_t)timer->start > 3599) {
timer->start = 3599; // 59:59
}
break;
}
}
+28 -3
View File
@@ -18,20 +18,45 @@
* GNU General Public License for more details.
*/
#include "../../opentx.h"
#include "opentx.h"
#if !defined GET_FAR_ADDRESS
#define GET_FAR_ADDRESS(var) \
({ \
uint32_t tmp; \
\
__asm__ __volatile__( \
\
"ldi %A0, lo8(%1)" "\n\t" \
"ldi %B0, hi8(%1)" "\n\t" \
"ldi %C0, hh8(%1)" "\n\t" \
"clr %D0" "\n\t" \
: \
"=d" (tmp) \
: \
"p" (&(var)) \
); \
tmp; \
})
#endif
#if defined(SPLASH)
const pm_uchar splashdata[] PROGMEM = {
'S','P','S',0,
#include "bitmaps/9x/splash.lbm"
'S','P','E',0 };
const pm_uchar * const splash_lbm = splashdata+4;
void drawSplash()
{
lcdClear();
lcd_img(0, 0, splash_lbm, 0, 0);
#if defined(PCBMEGA2560) && !defined(SIMU)
lcd_imgfar(0, 0, pgm_get_far_address(splash_lbm), 0, 0); // use progmem "far" for splash working with all other options enabled
#else
lcd_img(0, 0, splash_lbm, 0, 0);
#endif
#if MENUS_LOCK == 1
if (readonly == false) {
lcdDrawFilledRect((LCD_W-(sizeof(TR_UNLOCKED)-1)*FW)/2 - 9, 50, (sizeof(TR_UNLOCKED)-1)*FW+16, 11, SOLID, ERASE|ROUND);