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)
79 lines
2.9 KiB
C++
79 lines
2.9 KiB
C++
/* Copyright (c) 2012 mbed.org */
|
|
#ifndef THREAD_H
|
|
#define THREAD_H
|
|
|
|
#include <stdint.h>
|
|
#include "cmsis_os.h"
|
|
|
|
#define DEFAULT_STACK_SIZE 0x1000
|
|
|
|
namespace rtos {
|
|
|
|
/*! The Thread class allow defining, creating, and controlling thread functions in the system. */
|
|
class Thread {
|
|
public:
|
|
/*! Create a new thread, and start it executing the specified function.
|
|
\param task function to be executed by this thread.
|
|
\param argument pointer that is passed to the thread function as start argument. (default: NULL).
|
|
\param priority initial priority of the thread function. (default: osPriorityNormal).
|
|
\param stacksz stack size (in bytes) requirements for the thread function. (default: DEFAULT_STACK_SIZE).
|
|
*/
|
|
Thread(void (*task)(void const *argument),
|
|
void *argument=NULL,
|
|
osPriority priority=osPriorityNormal,
|
|
uint32_t stacksize=DEFAULT_STACK_SIZE);
|
|
|
|
/*! Terminate execution of a thread and remove it from Active Threads
|
|
\return status code that indicates the execution status of the function.
|
|
*/
|
|
osStatus terminate();
|
|
|
|
/*! Set priority of an active thread
|
|
\param priority new priority value for the thread function.
|
|
\return status code that indicates the execution status of the function.
|
|
*/
|
|
osStatus set_priority(osPriority priority);
|
|
|
|
/*! Get priority of an active thread
|
|
\ return current priority value of the thread function.
|
|
*/
|
|
osPriority get_priority();
|
|
|
|
/*! Set the specified Signal Flags of an active thread.
|
|
\param signals specifies the signal flags of the thread that should be set.
|
|
\return previous signal flags of the specified thread or 0x80000000 in case of incorrect parameters.
|
|
*/
|
|
int32_t signal_set(int32_t signals);
|
|
|
|
/*! Wait for one or more Signal Flags to become signaled for the current RUNNING thread.
|
|
\param signals wait until all specified signal flags set or 0 for any single signal flag.
|
|
\param millisec timeout value or 0 in case of no time-out. (default: osWaitForever).
|
|
\return event flag information or error code.
|
|
*/
|
|
static osEvent signal_wait(int32_t signals, uint32_t millisec=osWaitForever);
|
|
|
|
|
|
/*! Wait for a specified time period in millisec:
|
|
\param millisec time delay value
|
|
\return status code that indicates the execution status of the function.
|
|
*/
|
|
static osStatus wait(uint32_t millisec);
|
|
|
|
/*! Pass control to next thread that is in state READY.
|
|
\return status code that indicates the execution status of the function.
|
|
*/
|
|
static osStatus yield();
|
|
|
|
/*! Get the thread id of the current running thread.
|
|
\return thread ID for reference by other functions or NULL in case of error.
|
|
*/
|
|
static osThreadId gettid();
|
|
|
|
private:
|
|
osThreadId _tid;
|
|
osThreadDef_t _thread_def;
|
|
};
|
|
|
|
}
|
|
#endif
|