Files
uv-k5-ua1zbe-firmware/app/mode.h
ua1zbe a1206d6fd4 UA1ZBE Custom Firmware v1.0
Features:
- VFO mode with direct frequency input
- POCSAG decoder (512/1200 baud) with BCH(31,21) correction
- Full-screen Spectrum analyzer
- FM Radio receiver
- RSSI signal indicator overlay
- Custom boot splash (UA1ZBE / POCSAG pager / build date)

Architecture:
- app/mode.c — mode dispatcher (VFO/POCSAG/Spectrum/FM)
- app/boot_splash.c — 2-second boot splash
- app/pocsag/ — POCSAG decoder + BCH correction
- app/display_rssi.c — RSSI indicator
- main.c — entry point with custom init
- syscalls.c — bare-metal _sbrk stub

Build: arm-none-eabi-gcc -Os -flto -Wall -Werror -Wextra
Size: 57.9KB Flash / 3.6KB RAM

Controls:
- 0-9: Direct frequency input (VFO)
- SK2: POCSAG mode
- SK1: Spectrum analyzer
- 0: FM Radio
- EXIT: Return to VFO
- F/*: Toggle 512/1200 baud (in POCSAG)
2026-04-12 00:44:05 +03:00

51 lines
1.1 KiB
C

/* UA1ZBE Custom Firmware - Mode Dispatcher
*
* Manages switching between operating modes:
* MODE_VFO — Main VFO mode (default)
* MODE_POCSAG — POCSAG decoder
* MODE_SPECTRUM — Spectrum analyzer
* MODE_FM — FM radio receiver
*
* Key mappings:
* KEY_SIDE2 (SK2) → POCSAG mode
* KEY_SIDE1 (SK1) → Spectrum mode
* KEY_EXIT → Return to VFO
* KEY_0 (short) → FM mode
*/
#ifndef APP_MODE_H
#define APP_MODE_H
#include <stdint.h>
#include <stdbool.h>
/* Operating modes */
typedef enum {
MODE_VFO = 0,
MODE_POCSAG,
MODE_SPECTRUM,
MODE_FM,
MODE_COUNT
} op_mode_t;
/* Get current mode */
op_mode_t MODE_GetCurrent(void);
/* Switch to a mode */
void MODE_Switch(op_mode_t mode);
/* Initialize mode dispatcher (call once at boot) */
void MODE_Init(void);
/* Call from 10ms timeslice */
void MODE_TimeSlice10ms(void);
/* Call from 500ms timeslice */
void MODE_TimeSlice500ms(void);
/* Process key press for mode switching.
* Returns true if the key was consumed by mode switch. */
bool MODE_ProcessKey(int key, bool pressed, bool held);
#endif