mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
feat: Removed tiny font to free flash space
This commit is contained in:
parent
181b90973e
commit
80c44862d2
2
Makefile
2
Makefile
|
|
@ -120,7 +120,7 @@ CSRC = $(STARTUPSRC) \
|
|||
$(STREAMSSRC) \
|
||||
$(SHELLSRC) \
|
||||
usbcfg.c \
|
||||
main.c si5351.c tlv320aic3204.c dsp.c plot.c ui.c ili9341.c numfont20x24.c Font5x7.c Font8x8.c flash.c adc.c
|
||||
main.c si5351.c tlv320aic3204.c dsp.c plot.c ui.c ili9341.c numfont20x24.c Font8x8.c flash.c adc.c
|
||||
|
||||
# $(TESTSRC) \
|
||||
|
||||
|
|
|
|||
27
ili9341.c
27
ili9341.c
|
|
@ -336,28 +336,30 @@ ili9341_read_memory_continue(int len, uint16_t* out)
|
|||
|
||||
|
||||
|
||||
void
|
||||
unsigned char
|
||||
ili9341_drawchar_size(uint8_t ch, int x, int y, uint16_t fg, uint16_t bg, uint8_t size)
|
||||
{
|
||||
uint16_t *buf = spi_buffer;
|
||||
uint8_t bits;
|
||||
int c, r;
|
||||
int cline, ccol;
|
||||
|
||||
ch = x5x7_map_char_table(ch);
|
||||
ch = x8x8_map_char_table(ch);
|
||||
|
||||
for(c = 0; c < 7*size; c++)
|
||||
for(cline = 0; cline < 8*size; cline++)
|
||||
{
|
||||
bits = x5x7_bits[(ch * 7) + (c / size)];
|
||||
for (r = 0; r < 5*size; r++)
|
||||
bits = x8x8_bits[ch][cline/size];
|
||||
for (ccol = 0; ccol < x8x8_len[ch]*size; ccol++)
|
||||
{
|
||||
*buf++ = (0x80 & bits) ? fg : bg;
|
||||
if (r % size == (size-1))
|
||||
if (ccol % size == (size-1))
|
||||
{
|
||||
bits <<= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
ili9341_bulk(x, y, 5*size, 7*size);
|
||||
ili9341_bulk(x, y, x8x8_len[ch]*size, 8*size);
|
||||
|
||||
return x8x8_len[ch]*size;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -365,9 +367,12 @@ ili9341_drawchar_size(uint8_t ch, int x, int y, uint16_t fg, uint16_t bg, uint8_
|
|||
void
|
||||
ili9341_drawstring_size(const char *str, int x, int y, uint16_t fg, uint16_t bg, uint8_t size)
|
||||
{
|
||||
while (*str) {
|
||||
ili9341_drawchar_size(*str, x, y, fg, bg, size);
|
||||
x += 5 * size;
|
||||
unsigned char clength = 0;
|
||||
|
||||
while (*str)
|
||||
{
|
||||
clength = ili9341_drawchar_size(*str, x, y, fg, bg, size);
|
||||
x += clength;
|
||||
str++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,7 +150,6 @@ extern int area_height;
|
|||
|
||||
// font
|
||||
|
||||
extern const uint8_t x5x7_bits[];
|
||||
extern const uint8_t x8x8_bits[][8];
|
||||
extern const uint8_t x8x8_len[];
|
||||
extern const uint32_t numfont20x24[][24];
|
||||
|
|
@ -164,7 +163,6 @@ extern const uint32_t numfont20x24[][24];
|
|||
#define S_LARROW "\003"
|
||||
#define S_RARROW "\004"
|
||||
|
||||
extern uint8_t x5x7_map_char_table(uint8_t ch);
|
||||
extern uint8_t x8x8_map_char_table(uint8_t ch);
|
||||
|
||||
|
||||
|
|
@ -287,7 +285,7 @@ void ili9341_init(void);
|
|||
void ili9341_test(int mode);
|
||||
void ili9341_bulk(int x, int y, int w, int h);
|
||||
void ili9341_fill(int x, int y, int w, int h, int color);
|
||||
void ili9341_drawchar_size(uint8_t ch, int x, int y, uint16_t fg, uint16_t bg, uint8_t size);
|
||||
unsigned char ili9341_drawchar_size(uint8_t ch, int x, int y, uint16_t fg, uint16_t bg, uint8_t size);
|
||||
void ili9341_drawstring_size(const char *str, int x, int y, uint16_t fg, uint16_t bg, uint8_t size);
|
||||
unsigned char ili9341_drawchar_8x8(uint8_t ch, int x, int y, uint16_t fg, uint16_t bg);
|
||||
void ili9341_drawstring_8x8(const char *str, int x, int y, uint16_t fg, uint16_t bg);
|
||||
|
|
|
|||
47
plot.c
47
plot.c
|
|
@ -1022,24 +1022,31 @@ draw_marker(int w, int h, int x, int y, int c, int ch)
|
|||
{
|
||||
int i, j;
|
||||
|
||||
ch = x5x7_map_char_table(ch);
|
||||
ch = x8x8_map_char_table(ch);
|
||||
|
||||
for (j = 10; j >= 0; j--)
|
||||
for ( j = 12; j >= 0; j-- )
|
||||
{
|
||||
int j0 = j / 2;
|
||||
for (i = -j0; i <= j0; i++)
|
||||
for ( i = -j0; i <= j0; i++ )
|
||||
{
|
||||
int x0 = x + i;
|
||||
int y0 = y - j;
|
||||
int cc = c;
|
||||
if ( j <= 9 && j > 2 && i >= -1 && i <= 3 )
|
||||
|
||||
if ( (4 < j) && (j <= 11) && (-4 <= i) && (i <= 3) )
|
||||
{
|
||||
uint8_t bits = x5x7_bits[(ch * 7) + (9-j)];
|
||||
if ( bits & (0x80>>(i+1)) )
|
||||
uint8_t bits = x8x8_bits[ch][11-j];
|
||||
|
||||
if ( bits & (0x80>>(i+3)) )
|
||||
{
|
||||
cc = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (y0 >= 0 && y0 < h && x0 >= 0 && x0 < w)
|
||||
{
|
||||
spi_buffer[y0*w+x0] = cc;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1365,6 +1372,7 @@ request_to_draw_cells_behind_numeric_input(void)
|
|||
|
||||
|
||||
|
||||
#if 0
|
||||
void
|
||||
cell_drawchar_5x7(int w, int h, uint8_t ch, int x, int y, uint16_t fg, int invert)
|
||||
{
|
||||
|
|
@ -1395,32 +1403,7 @@ cell_drawchar_5x7(int w, int h, uint8_t ch, int x, int y, uint16_t fg, int inver
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
cell_drawstring_5x7(int w, int h, char *str, int x, int y, uint16_t fg)
|
||||
{
|
||||
while (*str) {
|
||||
cell_drawchar_5x7(w, h, *str, x, y, fg, FALSE);
|
||||
x += 5;
|
||||
str++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
cell_drawstring_invert_5x7(int w, int h, char *str, int x, int y, uint16_t fg, int invert)
|
||||
{
|
||||
while (*str)
|
||||
{
|
||||
cell_drawchar_5x7(w, h, *str, x, y, fg, invert);
|
||||
x += 5;
|
||||
str++;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
uint16_t
|
||||
|
|
|
|||
6
ui.c
6
ui.c
|
|
@ -430,14 +430,14 @@ enter_dfu(void)
|
|||
{
|
||||
adc_stop(ADC1);
|
||||
|
||||
int x = 100, y = 20;
|
||||
int x = 110, y = 20;
|
||||
|
||||
// leave a last message
|
||||
ili9341_fill(0, 0, 320, 240, 0);
|
||||
ili9341_drawstring_size("DFU", x+30, y, 0xffff, 0x0000, 4);
|
||||
ili9341_drawstring_size("DFU", x, y, 0xffff, 0x0000, 4);
|
||||
|
||||
x = 5;
|
||||
y += 50;
|
||||
|
||||
ili9341_drawstring_8x8_var("Device Firmware Update Mode", x, y += 10, 0xffff, 0x0000);
|
||||
ili9341_drawstring_8x8_var("To exit DFU mode, please reset device yourself.", x, y += 10, 0xffff, 0x0000);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue