Horus bootloader (#5455)

Horus bootloader
This commit is contained in:
Raphael Coeffic
2017-12-19 12:13:59 +01:00
committed by Bertrand Songis
parent 908adb4d2b
commit 0d7832b208
54 changed files with 1772 additions and 1038 deletions
+9 -7
View File
@@ -320,10 +320,12 @@ void BitmapBuffer::drawSizedText(coord_t x, coord_t y, const char * s, uint8_t l
const uint16_t * fontspecs = fontspecsTable[fontindex];
BitmapBuffer * fontcache = NULL;
if (flags & RIGHT)
if (flags & RIGHT) {
INCREMENT_POS(-width);
else if (flags & CENTERED)
}
else if (flags & CENTERED) {
INCREMENT_POS(-width/2);
}
coord_t & pos = (flags & VERTICAL) ? y : x;
@@ -380,11 +382,11 @@ void BitmapBuffer::drawSizedText(coord_t x, coord_t y, const char * s, uint8_t l
bool setpos = false;
const coord_t orig_pos = pos;
while (len--) {
unsigned char c;
if (flags & ZCHAR)
c = idx2char(*s);
else
c = pgm_read_byte(s);
#if defined(BOOT)
unsigned char c = *s;
#else
unsigned char c = (flags & ZCHAR) ? idx2char(*s) : *s;
#endif
if (setpos) {
pos = c;
setpos = false;
+9
View File
@@ -20,6 +20,7 @@
#include "opentx.h"
#if !defined(BOOT)
const uint16_t font_tinsize_specs[] = {
#include "font_tinsize.specs"
};
@@ -35,6 +36,7 @@ const uint16_t font_smlsize_specs[] = {
const pm_uchar font_smlsize[] = {
#include "font_smlsize.lbm"
};
#endif
const uint16_t font_stdsize_specs[] = {
#include "font_stdsize.specs"
@@ -44,6 +46,7 @@ const pm_uchar font_stdsize[] = {
#include "font_stdsize.lbm"
};
#if !defined(BOOT)
const uint16_t font_midsize_specs[] = {
#include "font_midsize.specs"
};
@@ -75,7 +78,9 @@ const uint16_t font_stdsizebold_specs[] = {
const pm_uchar font_stdsizebold[] = {
#include "font_stdsizebold.lbm"
};
#endif
#if !defined(BOOT)
const uint16_t * const fontspecsTable[16] = {
font_stdsize_specs, font_tinsize_specs, font_smlsize_specs, font_midsize_specs, font_dblsize_specs, font_xxlsize_specs, font_stdsize_specs, font_stdsize_specs,
font_stdsizebold_specs, font_tinsize_specs, font_smlsize_specs, font_midsize_specs, font_dblsize_specs, font_xxlsize_specs, font_stdsize_specs, font_stdsize_specs
@@ -85,6 +90,10 @@ const uint8_t * const fontsTable[16] = {
font_stdsize, font_tinsize, font_smlsize, font_midsize, font_dblsize, font_xxlsize, font_stdsize, font_stdsize,
font_stdsizebold, font_tinsize, font_smlsize, font_midsize, font_dblsize, font_xxlsize, font_stdsize, font_stdsize
};
#else
const uint16_t * const fontspecsTable[1] = { font_stdsize_specs };
const uint8_t * const fontsTable[1] = { font_stdsize };
#endif
BitmapBuffer * fontCache[2] = { NULL, NULL };
+9 -7
View File
@@ -21,6 +21,7 @@
#include <math.h>
#include <stdio.h>
#include "opentx.h"
#include "strhelpers.h"
#if defined(SIMU)
display_t displayBuf[DISPLAY_BUFFER_SIZE];
@@ -103,11 +104,12 @@ int getTextWidth(const char * s, int len, LcdFlags flags)
int result = 0;
for (int i=0; len==0 || i<len; ++i) {
char c;
if (flags & ZCHAR)
c = idx2char(*s);
else
c = *s;
#if !defined(BOOT)
char c = (flags & ZCHAR) ? idx2char(*s) : *s;
#else
char c = *s;
#endif
if (c == '\0')
break;
result += getCharWidth(c, specs);
@@ -175,7 +177,6 @@ void lcdDrawNumber(coord_t x, coord_t y, int32_t val, LcdFlags flags, uint8_t le
lcdDrawText(x, y, s, flags);
}
#if !defined(BOOT)
void lcdDrawLine(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat, LcdFlags att)
{
int dx = x2-x1; /* the horizontal distance of the line */
@@ -218,8 +219,8 @@ void lcdDrawLine(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat, Lc
}
}
}
#endif
#if !defined(BOOT)
void drawRtcTime(coord_t x, coord_t y, LcdFlags flags)
{
drawTimer(x, y, getValue(MIXSRC_TX_TIME), flags);
@@ -388,6 +389,7 @@ void drawGPSSensorValue(coord_t x, coord_t y, TelemetryItem & telemetryItem, Lcd
{
drawGPSPosition(x, y, telemetryItem.gps.longitude, telemetryItem.gps.latitude, flags);
}
#endif
void lcdSetContrast()
{
+14 -4
View File
@@ -87,8 +87,14 @@ enum FontSizeIndex {
#define XXLSIZE (XXLSIZE_INDEX << 8)
#define BOLD (STDSIZE_BOLD_INDEX << 8)
#define FONTSIZE_MASK 0x0f00
#if !defined(BOOT)
#define FONTSIZE(flags) ((flags) & FONTSIZE_MASK)
#define FONTINDEX(flags) (FONTSIZE(flags) >> 8)
#else
#define FONTSIZE(flags) STDSIZE
#define FONTINDEX(flags) STDSIZE_INDEX
#endif
#define TIMEBLINK 0x1000
#define TIMEHOUR 0x2000
@@ -134,6 +140,13 @@ inline void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, uint8_t le
void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags mode=0);
void lcdDrawNumber(coord_t x, coord_t y, int32_t val, LcdFlags flags=0, uint8_t len=0, const char * prefix=NULL, const char * suffix=NULL);
#if !defined(BOOT)
#define putstime_t int32_t
void drawRtcTime(coord_t x, coord_t y, LcdFlags att=0);
void drawTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att=0);
void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att);
void putsStickName(coord_t x, coord_t y, uint8_t idx, LcdFlags att=0);
void drawSwitch(coord_t x, coord_t y, swsrc_t swtch, LcdFlags flags=0);
@@ -145,10 +158,7 @@ void drawTrimMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags att
#define putsChn(x, y, idx, att) drawSource(x, y, MIXSRC_CH1+idx-1, att)
void putsChnLetter(coord_t x, coord_t y, uint8_t idx, LcdFlags attr);
#define putstime_t int32_t
void drawRtcTime(coord_t x, coord_t y, LcdFlags att=0);
void drawTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att=0);
#endif // !BOOT
#define SOLID 0xff
#define DOTTED 0x55