0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-28 14:21:25 +03:00

Added fagci's teeny teeny font

This commit is contained in:
OneOfEleven 2023-10-20 14:09:12 +01:00
parent 78b4c93f67
commit d3000206d6
16 changed files with 631 additions and 375 deletions

View File

@ -8,7 +8,7 @@ ENABLE_SWD := 0
ENABLE_OVERLAY := 0 ENABLE_OVERLAY := 0
ENABLE_LTO := 1 ENABLE_LTO := 1
ENABLE_UART := 1 ENABLE_UART := 1
ENABLE_UART_DEBUG := 1 ENABLE_UART_DEBUG := 0
ENABLE_AIRCOPY := 1 ENABLE_AIRCOPY := 1
ENABLE_AIRCOPY_REMEMBER_FREQ := 1 ENABLE_AIRCOPY_REMEMBER_FREQ := 1
ENABLE_AIRCOPY_RX_REBOOT := 0 ENABLE_AIRCOPY_RX_REBOOT := 0
@ -23,7 +23,7 @@ ENABLE_TX1750 := 0
ENABLE_PWRON_PASSWORD := 0 ENABLE_PWRON_PASSWORD := 0
ENABLE_RESET_AES_KEY := 1 ENABLE_RESET_AES_KEY := 1
ENABLE_BIG_FREQ := 0 ENABLE_BIG_FREQ := 0
ENABLE_SMALL_BOLD := 1 ENABLE_SMALL_BOLD := 0
ENABLE_KEEP_MEM_NAME := 1 ENABLE_KEEP_MEM_NAME := 1
ENABLE_WIDE_RX := 1 ENABLE_WIDE_RX := 1
ENABLE_TX_WHEN_AM := 0 ENABLE_TX_WHEN_AM := 0
@ -39,7 +39,7 @@ ENABLE_FREQ_SEARCH_TIMEOUT := 0
ENABLE_CODE_SEARCH_TIMEOUT := 0 ENABLE_CODE_SEARCH_TIMEOUT := 0
ENABLE_KILL_REVIVE := 0 ENABLE_KILL_REVIVE := 0
ENABLE_AM_FIX := 1 ENABLE_AM_FIX := 1
ENABLE_AM_FIX_SHOW_DATA := 1 ENABLE_AM_FIX_SHOW_DATA := 0
ENABLE_SQUELCH_MORE_SENSITIVE := 1 ENABLE_SQUELCH_MORE_SENSITIVE := 1
ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS := 1 ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS := 1
ENABLE_FASTER_CHANNEL_SCAN := 1 ENABLE_FASTER_CHANNEL_SCAN := 1

View File

@ -36,6 +36,11 @@
// ********************** // **********************
// aircopy packet format is very simple ..
//
// payloads ................ 0xABCD + 2 byte eeprom address + 64 byte payload + 2 byte CRC + 0xDCBA
// 1of11 req/ack additon ... 0xBCDA + 2 byte eeprom address + 2 byte CRC + 0xCDBA
#define AIRCOPY_MAGIC_START_REQ 0xBCDA // used to request a block resend #define AIRCOPY_MAGIC_START_REQ 0xBCDA // used to request a block resend
#define AIRCOPY_MAGIC_END_REQ 0xCDBA // used to request a block resend #define AIRCOPY_MAGIC_END_REQ 0xCDBA // used to request a block resend
@ -44,11 +49,11 @@
#define AIRCOPY_LAST_EEPROM_ADDR 0x1E00 // size of eeprom transferred #define AIRCOPY_LAST_EEPROM_ADDR 0x1E00 // size of eeprom transferred
// FSK Data Length .. 0xABCD + 2 byte eeprom address + 64 byte payload + 2 byte CRC + 0xDCBA // FSK payload data length
#define AIRCOPY_DATA_PACKET_SIZE (2 + 2 + 64 + 2 + 2) #define AIRCOPY_DATA_PACKET_SIZE (2 + 2 + 64 + 2 + 2)
// FSK Data Length .. 0xBCDA + 2 byte eeprom address + 2 byte CRC + 0xCDBA // FSK req/ack data length .. 0xBCDA + 2 byte eeprom address + 2 byte CRC + 0xCDBA
#define AIRCOPY_REQ_PACKET_SIZE (2 + 2 + 64 + 2 + 2) #define AIRCOPY_REQ_PACKET_SIZE (2 + 2 + 2 + 2)
// ********************** // **********************

View File

@ -88,6 +88,86 @@ void toggle_chan_scanlist(void)
g_flag_reset_vfos = true; g_flag_reset_vfos = true;
} }
#ifdef ENABLE_COPY_CHAN_TO_VFO_TO_CHAN
void MAIN_copy_mem_vfo_mem(void)
{
//const unsigned int vfo = get_RX_VFO();
const unsigned int vfo = g_eeprom.tx_vfo;
if (g_scan_state_dir != SCAN_STATE_DIR_OFF ||
g_css_scan_mode != CSS_SCAN_MODE_OFF ||
g_eeprom.dual_watch != DUAL_WATCH_OFF ||
!g_eeprom.vfo_open)
{ // scanning
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
return;
}
if (IS_USER_CHANNEL(g_eeprom.screen_channel[vfo]))
{ // copy channel to VFO, then swap to the VFO
const unsigned int channel = FREQ_CHANNEL_FIRST + g_eeprom.vfo_info[vfo].band;
g_eeprom.screen_channel[vfo] = channel;
g_eeprom.vfo_info[vfo].channel_save = channel;
g_eeprom.tx_vfo = vfo;
RADIO_select_vfos();
RADIO_ApplyOffset(g_tx_vfo);
RADIO_ConfigureSquelchAndOutputPower(g_tx_vfo);
RADIO_setup_registers(true);
// find the first channel that contains this frequency
g_tx_vfo->frequency_channel = BOARD_find_channel(g_tx_vfo->freq_config_tx.frequency);
g_request_save_vfo = true;
g_beep_to_play = BEEP_880HZ_60MS_TRIPLE_BEEP;
//g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
g_update_status = true;
g_update_display = true;
}
else
if (IS_NOT_NOAA_CHANNEL(g_eeprom.screen_channel[vfo]))
{ // copy VFO to a channel
// search the channels to see if the frequency is already present
unsigned int chan = BOARD_find_channel(g_eeprom.vfo_info[vfo].p_tx->frequency);
if (chan > USER_CHANNEL_LAST)
{ // find next next free channel
//for (chan = g_eeprom.screen_channel[vfo]; chan <= USER_CHANNEL_LAST; chan++)
for (chan = 0; chan <= USER_CHANNEL_LAST; chan++)
if (!RADIO_CheckValidChannel(chan, false, vfo))
break;
}
g_screen_to_display = DISPLAY_INVALID;
GUI_SelectNextDisplay(DISPLAY_MENU);
g_menu_cursor = MENU_MEM_SAVE;
g_is_in_sub_menu = true;
if (chan <= USER_CHANNEL_LAST)
{
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
UART_printf("vfo to mem %u\r\n", chan);
#endif
g_sub_menu_selection = chan;
g_flag_refresh_menu = false;
g_screen_to_display = DISPLAY_MENU;
g_update_display = false;
UI_DisplayMenu();
}
#ifdef ENABLE_VOICE
g_another_voice_id = VOICE_ID_MENU;
#endif
g_beep_to_play = BEEP_880HZ_60MS_TRIPLE_BEEP;
}
}
#endif
void processFKeyFunction(const key_code_t Key) void processFKeyFunction(const key_code_t Key)
{ {
uint8_t Band; uint8_t Band;
@ -625,81 +705,7 @@ void MAIN_Key_MENU(const bool key_pressed, const bool key_held)
g_update_status = true; g_update_status = true;
#ifdef ENABLE_COPY_CHAN_TO_VFO_TO_CHAN #ifdef ENABLE_COPY_CHAN_TO_VFO_TO_CHAN
MAIN_copy_mem_vfo_mem();
if (g_scan_state_dir == SCAN_STATE_DIR_OFF &&
g_css_scan_mode == CSS_SCAN_MODE_OFF &&
g_eeprom.dual_watch == DUAL_WATCH_OFF &&
g_eeprom.vfo_open)
{ // not scanning
//const unsigned int vfo = get_RX_VFO();
const unsigned int vfo = g_eeprom.tx_vfo;
if (IS_USER_CHANNEL(g_eeprom.screen_channel[vfo]))
{ // copy channel to VFO, then swap to the VFO
const unsigned int channel = FREQ_CHANNEL_FIRST + g_eeprom.vfo_info[vfo].band;
g_eeprom.screen_channel[vfo] = channel;
g_eeprom.vfo_info[vfo].channel_save = channel;
g_eeprom.tx_vfo = vfo;
RADIO_select_vfos();
RADIO_ApplyOffset(g_rx_vfo);
RADIO_ConfigureSquelchAndOutputPower(g_rx_vfo);
RADIO_setup_registers(true);
g_request_save_vfo = true;
g_beep_to_play = BEEP_880HZ_60MS_TRIPLE_BEEP;
//g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
g_update_status = true;
g_update_display = true;
}
else
if (IS_NOT_NOAA_CHANNEL(g_eeprom.screen_channel[vfo]))
{ // copy VFO to a channel
// search the channels to see if the frequency is already present
unsigned int chan = BOARD_find_channel(g_eeprom.vfo_info[vfo].p_tx->frequency);
if (chan > USER_CHANNEL_LAST)
{ // find next next free channel
//for (chan = g_eeprom.screen_channel[vfo]; chan <= USER_CHANNEL_LAST; chan++)
for (chan = 0; chan <= USER_CHANNEL_LAST; chan++)
if (!RADIO_CheckValidChannel(chan, false, vfo))
break;
}
g_screen_to_display = DISPLAY_INVALID;
GUI_SelectNextDisplay(DISPLAY_MENU);
g_menu_cursor = MENU_MEM_SAVE;
g_is_in_sub_menu = true;
if (chan <= USER_CHANNEL_LAST)
{
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
UART_printf("vfo to mem %u\r\n", chan);
#endif
g_sub_menu_selection = chan;
g_flag_refresh_menu = false;
g_screen_to_display = DISPLAY_MENU;
g_update_display = false;
UI_DisplayMenu();
}
#ifdef ENABLE_VOICE
g_another_voice_id = VOICE_ID_MENU;
#endif
g_beep_to_play = BEEP_880HZ_60MS_TRIPLE_BEEP;
}
}
else
{
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
}
#endif #endif
} }
} }

View File

@ -390,23 +390,3 @@ const uint8_t BITMAP_SCANLIST2[6] =
__extension__ 0b01111110, __extension__ 0b01111110,
__extension__ 0b01000010 __extension__ 0b01000010
}; };
const uint8_t BITMAP_COMPAND[6] =
{
__extension__ 0b00000000,
__extension__ 0b00111100,
__extension__ 0b01000010,
__extension__ 0b01000010,
__extension__ 0b01000010,
__extension__ 0b00100100
};
const uint8_t BITMAP_FREQ_CHAN[6] =
{
__extension__ 0b00000000,
__extension__ 0b01111110,
__extension__ 0b00010010,
__extension__ 0b00010010,
__extension__ 0b00000010,
__extension__ 0b00000010
};

View File

@ -59,9 +59,5 @@ extern const uint8_t BITMAP_VFO_NOT_DEFAULT[8];
extern const uint8_t BITMAP_SCANLIST1[6]; extern const uint8_t BITMAP_SCANLIST1[6];
extern const uint8_t BITMAP_SCANLIST2[6]; extern const uint8_t BITMAP_SCANLIST2[6];
extern const uint8_t BITMAP_COMPAND[6];
extern const uint8_t BITMAP_FREQ_CHAN[6];
#endif #endif

Binary file not shown.

Binary file not shown.

429
font.c
View File

@ -477,169 +477,266 @@ const uint8_t g_font_small[95][6] =
{0x0C, 0x06, 0x0C, 0x18, 0x0C, 0x00} {0x0C, 0x06, 0x0C, 0x18, 0x0C, 0x00}
}; };
#endif #endif
/*
#ifdef ENABLE_SPECTRUM const uint8_t g_font_small_4x5[95][4] =
const uint8_t g_font3x5[160][3] = {
{ {0x00, 0x00, 0x00, 0x00}, // ' '
{0x00, 0x00, 0x00}, // 32 - space {0x00, 0x00, 0x17, 0x00}, // '!'
{0x00, 0x17, 0x00}, // 33 - exclam {0x20, 0x00, 0x03, 0x00}, // '"'
{0x03, 0x00, 0x03}, // 34 - quotedbl {0x00, 0x00, 0x00, 0x0A}, // '#'
{0x1f, 0x0a, 0x1f}, // 35 - numbersign {0x0A, 0x1F, 0x28, 0x00}, // '$'
{0x0a, 0x1f, 0x05}, // 36 - dollar {0x15, 0x1F, 0x09, 0x70}, // '%'
{0x09, 0x04, 0x12}, // 37 - percent {0x11, 0x08, 0x04, 0x13}, // '&'
{0x0f, 0x17, 0x1c}, // 38 - ampersand {0x00, 0x1E, 0x15, 0x15}, // '''
{0x00, 0x03, 0x00}, // 39 - quotesingle {0x78, 0x00, 0x00, 0x00}, // '('
{0x00, 0x0e, 0x11}, // 40 - parenleft {0x07, 0x00, 0x00, 0x0E}, // ')'
{0x11, 0x0e, 0x00}, // 41 - parenright {0x00, 0x00, 0x20, 0x00}, // '*'
{0x05, 0x02, 0x05}, // 42 - asterisk {0x11, 0x0E, 0x00, 0x20}, // '+'
{0x04, 0x0e, 0x04}, // 43 - plus {0x12, 0x0C, 0x0C, 0x12}, // ','
{0x10, 0x08, 0x00}, // 44 - comma {0x00, 0x04, 0x0E, 0x04}, // '-'
{0x04, 0x04, 0x04}, // 45 - hyphen {0x00, 0x00, 0x00, 0x10}, // '.'
{0x00, 0x10, 0x00}, // 46 - period {0x00, 0x20, 0x00, 0x04}, // '/'
{0x18, 0x04, 0x03}, // 47 - slash {0x04, 0x00, 0x00, 0x00}, // '0'
{0x1e, 0x11, 0x0f}, // 48 - zero {0x10, 0x00, 0x00, 0x20}, // '1'
{0x02, 0x1f, 0x00}, // 49 - one {0x10, 0x08, 0x04, 0x03}, // '2'
{0x19, 0x15, 0x12}, // 50 - two {0x00, 0x0E, 0x11, 0x11}, // '3'
{0x11, 0x15, 0x0a}, // 51 - three {0x30, 0x00, 0x00, 0x12}, // '4'
{0x07, 0x04, 0x1f}, // 52 - four {0x10, 0x38, 0x00, 0x19}, // '5'
{0x17, 0x15, 0x09}, // 53 - five {0x15, 0x12, 0x78, 0x00}, // '6'
{0x1e, 0x15, 0x1d}, // 54 - six {0x15, 0x15, 0x1F, 0x78}, // '7'
{0x19, 0x05, 0x03}, // 55 - seven {0x0C, 0x0A, 0x09, 0x1F}, // '8'
{0x1f, 0x15, 0x1f}, // 56 - eight {0x00, 0x17, 0x15, 0x15}, // '9'
{0x17, 0x15, 0x0f}, // 57 - nine {0x78, 0x00, 0x1E, 0x15}, // ':'
{0x00, 0x0a, 0x00}, // 58 - colon {0x1D, 0x78, 0x00, 0x01}, // ';'
{0x10, 0x0a, 0x00}, // 59 - semicolon {0x05, 0x03, 0x20, 0x00}, // '<'
{0x04, 0x0a, 0x11}, // 60 - less {0x15, 0x15, 0x0A, 0x30}, // '='
{0x0a, 0x0a, 0x0a}, // 61 - equal {0x07, 0x05, 0x05, 0x1F}, // '>'
{0x11, 0x0a, 0x04}, // 62 - greater {0x00, 0x00, 0x16, 0x00}, // '?'
{0x01, 0x15, 0x03}, // 63 - question {0x20, 0x00, 0x00, 0x10}, // '@'
{0x0e, 0x15, 0x16}, // 64 - at {0x00, 0x20, 0x00, 0x08}, // 'A'
{0x1e, 0x05, 0x1e}, // 65 - A {0x22, 0x01, 0x20, 0x10}, // 'B'
{0x1f, 0x15, 0x0a}, // 66 - B {0x0A, 0x0A, 0x00, 0x00}, // 'C'
{0x0e, 0x11, 0x11}, // 67 - C {0x00, 0x01, 0x22, 0x14}, // 'D'
{0x1f, 0x11, 0x0e}, // 68 - D {0x10, 0x02, 0x11, 0x05}, // 'E'
{0x1f, 0x15, 0x15}, // 69 - E {0x20, 0x00, 0x0E, 0x15}, // 'F'
{0x1f, 0x05, 0x05}, // 70 - F {0x0E, 0x30, 0x00, 0x1E}, // 'G'
{0x0e, 0x15, 0x1d}, // 71 - G {0x05, 0x1E, 0x48, 0x00}, // 'H'
{0x1f, 0x04, 0x1f}, // 72 - H {0x15, 0x15, 0x0E, 0x70}, // 'I'
{0x11, 0x1f, 0x11}, // 73 - I {0x1F, 0x11, 0x11, 0x11}, // 'J'
{0x08, 0x10, 0x0f}, // 74 - J {0x00, 0x1F, 0x11, 0x11}, // 'K'
{0x1f, 0x04, 0x1b}, // 75 - K {0x70, 0x00, 0x1F, 0x15}, // 'L'
{0x1f, 0x10, 0x10}, // 76 - L {0x11, 0x78, 0x00, 0x1F}, // 'M'
{0x1f, 0x06, 0x1f}, // 77 - M {0x05, 0x01, 0x40, 0x00}, // 'N'
{0x1f, 0x0e, 0x1f}, // 78 - N {0x11, 0x15, 0x1D, 0x78}, // 'O'
{0x0e, 0x11, 0x0e}, // 79 - O {0x1F, 0x04, 0x04, 0x1F}, // 'P'
{0x1f, 0x05, 0x02}, // 80 - P {0x00, 0x11, 0x1F, 0x11}, // 'Q'
{0x0e, 0x19, 0x1e}, // 81 - Q {0x70, 0x00, 0x08, 0x11}, // 'R'
{0x1f, 0x0d, 0x16}, // 82 - R {0x1F, 0x38, 0x00, 0x1F}, // 'S'
{0x12, 0x15, 0x09}, // 83 - S {0x0A, 0x11, 0x48, 0x00}, // 'T'
{0x01, 0x1f, 0x01}, // 84 - T {0x10, 0x10, 0x10, 0x78}, // 'U'
{0x0f, 0x10, 0x1f}, // 85 - U {0x1F, 0x02, 0x02, 0x1F}, // 'V'
{0x07, 0x18, 0x07}, // 86 - V {0x00, 0x1F, 0x02, 0x04}, // 'W'
{0x1f, 0x0c, 0x1f}, // 87 - W {0x48, 0x00, 0x0E, 0x11}, // 'X'
{0x1b, 0x04, 0x1b}, // 88 - X {0x0E, 0x30, 0x00, 0x1F}, // 'Y'
{0x03, 0x1c, 0x03}, // 89 - Y {0x05, 0x02, 0x40, 0x00}, // 'Z'
{0x19, 0x15, 0x13}, // 90 - Z {0x11, 0x19, 0x1E, 0x38}, // '['
{0x1f, 0x11, 0x11}, // 91 - bracketleft {0x1F, 0x05, 0x05, 0x1A}, // '\'
{0x02, 0x04, 0x08}, // 92 - backslash {0x00, 0x12, 0x15, 0x15}, // ']'
{0x11, 0x11, 0x1f}, // 93 - bracketright {0x70, 0x00, 0x01, 0x1F}, // '^'
{0x02, 0x01, 0x02}, // 94 - asciicircum {0x00, 0x20, 0x00, 0x1F}, // '_'
{0x10, 0x10, 0x10}, // 95 - underscore {0x10, 0x1F, 0x78, 0x00}, // '`'
{0x01, 0x02, 0x00}, // 96 - grave {0x10, 0x10, 0x0F, 0x30}, // 'a'
{0x1a, 0x16, 0x1c}, // 97 - a {0x1F, 0x08, 0x08, 0x1F}, // 'b'
{0x1f, 0x12, 0x0c}, // 98 - b {0x00, 0x1B, 0x04, 0x04}, // 'c'
{0x0c, 0x12, 0x12}, // 99 - c {0x48, 0x00, 0x07, 0x1C}, // 'd'
{0x0c, 0x12, 0x1f}, // 100 - d {0x00, 0x20, 0x00, 0x19}, // 'e'
{0x0c, 0x1a, 0x16}, // 101 - e {0x15, 0x13, 0x78, 0x00}, // 'f'
{0x04, 0x1e, 0x05}, // 102 - f {0x11, 0x00, 0x00, 0x60}, // 'g'
{0x0c, 0x2a, 0x1e}, // 103 - g {0x01, 0x02, 0x04, 0x08}, // 'h'
{0x1f, 0x02, 0x1c}, // 104 - h {0x00, 0x00, 0x11, 0x1F}, // 'i'
{0x00, 0x1d, 0x00}, // 105 - i {0x30, 0x00, 0x02, 0x01}, // 'j'
{0x10, 0x20, 0x1d}, // 106 - j {0x00, 0x00, 0x00, 0x10}, // 'k'
{0x1f, 0x0c, 0x12}, // 107 - k {0x10, 0x10, 0x78, 0x00}, // 'l'
{0x11, 0x1f, 0x10}, // 108 - l {0x03, 0x07, 0x06, 0x00}, // 'm'
{0x1e, 0x0e, 0x1e}, // 109 - m {0x1D, 0x15, 0x15, 0x1E}, // 'n'
{0x1e, 0x02, 0x1c}, // 110 - n {0x00, 0x1F, 0x14, 0x14}, // 'o'
{0x0c, 0x12, 0x0c}, // 111 - o {0x70, 0x00, 0x0C, 0x12}, // 'p'
{0x3e, 0x12, 0x0c}, // 112 - p {0x12, 0x38, 0x00, 0x08}, // 'q'
{0x0c, 0x12, 0x3e}, // 113 - q {0x14, 0x1F, 0x38, 0x00}, // 'r'
{0x1c, 0x02, 0x02}, // 114 - r {0x15, 0x15, 0x16, 0x38}, // 's'
{0x14, 0x1e, 0x0a}, // 115 - s {0x1E, 0x05, 0x05, 0x00}, // 't'
{0x02, 0x1f, 0x12}, // 116 - t {0x00, 0x02, 0x15, 0x15}, // 'u'
{0x0e, 0x10, 0x1e}, // 117 - u {0x38, 0x00, 0x1F, 0x04}, // 'v'
{0x0e, 0x18, 0x0e}, // 118 - v {0x18, 0x48, 0x00, 0x00}, // 'w'
{0x1e, 0x1c, 0x1e}, // 119 - w {0x00, 0x00, 0x20, 0x00}, // 'x'
{0x12, 0x0c, 0x12}, // 120 - x {0x10, 0x1D, 0x00, 0x30}, // 'y'
{0x06, 0x28, 0x1e}, // 121 - y {0x1F, 0x04, 0x0A, 0x10}, // 'z'
{0x1a, 0x1e, 0x16}, // 122 - z {0x00, 0x00, 0x1F, 0x00}, // '{'
{0x04, 0x1b, 0x11}, // 123 - braceleft {0x20, 0x00, 0x1E, 0x04}, // '|'
{0x00, 0x1b, 0x00}, // 124 - bar {0x1E, 0x48, 0x00, 0x1E}, // '}'
{0x11, 0x1b, 0x04}, // 125 - braceright {0x02, 0x1C, 0x48, 0x00}, // '~'
{0x02, 0x03, 0x01}, // 126 - asciitilde };
{0x00, 0x00, 0x00}, // 127 - empty */
{0x00, 0x00, 0x00}, // 128 - empty const uint8_t g_font3x5[160][3] =
{0x00, 0x00, 0x00}, // 129 - empty {
{0x00, 0x00, 0x00}, // 130 - empty {0x00, 0x00, 0x00}, // 32 - space
{0x00, 0x00, 0x00}, // 131 - empty {0x00, 0x17, 0x00}, // 33 - exclam
{0x00, 0x00, 0x00}, // 132 - empty {0x03, 0x00, 0x03}, // 34 - quotedbl
{0x00, 0x00, 0x00}, // 133 - empty {0x1f, 0x0a, 0x1f}, // 35 - numbersign
{0x00, 0x00, 0x00}, // 134 - empty {0x0a, 0x1f, 0x05}, // 36 - dollar
{0x00, 0x00, 0x00}, // 135 - empty {0x09, 0x04, 0x12}, // 37 - percent
{0x00, 0x00, 0x00}, // 136 - empty {0x0f, 0x17, 0x1c}, // 38 - ampersand
{0x00, 0x00, 0x00}, // 137 - empty {0x00, 0x03, 0x00}, // 39 - quotesingle
{0x00, 0x00, 0x00}, // 138 - empty {0x00, 0x0e, 0x11}, // 40 - parenleft
{0x00, 0x00, 0x00}, // 139 - empty {0x11, 0x0e, 0x00}, // 41 - parenright
{0x00, 0x00, 0x00}, // 140 - empty {0x05, 0x02, 0x05}, // 42 - asterisk
{0x00, 0x00, 0x00}, // 141 - empty {0x04, 0x0e, 0x04}, // 43 - plus
{0x00, 0x00, 0x00}, // 142 - empty {0x10, 0x08, 0x00}, // 44 - comma
{0x00, 0x00, 0x00}, // 143 - empty {0x04, 0x04, 0x04}, // 45 - hyphen
{0x00, 0x00, 0x00}, // 144 - empty {0x00, 0x10, 0x00}, // 46 - period
{0x00, 0x00, 0x00}, // 145 - empty {0x18, 0x04, 0x03}, // 47 - slash
{0x00, 0x00, 0x00}, // 146 - empty {0x1e, 0x11, 0x0f}, // 48 - zero
{0x00, 0x00, 0x00}, // 147 - empty {0x02, 0x1f, 0x00}, // 49 - one
{0x00, 0x00, 0x00}, // 148 - empty {0x19, 0x15, 0x12}, // 50 - two
{0x00, 0x00, 0x00}, // 149 - empty {0x11, 0x15, 0x0a}, // 51 - three
{0x00, 0x00, 0x00}, // 150 - empty {0x07, 0x04, 0x1f}, // 52 - four
{0x00, 0x00, 0x00}, // 151 - empty {0x17, 0x15, 0x09}, // 53 - five
{0x00, 0x00, 0x00}, // 152 - empty {0x1e, 0x15, 0x1d}, // 54 - six
{0x00, 0x00, 0x00}, // 153 - empty {0x19, 0x05, 0x03}, // 55 - seven
{0x00, 0x00, 0x00}, // 154 - empty {0x1f, 0x15, 0x1f}, // 56 - eight
{0x00, 0x00, 0x00}, // 155 - empty {0x17, 0x15, 0x0f}, // 57 - nine
{0x00, 0x00, 0x00}, // 156 - empty {0x00, 0x0a, 0x00}, // 58 - colon
{0x00, 0x00, 0x00}, // 157 - empty {0x10, 0x0a, 0x00}, // 59 - semicolon
{0x00, 0x00, 0x00}, // 158 - empty {0x04, 0x0a, 0x11}, // 60 - less
{0x00, 0x00, 0x00}, // 159 - empty {0x0a, 0x0a, 0x0a}, // 61 - equal
{0x00, 0x00, 0x00}, // 160 - empty {0x11, 0x0a, 0x04}, // 62 - greater
{0x00, 0x1d, 0x00}, // 161 - exclamdown {0x01, 0x15, 0x03}, // 63 - question
{0x0e, 0x1b, 0x0a}, // 162 - cent {0x0e, 0x15, 0x16}, // 64 - at
{0x14, 0x1f, 0x15}, // 163 - sterling {0x1e, 0x05, 0x1e}, // 65 - A
{0x15, 0x0e, 0x15}, // 164 - currency {0x1f, 0x15, 0x0a}, // 66 - B
{0x0b, 0x1c, 0x0b}, // 165 - yen {0x0e, 0x11, 0x11}, // 67 - C
{0x00, 0x1b, 0x00}, // 166 - brokenbar {0x1f, 0x11, 0x0e}, // 68 - D
{0x14, 0x1b, 0x05}, // 167 - section {0x1f, 0x15, 0x15}, // 69 - E
{0x01, 0x00, 0x01}, // 168 - dieresis {0x1f, 0x05, 0x05}, // 70 - F
{0x02, 0x05, 0x05}, // 169 - copyright {0x0e, 0x15, 0x1d}, // 71 - G
{0x16, 0x15, 0x17}, // 170 - ordfeminine {0x1f, 0x04, 0x1f}, // 72 - H
{0x02, 0x05, 0x00}, // 171 - guillemotleft {0x11, 0x1f, 0x11}, // 73 - I
{0x02, 0x02, 0x06}, // 172 - logicalnot {0x08, 0x10, 0x0f}, // 74 - J
{0x04, 0x04, 0x00}, // 173 - softhyphen {0x1f, 0x04, 0x1b}, // 75 - K
{0x07, 0x03, 0x04}, // 174 - registered {0x1f, 0x10, 0x10}, // 76 - L
{0x01, 0x01, 0x01}, // 175 - macron {0x1f, 0x06, 0x1f}, // 77 - M
{0x02, 0x05, 0x02}, // 176 - degree {0x1f, 0x0e, 0x1f}, // 78 - N
{0x12, 0x17, 0x12}, // 177 - plusminus {0x0e, 0x11, 0x0e}, // 79 - O
{0x01, 0x07, 0x04}, // 178 - twosuperior {0x1f, 0x05, 0x02}, // 80 - P
{0x05, 0x07, 0x07}, // 179 - threesuperior {0x0e, 0x19, 0x1e}, // 81 - Q
{0x00, 0x02, 0x01}, // 180 - acute {0x1f, 0x0d, 0x16}, // 82 - R
{0x1f, 0x08, 0x07}, // 181 - mu {0x12, 0x15, 0x09}, // 83 - S
{0x02, 0x1d, 0x1f}, // 182 - paragraph {0x01, 0x1f, 0x01}, // 84 - T
{0x0e, 0x0e, 0x0e}, // 183 - periodcentered {0x0f, 0x10, 0x1f}, // 85 - U
{0x10, 0x14, 0x08}, // 184 - cedilla {0x07, 0x18, 0x07}, // 86 - V
{0x00, 0x07, 0x00}, // 185 - onesuperior {0x1f, 0x0c, 0x1f}, // 87 - W
{0x12, 0x15, 0x12}, // 186 - ordmasculine {0x1b, 0x04, 0x1b}, // 88 - X
{0x00, 0x05, 0x02}, // 187 - guillemotright {0x03, 0x1c, 0x03}, // 89 - Y
{0x03, 0x08, 0x18}, // 188 - onequarter {0x19, 0x15, 0x13}, // 90 - Z
{0x0b, 0x18, 0x10}, // 189 - onehalf {0x1f, 0x11, 0x11}, // 91 - bracketleft
{0x03, 0x0b, 0x18}, // 190 - threequarters {0x02, 0x04, 0x08}, // 92 - backslash
{0x18, 0x15, 0x10}, // 191 - questiondown {0x11, 0x11, 0x1f}, // 93 - bracketright
}; {0x02, 0x01, 0x02}, // 94 - asciicircum
#endif {0x10, 0x10, 0x10}, // 95 - underscore
{0x01, 0x02, 0x00}, // 96 - grave
{0x1a, 0x16, 0x1c}, // 97 - a
{0x1f, 0x12, 0x0c}, // 98 - b
{0x0c, 0x12, 0x12}, // 99 - c
{0x0c, 0x12, 0x1f}, // 100 - d
{0x0c, 0x1a, 0x16}, // 101 - e
{0x04, 0x1e, 0x05}, // 102 - f
{0x0c, 0x2a, 0x1e}, // 103 - g
{0x1f, 0x02, 0x1c}, // 104 - h
{0x00, 0x1d, 0x00}, // 105 - i
{0x10, 0x20, 0x1d}, // 106 - j
{0x1f, 0x0c, 0x12}, // 107 - k
{0x11, 0x1f, 0x10}, // 108 - l
{0x1e, 0x0e, 0x1e}, // 109 - m
{0x1e, 0x02, 0x1c}, // 110 - n
{0x0c, 0x12, 0x0c}, // 111 - o
{0x3e, 0x12, 0x0c}, // 112 - p
{0x0c, 0x12, 0x3e}, // 113 - q
{0x1c, 0x02, 0x02}, // 114 - r
{0x14, 0x1e, 0x0a}, // 115 - s
{0x02, 0x1f, 0x12}, // 116 - t
{0x0e, 0x10, 0x1e}, // 117 - u
{0x0e, 0x18, 0x0e}, // 118 - v
{0x1e, 0x1c, 0x1e}, // 119 - w
{0x12, 0x0c, 0x12}, // 120 - x
{0x06, 0x28, 0x1e}, // 121 - y
{0x1a, 0x1e, 0x16}, // 122 - z
{0x04, 0x1b, 0x11}, // 123 - braceleft
{0x00, 0x1b, 0x00}, // 124 - bar
{0x11, 0x1b, 0x04}, // 125 - braceright
{0x02, 0x03, 0x01}, // 126 - asciitilde
{0x00, 0x00, 0x00}, // 127 - empty
{0x00, 0x00, 0x00}, // 128 - empty
{0x00, 0x00, 0x00}, // 129 - empty
{0x00, 0x00, 0x00}, // 130 - empty
{0x00, 0x00, 0x00}, // 131 - empty
{0x00, 0x00, 0x00}, // 132 - empty
{0x00, 0x00, 0x00}, // 133 - empty
{0x00, 0x00, 0x00}, // 134 - empty
{0x00, 0x00, 0x00}, // 135 - empty
{0x00, 0x00, 0x00}, // 136 - empty
{0x00, 0x00, 0x00}, // 137 - empty
{0x00, 0x00, 0x00}, // 138 - empty
{0x00, 0x00, 0x00}, // 139 - empty
{0x00, 0x00, 0x00}, // 140 - empty
{0x00, 0x00, 0x00}, // 141 - empty
{0x00, 0x00, 0x00}, // 142 - empty
{0x00, 0x00, 0x00}, // 143 - empty
{0x00, 0x00, 0x00}, // 144 - empty
{0x00, 0x00, 0x00}, // 145 - empty
{0x00, 0x00, 0x00}, // 146 - empty
{0x00, 0x00, 0x00}, // 147 - empty
{0x00, 0x00, 0x00}, // 148 - empty
{0x00, 0x00, 0x00}, // 149 - empty
{0x00, 0x00, 0x00}, // 150 - empty
{0x00, 0x00, 0x00}, // 151 - empty
{0x00, 0x00, 0x00}, // 152 - empty
{0x00, 0x00, 0x00}, // 153 - empty
{0x00, 0x00, 0x00}, // 154 - empty
{0x00, 0x00, 0x00}, // 155 - empty
{0x00, 0x00, 0x00}, // 156 - empty
{0x00, 0x00, 0x00}, // 157 - empty
{0x00, 0x00, 0x00}, // 158 - empty
{0x00, 0x00, 0x00}, // 159 - empty
{0x00, 0x00, 0x00}, // 160 - empty
{0x00, 0x1d, 0x00}, // 161 - exclamdown
{0x0e, 0x1b, 0x0a}, // 162 - cent
{0x14, 0x1f, 0x15}, // 163 - sterling
{0x15, 0x0e, 0x15}, // 164 - currency
{0x0b, 0x1c, 0x0b}, // 165 - yen
{0x00, 0x1b, 0x00}, // 166 - brokenbar
{0x14, 0x1b, 0x05}, // 167 - section
{0x01, 0x00, 0x01}, // 168 - dieresis
{0x02, 0x05, 0x05}, // 169 - copyright
{0x16, 0x15, 0x17}, // 170 - ordfeminine
{0x02, 0x05, 0x00}, // 171 - guillemotleft
{0x02, 0x02, 0x06}, // 172 - logicalnot
{0x04, 0x04, 0x00}, // 173 - softhyphen
{0x07, 0x03, 0x04}, // 174 - registered
{0x01, 0x01, 0x01}, // 175 - macron
{0x02, 0x05, 0x02}, // 176 - degree
{0x12, 0x17, 0x12}, // 177 - plusminus
{0x01, 0x07, 0x04}, // 178 - twosuperior
{0x05, 0x07, 0x07}, // 179 - threesuperior
{0x00, 0x02, 0x01}, // 180 - acute
{0x1f, 0x08, 0x07}, // 181 - mu
{0x02, 0x1d, 0x1f}, // 182 - paragraph
{0x0e, 0x0e, 0x0e}, // 183 - periodcentered
{0x10, 0x14, 0x08}, // 184 - cedilla
{0x00, 0x07, 0x00}, // 185 - onesuperior
{0x12, 0x15, 0x12}, // 186 - ordmasculine
{0x00, 0x05, 0x02}, // 187 - guillemotright
{0x03, 0x08, 0x18}, // 188 - onequarter
{0x0b, 0x18, 0x10}, // 189 - onehalf
{0x03, 0x0b, 0x18}, // 190 - threequarters
{0x18, 0x15, 0x10}, // 191 - questiondown
};

2
font.h
View File

@ -26,6 +26,8 @@ extern const uint8_t g_font_small[95][6];
#ifdef ENABLE_SMALL_BOLD #ifdef ENABLE_SMALL_BOLD
extern const uint8_t g_font_small_bold[95][6]; extern const uint8_t g_font_small_bold[95][6];
#endif #endif
//extern const uint8_t g_font_small_4x5[95][4];
extern const uint8_t g_font3x5[160][3];
#endif #endif

View File

@ -135,52 +135,59 @@ typedef enum mdf_display_mode_e mdf_display_mode_t;
// 16 bytes // 16 bytes
typedef struct { typedef struct {
// [0] // [0]
uint32_t frequency; // uint32_t frequency; //
// [4] // [4]
uint32_t offset; // uint32_t offset; //
// [8] // [8]
uint8_t rx_ctcss_cdcss_code; // uint8_t rx_ctcss_cdcss_code; //
// [9] // [9]
uint8_t tx_ctcss_cdcss_code; // uint8_t tx_ctcss_cdcss_code; //
// [10] // [10]
uint8_t rx_ctcss_cdcss_type:2; // uint8_t rx_ctcss_cdcss_type:2; //
uint8_t unused1:2; // uint8_t unused1:2; //
uint8_t tx_ctcss_cdcss_type:2; // uint8_t tx_ctcss_cdcss_type:2; //
uint8_t unused2:2; // uint8_t unused2:2; //
// [11] // [11]
uint8_t tx_offset_dir:2; // uint8_t tx_offset_dir:2; //
uint8_t unused3:2; // uint8_t unused3:2; //
uint8_t am_mode:1; // uint8_t am_mode:1; //
uint8_t unused4:3; // uint8_t unused4:3; //
// [12] // [12]
uint8_t frequency_reverse:1; // reverse repeater uint8_t frequency_reverse:1; // reverse repeater
uint8_t channel_bandwidth:1; // wide/narrow uint8_t channel_bandwidth:1; // wide/narrow
uint8_t tx_power:2; // 0, 1 or 2 .. L, M or H uint8_t tx_power:2; // 0, 1 or 2 .. L, M or H
uint8_t busy_channel_lock:1; // uint8_t busy_channel_lock:1; //
#if 0 #if 0
// QS // QS
uint8_t unused5:3; // uint8_t unused5:3; //
#else #else
// 1of11 // 1of11
uint8_t unused5:1; // uint8_t unused5:1; //
uint8_t compand:2; // 0 = off, 1 = TX, 2 = RX, 3 = TX/RX uint8_t compand:2; // 0 = off, 1 = TX, 2 = RX, 3 = TX/RX
#endif #endif
// [13] // [13]
uint8_t dtmf_decoding_enable:1; // uint8_t dtmf_decoding_enable:1; //
uint8_t dtmf_ptt_id_tx_mode:3; // uint8_t dtmf_ptt_id_tx_mode:3; //
uint8_t unused6:4; // uint8_t unused6:4; //
// [14] // [14]
uint8_t step_setting; // uint8_t step_setting; //
// [15] // [15]
uint8_t scrambler:4; // uint8_t scrambler:4; //
#if 0 #if 0
// QS // QS
uint8_t unused7:4; // uint8_t unused7:4; //
#else #else
// 1of11 // 1of11
uint8_t squelch_level:4; // 0 ~ 9 per channel squelch, 0 = use main squelch level uint8_t squelch_level:4; // 0 ~ 9 per channel squelch, 0 = use main squelch level
#endif #endif
} __attribute__((packed)) t_channel; // } __attribute__((packed)) t_channel; //
typedef struct {
uint8_t band:4; // why do QS have these bits ? band can/is computed from the frequency
uint8_t unused:2; //
uint8_t scanlist2:1; // set if in scan list 2
uint8_t scanlist1:1; // set if in scan list 1
} __attribute__((packed)) t_channel_attr; //
// 512 bytes // 512 bytes
typedef struct { typedef struct {
@ -270,12 +277,7 @@ typedef struct {
} __attribute__((packed)); // } __attribute__((packed)); //
// 0x0D60 // 0x0D60
struct { // these channel attribute settings could have been in the t_channel structure ! t_channel_attr channel_attr[200]; //
uint8_t band:4; // why do QS have these bits ? band can/is computed from the frequency
uint8_t unused:2; //
uint8_t scanlist2:1; // set if in scan list 2
uint8_t scanlist1:1; // set if in scan list 1
} __attribute__((packed)) channel_attr[200]; //
uint8_t unused1[8]; // 0xff's uint8_t unused1[8]; // 0xff's
@ -412,10 +414,10 @@ typedef struct {
uint8_t dtmf_live_decoder:1; // 1 = enable on-screen live DTMF decoder uint8_t dtmf_live_decoder:1; // 1 = enable on-screen live DTMF decoder
uint8_t battery_text:2; // 0 = no battery text, 1 = voltage, 2 = percent .. on the status bar uint8_t battery_text:2; // 0 = no battery text, 1 = voltage, 2 = percent .. on the status bar
uint8_t mic_bar:1; // 1 = on-screen TX audio level uint8_t mic_bar:1; // 1 = on-screen TX audio level
uint8_t am_fix:1; // 1 = RX AM fix uint8_t am_fix:1; // 1 = enable RX AM fix
uint8_t backlight_on_tx_rx:2; // 0 = no backlight when TX/RX, 1 = when TX, 2 = when RX, 3 = both RX/TX uint8_t backlight_on_tx_rx:2; // 0 = no backlight when TX/RX, 1 = when TX, 2 = when RX, 3 = both RX/TX
uint8_t scan_hold_time; // ticks we stay paused on a signal when scanning uint8_t scan_hold_time; // ticks we stay paused for on an RX'ed signal when scanning
uint8_t unused12[7]; // 0xff's uint8_t unused12[7]; // 0xff's
#endif #endif

View File

@ -90,65 +90,110 @@ void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Lin
} }
} }
void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_t Line) void UI_print_string(
const char *str,
unsigned int start,
const unsigned int end,
const unsigned int line,
const uint8_t *font,
const unsigned int font_size,
const unsigned int char_width)
{ {
const size_t Length = strlen(pString);
size_t i;
if (End > Start)
Start += (((End - Start) - (Length * 7)) + 1) / 2;
const unsigned int char_width = ARRAY_SIZE(g_font_small[0]);
const unsigned int char_spacing = char_width + 1; const unsigned int char_spacing = char_width + 1;
uint8_t *pFb = g_frame_buffer[Line] + Start; const size_t length = strlen(str);
for (i = 0; i < Length; i++) unsigned int i;
uint8_t *f_buf;
if (end > start)
start += (((end - start) - (length * (char_width - 1))) + 1) / 2;
f_buf = g_frame_buffer[line] + start;
for (i = 0; i < length; i++)
{ {
if (pString[i] >= 32) const int c = (int)str[i] - ' ';
{ if (c >= 0 && c < (int)font_size)
const unsigned int index = (unsigned int)pString[i] - 32; memmove(f_buf + (char_spacing * i) + 1, font + (char_width * c), char_width);
if (index < ARRAY_SIZE(g_font_small))
memmove(pFb + (i * char_spacing) + 1, &g_font_small[index], char_width);
}
} }
} }
void UI_PrintStringSmall(const char *str, const unsigned int start, const unsigned int end, const unsigned int line)
{
UI_print_string(str, start, end, line, (const uint8_t *)g_font_small, ARRAY_SIZE(g_font_small), ARRAY_SIZE(g_font_small[0]));
}
#ifdef ENABLE_SMALL_BOLD #ifdef ENABLE_SMALL_BOLD
void UI_PrintStringSmallBold(const char *pString, uint8_t Start, uint8_t End, uint8_t Line) void UI_PrintStringSmallBold(const char *str, const unsigned int start, const unsigned int end, const unsigned int line)
{ {
const size_t Length = strlen(pString); UI_print_string(str, start, end, line, (const uint8_t *)g_font_small_bold, ARRAY_SIZE(g_font_small_bold), ARRAY_SIZE(g_font_small_bold[0]));
size_t i;
if (End > Start)
Start += (((End - Start) - (Length * 7)) + 1) / 2;
const unsigned int char_width = ARRAY_SIZE(g_font_small_bold[0]);
const unsigned int char_spacing = char_width + 1;
uint8_t *pFb = g_frame_buffer[Line] + Start;
for (i = 0; i < Length; i++)
{
if (pString[i] >= 32)
{
const unsigned int index = (unsigned int)pString[i] - 32;
if (index < ARRAY_SIZE(g_font_small_bold))
memmove(pFb + (i * char_spacing) + 1, &g_font_small_bold[index], char_width);
}
}
} }
#endif #endif
/*
void UI_PrintStringSmall4x5(const char *str, const unsigned int start, const unsigned int end, const unsigned int line)
{
UI_print_string(str, start, end, line, (const uint8_t *)g_font_small_4x5, ARRAY_SIZE(g_font_small_4x5), ARRAY_SIZE(g_font_small_4x5[0]));
}
*/
void PutPixel(const unsigned int x, const unsigned int y, const bool fill)
{
if (fill)
g_frame_buffer[y >> 3][x] |= 1u << (y & 7u);
else
g_frame_buffer[y >> 3][x] &= ~(1u << (y & 7u));
}
void PutPixelStatus(const unsigned int x, const unsigned int y, bool fill)
{
if (fill)
g_status_line[x] |= 1u << y;
else
g_status_line[x] &= ~(1u << y);
}
void UI_PrintStringSmallest(const void *pString, unsigned int x, const unsigned int y, const bool statusbar, const bool fill)
{
const unsigned int char_width = ARRAY_SIZE(g_font3x5[0]);
const unsigned int char_height = 5;
// const uint8_t pixel_mask = (1u << char_height) - 1;
const uint8_t *p = (const uint8_t *)pString;
int c;
while ((c = *p++) != 0)
{
c -= ' ';
if (c >= 0 && c < (int)ARRAY_SIZE(g_font3x5))
{
for (unsigned int xx = 0; xx < char_width; xx++)
{
uint8_t pixels = g_font3x5[c][xx];
if (statusbar)
{
for (unsigned int yy = 0; yy <= char_height; yy++, pixels >>= 1)
if (pixels & 1u)
PutPixelStatus(x + xx, y + yy, fill);
}
else
{
for (unsigned int yy = 0; yy <= char_height; yy++, pixels >>= 1)
if (pixels & 1u)
PutPixel(x + xx, y + yy, fill);
}
}
}
x += char_width + 1;
}
}
void UI_PrintStringSmallBuffer(const char *pString, uint8_t *buffer) void UI_PrintStringSmallBuffer(const char *pString, uint8_t *buffer)
{ {
size_t i;
const unsigned int char_width = ARRAY_SIZE(g_font_small[0]); const unsigned int char_width = ARRAY_SIZE(g_font_small[0]);
const unsigned int char_spacing = char_width + 1; const unsigned int char_spacing = char_width + 1;
unsigned int i;
for (i = 0; i < strlen(pString); i++) for (i = 0; i < strlen(pString); i++)
{ {
if (pString[i] >= 32) const int c = (int)pString[i] - ' ';
{ if (c >= 0 && c < (int)ARRAY_SIZE(g_font_small))
const unsigned int index = (unsigned int)pString[i] - 32; memmove(buffer + (i * char_spacing) + 1, &g_font_small[c], char_width);
if (index < ARRAY_SIZE(g_font_small))
memmove(buffer + (i * char_spacing) + 1, &g_font_small[index], char_width);
}
} }
} }

View File

@ -23,10 +23,12 @@
void UI_GenerateChannelString(char *pString, const uint8_t Channel, const char separating_char); void UI_GenerateChannelString(char *pString, const uint8_t Channel, const char separating_char);
void UI_GenerateChannelStringEx(char *pString, const char *prefix, const uint8_t ChannelNumber); void UI_GenerateChannelStringEx(char *pString, const char *prefix, const uint8_t ChannelNumber);
void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t Width); void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t Width);
void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_t Line); void UI_PrintStringSmall(const char *str, const unsigned int start, const unsigned int end, const unsigned int line);
#ifdef ENABLE_SMALL_BOLD #ifdef ENABLE_SMALL_BOLD
void UI_PrintStringSmallBold(const char *pString, uint8_t Start, uint8_t End, uint8_t Line); void UI_PrintStringSmallBold(const char *str, const unsigned int start, const unsigned int end, const unsigned int line);
#endif #endif
//void UI_PrintStringSmall4x5(const char *str, const unsigned int start, const unsigned int end, const unsigned int line);
void UI_PrintStringSmallest(const void *pString, unsigned int x, const unsigned int y, const bool statusbar, const bool fill);
void UI_PrintStringSmallBuffer(const char *pString, uint8_t *buffer); void UI_PrintStringSmallBuffer(const char *pString, uint8_t *buffer);
void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool flag); void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool flag);
void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero); void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero);

View File

@ -31,6 +31,7 @@
#include "driver/bk4819.h" #include "driver/bk4819.h"
#include "driver/st7565.h" #include "driver/st7565.h"
#include "external/printf/printf.h" #include "external/printf/printf.h"
#include "font.h"
#include "functions.h" #include "functions.h"
#include "helper/battery.h" #include "helper/battery.h"
#include "misc.h" #include "misc.h"
@ -395,6 +396,7 @@ void UI_update_rssi(const int16_t rssi, const int vfo)
void UI_DisplayMain(void) void UI_DisplayMain(void)
{ {
const unsigned int smallest_char_spacing = ARRAY_SIZE(g_font3x5[0]) + 1;
const unsigned int line0 = 0; // text screen line const unsigned int line0 = 0; // text screen line
const unsigned int line1 = 4; const unsigned int line1 = 4;
char String[17]; char String[17];
@ -746,19 +748,22 @@ void UI_DisplayMain(void)
#else #else
{ {
unsigned int x = LCD_WIDTH + LCD_WIDTH - 1 - sizeof(BITMAP_FREQ_CHAN) - sizeof(BITMAP_COMPAND); unsigned int x = LCD_WIDTH + LCD_WIDTH - 1 - (smallest_char_spacing * 1) - (smallest_char_spacing * 4);
if (g_eeprom.vfo_info[vfo_num].compand)
memmove(p_line0 + x, BITMAP_COMPAND, sizeof(BITMAP_COMPAND));
x += sizeof(BITMAP_COMPAND);
if (IS_FREQ_CHANNEL(g_eeprom.screen_channel[vfo_num])) if (IS_FREQ_CHANNEL(g_eeprom.screen_channel[vfo_num]))
{ {
//g_eeprom.vfo_info[vfo_num].frequency_channel = BOARD_find_channel(frequency); //g_eeprom.vfo_info[vfo_num].frequency_channel = BOARD_find_channel(frequency);
if (g_eeprom.vfo_info[vfo_num].frequency_channel <= USER_CHANNEL_LAST) if (g_eeprom.vfo_info[vfo_num].frequency_channel <= USER_CHANNEL_LAST)
memmove(p_line0 + x, BITMAP_FREQ_CHAN, sizeof(BITMAP_FREQ_CHAN)); { // the channel number that contains this VFO frequency
//x += sizeof(BITMAP_FREQ_CHAN); sprintf(String, "%03u", g_eeprom.vfo_info[vfo_num].frequency_channel);
UI_PrintStringSmallest(String, x, (line + 0) * 8, false, true);
}
} }
x += smallest_char_spacing * 4;
if (g_eeprom.vfo_info[vfo_num].compand)
UI_PrintStringSmallest("C", x, (line + 0) * 8, false, true);
//x += smallest_char_spacing * 1;
} }
#endif #endif
} }
@ -846,6 +851,8 @@ void UI_DisplayMain(void)
#else #else
if (g_eeprom.vfo_info[vfo_num].dtmf_decoding_enable) if (g_eeprom.vfo_info[vfo_num].dtmf_decoding_enable)
UI_PrintStringSmall("DTMF", LCD_WIDTH + 78, 0, line + 1); UI_PrintStringSmall("DTMF", LCD_WIDTH + 78, 0, line + 1);
//UI_PrintStringSmall4x5("DTMF", LCD_WIDTH + 78, 0, line + 1); // font table is currently wrong
//UI_PrintStringSmallest("DTMF", LCD_WIDTH + 78, (line + 1) * 8, false, true);
#endif #endif
// show the audio scramble symbol // show the audio scramble symbol

View File

@ -20,6 +20,10 @@
#include <string.h> #include <string.h>
#include <vector> #include <vector>
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#endif
// ************************************************************************ // ************************************************************************
// create a front end gain table for the firmware // create a front end gain table for the firmware
@ -346,7 +350,7 @@ void create_gain_table(const char *filename)
fclose(file); fclose(file);
} }
// ************************************************************************ // ************************************************************************
// "rotate_font()" has nothing to do with this program at all, I just needed // "rotate_font()" has nothing to do with this program at all, I just needed
// to write a bit of code to rotate some fonts I've drawn // to write a bit of code to rotate some fonts I've drawn
@ -397,19 +401,19 @@ void rotate_font(const char *filename1, const char *filename2)
{ {
uint8_t c1[8]; uint8_t c1[8];
uint8_t c2[8]; uint8_t c2[8];
memcpy(c1, &data[i], 8); memcpy(c1, &data[i], ARRAY_SIZE(c1));
memset(c2, 0, 8); memset(c2, 0, ARRAY_SIZE(c2));
for (unsigned int k = 0; k < 8; k++) for (unsigned int k = 0; k < ARRAY_SIZE(c1); k++)
{ {
uint8_t b = c1[k]; uint8_t b = c1[k];
for (unsigned int m = 0; m < 8; m++) for (unsigned int m = 0; m < ARRAY_SIZE(c2); m++)
{ {
if (b & 0x80) if (b & 0x80)
c2[m] |= 1u << k; c2[m] |= 1u << k;
b <<= 1; b <<= 1;
} }
} }
memcpy(&data[i], c2, 8); memcpy(&data[i], c2, ARRAY_SIZE(c2));
} }
// *************************** // ***************************
@ -422,7 +426,7 @@ void rotate_font(const char *filename1, const char *filename2)
fprintf(file, "const uint8_t gFontSmall[95][7] =\n"); fprintf(file, "const uint8_t gFontSmall[95][7] =\n");
fprintf(file, "{\n"); fprintf(file, "{\n");
for (unsigned int i = 0; i < data.size(); ) for (unsigned int i = 0, c = ' '; i < data.size() && c < (' ' + 95); i++, c++)
{ {
char s[1024]; char s[1024];
memset(s, 0, sizeof(s)); memset(s, 0, sizeof(s));
@ -445,13 +449,122 @@ void rotate_font(const char *filename1, const char *filename2)
else else
{ {
strcat(s, s2); strcat(s, s2);
strcat(s, "},\n"); strcat(s, "},");
} }
} }
i++; fprintf(file, "%s // '%c'\n", s, c);
}
fprintf(file, "%s", s); fprintf(file, "};\n");
fclose(file);
// ***************************
}
// ************************************************************************
// "rotate_font()" has nothing to do with this program at all, I just needed
// to write a bit of code to rotate some fonts I've drawn
void rotate_font_4x5(const char *filename1, const char *filename2)
{
std::vector <uint8_t> data;
if (filename1 == NULL || filename2 == NULL)
return;
// ****************************
// load the file
FILE *file = fopen(filename1, "rb");
if (file == NULL)
return;
if (fseek(file, 0, SEEK_END) != 0)
{
fclose(file);
return;
}
const size_t file_size = ftell(file);
if (file_size <= 0)
{
fclose(file);
return;
}
if (fseek(file, 0, SEEK_SET) != 0)
{
fclose(file);
return;
}
data.resize(file_size);
const size_t bytes_loaded = fread(&data[0], 1, file_size, file);
fclose(file);
if (bytes_loaded != file_size)
return;
// ***************************
// rotate the font 90-deg clockwise
for (unsigned int i = 0; i <= (data.size() - 6); i += 6)
{
uint8_t c1[6];
uint8_t c2[4];
memcpy(c1, &data[i], 6);
memset(c2, 0, 4);
for (unsigned int k = 0; k < ARRAY_SIZE(c1); k++)
{
uint8_t b = c1[k];
for (unsigned int m = 0; m < ARRAY_SIZE(c2); m++)
{
if (b & 0x40)
c2[m] |= 1u << k;
b <<= 1;
}
}
memcpy(&data[i], c2, 4);
}
// ***************************
// save the file
file = fopen(filename2, "wt");
if (file == NULL)
return;
fprintf(file, "const uint8_t g_font_small_4x5[95][4] =\n");
fprintf(file, "{\n");
for (unsigned int i = 0, c = ' '; i < data.size() && c < (' ' + 95); i++, c++)
{
char s[1024];
memset(s, 0, sizeof(s));
for (unsigned int k = 0; k < 4 && i < data.size(); k++)
{
char s2[16];
sprintf(s2, "0x%02X", data[i++]);
if (k == 0)
strcat(s, "\t{");
if (k < 3)
{
strcat(s, s2);
strcat(s, ", ");
}
else
{
strcat(s, s2);
strcat(s, "},");
}
}
fprintf(file, "%s // '%c'\n", s, c);
} }
fprintf(file, "};\n"); fprintf(file, "};\n");
@ -466,8 +579,9 @@ int main(int argc, char* argv[])
{ {
create_gain_table("gain_table.c"); create_gain_table("gain_table.c");
rotate_font("uv-k5_small.bin", "uv-k5_small.c"); rotate_font("uv-k5_small.bin", "uv-k5_small.c");
rotate_font("uv-k5_small_bold.bin", "uv-k5_small_bold.c"); rotate_font("uv-k5_small_bold.bin", "uv-k5_small_bold.c");
rotate_font_4x5("uv-k5_small_4x5.bin", "uv-k5_small_4x5.c");
return 0; return 0;
} }

Binary file not shown.

BIN
utils/uv-k5_small_4x5.bin Normal file

Binary file not shown.