Skip to content

Commit

Permalink
Merge branch 'si'
Browse files Browse the repository at this point in the history
  • Loading branch information
fagci committed May 20, 2024
2 parents 7952be2 + c804d7f commit 79ed348
Show file tree
Hide file tree
Showing 93 changed files with 3,699 additions and 1,657 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
obj/
bin/
src/external/
.vsconfig/
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ SIZE = arm-none-eabi-size
GIT_HASH := $(shell git rev-parse --short HEAD)

ASFLAGS = -c -mcpu=cortex-m0
# CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-delete-null-pointer-checks -std=c11 -MMD -ffunction-sections -fdata-sections
# CFLAGS = -Os -Wall -Wno-error -mcpu=cortex-m0 -fno-delete-null-pointer-checks -std=c11 -MMD -ffunction-sections -fdata-sections
CFLAGS = -Os -Wall -Wno-error -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c2x -MMD -flto=auto -Wextra
# CFLAGS = -Os -Wall -Wno-error -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c2x -MMD -ffunction-sections -fdata-sections -Wextra
CFLAGS += -DPRINTF_INCLUDE_CONFIG_H
Expand Down Expand Up @@ -76,4 +76,4 @@ $(BIN_DIR) $(OBJ_DIR) $(BIN_DIR):
-include $(DEPS)

clean:
rm -f $(TARGET).bin $(TARGET).packed.bin $(TARGET) $(OBJS) $(DEPS)
rm -f $(TARGET).bin $(TARGET).packed.bin $(TARGET) $(OBJ_DIR)/*.o $(OBJ_DIR)/*.d $(OBJ_DIR)/**/*.o $(OBJ_DIR)/**/*.d
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Reborn firmware

Based on [https://github.com/DualTachyon/uv-k5-firmware](https://github.com/DualTachyon/uv-k5-firmware).

[Telegram group](https://t.me/uvk5_spectrum_talk)

[Donations](https://t.me/uvk5_spectrum_talk/6032/6035)

## License

To be clear, I don't like license preamble inside everu source file.

So, license is Apache, main author is [Dual Tachyon](https://github.com/DualTachyon).

I permit all type of copypasting/modifications.

77 changes: 4 additions & 73 deletions src/apps/about.c
Original file line number Diff line number Diff line change
@@ -1,82 +1,13 @@
#include "about.h"
#include "../driver/bk4819.h"
#include "../misc.h"
#include "../scheduler.h"
#include "../ui/graphics.h"
#include "../ui/statusline.h"
#include "apps.h"

const char *qr[] = {
"111111101111101011111101001111111", "100000101010001010101011101000001",
"101110100000011101101001001011101", "101110101011100001111010001011101",
"101110100010100011001000101011101", "100000100001110111011110001000001",
"111111101010101010101010101111111", "000000001100101111110000100000000",
"101101110110101111100101101001011", "000001010010110000110001001101111",
"110010100100110010000011000111001", "111000000110100111100001100101011",
"111000110101101110110011110111011", "001010001010011000111001110100110",
"100100100010001001110000101111100", "011101001011111100000110011001100",
"011110101111000010101111011010100", "101011000110010101001001001011011",
"000100110001011110100000000110110", "010110010101101010110000110010001",
"011100110000111110001100000101110", "111111011010100111100101001000101",
"000110101000011101100101011101111", "010001010011111100111010101011011",
"101111101111111001110010111110000", "000000001011110110010000100011010",
"111111101101001001011001101010000", "100000101100001000000111100011101",
"101110100100011000100111111110101", "101110101111110011000001100101001",
"101110101111111101000001111101100", "100000100100100001111000100110001",
"111111101101010001110101000011100",
};

void ABOUT_Init() { STATUSLINE_SetText("t.me/uvk5_spectrum_talk"); }

void ABOUT_Deinit() {
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, false);
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
}

static uint32_t lastUpdate = 0;
static bool red = false;

void ABOUT_Update() {
if (elapsedMilliseconds - lastUpdate >= 500) {
red = (elapsedMilliseconds / 500) % 3;
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN,
(elapsedMilliseconds / 500) % 2);
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, red);
lastUpdate = elapsedMilliseconds;
gRedrawScreen = true;
}
}

void ABOUT_Render() {
UI_ClearScreen();
for (uint8_t y = 0; y < ARRAY_SIZE(qr); y++) {
for (uint8_t x = 0; x < strlen(qr[0]); x++) {
if (qr[y][x] == '1') {
DrawRect(x * 2, y * 1 + 9, 2, 1, C_FILL);
}
}
}
PrintMediumEx(68 + 6, 16, POS_L, C_FILL, "OSFW");
PrintSmallEx(96 + 2, 14, POS_L, C_FILL, "REBORN");
PrintMediumEx(LCD_WIDTH - 1, 16 + 6, POS_R, C_FILL, "FAGCI");
PrintSmallEx(LCD_WIDTH - 29, 16 + 6, POS_R, C_FILL, "by");

PrintMediumBoldEx(32, 50, POS_C, C_FILL, "Happy");
PrintMediumBoldEx(32, 60, POS_C, C_FILL, "2024!");

if (red) {
PutPixel(LCD_WIDTH - 32, 32 - 4, C_FILL);
PutPixel(LCD_WIDTH - 32 - 3, 32 - 1, C_FILL);
PutPixel(LCD_WIDTH - 32 + 3, 32 - 1, C_FILL);
PutPixel(LCD_WIDTH - 32, 32 + 2, C_FILL);
}

PrintSmallEx(LCD_WIDTH - 32, 32 + 2, POS_C, C_FILL, "*");
PrintSmallEx(LCD_WIDTH - 32, 32 + 6, POS_C, C_FILL, "c");
PrintSmallEx(LCD_WIDTH - 32, 32 + 12, POS_C, C_FILL, "ris");
PrintSmallEx(LCD_WIDTH - 32, 32 + 18, POS_C, C_FILL, "tmas");
PrintSmallEx(LCD_WIDTH - 32, 32 + 24, POS_C, C_FILL, "tree is");
PrintSmallEx(LCD_WIDTH - 32, 32 + 30, POS_C, C_FILL, "here");
PrintMediumEx(LCD_XCENTER, LCD_YCENTER + 8, POS_C, C_FILL, "r3b0rn");
PrintSmallEx(LCD_XCENTER, LCD_YCENTER + 14, POS_C, C_FILL, "by FAGCI");
PrintSmallEx(LCD_XCENTER, LCD_YCENTER + 24, POS_C, C_FILL,
"t.me/uvk5_spectrum_talk");
}

bool ABOUT_key(KEY_Code_t k, bool p, bool h) {
Expand Down
3 changes: 0 additions & 3 deletions src/apps/about.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

#include "../driver/keyboard.h"

void ABOUT_Init();
void ABOUT_Deinit();
void ABOUT_Update();
void ABOUT_Render();
bool ABOUT_key(KEY_Code_t k, bool p, bool h);

Expand Down
4 changes: 2 additions & 2 deletions src/apps/analyzer.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void ANALYZER_init(void) {
SVC_Toggle(SVC_LISTEN, false, 0);
RADIO_ToggleRX(false);
RADIO_LoadCurrentVFO();
RADIO_ToggleBK1080(false);
// RADIO_ToggleBK1080(false);

gMonitorMode = false;

Expand Down Expand Up @@ -244,5 +244,5 @@ void ANALYZER_render(void) {
PrintSmallEx(spectrumWidth / 2, LCD_HEIGHT - 1, POS_C, C_FILL, "%u.%05u",
centerF / 100000, centerF % 100000);

lastRender = elapsedMilliseconds;
lastRender = Now();
}
2 changes: 0 additions & 2 deletions src/apps/antenna.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ void ANTENNA_init(void) {
f = GetScreenF(radio->rx.f);
}

void ANTENNA_update(void) {}

bool ANTENNA_key(KEY_Code_t key, bool bKeyPressed, bool bKeyHeld) {
if (!bKeyPressed && !bKeyHeld) {
switch (key) {
Expand Down
1 change: 0 additions & 1 deletion src/apps/antenna.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <stdint.h>

void ANTENNA_init();
void ANTENNA_update();
bool ANTENNA_key(KEY_Code_t key, bool bKeyPressed, bool bKeyHeld);
void ANTENNA_render();
void ANTENNA_deinit();
Expand Down
58 changes: 32 additions & 26 deletions src/apps/apps.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,15 @@
#include "fastscan.h"
#include "finput.h"
#include "lootlist.h"
#include "messenger.h"
#include "memview.h"
#include "presetcfg.h"
#include "presetlist.h"
#include "reset.h"
#include "savech.h"
#include "scanlists.h"
#include "settings.h"
#include "si.h"
#include "spectrumreborn.h"
#include "still.h"
#include "taskman.h"
#include "test.h"
#include "textinput.h"
#include "vfo1.h"
#include "vfo2.h"
Expand Down Expand Up @@ -64,53 +62,52 @@ const AppType_t appsAvailableToRun[RUN_APPS_COUNT] = {
APP_VFO1, //
APP_STILL, //
APP_VFO2, //
APP_SI, //
APP_CH_SCANNER, //
APP_SAVECH, //
APP_SPECTRUM, //
APP_ANALYZER, //
APP_FASTSCAN, //
APP_LOOT_LIST, //
APP_SCANLISTS, //
APP_PRESETS_LIST, //
APP_ANT, //
APP_TASKMAN, //
APP_TEST, //
APP_MEMVIEW, //
APP_ABOUT, //
};

const App apps[APPS_COUNT] = {
{"None"},
{"Test", TEST_Init, TEST_Update, TEST_Render, TEST_key},
{"EEPROM view", MEMVIEW_Init, MEMVIEW_Update, MEMVIEW_Render, MEMVIEW_key,
NULL},
{"Spectrum band", SPECTRUM_init, SPECTRUM_update, SPECTRUM_render,
SPECTRUM_key, SPECTRUM_deinit},
{"Spectrum analyzer", ANALYZER_init, ANALYZER_update, ANALYZER_render,
ANALYZER_key, ANALYZER_deinit},
{"CH Scan", CHSCANNER_init, CHSCANNER_update, CHSCANNER_render,
CHSCANNER_key, CHSCANNER_deinit},
{"Channels", SAVECH_init, SAVECH_update, SAVECH_render, SAVECH_key, NULL},
{"Freq catch", FASTSCAN_init, FASTSCAN_update, FASTSCAN_render,
FASTSCAN_key, FASTSCAN_deinit},
{"1 VFO pro", STILL_init, STILL_update, STILL_render, STILL_key,
STILL_deinit},
{"Frequency input", FINPUT_init, NULL, FINPUT_render, FINPUT_key,
FINPUT_deinit},
{"Run app", APPSLIST_init, NULL, APPSLIST_render, APPSLIST_key},
{"Loot", LOOTLIST_init, NULL, LOOTLIST_render, LOOTLIST_key},
{"Presets", PRESETLIST_init, NULL, PRESETLIST_render, PRESETLIST_key},
{"Reset", RESET_Init, RESET_Update, RESET_Render, RESET_key},
{"Text input", TEXTINPUT_init, TEXTINPUT_update, TEXTINPUT_render,
TEXTINPUT_key, TEXTINPUT_deinit},
{"VFO config", VFOCFG_init, VFOCFG_update, VFOCFG_render, VFOCFG_key},
{"Run app", APPSLIST_init, NULL, APPSLIST_render, APPSLIST_key, NULL},
{"Loot", LOOTLIST_init, NULL, LOOTLIST_render, LOOTLIST_key, NULL},
{"Presets", PRESETLIST_init, NULL, PRESETLIST_render, PRESETLIST_key, NULL},
{"Reset", RESET_Init, RESET_Update, RESET_Render, RESET_key, NULL},
{"Text input", TEXTINPUT_init, NULL, TEXTINPUT_render, TEXTINPUT_key,
TEXTINPUT_deinit},
{"VFO config", VFOCFG_init, VFOCFG_update, VFOCFG_render, VFOCFG_key, NULL},
{"Preset config", PRESETCFG_init, PRESETCFG_update, PRESETCFG_render,
PRESETCFG_key},
{"Scanlists", SCANLISTS_init, SCANLISTS_update, SCANLISTS_render,
SCANLISTS_key},
{"Save to channel", SAVECH_init, SAVECH_update, SAVECH_render, SAVECH_key},
{"Settings", SETTINGS_init, SETTINGS_update, SETTINGS_render, SETTINGS_key},
PRESETCFG_key, NULL},
{"Settings", SETTINGS_init, NULL, SETTINGS_render, SETTINGS_key, NULL},
{"1 VFO", VFO1_init, VFO1_update, VFO1_render, VFO1_key, VFO1_deinit},
{"2 VFO", VFO2_init, VFO2_update, VFO2_render, VFO2_key, VFO2_deinit},
{"ABOUT", ABOUT_Init, ABOUT_Update, ABOUT_Render, ABOUT_key, ABOUT_Deinit},
{"Antenna len", ANTENNA_init, ANTENNA_update, ANTENNA_render, ANTENNA_key,
{"SI47XX", SI_init, SI_update, SI_render, SI_key, SI_deinit},
{"ABOUT", NULL, NULL, ABOUT_Render, ABOUT_key, NULL},
{"Antenna len", ANTENNA_init, NULL, ANTENNA_render, ANTENNA_key,
ANTENNA_deinit},
{"Task manager", TASKMAN_Init, NULL, TASKMAN_Render, TASKMAN_Key},
};

bool APPS_key(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
Expand Down Expand Up @@ -148,7 +145,9 @@ void APPS_run(AppType_t app) {
if (appsStack[stackIndex] == app) {
return;
}
APPS_deinit();
if (app != APP_FINPUT && app != APP_TEXTINPUT) {
APPS_deinit();
}
pushApp(app);
APPS_init(app);
}
Expand All @@ -166,7 +165,14 @@ bool APPS_exit(void) {
return false;
}
APPS_deinit();
popApp();
APPS_init(APPS_Peek());
AppType_t app = popApp();
if (app != APP_FINPUT && app != APP_TEXTINPUT) {
APPS_init(APPS_Peek());
} else {
gCurrentApp = APPS_Peek();

STATUSLINE_SetText("%s", apps[gCurrentApp].name);
gRedrawScreen = true;
}
return true;
}
9 changes: 4 additions & 5 deletions src/apps/apps.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@

#include "../driver/keyboard.h"

#define APPS_COUNT 23
#define APPS_COUNT 22
#define RUN_APPS_COUNT 14

typedef enum {
APP_NONE,
APP_TEST,
APP_MEMVIEW,
APP_SPECTRUM,
APP_ANALYZER,
APP_CH_SCANNER,
APP_SAVECH,
APP_FASTSCAN,
APP_STILL,
APP_FINPUT,
Expand All @@ -22,14 +23,12 @@ typedef enum {
APP_TEXTINPUT,
APP_VFO_CFG,
APP_PRESET_CFG,
APP_SCANLISTS,
APP_SAVECH,
APP_SETTINGS,
APP_VFO1,
APP_VFO2,
APP_SI,
APP_ABOUT,
APP_ANT,
APP_TASKMAN,
} AppType_t;

typedef struct App {
Expand Down
5 changes: 2 additions & 3 deletions src/apps/appslist.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static void setMenuIndexAndRun(uint16_t v) {
}

void APPSLIST_init(void) { gRedrawScreen = true; }
void APPSLIST_update(void) {}

bool APPSLIST_key(KEY_Code_t key, bool bKeyPressed, bool bKeyHeld) {
if (!bKeyPressed && !bKeyHeld) {
if (!gIsNumNavInput && key >= KEY_0 && key <= KEY_9) {
Expand All @@ -59,8 +59,7 @@ bool APPSLIST_key(KEY_Code_t key, bool bKeyPressed, bool bKeyHeld) {
return true;
case KEY_MENU:
APPS_exit();
if (app == APP_PRESETS_LIST || app == APP_LOOT_LIST ||
app == APP_SCANLISTS) {
if (app == APP_PRESETS_LIST || app == APP_LOOT_LIST || app == APP_SAVECH) {
APPS_run(app);
} else {
APPS_runManual(app);
Expand Down
1 change: 0 additions & 1 deletion src/apps/appslist.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <stdint.h>

void APPSLIST_init();
void APPSLIST_update();
bool APPSLIST_key(KEY_Code_t key, bool bKeyPressed, bool bKeyHeld);
void APPSLIST_render();

Expand Down
Loading

0 comments on commit 79ed348

Please sign in to comment.