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)
49 lines
989 B
C
49 lines
989 B
C
#ifndef DEBUGGING_H
|
|
#define DEBUGGING_H
|
|
|
|
#ifdef ENABLE_UART
|
|
|
|
#include "driver/uart.h"
|
|
#include "driver/bk4819.h"
|
|
#include "string.h"
|
|
#include "external/printf/printf.h"
|
|
#include "am_fix.h"
|
|
|
|
static inline void LogUart(const char *const str)
|
|
{
|
|
UART_Send(str, strlen(str));
|
|
}
|
|
|
|
static inline void LogUartf(const char* format, ...)
|
|
{
|
|
char buffer[128];
|
|
va_list va;
|
|
va_start(va, format);
|
|
vsnprintf(buffer, (size_t)-1, format, va);
|
|
va_end(va);
|
|
UART_Send(buffer, strlen(buffer));
|
|
}
|
|
|
|
static inline void LogRegUart(uint16_t reg)
|
|
{
|
|
uint16_t regVal = BK4819_ReadRegister(reg);
|
|
char buf[32];
|
|
sprintf(buf, "reg%02X: %04X\n", reg, regVal);
|
|
LogUart(buf);
|
|
}
|
|
|
|
static inline void LogPrint()
|
|
{
|
|
uint16_t rssi = BK4819_GetRSSI();
|
|
uint16_t reg7e = BK4819_ReadRegister(0x7E);
|
|
char buf[32];
|
|
sprintf(buf, "reg7E: %d %2d %6d %2d %d rssi: %d\n", (reg7e >> 15),
|
|
(reg7e >> 12) & 0b111, (reg7e >> 5) & 0b1111111,
|
|
(reg7e >> 2) & 0b111, (reg7e >> 0) & 0b11, rssi);
|
|
LogUart(buf);
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|