mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-06-18 22:29:50 +03:00
Adding compander
This commit is contained in:
@ -384,7 +384,7 @@ void BK4819_EnableVox(uint16_t VoxEnableThreshold, uint16_t VoxDisableThreshold)
|
||||
BK4819_WriteRegister(BK4819_REG_7A, 0x289A); // vox disable delay = 128*5 = 640ms
|
||||
|
||||
// Enable VOX
|
||||
BK4819_WriteRegister(BK4819_REG_31, REG_31_Value | 4u); // bit 2 - VOX Enable
|
||||
BK4819_WriteRegister(BK4819_REG_31, REG_31_Value | (1u << 2)); // VOX Enable
|
||||
}
|
||||
|
||||
void BK4819_SetFilterBandwidth(BK4819_FilterBandwidth_t Bandwidth)
|
||||
@ -509,16 +509,33 @@ void BK4819_PickRXFilterPathBasedOnFrequency(uint32_t Frequency)
|
||||
void BK4819_DisableScramble(void)
|
||||
{
|
||||
const uint16_t Value = BK4819_ReadRegister(BK4819_REG_31);
|
||||
BK4819_WriteRegister(BK4819_REG_31, Value & 0xFFFD);
|
||||
BK4819_WriteRegister(BK4819_REG_31, Value & ~(1u << 1));
|
||||
}
|
||||
|
||||
void BK4819_EnableScramble(uint8_t Type)
|
||||
{
|
||||
const uint16_t Value = BK4819_ReadRegister(BK4819_REG_31);
|
||||
BK4819_WriteRegister(BK4819_REG_31, Value | 2u);
|
||||
BK4819_WriteRegister(BK4819_REG_31, Value | (1u << 1));
|
||||
|
||||
BK4819_WriteRegister(BK4819_REG_71, 0x68DC + (Type * 1032));
|
||||
}
|
||||
|
||||
bool BK4819_CompanderEnabled(void)
|
||||
{
|
||||
return (BK4819_ReadRegister(BK4819_REG_31) & (1u < 3)) ? true : false;
|
||||
}
|
||||
void BK4819_DisableCompander(void)
|
||||
{
|
||||
const uint16_t Value = BK4819_ReadRegister(BK4819_REG_31);
|
||||
BK4819_WriteRegister(BK4819_REG_31, Value & ~(1u < 3));
|
||||
}
|
||||
|
||||
void BK4819_EnableCompander(void)
|
||||
{
|
||||
const uint16_t Value = BK4819_ReadRegister(BK4819_REG_31);
|
||||
BK4819_WriteRegister(BK4819_REG_31, Value | (1u < 3));
|
||||
}
|
||||
|
||||
void BK4819_DisableVox(void)
|
||||
{
|
||||
const uint16_t Value = BK4819_ReadRegister(BK4819_REG_31);
|
||||
@ -675,9 +692,9 @@ void BK4819_EnterDTMF_TX(bool bLocalLoopback)
|
||||
BK4819_WriteRegister(BK4819_REG_70,
|
||||
0
|
||||
| BK4819_REG_70_MASK_ENABLE_TONE1
|
||||
| (83 << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN)
|
||||
| (83u << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN)
|
||||
| BK4819_REG_70_MASK_ENABLE_TONE2
|
||||
| (83 << BK4819_REG_70_SHIFT_TONE2_TUNING_GAIN));
|
||||
| (83u << BK4819_REG_70_SHIFT_TONE2_TUNING_GAIN));
|
||||
|
||||
BK4819_EnableTXLink();
|
||||
}
|
||||
|
@ -84,6 +84,11 @@ void BK4819_RX_TurnOn(void);
|
||||
void BK4819_PickRXFilterPathBasedOnFrequency(uint32_t Frequency);
|
||||
void BK4819_DisableScramble(void);
|
||||
void BK4819_EnableScramble(uint8_t Type);
|
||||
|
||||
bool BK4819_CompanderEnabled(void);
|
||||
void BK4819_DisableCompander(void);
|
||||
void BK4819_EnableCompander(void);
|
||||
|
||||
void BK4819_DisableVox(void);
|
||||
void BK4819_DisableDTMF(void);
|
||||
void BK4819_EnableDTMF(void);
|
||||
|
@ -23,6 +23,9 @@
|
||||
#include "driver/st7565.h"
|
||||
#include "driver/system.h"
|
||||
|
||||
#define LCD_WIDTH 128
|
||||
#define LCD_HEIGHT 64
|
||||
|
||||
uint8_t gStatusLine[128];
|
||||
uint8_t gFrameBuffer[7][128];
|
||||
|
||||
@ -96,7 +99,7 @@ void ST7565_BlitStatusLine(void)
|
||||
|
||||
SPI_ToggleMasterMode(&SPI0->CR, false);
|
||||
|
||||
ST7565_WriteByte(0x40);
|
||||
ST7565_WriteByte(0x40); // start line ?
|
||||
|
||||
ST7565_SelectColumnAndLine(4, 0);
|
||||
|
||||
@ -141,36 +144,35 @@ void ST7565_Init(void)
|
||||
|
||||
SPI_ToggleMasterMode(&SPI0->CR, false);
|
||||
|
||||
// RESET command
|
||||
ST7565_WriteByte(0xE2);
|
||||
ST7565_WriteByte(0xE2); // internal reset
|
||||
|
||||
SYSTEM_DelayMs(120);
|
||||
|
||||
ST7565_WriteByte(0xA2);
|
||||
ST7565_WriteByte(0xC0);
|
||||
ST7565_WriteByte(0xA1);
|
||||
ST7565_WriteByte(0xA6);
|
||||
ST7565_WriteByte(0xA4);
|
||||
ST7565_WriteByte(0x24);
|
||||
ST7565_WriteByte(0x81);
|
||||
ST7565_WriteByte(0x1F);
|
||||
ST7565_WriteByte(0x2B);
|
||||
ST7565_WriteByte(0xA2); // bias 9
|
||||
ST7565_WriteByte(0xC0); // com normal
|
||||
ST7565_WriteByte(0xA1); // reverse ?
|
||||
ST7565_WriteByte(0xA6); // normal ?
|
||||
ST7565_WriteByte(0xA4); // all points normal
|
||||
ST7565_WriteByte(0x24); //
|
||||
ST7565_WriteByte(0x81); // volume first ?
|
||||
ST7565_WriteByte(0x1f); // contrast ?
|
||||
ST7565_WriteByte(0x2B); // power control ?
|
||||
|
||||
SYSTEM_DelayMs(1);
|
||||
|
||||
ST7565_WriteByte(0x2E);
|
||||
ST7565_WriteByte(0x2E); // power control ?
|
||||
|
||||
SYSTEM_DelayMs(1);
|
||||
|
||||
ST7565_WriteByte(0x2F);
|
||||
ST7565_WriteByte(0x2F);
|
||||
ST7565_WriteByte(0x2F);
|
||||
ST7565_WriteByte(0x2F);
|
||||
ST7565_WriteByte(0x2F); //
|
||||
ST7565_WriteByte(0x2F); //
|
||||
ST7565_WriteByte(0x2F); //
|
||||
ST7565_WriteByte(0x2F); //
|
||||
|
||||
SYSTEM_DelayMs(40);
|
||||
|
||||
ST7565_WriteByte(0x40);
|
||||
ST7565_WriteByte(0xAF);
|
||||
ST7565_WriteByte(0x40); // start line ?
|
||||
ST7565_WriteByte(0xAF); // display on ?
|
||||
|
||||
SPI_WaitForUndocumentedTxFifoStatusBit();
|
||||
|
||||
|
Reference in New Issue
Block a user