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)
52 lines
1.4 KiB
C
52 lines
1.4 KiB
C
#include "cmsis_os2.h" // CMSIS RTOS header file
|
|
|
|
/*----------------------------------------------------------------------------
|
|
* Event Flags creation & usage
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
#define FLAGS_MSK1 0x00000001U
|
|
|
|
osEventFlagsId_t evt_id; // event flasg id
|
|
|
|
osThreadId_t tid_Thread_EventSender; // thread id 1
|
|
osThreadId_t tid_Thread_EventReceiver; // thread id 2
|
|
|
|
void Thread_EventSender (void *argument); // thread function 1
|
|
void Thread_EventReceiver (void *argument); // thread function 2
|
|
|
|
int Init_Events (void) {
|
|
|
|
evt_id = osEventFlagsNew(NULL);
|
|
if (evt_id == NULL) {
|
|
; // Event Flags object not created, handle failure
|
|
}
|
|
|
|
tid_Thread_EventSender = osThreadNew(Thread_EventSender, NULL, NULL);
|
|
if (tid_Thread_EventSender == NULL) {
|
|
return(-1);
|
|
}
|
|
tid_Thread_EventReceiver = osThreadNew(Thread_EventReceiver, NULL, NULL);
|
|
if (tid_Thread_EventReceiver == NULL) {
|
|
return(-1);
|
|
}
|
|
|
|
return(0);
|
|
}
|
|
|
|
void Thread_EventSender (void *argument) {
|
|
|
|
while (1) {
|
|
osEventFlagsSet(evt_id, FLAGS_MSK1);
|
|
osThreadYield(); // suspend thread
|
|
}
|
|
}
|
|
|
|
void Thread_EventReceiver (void *argument) {
|
|
uint32_t flags;
|
|
|
|
while (1) {
|
|
flags = osEventFlagsWait(evt_id, FLAGS_MSK1, osFlagsWaitAny, osWaitForever);
|
|
//handle event
|
|
}
|
|
}
|