EEPROM layout (settings.h), replacing the broken 24 byte layout from
85fb527 (200 x 24 B channels overran the VFOs, attributes and settings;
names were saved at ch*24 but read at ch*20):
- 32 byte channel records with the 10 char name and the 16 bit scrambler
inside, 171 channels in two areas (0x0000, 0x11E0); VFOs at 0x1020 with
the same record; attributes moved to 0x0F50.
- Message store from 0x1900: 26 messages of 40 characters.
- Reset VFO no longer wipes the memory channels and messages.
- Static asserts that no area overlaps another or the calibration.
Identity: reports "BRN-POCSAG v4.0" to CHIRP and in the packed image, so
stock / egzumer / F4HWN drivers do not accept the new layout; the name is
shown on the welcome screen.
Make toggles: ENABLE_POCSAG, ENABLE_POCSAG_DEBUG, ENABLE_POCSAG_DEV_TUNING,
ENABLE_OOK_SENDER (POCSAG code and the OOK sender compile out completely).
Fonts: removed the unused big font, big digits and small digits; the 3x5
font is only built with the spectrum.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
39 lines
1.7 KiB
C
39 lines
1.7 KiB
C
#ifndef APP_POCSAG_H
|
|
#define APP_POCSAG_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#define POCSAG_SYNC_WORD 0x7CD215D8UL
|
|
#define POCSAG_IDLE_WORD 0x7A89C197UL
|
|
|
|
#define POCSAG_MAX_RIC 0x1FFFFFUL // 21 bit capcode (2097151)
|
|
#define POCSAG_ANY_RIC 0xFFFFFFFFUL // POCSAG_Decode(): accept any address
|
|
// Longest alphanumeric message (TX and RX). Also the stored message length, see
|
|
// app/messages.h. Up to 45 fits the fixed two-batch TX frame (checked in pocsag.c).
|
|
#ifndef POCSAG_MAX_MESSAGE_LENGTH
|
|
#define POCSAG_MAX_MESSAGE_LENGTH 40U
|
|
#endif
|
|
#define POCSAG_PREAMBLE_BYTES 72U // 576 bits of 1010..., the minimum the spec allows
|
|
#define POCSAG_BATCH_WORDS 16U
|
|
#define POCSAG_BATCH_BYTES (4U + POCSAG_BATCH_WORDS * 4U)
|
|
#define POCSAG_BATCH_COUNT 2U
|
|
|
|
// Every frame produced by POCSAG_Encode() is exactly this long: preamble + two batches.
|
|
// Two batches always hold the address plus a POCSAG_MAX_MESSAGE_LENGTH message followed
|
|
// by at least one idle codeword (the address sits in slot <= 14).
|
|
#define POCSAG_MAX_FRAME_SIZE (POCSAG_PREAMBLE_BYTES + POCSAG_BATCH_COUNT * POCSAG_BATCH_BYTES)
|
|
|
|
// Encodes an alphanumeric page for the given 21 bit capcode (RIC).
|
|
// Output is the logical bit stream (MSB of output[0] is sent first, 1 = logical one).
|
|
bool POCSAG_Encode(uint32_t capcode, const char *message, uint8_t *output,
|
|
size_t output_capacity, size_t *output_size);
|
|
|
|
// Searches the bit stream for a sync codeword (either polarity) and decodes the first
|
|
// alphanumeric message addressed to capcode. *sender receives the matched capcode.
|
|
bool POCSAG_Decode(const uint8_t *input, size_t input_size, uint32_t capcode,
|
|
uint32_t *sender, char *message, size_t message_capacity);
|
|
|
|
#endif
|