uv-k5-firmware/audio.h

138 lines
3.7 KiB
C
Raw Normal View History

2023-08-14 05:40:33 +08:00
/* Copyright 2023 Dual Tachyon
* https://github.com/DualTachyon
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
2023-08-13 04:33:27 +08:00
#ifndef AUDIO_H
#define AUDIO_H
2023-08-14 05:40:33 +08:00
#include <stdbool.h>
2023-08-13 04:33:27 +08:00
#include <stdint.h>
2023-08-13 04:49:16 +08:00
enum BEEP_Type_t {
2023-09-02 23:57:57 +08:00
BEEP_NONE = 0U,
2023-08-13 04:49:16 +08:00
BEEP_1KHZ_60MS_OPTIONAL = 1U,
BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL = 2U,
BEEP_440HZ_500MS = 3U,
BEEP_500HZ_60MS_DOUBLE_BEEP = 4U,
};
typedef enum BEEP_Type_t BEEP_Type_t;
2023-08-15 18:02:03 +08:00
enum {
VOICE_ID_CHI_BASE = 0x10U,
VOICE_ID_ENG_BASE = 0x60U,
};
2023-08-14 05:40:33 +08:00
enum VOICE_ID_t {
2023-08-15 18:02:03 +08:00
VOICE_ID_0 = 0x00U,
VOICE_ID_1 = 0x01U,
VOICE_ID_2 = 0x02U,
VOICE_ID_3 = 0x03U,
VOICE_ID_4 = 0x04U,
VOICE_ID_5 = 0x05U,
VOICE_ID_6 = 0x06U,
VOICE_ID_7 = 0x07U,
VOICE_ID_8 = 0x08U,
VOICE_ID_9 = 0x09U,
VOICE_ID_10 = 0x0AU,
VOICE_ID_100 = 0x0BU,
VOICE_ID_WELCOME = 0x0CU,
VOICE_ID_LOCK = 0x0DU,
2023-08-28 08:27:31 +08:00
VOICE_ID_UNLOCK = 0x0EU,
2023-08-15 18:02:03 +08:00
VOICE_ID_SCANNING_BEGIN = 0x0FU,
VOICE_ID_SCANNING_STOP = 0x10U,
VOICE_ID_SCRAMBLER_ON = 0x11U,
VOICE_ID_SCRAMBLER_OFF = 0x12U,
VOICE_ID_FUNCTION = 0x13U,
VOICE_ID_CTCSS = 0x14U,
VOICE_ID_DCS = 0x15U,
VOICE_ID_POWER = 0x16U,
VOICE_ID_SAVE_MODE = 0x17U,
VOICE_ID_MEMORY_CHANNEL = 0x18U,
VOICE_ID_DELETE_CHANNEL = 0x19U,
VOICE_ID_FREQUENCY_STEP = 0x1AU,
VOICE_ID_SQUELCH = 0x1BU,
VOICE_ID_TRANSMIT_OVER_TIME = 0x1CU,
VOICE_ID_BACKLIGHT_SELECTION = 0x1DU,
VOICE_ID_VOX = 0x1EU,
VOICE_ID_FREQUENCY_DIRECTION = 0x1FU,
VOICE_ID_OFFSET_FREQUENCY = 0x20U,
VOICE_ID_TRANSMITING_MEMORY = 0x21U,
VOICE_ID_RECEIVING_MEMORY = 0x22U,
VOICE_ID_EMERGENCY_CALL = 0x23U,
VOICE_ID_LOW_VOLTAGE = 0x24U,
VOICE_ID_CHANNEL_MODE = 0x25U,
VOICE_ID_FREQUENCY_MODE = 0x26U,
VOICE_ID_VOICE_PROMPT = 0x27U,
VOICE_ID_BAND_SELECTION = 0x28U,
VOICE_ID_DUAL_STANDBY = 0x29U,
VOICE_ID_CHANNEL_BANDWIDTH = 0x2AU,
VOICE_ID_OPTIONAL_SIGNAL = 0x2BU,
VOICE_ID_MUTE_MODE = 0x2CU,
VOICE_ID_BUSY_LOCKOUT = 0x2DU,
VOICE_ID_BEEP_PROMPT = 0x2EU,
VOICE_ID_ANI_CODE = 0x2FU,
VOICE_ID_INITIALISATION = 0x30U,
VOICE_ID_CONFIRM = 0x31U,
VOICE_ID_CANCEL = 0x32U,
VOICE_ID_ON = 0x33U,
VOICE_ID_OFF = 0x34U,
VOICE_ID_2_TONE = 0x35U,
VOICE_ID_5_TONE = 0x36U,
VOICE_ID_DIGITAL_SIGNAL = 0x37U,
VOICE_ID_REPEATER = 0x38U,
VOICE_ID_MENU = 0x39U,
VOICE_ID_11 = 0x3AU,
VOICE_ID_12 = 0x3BU,
VOICE_ID_13 = 0x3CU,
VOICE_ID_14 = 0x3DU,
VOICE_ID_15 = 0x3EU,
VOICE_ID_16 = 0x3FU,
VOICE_ID_17 = 0x40U,
VOICE_ID_18 = 0x41U,
VOICE_ID_19 = 0x42U,
VOICE_ID_20 = 0x43U,
VOICE_ID_30 = 0x44U,
VOICE_ID_40 = 0x45U,
VOICE_ID_50 = 0x46U,
VOICE_ID_60 = 0x47U,
VOICE_ID_70 = 0x48U,
VOICE_ID_80 = 0x49U,
VOICE_ID_90 = 0x4AU,
VOICE_ID_END = 0x4BU,
2023-08-28 01:04:19 +08:00
VOICE_ID_INVALID = 0xFFU,
2023-08-14 05:40:33 +08:00
};
typedef enum VOICE_ID_t VOICE_ID_t;
2023-08-30 02:17:01 +08:00
extern VOICE_ID_t gVoiceID[8];
2023-08-14 05:40:33 +08:00
extern uint8_t gVoiceReadIndex;
extern uint8_t gVoiceWriteIndex;
2023-08-15 06:38:59 +08:00
extern volatile uint16_t gCountdownToPlayNextVoice;
extern volatile bool gFlagPlayQueuedVoice;
2023-08-27 19:32:21 +08:00
extern VOICE_ID_t gAnotherVoiceID;
extern BEEP_Type_t gBeepToPlay;
2023-08-14 05:40:33 +08:00
2023-08-13 04:49:16 +08:00
void AUDIO_PlayBeep(BEEP_Type_t Beep);
2023-08-30 02:17:01 +08:00
void AUDIO_PlayVoice(uint8_t VoiceID);
2023-08-14 05:40:33 +08:00
void AUDIO_PlaySingleVoice(bool bFlag);
void AUDIO_SetVoiceID(uint8_t Index, VOICE_ID_t VoiceID);
2023-08-30 02:17:01 +08:00
uint8_t AUDIO_SetDigitVoice(uint8_t Index, uint16_t Value);
2023-08-15 18:04:21 +08:00
void AUDIO_PlayQueuedVoice(void);
2023-08-13 04:33:27 +08:00
#endif