Full messaging support, implemented fresh in three layers: - dmrDataProtocol: pure short-data codec (CSBK preamble, data/response headers, IP/UDP/TMS payload, ETSI CRCs) validated against on-air captures by a host-side test suite. Transmits Motorola TMS (UDP 4007), receives TMS and Anytone/"DMR standard" (UDP 5016). - smsCore/smsStorage: TX queue with wait-for-channel and delivery confirmation (response PDU / ACK, resend prompt on timeout), ISR-side block assembly with layout auto-detection (confirmed/unconfirmed, rate-1/2 and full 18-byte rate-3/4 blocks), delivery reports to senders that request them, and a checksummed message store in SPI flash at 0xC00000 (inbox + sent, 8 each; 8 quick texts). - UI: Messages hub (main menu or long-press GREEN), keypad compose with multi-tap (160 chars), inbox/sent/view with reply-resend-delete, quick-text picker/editor, options (Wait for ACK, My ID only), and an incoming-message popup with chime. Strings in all 20 languages. The HR-C6000 does the BPTC/FEC; the driver streams 12-byte logical bursts through the existing TX state machine (repeater wake included), locks out PTT during a send, and leaves hotspot mode untouched. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
132 lines
5.1 KiB
C
132 lines
5.1 KiB
C
/*
|
|
* Copyright (C) 2019 Kai Ludwig, DG4KLU
|
|
* Copyright (C) 2019-2025 Roger Clark, VK3KYY / G4KYF
|
|
*
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions
|
|
* are met:
|
|
*
|
|
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
*
|
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
|
|
* in the documentation and/or other materials provided with the distribution.
|
|
*
|
|
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
|
|
* from this software without specific prior written permission.
|
|
*
|
|
* 4. Use of this source code or binary releases for commercial purposes is strictly forbidden. This includes, without limitation,
|
|
* incorporation in a commercial product or incorporation into a product or project which allows commercial use.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
|
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
*
|
|
*/
|
|
|
|
#ifndef _OPENGD77_SOUND_H_
|
|
#define _OPENGD77_SOUND_H_
|
|
|
|
#include <FreeRTOS.h>
|
|
#include <task.h>
|
|
#include "main.h"
|
|
#include "interfaces/wdog.h"
|
|
|
|
extern Task_t beepTask;
|
|
|
|
extern int16_t melody_generic[512];
|
|
extern const int16_t MELODY_POWER_ON[];
|
|
extern const int16_t MELODY_PRIVATE_CALL[];
|
|
extern const int16_t MELODY_SMS_RX[];
|
|
extern const int16_t MELODY_KEY_BEEP[];
|
|
extern const int16_t MELODY_KEY_LONG_BEEP[];
|
|
extern const int16_t MELODY_ACK_BEEP[];
|
|
extern const int16_t MELODY_NACK_BEEP[];
|
|
extern const int16_t MELODY_ERROR_BEEP[];
|
|
extern const int16_t MELODY_TX_TIMEOUT_BEEP[];
|
|
extern const int16_t MELODY_DMR_TX_START_BEEP[];
|
|
extern const int16_t MELODY_DMR_TX_STOP_BEEP[];
|
|
extern const int16_t MELODY_KEY_BEEP_FIRST_ITEM[];
|
|
extern const int16_t MELODY_LOW_BATTERY[];
|
|
extern const int16_t MELODY_APO_TRIGGERED[];
|
|
extern const int16_t MELODY_QUICKKEYS_CLEAR_ACK_BEEP[];
|
|
extern const int16_t MELODY_RX_TGTSCC_WARNING_BEEP[];
|
|
extern const int16_t MELODY_RX_BEEP_BEGIN_BEEP[];
|
|
extern const int16_t MELODY_RX_BEEP_END_BEEP[];
|
|
extern const int16_t MELODY_RX_BEEP_CALLER_BEGIN_BEEP[];
|
|
extern const int16_t MELODY_RX_BEEP_CALLER_END_BEEP[];
|
|
extern const int16_t MELODY_1750[];
|
|
extern const int16_t MELODY_DTMF[];
|
|
//extern const int16_t MELODY_SK2_BEEP[];
|
|
//extern const int16_t MELODY_NSK2_BEEP[];
|
|
extern const int16_t MELODY_BEEP_LOW_SHORT[];
|
|
|
|
extern volatile int16_t *melody_play;
|
|
extern volatile int16_t melody_idx;
|
|
extern volatile int micAudioSamplesTotal;
|
|
extern int soundBeepVolumeDivider;
|
|
extern volatile float dmrRxAGCrxPeakAverage;
|
|
|
|
#define WAV_BUFFER_SIZE 160
|
|
#define WAV_BUFFER_COUNT 30 // 5 DMR frames, was 24
|
|
#define WAV_BUFFER_AMBE_PREBUFFERING_COUNT 12 // 2 DMR frames, 6 buffers each
|
|
#define HOTSPOT_BUFFER_SIZE 50U
|
|
#define HOTSPOT_BUFFER_COUNT 48U
|
|
|
|
#define DMR_RX_AGC_DEFAULT_PEAK_SAMPLES 2000.0f
|
|
|
|
extern union sharedDataBuffer
|
|
{
|
|
volatile uint8_t wavbuffer[WAV_BUFFER_COUNT][WAV_BUFFER_SIZE]; // 3840
|
|
volatile uint8_t hotspotBuffer[HOTSPOT_BUFFER_COUNT][HOTSPOT_BUFFER_SIZE]; // 2400
|
|
volatile uint8_t rawBuffer[HOTSPOT_BUFFER_COUNT * HOTSPOT_BUFFER_SIZE]; // 2400
|
|
} audioAndHotspotDataBuffer;
|
|
|
|
extern volatile int16_t wavbuffer_read_idx;
|
|
extern volatile int16_t wavbuffer_write_idx;
|
|
extern volatile int16_t wavbuffer_count;
|
|
extern volatile uint8_t *currentWaveBuffer;
|
|
|
|
|
|
void soundInit(void);
|
|
void soundTerminateSound(void);
|
|
void soundSetMelody(const int16_t *melody);
|
|
void soundCreateSong(const uint8_t *melody);
|
|
void soundInitBeepTask(void);
|
|
|
|
void soundSendData(void);
|
|
|
|
void soundStoreBuffer(void);
|
|
void soundRetrieveBuffer(void);
|
|
void soundTickRXBuffer(void);
|
|
void soundSetupBuffer(void);
|
|
void soundStopMelody(void);
|
|
|
|
void soundTickMelody(void);
|
|
|
|
bool soundRefillData(uint32_t bufNum);
|
|
bool soundReceiveData(void);
|
|
void soundReceiveRefillData(uint32_t bufNum);
|
|
bool soundMelodyIsPlaying(void);
|
|
void soundResetDMRRxAGCGain(void);
|
|
void soundStartDMA(void);
|
|
|
|
//bit field to track audio amp usage
|
|
#define AUDIO_AMP_CHANNEL_NONE 0U
|
|
typedef enum
|
|
{
|
|
AUDIO_AMP_CHANNEL_BEEP = (1 << 0),
|
|
AUDIO_AMP_CHANNEL_RF = (1 << 1),
|
|
AUDIO_AMP_CHANNEL_PROMPT = (1 << 2)
|
|
} audioAmpChannel_t;
|
|
|
|
|
|
uint8_t audioAmpGetStatus(void);
|
|
void audioAmpEnable(audioAmpChannel_t audioChannel);
|
|
void audioAmpDisable(audioAmpChannel_t audioChannel);
|
|
void audioAmpMute(bool mute);
|
|
bool audioAmpIsMuted(void);
|
|
|
|
#endif /* _OPENGD77_SOUND_H_ */
|