forked from mirror/uv-k5-firmware
More restructuring of functions and variables.
This commit is contained in:
parent
3aa58ce5c4
commit
05382584f4
8
Makefile
8
Makefile
@ -40,7 +40,6 @@ OBJS += app/generic.o
|
||||
OBJS += app/main.o
|
||||
OBJS += app/menu.o
|
||||
OBJS += audio.o
|
||||
OBJS += battery.o
|
||||
OBJS += bitmaps.o
|
||||
OBJS += board.o
|
||||
OBJS += dcs.o
|
||||
@ -49,20 +48,25 @@ OBJS += fm.o
|
||||
OBJS += font.o
|
||||
OBJS += frequencies.o
|
||||
OBJS += functions.o
|
||||
OBJS += gui.o
|
||||
OBJS += helper.o
|
||||
OBJS += helper/battery.o
|
||||
OBJS += misc.o
|
||||
OBJS += radio.o
|
||||
OBJS += scheduler.o
|
||||
OBJS += settings.o
|
||||
OBJS += ui/aircopy.o
|
||||
OBJS += ui/battery.o
|
||||
OBJS += ui/fmradio.o
|
||||
OBJS += ui/helper.o
|
||||
OBJS += ui/inputbox.o
|
||||
OBJS += ui/lock.o
|
||||
OBJS += ui/main.o
|
||||
OBJS += ui/menu.o
|
||||
OBJS += ui/rssi.o
|
||||
OBJS += ui/scanner.o
|
||||
OBJS += ui/status.o
|
||||
OBJS += ui/ui.o
|
||||
OBJS += ui/welcome.o
|
||||
|
||||
OBJS += main.o
|
||||
|
||||
|
10
app/app.c
10
app/app.c
@ -21,7 +21,6 @@
|
||||
#include "app/main.h"
|
||||
#include "app/menu.h"
|
||||
#include "audio.h"
|
||||
#include "battery.h"
|
||||
#include "board.h"
|
||||
#include "bsp/dp32g030/gpio.h"
|
||||
#include "driver/backlight.h"
|
||||
@ -36,15 +35,18 @@
|
||||
#include "fm.h"
|
||||
#include "frequencies.h"
|
||||
#include "functions.h"
|
||||
#include "gui.h"
|
||||
#include "helper.h"
|
||||
#include "helper/battery.h"
|
||||
#include "misc.h"
|
||||
#include "radio.h"
|
||||
#include "settings.h"
|
||||
#include "sram-overlay.h"
|
||||
#include "ui/battery.h"
|
||||
#include "ui/inputbox.h"
|
||||
#include "ui/menu.h"
|
||||
#include "ui/rssi.h"
|
||||
#include "ui/status.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||
void FUN_000069f8(FUNCTION_Type_t Function);
|
||||
@ -1047,7 +1049,7 @@ void APP_TimeSlice10ms(void)
|
||||
|
||||
if (gCurrentFunction != FUNCTION_TRANSMIT) {
|
||||
if (g_2000036F == 1) {
|
||||
GUI_DisplayStatusLine();
|
||||
UI_DisplayStatus();
|
||||
g_2000036F = 0;
|
||||
}
|
||||
if (gUpdateDisplay) {
|
||||
@ -1291,7 +1293,7 @@ LAB_00004b08:
|
||||
|
||||
if (gLowBattery) {
|
||||
gLowBatteryBlink = ++g_20000400 & 1;
|
||||
GUI_DisplayBatteryLevel(g_20000400);
|
||||
UI_DisplayBattery(g_20000400);
|
||||
if (gCurrentFunction != FUNCTION_TRANSMIT) {
|
||||
if (g_20000400 < 30) {
|
||||
if (g_20000400 == 29 && gChargingWithTypeC == false) {
|
||||
|
@ -1,13 +1,14 @@
|
||||
#include "app/generic.h"
|
||||
#include "audio.h"
|
||||
#include "driver/keyboard.h"
|
||||
#include "dtmf.h"
|
||||
#include "external/printf/printf.h"
|
||||
#include "fm.h"
|
||||
#include "functions.h"
|
||||
#include "gui.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
#include "ui/inputbox.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
extern void FUN_0000773c(void);
|
||||
extern void PlayFMRadio(void);
|
||||
|
@ -4,11 +4,11 @@
|
||||
#include "dtmf.h"
|
||||
#include "fm.h"
|
||||
#include "frequencies.h"
|
||||
#include "gui.h"
|
||||
#include "misc.h"
|
||||
#include "radio.h"
|
||||
#include "settings.h"
|
||||
#include "ui/inputbox.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
extern void APP_SwitchToFM(void);
|
||||
extern void FUN_0000773c(void);
|
||||
|
@ -7,12 +7,12 @@
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/keyboard.h"
|
||||
#include "frequencies.h"
|
||||
#include "gui.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
#include "sram-overlay.h"
|
||||
#include "ui/inputbox.h"
|
||||
#include "ui/menu.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
static const VOICE_ID_t MenuVoices[] = {
|
||||
VOICE_ID_SQUELCH,
|
||||
|
2
audio.c
2
audio.c
@ -23,9 +23,9 @@
|
||||
#include "driver/systick.h"
|
||||
#include "fm.h"
|
||||
#include "functions.h"
|
||||
#include "gui.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
static const uint8_t VoiceClipLengthChinese[58] = {
|
||||
0x32, 0x32, 0x32, 0x37, 0x37, 0x32, 0x32, 0x32,
|
||||
|
2
board.c
2
board.c
@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "battery.h"
|
||||
#include "board.h"
|
||||
#include "bsp/dp32g030/gpio.h"
|
||||
#include "bsp/dp32g030/portcon.h"
|
||||
@ -34,6 +33,7 @@
|
||||
#include "dtmf.h"
|
||||
#include "fm.h"
|
||||
#include "frequencies.h"
|
||||
#include "helper/battery.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
#include "sram-overlay.h"
|
||||
|
@ -20,6 +20,11 @@
|
||||
#include "driver/keyboard.h"
|
||||
#include "driver/systick.h"
|
||||
|
||||
KEY_Code_t gKeyReading0;
|
||||
KEY_Code_t gKeyReading1;
|
||||
uint8_t gDebounceCounter;
|
||||
bool gWasFKeyPressed;
|
||||
|
||||
KEY_Code_t KEYBOARD_Poll(void)
|
||||
{
|
||||
KEY_Code_t Key = KEY_INVALID;
|
||||
|
@ -18,6 +18,9 @@
|
||||
#ifndef DRIVER_KEYBOARD_H
|
||||
#define DRIVER_KEYBOARD_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
enum KEY_Code_t {
|
||||
KEY_0 = 0,
|
||||
KEY_1 = 1,
|
||||
@ -43,6 +46,11 @@ enum KEY_Code_t {
|
||||
|
||||
typedef enum KEY_Code_t KEY_Code_t;
|
||||
|
||||
extern KEY_Code_t gKeyReading0;
|
||||
extern KEY_Code_t gKeyReading1;
|
||||
extern uint8_t gDebounceCounter;
|
||||
extern bool gWasFKeyPressed;
|
||||
|
||||
KEY_Code_t KEYBOARD_Poll(void);
|
||||
|
||||
#endif
|
||||
|
@ -15,7 +15,6 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "battery.h"
|
||||
#include "bsp/dp32g030/gpio.h"
|
||||
#include "dcs.h"
|
||||
#include "driver/bk1080.h"
|
||||
@ -26,10 +25,12 @@
|
||||
#include "external/printf/printf.h"
|
||||
#include "fm.h"
|
||||
#include "functions.h"
|
||||
#include "gui.h"
|
||||
#include "helper/battery.h"
|
||||
#include "misc.h"
|
||||
#include "radio.h"
|
||||
#include "settings.h"
|
||||
#include "ui/status.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
FUNCTION_Type_t gCurrentFunction;
|
||||
|
||||
@ -81,7 +82,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
if (Function != FUNCTION_POWER_SAVE) {
|
||||
BK4819_Conditional_RX_TurnOn_and_GPIO6_Enable();
|
||||
gThisCanEnable_BK4819_Rxon = false;
|
||||
GUI_DisplayStatusLine();
|
||||
UI_DisplayStatus();
|
||||
}
|
||||
}
|
||||
|
||||
|
306
gui.c
306
gui.c
@ -1,306 +0,0 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "audio.h"
|
||||
#include "battery.h"
|
||||
#include "bitmaps.h"
|
||||
#include "driver/eeprom.h"
|
||||
#include "driver/keyboard.h"
|
||||
#include "driver/st7565.h"
|
||||
#include "external/printf/printf.h"
|
||||
#include "fm.h"
|
||||
#include "functions.h"
|
||||
#include "gui.h"
|
||||
#include "helper.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
#include "ui/aircopy.h"
|
||||
#include "ui/fmradio.h"
|
||||
#include "ui/helper.h"
|
||||
#include "ui/inputbox.h"
|
||||
#include "ui/main.h"
|
||||
#include "ui/menu.h"
|
||||
#include "ui/scanner.h"
|
||||
|
||||
GUI_DisplayType_t gScreenToDisplay;
|
||||
volatile int8_t gStepDirection;
|
||||
GUI_DisplayType_t gRequestDisplayScreen;
|
||||
uint8_t g_200003BB;
|
||||
bool gWasFKeyPressed;
|
||||
|
||||
uint8_t gAskForConfirmation;
|
||||
bool gAskToSave;
|
||||
bool gAskToDelete;
|
||||
|
||||
void GUI_DisplayBatteryLevel(uint8_t BatteryLevel)
|
||||
{
|
||||
const uint8_t *pBitmap;
|
||||
bool bClearMode = false;
|
||||
|
||||
if (gCurrentFunction != 1) {
|
||||
switch (BatteryLevel) {
|
||||
case 0:
|
||||
pBitmap = NULL;
|
||||
bClearMode = 1;
|
||||
break;
|
||||
case 1:
|
||||
pBitmap = BITMAP_BatteryLevel1;
|
||||
break;
|
||||
case 2:
|
||||
pBitmap = BITMAP_BatteryLevel2;
|
||||
break;
|
||||
case 3:
|
||||
pBitmap = BITMAP_BatteryLevel3;
|
||||
break;
|
||||
case 4:
|
||||
pBitmap = BITMAP_BatteryLevel4;
|
||||
break;
|
||||
default:
|
||||
pBitmap = BITMAP_BatteryLevel5;
|
||||
break;
|
||||
}
|
||||
ST7565_DrawLine(110, 0, 18, pBitmap, bClearMode);
|
||||
}
|
||||
}
|
||||
|
||||
void GUI_Welcome(void)
|
||||
{
|
||||
char WelcomeString0[16];
|
||||
char WelcomeString1[16];
|
||||
|
||||
memset(gStatusLine, 0, sizeof(gStatusLine));
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
|
||||
if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_FULL_SCREEN) {
|
||||
ST7565_FillScreen(0xFF);
|
||||
} else {
|
||||
memset(WelcomeString0, 0, sizeof(WelcomeString0));
|
||||
memset(WelcomeString1, 0, sizeof(WelcomeString1));
|
||||
if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_VOLTAGE) {
|
||||
sprintf(WelcomeString0, "VOLTAGE");
|
||||
sprintf(WelcomeString1, "%.2fV", gBatteryVoltageAverage * 0.01);
|
||||
} else {
|
||||
EEPROM_ReadBuffer(0x0EB0, WelcomeString0, 16);
|
||||
EEPROM_ReadBuffer(0x0EC0, WelcomeString1, 16);
|
||||
}
|
||||
UI_PrintString(WelcomeString0, 0, 127, 1, 10, true);
|
||||
UI_PrintString(WelcomeString1, 0, 127, 3, 10, true);
|
||||
ST7565_BlitStatusLine();
|
||||
ST7565_BlitFullScreen();
|
||||
}
|
||||
}
|
||||
|
||||
void GUI_PasswordScreen(void)
|
||||
{
|
||||
KEY_Code_t Key;
|
||||
BEEP_Type_t Beep;
|
||||
|
||||
gUpdateDisplay = true;
|
||||
memset(gInputBox, 10, sizeof(gInputBox));
|
||||
|
||||
while (1) {
|
||||
while (!gNextTimeslice) {
|
||||
}
|
||||
// TODO: Original code doesn't do the below, but is needed for proper key debounce.
|
||||
gNextTimeslice = false;
|
||||
Key = KEYBOARD_Poll();
|
||||
if (gKeyReading0 == Key) {
|
||||
gDebounceCounter++;
|
||||
if (gDebounceCounter == 2) {
|
||||
if (Key == KEY_INVALID) {
|
||||
gKeyReading1 = KEY_INVALID;
|
||||
} else {
|
||||
gKeyReading1 = Key;
|
||||
switch (Key) {
|
||||
case KEY_0: case KEY_1: case KEY_2: case KEY_3:
|
||||
case KEY_4: case KEY_5: case KEY_6: case KEY_7:
|
||||
case KEY_8: case KEY_9:
|
||||
INPUTBOX_Append(Key - KEY_0);
|
||||
if (gInputBoxIndex < 6) {
|
||||
Beep = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
} else {
|
||||
uint32_t Password;
|
||||
|
||||
gInputBoxIndex = 0;
|
||||
NUMBER_Get(gInputBox, &Password);
|
||||
if ((gEeprom.POWER_ON_PASSWORD * 100) == Password) {
|
||||
AUDIO_PlayBeep(BEEP_1KHZ_60MS_OPTIONAL);
|
||||
return;
|
||||
}
|
||||
memset(gInputBox, 10, sizeof(gInputBox));
|
||||
Beep = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
}
|
||||
AUDIO_PlayBeep(Beep);
|
||||
gUpdateDisplay = true;
|
||||
break;
|
||||
case KEY_EXIT: // Delete digit
|
||||
if (gInputBoxIndex) {
|
||||
gInputBoxIndex -= 1;
|
||||
gInputBox[gInputBoxIndex] = 10;
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
AUDIO_PlayBeep(BEEP_1KHZ_60MS_OPTIONAL);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
gKeyBeingHeld = false;
|
||||
}
|
||||
} else {
|
||||
gDebounceCounter = 0;
|
||||
gKeyReading0 = Key;
|
||||
}
|
||||
#if 0
|
||||
if (UART_CheckForCommand()) {
|
||||
__disable_irq();
|
||||
ProcessUartCommand();
|
||||
__enable_irq();
|
||||
}
|
||||
#endif
|
||||
if (gUpdateDisplay) {
|
||||
GUI_LockScreen();
|
||||
gUpdateDisplay = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GUI_LockScreen(void)
|
||||
{
|
||||
char String[7];
|
||||
uint8_t i;
|
||||
|
||||
memset(gStatusLine, 0, sizeof(gStatusLine));
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
strcpy(String, "LOCK");
|
||||
UI_PrintString(String, 0, 127, 1, 10, true);
|
||||
for (i = 0; i < 6; i++) {
|
||||
if (gInputBox[i] == 10) {
|
||||
String[i] = '-';
|
||||
} else {
|
||||
String[i] = '*';
|
||||
}
|
||||
}
|
||||
String[6] = 0;
|
||||
UI_PrintString(String, 0, 127, 3, 12, true);
|
||||
ST7565_BlitStatusLine();
|
||||
ST7565_BlitFullScreen();
|
||||
}
|
||||
|
||||
void GUI_DisplayStatusLine(void)
|
||||
{
|
||||
memset(gStatusLine, 0, sizeof(gStatusLine));
|
||||
if (gCurrentFunction == FUNCTION_POWER_SAVE) {
|
||||
memcpy(gStatusLine, BITMAP_PowerSave, sizeof(BITMAP_PowerSave));
|
||||
}
|
||||
if (gBatteryDisplayLevel < 2) {
|
||||
if (gLowBatteryBlink == 1) {
|
||||
memcpy(gStatusLine + 110, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
||||
}
|
||||
} else {
|
||||
if (gBatteryDisplayLevel == 2) {
|
||||
memcpy(gStatusLine + 110, BITMAP_BatteryLevel2, sizeof(BITMAP_BatteryLevel2));
|
||||
} else if (gBatteryDisplayLevel == 3) {
|
||||
memcpy(gStatusLine + 110, BITMAP_BatteryLevel3, sizeof(BITMAP_BatteryLevel3));
|
||||
} else if (gBatteryDisplayLevel == 4) {
|
||||
memcpy(gStatusLine + 110, BITMAP_BatteryLevel4, sizeof(BITMAP_BatteryLevel4));
|
||||
} else {
|
||||
memcpy(gStatusLine + 110, BITMAP_BatteryLevel5, sizeof(BITMAP_BatteryLevel5));
|
||||
}
|
||||
}
|
||||
if (gChargingWithTypeC) {
|
||||
memcpy(gStatusLine + 100, BITMAP_USB_C, sizeof(BITMAP_USB_C));
|
||||
}
|
||||
if (gEeprom.KEY_LOCK) {
|
||||
memcpy(gStatusLine + 90, BITMAP_KeyLock, sizeof(BITMAP_KeyLock));
|
||||
} else if (gWasFKeyPressed) {
|
||||
memcpy(gStatusLine + 90, BITMAP_F_Key, sizeof(BITMAP_F_Key));
|
||||
}
|
||||
|
||||
if (gEeprom.VOX_SWITCH) {
|
||||
memcpy(gStatusLine + 71, BITMAP_VOX, sizeof(BITMAP_VOX));
|
||||
}
|
||||
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) {
|
||||
memcpy(gStatusLine + 58, BITMAP_WX, sizeof(BITMAP_WX));
|
||||
}
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) {
|
||||
memcpy(gStatusLine + 45, BITMAP_TDR, sizeof(BITMAP_TDR));
|
||||
}
|
||||
if (gEeprom.VOICE_PROMPT != VOICE_PROMPT_OFF) {
|
||||
memcpy(gStatusLine + 34, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt));
|
||||
}
|
||||
if (gSetting_KILLED) {
|
||||
memset(gStatusLine + 21, 0xFF, 10);
|
||||
}
|
||||
else if (gFmRadioMode) {
|
||||
memcpy(gStatusLine + 21, BITMAP_FM, sizeof(BITMAP_FM));
|
||||
}
|
||||
if (gIsNoaaMode) {
|
||||
memcpy(gStatusLine + 7, BITMAP_NOAA, sizeof(BITMAP_NOAA));
|
||||
}
|
||||
ST7565_BlitStatusLine();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
void GUI_DisplayScreen(void)
|
||||
{
|
||||
switch (gScreenToDisplay) {
|
||||
case DISPLAY_MAIN:
|
||||
UI_DisplayMain();
|
||||
break;
|
||||
case DISPLAY_FM:
|
||||
UI_DisplayFM();
|
||||
break;
|
||||
case DISPLAY_MENU:
|
||||
UI_DisplayMenu();
|
||||
break;
|
||||
case DISPLAY_SCANNER:
|
||||
UI_DisplayScanner();
|
||||
break;
|
||||
case DISPLAY_AIRCOPY:
|
||||
UI_DisplayAircopy();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GUI_SelectNextDisplay(GUI_DisplayType_t Display)
|
||||
{
|
||||
if (Display != DISPLAY_INVALID) {
|
||||
if (gScreenToDisplay != Display) {
|
||||
gInputBoxIndex = 0;
|
||||
gIsInSubMenu = false;
|
||||
g_20000381 = 0;
|
||||
gStepDirection = 0;
|
||||
g_20000390 = 0;
|
||||
gAskForConfirmation = 0;
|
||||
g_200003BA = 0;
|
||||
g_200003BB = 0;
|
||||
gF_LOCK = false;
|
||||
gAskToSave = false;
|
||||
gAskToDelete = false;
|
||||
if (gWasFKeyPressed) {
|
||||
gWasFKeyPressed = false;
|
||||
g_2000036F = 1;
|
||||
}
|
||||
}
|
||||
gUpdateDisplay = true;
|
||||
gScreenToDisplay = Display;
|
||||
}
|
||||
}
|
||||
|
8
helper.c
8
helper.c
@ -20,16 +20,12 @@
|
||||
#include "driver/keyboard.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/system.h"
|
||||
#include "gui.h"
|
||||
#include "helper.h"
|
||||
#include "misc.h"
|
||||
#include "radio.h"
|
||||
#include "settings.h"
|
||||
#include "ui/menu.h"
|
||||
|
||||
KEY_Code_t gKeyReading0;
|
||||
KEY_Code_t gKeyReading1;
|
||||
uint8_t g_2000042A;
|
||||
#include "ui/ui.h"
|
||||
|
||||
uint8_t HELPER_GetKey(void)
|
||||
{
|
||||
@ -48,7 +44,7 @@ uint8_t HELPER_GetKey(void)
|
||||
if (Keys[0] == Keys[1]) {
|
||||
gKeyReading0 = Keys[0];
|
||||
gKeyReading1 = Keys[0];
|
||||
g_2000042A = 2;
|
||||
gDebounceCounter = 2;
|
||||
if (i == KEY_SIDE1) {
|
||||
ret = 1;
|
||||
} else if (i == KEY_SIDE2) {
|
||||
|
4
helper.h
4
helper.h
@ -20,10 +20,6 @@
|
||||
#include <stdint.h>
|
||||
#include "driver/keyboard.h"
|
||||
|
||||
extern KEY_Code_t gKeyReading0;
|
||||
extern KEY_Code_t gKeyReading1;
|
||||
extern uint8_t g_2000042A;
|
||||
|
||||
uint8_t HELPER_GetKey(void);
|
||||
void HELPER_CheckBootKey(uint8_t KeyType);
|
||||
|
||||
|
@ -16,9 +16,10 @@
|
||||
|
||||
#include "battery.h"
|
||||
#include "driver/backlight.h"
|
||||
#include "gui.h"
|
||||
#include "misc.h"
|
||||
#include "ui/battery.h"
|
||||
#include "ui/menu.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
uint16_t gBatteryCalibration[6];
|
||||
uint16_t gBatteryCurrentVoltage;
|
||||
@ -83,7 +84,7 @@ void BATTERY_GetReadings(bool bDisplayBatteryLevel)
|
||||
} else {
|
||||
gLowBattery = false;
|
||||
if (bDisplayBatteryLevel) {
|
||||
GUI_DisplayBatteryLevel(gBatteryDisplayLevel);
|
||||
UI_DisplayBattery(gBatteryDisplayLevel);
|
||||
}
|
||||
}
|
||||
g_20000400 = 0;
|
9
main.c
9
main.c
@ -20,7 +20,6 @@
|
||||
|
||||
#include "app/app.h"
|
||||
#include "audio.h"
|
||||
#include "battery.h"
|
||||
#include "bsp/dp32g030/gpio.h"
|
||||
#include "bsp/dp32g030/portcon.h"
|
||||
#include "bsp/dp32g030/syscon.h"
|
||||
@ -40,11 +39,13 @@
|
||||
#include "dtmf.h"
|
||||
#include "external/printf/printf.h"
|
||||
#include "functions.h"
|
||||
#include "gui.h"
|
||||
#include "helper.h"
|
||||
#include "helper/battery.h"
|
||||
#include "misc.h"
|
||||
#include "radio.h"
|
||||
#include "settings.h"
|
||||
#include "ui/lock.h"
|
||||
#include "ui/welcome.h"
|
||||
|
||||
static const char Version[] = "UV-K5 Firmware, v0.01 Open Edition\r\n";
|
||||
|
||||
@ -104,7 +105,7 @@ void Main(void)
|
||||
uint8_t KeyType;
|
||||
uint8_t Channel;
|
||||
|
||||
GUI_Welcome();
|
||||
UI_DisplayWelcome();
|
||||
BACKLIGHT_TurnOn();
|
||||
SYSTEM_DelayMs(1000);
|
||||
gMenuListCount = 51;
|
||||
@ -113,7 +114,7 @@ void Main(void)
|
||||
KeyType = HELPER_GetKey();
|
||||
if (gEeprom.POWER_ON_PASSWORD < 1000000) {
|
||||
g_2000036E = 1;
|
||||
GUI_PasswordScreen();
|
||||
UI_DisplayLock();
|
||||
g_2000036E = 0;
|
||||
}
|
||||
|
||||
|
4
misc.c
4
misc.c
@ -106,6 +106,7 @@ uint8_t g_200003B4;
|
||||
uint16_t g_200003B6;
|
||||
uint16_t g_200003B8;
|
||||
uint8_t g_200003BA;
|
||||
uint8_t g_200003BB;
|
||||
uint8_t g_200003BC;
|
||||
uint8_t g_200003BD;
|
||||
uint8_t g_200003BE;
|
||||
@ -165,7 +166,6 @@ uint8_t gNoaaChannel;
|
||||
bool gUpdateDisplay;
|
||||
uint8_t gFmRadioCountdown;
|
||||
uint8_t gA_Scan_Channel;
|
||||
uint8_t gDebounceCounter;
|
||||
uint8_t gDTMF_AUTO_RESET_TIME;
|
||||
bool gF_LOCK;
|
||||
uint8_t gScanChannel;
|
||||
@ -194,6 +194,8 @@ int16_t gFM_FrequencyDeviation;
|
||||
|
||||
uint16_t gCurrentRSSI;
|
||||
|
||||
volatile int8_t gStepDirection;
|
||||
|
||||
// --------
|
||||
|
||||
void NUMBER_Get(char *pDigits, uint32_t *pInteger)
|
||||
|
4
misc.h
4
misc.h
@ -115,6 +115,7 @@ extern uint8_t g_200003B4;
|
||||
extern uint16_t g_200003B6;
|
||||
extern uint16_t g_200003B8;
|
||||
extern uint8_t g_200003BA;
|
||||
extern uint8_t g_200003BB;
|
||||
extern uint8_t g_200003BC;
|
||||
extern uint8_t g_200003BD;
|
||||
extern uint8_t g_200003BE;
|
||||
@ -174,7 +175,6 @@ extern uint8_t gNoaaChannel;
|
||||
extern bool gUpdateDisplay;
|
||||
extern uint8_t gFmRadioCountdown;
|
||||
extern uint8_t gA_Scan_Channel;
|
||||
extern uint8_t gDebounceCounter;
|
||||
extern uint8_t gDTMF_AUTO_RESET_TIME;
|
||||
extern bool gF_LOCK;
|
||||
extern uint8_t gScanChannel;
|
||||
@ -202,6 +202,8 @@ extern int16_t gFM_FrequencyDeviation;
|
||||
|
||||
extern uint16_t gCurrentRSSI;
|
||||
|
||||
extern volatile int8_t gStepDirection;
|
||||
|
||||
// --------
|
||||
|
||||
void NUMBER_Get(char *pDigits, uint32_t *pInteger);
|
||||
|
2
radio.c
2
radio.c
@ -16,7 +16,6 @@
|
||||
|
||||
#include <string.h>
|
||||
#include "audio.h"
|
||||
#include "battery.h"
|
||||
#include "bsp/dp32g030/gpio.h"
|
||||
#include "dcs.h"
|
||||
#include "driver/bk4819.h"
|
||||
@ -26,6 +25,7 @@
|
||||
#include "fm.h"
|
||||
#include "frequencies.h"
|
||||
#include "functions.h"
|
||||
#include "helper/battery.h"
|
||||
#include "misc.h"
|
||||
#include "radio.h"
|
||||
#include "settings.h"
|
||||
|
@ -15,9 +15,8 @@
|
||||
*/
|
||||
|
||||
#include "audio.h"
|
||||
#include "battery.h"
|
||||
#include "functions.h"
|
||||
#include "gui.h"
|
||||
#include "helper/battery.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
|
||||
|
53
ui/battery.c
Normal file
53
ui/battery.c
Normal file
@ -0,0 +1,53 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include "bitmaps.h"
|
||||
#include "driver/st7565.h"
|
||||
#include "functions.h"
|
||||
#include "ui/battery.h"
|
||||
|
||||
void UI_DisplayBattery(uint8_t Level)
|
||||
{
|
||||
const uint8_t *pBitmap;
|
||||
bool bClearMode = false;
|
||||
|
||||
if (gCurrentFunction != 1) {
|
||||
switch (Level) {
|
||||
case 0:
|
||||
pBitmap = NULL;
|
||||
bClearMode = 1;
|
||||
break;
|
||||
case 1:
|
||||
pBitmap = BITMAP_BatteryLevel1;
|
||||
break;
|
||||
case 2:
|
||||
pBitmap = BITMAP_BatteryLevel2;
|
||||
break;
|
||||
case 3:
|
||||
pBitmap = BITMAP_BatteryLevel3;
|
||||
break;
|
||||
case 4:
|
||||
pBitmap = BITMAP_BatteryLevel4;
|
||||
break;
|
||||
default:
|
||||
pBitmap = BITMAP_BatteryLevel5;
|
||||
break;
|
||||
}
|
||||
ST7565_DrawLine(110, 0, 18, pBitmap, bClearMode);
|
||||
}
|
||||
}
|
||||
|
26
ui/battery.h
Normal file
26
ui/battery.h
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef UI_BATTERY_H
|
||||
#define UI_BATTERY_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void UI_DisplayBattery(uint8_t Level);
|
||||
|
||||
#endif
|
||||
|
@ -18,12 +18,12 @@
|
||||
#include "driver/st7565.h"
|
||||
#include "external/printf/printf.h"
|
||||
#include "fm.h"
|
||||
#include "gui.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
#include "ui/fmradio.h"
|
||||
#include "ui/helper.h"
|
||||
#include "ui/inputbox.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
void UI_DisplayFM(void)
|
||||
{
|
||||
|
122
ui/lock.c
Normal file
122
ui/lock.c
Normal file
@ -0,0 +1,122 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "audio.h"
|
||||
#include "driver/keyboard.h"
|
||||
#include "driver/st7565.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
#include "ui/helper.h"
|
||||
#include "ui/inputbox.h"
|
||||
#include "ui/lock.h"
|
||||
|
||||
static void Render(void)
|
||||
{
|
||||
char String[7];
|
||||
uint8_t i;
|
||||
|
||||
memset(gStatusLine, 0, sizeof(gStatusLine));
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
strcpy(String, "LOCK");
|
||||
UI_PrintString(String, 0, 127, 1, 10, true);
|
||||
for (i = 0; i < 6; i++) {
|
||||
if (gInputBox[i] == 10) {
|
||||
String[i] = '-';
|
||||
} else {
|
||||
String[i] = '*';
|
||||
}
|
||||
}
|
||||
String[6] = 0;
|
||||
UI_PrintString(String, 0, 127, 3, 12, true);
|
||||
ST7565_BlitStatusLine();
|
||||
ST7565_BlitFullScreen();
|
||||
}
|
||||
|
||||
void UI_DisplayLock(void)
|
||||
{
|
||||
KEY_Code_t Key;
|
||||
BEEP_Type_t Beep;
|
||||
|
||||
gUpdateDisplay = true;
|
||||
memset(gInputBox, 10, sizeof(gInputBox));
|
||||
|
||||
while (1) {
|
||||
while (!gNextTimeslice) {
|
||||
}
|
||||
// TODO: Original code doesn't do the below, but is needed for proper key debounce.
|
||||
gNextTimeslice = false;
|
||||
Key = KEYBOARD_Poll();
|
||||
if (gKeyReading0 == Key) {
|
||||
gDebounceCounter++;
|
||||
if (gDebounceCounter == 2) {
|
||||
if (Key == KEY_INVALID) {
|
||||
gKeyReading1 = KEY_INVALID;
|
||||
} else {
|
||||
gKeyReading1 = Key;
|
||||
switch (Key) {
|
||||
case KEY_0: case KEY_1: case KEY_2: case KEY_3:
|
||||
case KEY_4: case KEY_5: case KEY_6: case KEY_7:
|
||||
case KEY_8: case KEY_9:
|
||||
INPUTBOX_Append(Key - KEY_0);
|
||||
if (gInputBoxIndex < 6) {
|
||||
Beep = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
} else {
|
||||
uint32_t Password;
|
||||
|
||||
gInputBoxIndex = 0;
|
||||
NUMBER_Get(gInputBox, &Password);
|
||||
if ((gEeprom.POWER_ON_PASSWORD * 100) == Password) {
|
||||
AUDIO_PlayBeep(BEEP_1KHZ_60MS_OPTIONAL);
|
||||
return;
|
||||
}
|
||||
memset(gInputBox, 10, sizeof(gInputBox));
|
||||
Beep = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
}
|
||||
AUDIO_PlayBeep(Beep);
|
||||
gUpdateDisplay = true;
|
||||
break;
|
||||
case KEY_EXIT: // Delete digit
|
||||
if (gInputBoxIndex) {
|
||||
gInputBoxIndex -= 1;
|
||||
gInputBox[gInputBoxIndex] = 10;
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
AUDIO_PlayBeep(BEEP_1KHZ_60MS_OPTIONAL);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
gKeyBeingHeld = false;
|
||||
}
|
||||
} else {
|
||||
gDebounceCounter = 0;
|
||||
gKeyReading0 = Key;
|
||||
}
|
||||
#if 0
|
||||
if (UART_CheckForCommand()) {
|
||||
__disable_irq();
|
||||
ProcessUartCommand();
|
||||
__enable_irq();
|
||||
}
|
||||
#endif
|
||||
if (gUpdateDisplay) {
|
||||
Render();
|
||||
gUpdateDisplay = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
23
ui/lock.h
Normal file
23
ui/lock.h
Normal file
@ -0,0 +1,23 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef UI_LOCK_H
|
||||
#define UI_LOCK_H
|
||||
|
||||
void UI_DisplayLock(void);
|
||||
|
||||
#endif
|
||||
|
14
ui/menu.c
14
ui/menu.c
@ -15,28 +15,18 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
//#include "app/aircopy.h"
|
||||
//#include "audio.h"
|
||||
#include "battery.h"
|
||||
#include "bitmaps.h"
|
||||
#include "dcs.h"
|
||||
//#include "driver/eeprom.h"
|
||||
//#include "driver/keyboard.h"
|
||||
#include "driver/st7565.h"
|
||||
#include "dtmf.h"
|
||||
#include "external/printf/printf.h"
|
||||
//#include "font.h"
|
||||
//#include "fm.h"
|
||||
//#include "functions.h"
|
||||
#include "gui.h"
|
||||
//#include "helper.h"
|
||||
#include "helper/battery.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
//#include "ui/aircopy.h"
|
||||
//#include "ui/fmradio.h"
|
||||
#include "ui/helper.h"
|
||||
#include "ui/inputbox.h"
|
||||
#include "ui/menu.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
static const char MenuList[][7] = {
|
||||
// 0x00
|
||||
|
@ -18,10 +18,10 @@
|
||||
#include "bitmaps.h"
|
||||
#include "driver/st7565.h"
|
||||
#include "functions.h"
|
||||
#include "gui.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
#include "ui/rssi.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
static void Render(uint8_t RssiLevel, uint8_t VFO)
|
||||
{
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "dcs.h"
|
||||
#include "driver/st7565.h"
|
||||
#include "external/printf/printf.h"
|
||||
#include "gui.h"
|
||||
#include "misc.h"
|
||||
#include "ui/helper.h"
|
||||
#include "ui/scanner.h"
|
||||
|
81
ui/status.c
Normal file
81
ui/status.c
Normal file
@ -0,0 +1,81 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "bitmaps.h"
|
||||
#include "driver/keyboard.h"
|
||||
#include "driver/st7565.h"
|
||||
#include "fm.h"
|
||||
#include "functions.h"
|
||||
#include "helper/battery.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
#include "ui/status.h"
|
||||
|
||||
void UI_DisplayStatus(void)
|
||||
{
|
||||
memset(gStatusLine, 0, sizeof(gStatusLine));
|
||||
if (gCurrentFunction == FUNCTION_POWER_SAVE) {
|
||||
memcpy(gStatusLine, BITMAP_PowerSave, sizeof(BITMAP_PowerSave));
|
||||
}
|
||||
if (gBatteryDisplayLevel < 2) {
|
||||
if (gLowBatteryBlink == 1) {
|
||||
memcpy(gStatusLine + 110, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
||||
}
|
||||
} else {
|
||||
if (gBatteryDisplayLevel == 2) {
|
||||
memcpy(gStatusLine + 110, BITMAP_BatteryLevel2, sizeof(BITMAP_BatteryLevel2));
|
||||
} else if (gBatteryDisplayLevel == 3) {
|
||||
memcpy(gStatusLine + 110, BITMAP_BatteryLevel3, sizeof(BITMAP_BatteryLevel3));
|
||||
} else if (gBatteryDisplayLevel == 4) {
|
||||
memcpy(gStatusLine + 110, BITMAP_BatteryLevel4, sizeof(BITMAP_BatteryLevel4));
|
||||
} else {
|
||||
memcpy(gStatusLine + 110, BITMAP_BatteryLevel5, sizeof(BITMAP_BatteryLevel5));
|
||||
}
|
||||
}
|
||||
if (gChargingWithTypeC) {
|
||||
memcpy(gStatusLine + 100, BITMAP_USB_C, sizeof(BITMAP_USB_C));
|
||||
}
|
||||
if (gEeprom.KEY_LOCK) {
|
||||
memcpy(gStatusLine + 90, BITMAP_KeyLock, sizeof(BITMAP_KeyLock));
|
||||
} else if (gWasFKeyPressed) {
|
||||
memcpy(gStatusLine + 90, BITMAP_F_Key, sizeof(BITMAP_F_Key));
|
||||
}
|
||||
|
||||
if (gEeprom.VOX_SWITCH) {
|
||||
memcpy(gStatusLine + 71, BITMAP_VOX, sizeof(BITMAP_VOX));
|
||||
}
|
||||
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) {
|
||||
memcpy(gStatusLine + 58, BITMAP_WX, sizeof(BITMAP_WX));
|
||||
}
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) {
|
||||
memcpy(gStatusLine + 45, BITMAP_TDR, sizeof(BITMAP_TDR));
|
||||
}
|
||||
if (gEeprom.VOICE_PROMPT != VOICE_PROMPT_OFF) {
|
||||
memcpy(gStatusLine + 34, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt));
|
||||
}
|
||||
if (gSetting_KILLED) {
|
||||
memset(gStatusLine + 21, 0xFF, 10);
|
||||
}
|
||||
else if (gFmRadioMode) {
|
||||
memcpy(gStatusLine + 21, BITMAP_FM, sizeof(BITMAP_FM));
|
||||
}
|
||||
if (gIsNoaaMode) {
|
||||
memcpy(gStatusLine + 7, BITMAP_NOAA, sizeof(BITMAP_NOAA));
|
||||
}
|
||||
ST7565_BlitStatusLine();
|
||||
}
|
||||
|
23
ui/status.h
Normal file
23
ui/status.h
Normal file
@ -0,0 +1,23 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef UI_STATUS_H
|
||||
#define UI_STATUS_H
|
||||
|
||||
void UI_DisplayStatus(void);
|
||||
|
||||
#endif
|
||||
|
82
ui/ui.c
Normal file
82
ui/ui.c
Normal file
@ -0,0 +1,82 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "driver/keyboard.h"
|
||||
#include "misc.h"
|
||||
#include "ui/aircopy.h"
|
||||
#include "ui/fmradio.h"
|
||||
#include "ui/inputbox.h"
|
||||
#include "ui/main.h"
|
||||
#include "ui/menu.h"
|
||||
#include "ui/scanner.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
GUI_DisplayType_t gScreenToDisplay;
|
||||
GUI_DisplayType_t gRequestDisplayScreen;
|
||||
|
||||
uint8_t gAskForConfirmation;
|
||||
bool gAskToSave;
|
||||
bool gAskToDelete;
|
||||
|
||||
void GUI_DisplayScreen(void)
|
||||
{
|
||||
switch (gScreenToDisplay) {
|
||||
case DISPLAY_MAIN:
|
||||
UI_DisplayMain();
|
||||
break;
|
||||
case DISPLAY_FM:
|
||||
UI_DisplayFM();
|
||||
break;
|
||||
case DISPLAY_MENU:
|
||||
UI_DisplayMenu();
|
||||
break;
|
||||
case DISPLAY_SCANNER:
|
||||
UI_DisplayScanner();
|
||||
break;
|
||||
case DISPLAY_AIRCOPY:
|
||||
UI_DisplayAircopy();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GUI_SelectNextDisplay(GUI_DisplayType_t Display)
|
||||
{
|
||||
if (Display != DISPLAY_INVALID) {
|
||||
if (gScreenToDisplay != Display) {
|
||||
gInputBoxIndex = 0;
|
||||
gIsInSubMenu = false;
|
||||
g_20000381 = 0;
|
||||
gStepDirection = 0;
|
||||
g_20000390 = 0;
|
||||
gAskForConfirmation = 0;
|
||||
g_200003BA = 0;
|
||||
g_200003BB = 0;
|
||||
gF_LOCK = false;
|
||||
gAskToSave = false;
|
||||
gAskToDelete = false;
|
||||
if (gWasFKeyPressed) {
|
||||
gWasFKeyPressed = false;
|
||||
g_2000036F = 1;
|
||||
}
|
||||
}
|
||||
gUpdateDisplay = true;
|
||||
gScreenToDisplay = Display;
|
||||
}
|
||||
}
|
||||
|
@ -32,21 +32,12 @@ enum GUI_DisplayType_t {
|
||||
typedef enum GUI_DisplayType_t GUI_DisplayType_t;
|
||||
|
||||
extern GUI_DisplayType_t gScreenToDisplay;
|
||||
extern volatile int8_t gStepDirection;
|
||||
extern GUI_DisplayType_t gRequestDisplayScreen;
|
||||
extern uint8_t g_200003BB;
|
||||
extern bool gWasFKeyPressed;
|
||||
|
||||
extern uint8_t gAskForConfirmation;
|
||||
extern bool gAskToSave;
|
||||
extern bool gAskToDelete;
|
||||
|
||||
void GUI_DisplayBatteryLevel(uint8_t BatteryLevel);
|
||||
void GUI_Welcome(void);
|
||||
void GUI_PasswordScreen(void);
|
||||
void GUI_LockScreen(void);
|
||||
void GUI_DisplayStatusLine(void);
|
||||
|
||||
void GUI_DisplayScreen(void);
|
||||
void GUI_SelectNextDisplay(GUI_DisplayType_t Display);
|
||||
|
52
ui/welcome.c
Normal file
52
ui/welcome.c
Normal file
@ -0,0 +1,52 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "driver/eeprom.h"
|
||||
#include "driver/st7565.h"
|
||||
#include "external/printf/printf.h"
|
||||
#include "helper/battery.h"
|
||||
#include "settings.h"
|
||||
#include "ui/helper.h"
|
||||
#include "ui/welcome.h"
|
||||
|
||||
void UI_DisplayWelcome(void)
|
||||
{
|
||||
char WelcomeString0[16];
|
||||
char WelcomeString1[16];
|
||||
|
||||
memset(gStatusLine, 0, sizeof(gStatusLine));
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
|
||||
if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_FULL_SCREEN) {
|
||||
ST7565_FillScreen(0xFF);
|
||||
} else {
|
||||
memset(WelcomeString0, 0, sizeof(WelcomeString0));
|
||||
memset(WelcomeString1, 0, sizeof(WelcomeString1));
|
||||
if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_VOLTAGE) {
|
||||
sprintf(WelcomeString0, "VOLTAGE");
|
||||
sprintf(WelcomeString1, "%.2fV", gBatteryVoltageAverage * 0.01);
|
||||
} else {
|
||||
EEPROM_ReadBuffer(0x0EB0, WelcomeString0, 16);
|
||||
EEPROM_ReadBuffer(0x0EC0, WelcomeString1, 16);
|
||||
}
|
||||
UI_PrintString(WelcomeString0, 0, 127, 1, 10, true);
|
||||
UI_PrintString(WelcomeString1, 0, 127, 3, 10, true);
|
||||
ST7565_BlitStatusLine();
|
||||
ST7565_BlitFullScreen();
|
||||
}
|
||||
}
|
||||
|
23
ui/welcome.h
Normal file
23
ui/welcome.h
Normal file
@ -0,0 +1,23 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef UI_WELCOME_H
|
||||
#define UI_WELCOME_H
|
||||
|
||||
void UI_DisplayWelcome(void);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user