diff --git a/radio/bootloader/Makefile b/radio/bootloader/Makefile index 9f406db8b..8cee2f3b3 100644 --- a/radio/bootloader/Makefile +++ b/radio/bootloader/Makefile @@ -146,7 +146,7 @@ CPPSRC = ../src/targets/taranis/lcd_driver.cpp \ ../src/targets/taranis/usbd_usr.cpp \ usbd_storage_msd.cpp \ ../src/lcd.cpp \ - ../src/translations.cpp \ + ../src/fonts.cpp \ power.cpp \ boot.cpp diff --git a/radio/src/Makefile b/radio/src/Makefile index b583e8868..cda31aa0f 100644 --- a/radio/src/Makefile +++ b/radio/src/Makefile @@ -742,7 +742,7 @@ else TTS_SRC = $(shell sh -c "if test -f $(STD_TTS_SRC); then echo $(STD_TTS_SRC); else echo translations/tts_en.cpp; fi") endif -CPPSRC += opentx.cpp $(PULSESSRC) stamp.cpp gui/menus.cpp gui/menu_model.cpp gui/menu_general.cpp gui/view_main.cpp gui/view_statistics.cpp $(EEPROMSRC) lcd.cpp keys.cpp maths.cpp translations.cpp $(TTS_SRC) +CPPSRC += opentx.cpp $(PULSESSRC) stamp.cpp gui/menus.cpp gui/menu_model.cpp gui/menu_general.cpp gui/view_main.cpp gui/view_statistics.cpp $(EEPROMSRC) lcd.cpp keys.cpp maths.cpp translations.cpp fonts.cpp $(TTS_SRC) # Debugging format. # Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs. diff --git a/radio/src/fonts.cpp b/radio/src/fonts.cpp new file mode 100755 index 000000000..5c1ec8bc4 --- /dev/null +++ b/radio/src/fonts.cpp @@ -0,0 +1,163 @@ +/* + * Authors (alphabetical order) + * - Andre Bernet + * - Andreas Weitl + * - Bertrand Songis + * - Bryan J. Rentoul (Gruvin) + * - Cameron Weeks + * - Erez Raviv + * - Gabriel Birkus + * - Jean-Pierre Parisy + * - Karl Szmutny + * - Michael Blandford + * - Michal Hlavinka + * - Pat Mackenzie + * - Philip Moss + * - Rob Thomson + * - Romolo Manfredini + * - Thomas Husterer + * + * opentx is based on code named + * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, + * er9x by Erez Raviv: http://code.google.com/p/er9x/, + * and the original (and ongoing) project by + * Thomas Husterer, th9x: http://code.google.com/p/th9x/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include "opentx.h" + +const pm_uchar font_5x7[] PROGMEM = { +#if defined (CPUARM) +#include "font_05x07.lbm" +#else +#include "font_05x07_avr.lbm" +#endif +#if defined(TRANSLATIONS_DE) +#include "font_de_05x07.lbm" +#elif defined(TRANSLATIONS_CZ) +#include "font_cz_05x07.lbm" +#elif defined(TRANSLATIONS_ES) +#include "font_es_05x07.lbm" +#elif defined(TRANSLATIONS_FI) +#include "font_fi_05x07.lbm" +#elif defined(TRANSLATIONS_FR) +#include "font_fr_05x07.lbm" +#elif defined(TRANSLATIONS_IT) +#include "font_it_05x07.lbm" +#elif defined(TRANSLATIONS_PL) +#include "font_pl_05x07.lbm" +#elif defined(TRANSLATIONS_PT) +#include "font_pt_05x07.lbm" +#elif defined(TRANSLATIONS_SE) +#include "font_se_05x07.lbm" +#endif +}; + +#if defined(BOLD_FONT) && (!defined(CPUM64) || defined(EXTSTD)) +const pm_uchar font_5x7_B[] PROGMEM = { +#include "font_05x07_B_compressed.lbm" +}; +#endif + +#if !defined(BOOT) +const pm_uchar font_10x14[] PROGMEM = { +#include "font_10x14_compressed.lbm" +#if defined(CPUARM) + #if defined(TRANSLATIONS_DE) + #include "font_de_10x14.lbm" + #elif defined(TRANSLATIONS_CZ) + #include "font_cz_10x14.lbm" + #elif defined(TRANSLATIONS_ES) + #include "font_es_10x14.lbm" + #elif defined(TRANSLATIONS_FI) + #include "font_fi_10x14.lbm" + #elif defined(TRANSLATIONS_FR) + #include "font_fr_10x14.lbm" + #elif defined(TRANSLATIONS_IT) + #include "font_it_10x14.lbm" + #elif defined(TRANSLATIONS_PL) + #include "font_pl_10x14.lbm" + #elif defined(TRANSLATIONS_PT) + #include "font_pt_10x14.lbm" + #elif defined(TRANSLATIONS_SE) + #include "font_se_10x14.lbm" + #endif +#endif +}; +#endif + +#if defined(CPUARM) && !defined(BOOT) +const pm_uchar font_3x5[] PROGMEM = { +#include "font_03x05.lbm" +}; + +const pm_uchar font_4x6[] PROGMEM = { +#include "font_04x06.lbm" +#if defined(TRANSLATIONS_DE) +#include "font_de_04x06.lbm" +#elif defined(TRANSLATIONS_CZ) +#include "font_cz_04x06.lbm" +#elif defined(TRANSLATIONS_ES) +#include "font_es_04x06.lbm" +#elif defined(TRANSLATIONS_FI) +#include "font_fi_04x06.lbm" +#elif defined(TRANSLATIONS_FR) +#include "font_fr_04x06.lbm" +#elif defined(TRANSLATIONS_IT) +#include "font_it_04x06.lbm" +#elif defined(TRANSLATIONS_PL) +#include "font_pl_04x06.lbm" +#elif defined(TRANSLATIONS_PT) +#include "font_pt_04x06.lbm" +#elif defined(TRANSLATIONS_SE) +#include "font_se_04x06.lbm" +#endif +}; + +const pm_uchar font_8x10[] PROGMEM = { +#include "font_08x10.lbm" +#if defined(TRANSLATIONS_DE) +#include "font_de_08x10.lbm" +#elif defined(TRANSLATIONS_CZ) +#include "font_cz_08x10.lbm" +#elif defined(TRANSLATIONS_ES) +#include "font_es_08x10.lbm" +#elif defined(TRANSLATIONS_FI) +#include "font_fi_08x10.lbm" +#elif defined(TRANSLATIONS_FR) +#include "font_fr_08x10.lbm" +#elif defined(TRANSLATIONS_IT) +#include "font_it_08x10.lbm" +#elif defined(TRANSLATIONS_PL) +#include "font_pl_08x10.lbm" +#elif defined(TRANSLATIONS_PT) +#include "font_pt_08x10.lbm" +#elif defined(TRANSLATIONS_SE) +#include "font_se_08x10.lbm" +#endif +}; + +const pm_uchar font_4x6_extra[] PROGMEM = { +#include "font_04x06_extra.lbm" +}; + +const pm_uchar font_5x7_extra[] PROGMEM = { +#include "font_05x07_extra.lbm" +}; + +const pm_uchar font_10x14_extra[] PROGMEM = { +#include "font_10x14_extra.lbm" +}; + +#endif + diff --git a/radio/src/fonts.h b/radio/src/fonts.h new file mode 100755 index 000000000..f254800dc --- /dev/null +++ b/radio/src/fonts.h @@ -0,0 +1,57 @@ +/* + * Authors (alphabetical order) + * - Andre Bernet + * - Andreas Weitl + * - Bertrand Songis + * - Bryan J. Rentoul (Gruvin) + * - Cameron Weeks + * - Erez Raviv + * - Gabriel Birkus + * - Jean-Pierre Parisy + * - Karl Szmutny + * - Michael Blandford + * - Michal Hlavinka + * - Pat Mackenzie + * - Philip Moss + * - Rob Thomson + * - Romolo Manfredini + * - Thomas Husterer + * + * opentx is based on code named + * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, + * er9x by Erez Raviv: http://code.google.com/p/er9x/, + * and the original (and ongoing) project by + * Thomas Husterer, th9x: http://code.google.com/p/th9x/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef fonts_h +#define fonts_h + +extern const pm_uchar font_5x7[]; +extern const pm_uchar font_10x14[]; + +#if defined(BOLD_FONT) && (!defined(CPUM64) || defined(EXTSTD)) && !defined(BOOT) + #define BOLD_SPECIFIC_FONT + extern const pm_uchar font_5x7_B[]; +#endif + +#if defined(CPUARM) +extern const pm_uchar font_3x5[]; +extern const pm_uchar font_4x6[]; +extern const pm_uchar font_8x10[]; +extern const pm_uchar font_5x7_extra[]; +extern const pm_uchar font_10x14_extra[]; +extern const pm_uchar font_4x6_extra[]; +#endif + +#endif diff --git a/radio/src/lcd.cpp b/radio/src/lcd.cpp index f65811a0a..51793bed7 100644 --- a/radio/src/lcd.cpp +++ b/radio/src/lcd.cpp @@ -49,44 +49,6 @@ void lcd_clear() memset(displayBuf, 0, sizeof(displayBuf)); } -#if !defined(BOOT) -void lcd_img(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t idx, LcdFlags att) -{ - const pm_uchar *q = img; -#if LCD_W >= 260 - xcoord_t w = pgm_read_byte(q++); - if (w == 255) w += pgm_read_byte(q++); -#else - uint8_t w = pgm_read_byte(q++); -#endif - 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 (xcoord_t i=0; i> (8-ym8)); } -#if defined(PCBTARANIS) && !defined(BOOT) +#if defined(PCBTARANIS) if (inv) { if (ym8) lcd_mask(p, 0x01 << (ym8-1), FORCE); else if (y) { @@ -354,13 +321,6 @@ void lcd_putc(xcoord_t x, uint8_t y, const unsigned char c) lcd_putcAtt(x, y, c, 0); } -void lcd_putsiAtt(xcoord_t x, uint8_t y,const pm_char * s,uint8_t idx, LcdFlags flags) -{ - uint8_t length; - length = pgm_read_byte(s++); - lcd_putsnAtt(x,y,s+length*idx,length,flags & ~(BSS|ZCHAR)); -} - void lcd_putsnAtt(xcoord_t x, uint8_t y, const pm_char * s, uint8_t len, LcdFlags mode) { xcoord_t orig_x = x; @@ -440,6 +400,14 @@ void lcd_putsLeft(uint8_t y, const pm_char * s) lcd_puts(0, y, s); } +#if !defined(BOOT) +void lcd_putsiAtt(xcoord_t x, uint8_t y,const pm_char * s,uint8_t idx, LcdFlags flags) +{ + uint8_t length; + length = pgm_read_byte(s++); + lcd_putsnAtt(x,y,s+length*idx,length,flags & ~(BSS|ZCHAR)); +} + void lcd_outhex4(xcoord_t x, uint8_t y, uint16_t val) { x+=FWNUM*4+1; @@ -596,6 +564,7 @@ void lcd_outdezNAtt(xcoord_t x, uint8_t y, lcdint_t val, LcdFlags flags, uint8_t } if (neg) lcd_putcAtt(x, y, '-', flags); } +#endif #if defined(PCBTARANIS) void lcd_mask(uint8_t *p, uint8_t mask, LcdFlags att) @@ -817,6 +786,21 @@ void lcd_vline(xcoord_t x, int8_t y, int8_t h) lcd_vlineStip(x, y, h, 0xff); } +void lcd_invert_line(int8_t y) +{ + uint8_t *p = &displayBuf[y * LCD_W]; + for (xcoord_t x=0; x= 260 + xcoord_t w = pgm_read_byte(q++); + if (w == 255) w += pgm_read_byte(q++); +#else + uint8_t w = pgm_read_byte(q++); +#endif + 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 (xcoord_t i=0; i= 212 - #define TR(x,y) y + #define TR(x, y) y #else - #define TR(x,y) x + #define TR(x, y) x #endif // The non-0-terminated-strings @@ -547,21 +547,6 @@ extern const pm_char STR_RESET_BTN[]; #define STR_UPDATE_LIST STR_DELAYDOWN #endif -extern const pm_uchar font_5x7[]; -extern const pm_uchar font_10x14[]; -#if !defined(CPUM64) || defined(EXTSTD) -extern const pm_uchar font_5x7_B[]; -#endif - -#if defined(CPUARM) -extern const pm_uchar font_3x5[]; -extern const pm_uchar font_4x6[]; -extern const pm_uchar font_8x10[]; -extern const pm_uchar font_5x7_extra[]; -extern const pm_uchar font_10x14_extra[]; -extern const pm_uchar font_4x6_extra[]; -#endif - extern const pm_char STR_WARNING[]; extern const pm_char STR_EEPROMWARN[]; extern const pm_char STR_THROTTLEWARN[];