mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-08-03 01:26:33 +03:00
Renamed lots more
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
#include "settings.h"
|
||||
|
||||
// this is decremented once every 500ms
|
||||
uint16_t gBacklightCountdown = 0;
|
||||
uint16_t g_backlight_count_down = 0;
|
||||
|
||||
void backlight_turn_on(void)
|
||||
{
|
||||
@@ -34,27 +34,27 @@ void backlight_turn_on(void)
|
||||
{
|
||||
default:
|
||||
case 1: // 5 sec
|
||||
gBacklightCountdown = 5;
|
||||
g_backlight_count_down = 5;
|
||||
break;
|
||||
case 2: // 10 sec
|
||||
gBacklightCountdown = 10;
|
||||
g_backlight_count_down = 10;
|
||||
break;
|
||||
case 3: // 20 sec
|
||||
gBacklightCountdown = 20;
|
||||
g_backlight_count_down = 20;
|
||||
break;
|
||||
case 4: // 1 min
|
||||
gBacklightCountdown = 60;
|
||||
g_backlight_count_down = 60;
|
||||
break;
|
||||
case 5: // 2 min
|
||||
gBacklightCountdown = 60 * 2;
|
||||
g_backlight_count_down = 60 * 2;
|
||||
break;
|
||||
case 6: // 4 min
|
||||
gBacklightCountdown = 60 * 4;
|
||||
g_backlight_count_down = 60 * 4;
|
||||
break;
|
||||
case 7: // always on
|
||||
gBacklightCountdown = 0;
|
||||
g_backlight_count_down = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
gBacklightCountdown *= 2;
|
||||
g_backlight_count_down *= 2;
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
extern uint16_t gBacklightCountdown;
|
||||
extern uint16_t g_backlight_count_down;
|
||||
|
||||
void backlight_turn_on(void);
|
||||
|
||||
|
@@ -542,7 +542,7 @@ void BK4819_EnableVox(uint16_t VoxEnableThreshold, uint16_t VoxDisableThreshold)
|
||||
BK4819_WriteRegister(BK4819_REG_31, REG_31_Value | (1u << 2)); // VOX Enable
|
||||
}
|
||||
|
||||
void BK4819_SetFilterBandwidth(const BK4819_FilterBandwidth_t Bandwidth, const bool weak_no_different)
|
||||
void BK4819_SetFilterBandwidth(const BK4819_filter_bandwidth_t Bandwidth, const bool weak_no_different)
|
||||
{
|
||||
// REG_43
|
||||
// <15> 0 ???
|
||||
@@ -713,8 +713,8 @@ void BK4819_SetFrequency(uint32_t Frequency)
|
||||
}
|
||||
|
||||
void BK4819_SetupSquelch(
|
||||
uint8_t squelch_open_RSSI_thresh,
|
||||
uint8_t squelch_close_RSSI_thresh,
|
||||
uint8_t squelch_open_rssi_thresh,
|
||||
uint8_t squelch_close_rssi_thresh,
|
||||
uint8_t squelch_open_noise_thresh,
|
||||
uint8_t squelch_close_noise_thresh,
|
||||
uint8_t squelch_close_glitch_thresh,
|
||||
@@ -792,14 +792,14 @@ void BK4819_SetupSquelch(
|
||||
//
|
||||
// <7:0> 70 RSSI threshold for Squelch = close 0.5dB/step
|
||||
//
|
||||
BK4819_WriteRegister(BK4819_REG_78, ((uint16_t)squelch_open_RSSI_thresh << 8) | squelch_close_RSSI_thresh);
|
||||
BK4819_WriteRegister(BK4819_REG_78, ((uint16_t)squelch_open_rssi_thresh << 8) | squelch_close_rssi_thresh);
|
||||
|
||||
BK4819_SetAF(BK4819_AF_MUTE);
|
||||
|
||||
BK4819_RX_TurnOn();
|
||||
}
|
||||
|
||||
void BK4819_SetAF(BK4819_AF_Type_t AF)
|
||||
void BK4819_SetAF(BK4819_af_type_t AF)
|
||||
{
|
||||
// AF Output Inverse Mode = Inverse
|
||||
// Undocumented bits 0x2040
|
||||
@@ -1504,7 +1504,7 @@ bool BK4819_GetFrequencyScanResult(uint32_t *pFrequency)
|
||||
return finished;
|
||||
}
|
||||
|
||||
BK4819_CssScanResult_t BK4819_GetCxCSSScanResult(uint32_t *pCdcssFreq, uint16_t *pCtcssFreq)
|
||||
BK4819_CSS_scan_result_t BK4819_GetCxCSSScanResult(uint32_t *pCdcssFreq, uint16_t *pCtcssFreq)
|
||||
{
|
||||
// **********
|
||||
// REG_68 read only
|
||||
|
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "driver/bk4819-regs.h"
|
||||
|
||||
enum BK4819_AF_Type_t
|
||||
enum BK4819_af_type_e
|
||||
{
|
||||
BK4819_AF_MUTE = 0u, //
|
||||
BK4819_AF_FM = 1u, // FM
|
||||
@@ -38,29 +38,26 @@ enum BK4819_AF_Type_t
|
||||
BK4819_AF_UNKNOWN5 = 11u, // distorted
|
||||
BK4819_AF_UNKNOWN6 = 12u, // distorted
|
||||
BK4819_AF_UNKNOWN7 = 13u, // interesting
|
||||
BK4819_AF_UNKNOWN8 = 14u, // interesting
|
||||
BK4819_AF_UNKNOWN8 = 14u, // interesting
|
||||
BK4819_AF_UNKNOWN9 = 15u // not a lot
|
||||
};
|
||||
typedef enum BK4819_af_type_e BK4819_af_type_t;
|
||||
|
||||
typedef enum BK4819_AF_Type_t BK4819_AF_Type_t;
|
||||
|
||||
enum BK4819_FilterBandwidth_t
|
||||
enum BK4819_filter_bandwidth_e
|
||||
{
|
||||
BK4819_FILTER_BW_WIDE = 0,
|
||||
BK4819_FILTER_BW_NARROW,
|
||||
BK4819_FILTER_BW_NARROWER
|
||||
};
|
||||
typedef enum BK4819_filter_bandwidth_e BK4819_filter_bandwidth_t;
|
||||
|
||||
typedef enum BK4819_FilterBandwidth_t BK4819_FilterBandwidth_t;
|
||||
|
||||
enum BK4819_CssScanResult_t
|
||||
enum BK4819_CSS_scan_result_e
|
||||
{
|
||||
BK4819_CSS_RESULT_NOT_FOUND = 0,
|
||||
BK4819_CSS_RESULT_CTCSS,
|
||||
BK4819_CSS_RESULT_CDCSS
|
||||
};
|
||||
|
||||
typedef enum BK4819_CssScanResult_t BK4819_CssScanResult_t;
|
||||
typedef enum BK4819_CSS_scan_result_e BK4819_CSS_scan_result_t;
|
||||
|
||||
extern bool g_rx_idle_mode;
|
||||
|
||||
@@ -78,7 +75,7 @@ void BK4819_SetCDCSSCodeWord(uint32_t CodeWord);
|
||||
void BK4819_SetCTCSSFrequency(uint32_t BaudRate);
|
||||
void BK4819_SetTailDetection(const uint32_t freq_10Hz);
|
||||
void BK4819_EnableVox(uint16_t Vox1Threshold, uint16_t Vox0Threshold);
|
||||
void BK4819_SetFilterBandwidth(const BK4819_FilterBandwidth_t Bandwidth, const bool weak_no_different);
|
||||
void BK4819_SetFilterBandwidth(const BK4819_filter_bandwidth_t Bandwidth, const bool weak_no_different);
|
||||
void BK4819_SetupPowerAmplifier(const uint8_t bias, const uint32_t frequency);
|
||||
void BK4819_SetFrequency(uint32_t Frequency);
|
||||
void BK4819_SetupSquelch(
|
||||
@@ -89,7 +86,7 @@ void BK4819_SetupSquelch(
|
||||
uint8_t SquelchCloseGlitchThresh,
|
||||
uint8_t SquelchOpenGlitchThresh);
|
||||
|
||||
void BK4819_SetAF(BK4819_AF_Type_t AF);
|
||||
void BK4819_SetAF(BK4819_af_type_t AF);
|
||||
void BK4819_RX_TurnOn(void);
|
||||
void BK4819_PickRXFilterPathBasedOnFrequency(uint32_t Frequency);
|
||||
void BK4819_DisableScramble(void);
|
||||
@@ -139,7 +136,7 @@ uint16_t BK4819_GetVoiceAmplitudeOut(void);
|
||||
uint8_t BK4819_GetAfTxRx(void);
|
||||
|
||||
bool BK4819_GetFrequencyScanResult(uint32_t *pFrequency);
|
||||
BK4819_CssScanResult_t BK4819_GetCxCSSScanResult(uint32_t *pCdcssFreq, uint16_t *pCtcssFreq);
|
||||
BK4819_CSS_scan_result_t BK4819_GetCxCSSScanResult(uint32_t *pCdcssFreq, uint16_t *pCtcssFreq);
|
||||
void BK4819_DisableFrequencyScan(void);
|
||||
void BK4819_EnableFrequencyScan(void);
|
||||
void BK4819_SetScanFrequency(uint32_t Frequency);
|
||||
@@ -156,15 +153,14 @@ uint8_t BK4819_GetCTCType(void);
|
||||
|
||||
void BK4819_SendFSKData(uint16_t *pData);
|
||||
void BK4819_PrepareFSKReceive(void);
|
||||
|
||||
|
||||
void BK4819_PlayRoger(void);
|
||||
void BK4819_PlayRogerMDC(void);
|
||||
|
||||
|
||||
void BK4819_Enable_AfDac_DiscMode_TxDsp(void);
|
||||
|
||||
|
||||
void BK4819_GetVoxAmp(uint16_t *pResult);
|
||||
void BK4819_SetScrambleFrequencyControlWord(uint32_t Frequency);
|
||||
void BK4819_PlayDTMFEx(bool bLocalLoopback, char Code);
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -25,7 +25,7 @@
|
||||
key_code_t g_key_reading_0 = KEY_INVALID;
|
||||
key_code_t g_key_reading_1 = KEY_INVALID;
|
||||
uint16_t g_debounce_counter = 0;
|
||||
bool g_was_f_key_pressed = false;
|
||||
bool g_f_key_was_pressed = false;
|
||||
|
||||
static const struct {
|
||||
|
||||
|
@@ -48,7 +48,7 @@ typedef enum key_code_e key_code_t;
|
||||
extern key_code_t g_key_reading_0;
|
||||
extern key_code_t g_key_reading_1;
|
||||
extern uint16_t g_debounce_counter;
|
||||
extern bool g_was_f_key_pressed;
|
||||
extern bool g_f_key_was_pressed;
|
||||
|
||||
key_code_t KEYBOARD_Poll(void);
|
||||
|
||||
|
@@ -25,8 +25,8 @@
|
||||
#include "driver/system.h"
|
||||
#include "misc.h"
|
||||
|
||||
uint8_t gStatusLine[128];
|
||||
uint8_t gFrameBuffer[7][128];
|
||||
uint8_t g_status_line[128];
|
||||
uint8_t g_frame_buffer[7][128];
|
||||
|
||||
void ST7565_DrawLine(const unsigned int Column, const unsigned int Line, const unsigned int Size, const uint8_t *pBitmap)
|
||||
{
|
||||
@@ -68,15 +68,15 @@ void ST7565_BlitFullScreen(void)
|
||||
|
||||
ST7565_WriteByte(0x40);
|
||||
|
||||
for (Line = 0; Line < ARRAY_SIZE(gFrameBuffer); Line++)
|
||||
for (Line = 0; Line < ARRAY_SIZE(g_frame_buffer); Line++)
|
||||
{
|
||||
unsigned int Column;
|
||||
ST7565_SelectColumnAndLine(4, Line + 1);
|
||||
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_ST7565_A0);
|
||||
for (Column = 0; Column < ARRAY_SIZE(gFrameBuffer[0]); Column++)
|
||||
for (Column = 0; Column < ARRAY_SIZE(g_frame_buffer[0]); Column++)
|
||||
{
|
||||
while ((SPI0->FIFOST & SPI_FIFOST_TFF_MASK) != SPI_FIFOST_TFF_BITS_NOT_FULL) {}
|
||||
SPI0->WDR = gFrameBuffer[Line][Column];
|
||||
SPI0->WDR = g_frame_buffer[Line][Column];
|
||||
}
|
||||
SPI_WaitForUndocumentedTxFifoStatusBit();
|
||||
}
|
||||
@@ -104,10 +104,10 @@ void ST7565_BlitStatusLine(void)
|
||||
|
||||
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_ST7565_A0);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(gStatusLine); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(g_status_line); i++)
|
||||
{
|
||||
while ((SPI0->FIFOST & SPI_FIFOST_TFF_MASK) != SPI_FIFOST_TFF_BITS_NOT_FULL) {}
|
||||
SPI0->WDR = gStatusLine[i];
|
||||
SPI0->WDR = g_status_line[i];
|
||||
}
|
||||
|
||||
SPI_WaitForUndocumentedTxFifoStatusBit();
|
||||
|
@@ -23,8 +23,8 @@
|
||||
#define LCD_WIDTH 128
|
||||
#define LCD_HEIGHT 64
|
||||
|
||||
extern uint8_t gStatusLine[128];
|
||||
extern uint8_t gFrameBuffer[7][128];
|
||||
extern uint8_t g_status_line[128];
|
||||
extern uint8_t g_frame_buffer[7][128];
|
||||
|
||||
void ST7565_DrawLine(const unsigned int Column, const unsigned int Line, const unsigned int Size, const uint8_t *pBitmap);
|
||||
void ST7565_BlitFullScreen(void);
|
||||
|
@@ -21,7 +21,7 @@
|
||||
#include "driver/uart.h"
|
||||
|
||||
static bool UART_IsLogEnabled;
|
||||
uint8_t UART_DMA_Buffer[256];
|
||||
uint8_t UART_DMA_Buffer[256];
|
||||
|
||||
void UART_Init(void)
|
||||
{
|
||||
@@ -33,11 +33,7 @@ void UART_Init(void)
|
||||
Delta = SYSCON_RC_FREQ_DELTA;
|
||||
Positive = (Delta & SYSCON_RC_FREQ_DELTA_RCHF_SIG_MASK) >> SYSCON_RC_FREQ_DELTA_RCHF_SIG_SHIFT;
|
||||
Frequency = (Delta & SYSCON_RC_FREQ_DELTA_RCHF_DELTA_MASK) >> SYSCON_RC_FREQ_DELTA_RCHF_DELTA_SHIFT;
|
||||
if (Positive) {
|
||||
Frequency += 48000000U;
|
||||
} else {
|
||||
Frequency = 48000000U - Frequency;
|
||||
}
|
||||
Frequency = Positive ? Frequency + 48000000U : 48000000U - Frequency;
|
||||
|
||||
UART1->BAUD = Frequency / 39053U;
|
||||
UART1->CTRL = UART_CTRL_RXEN_BITS_ENABLE | UART_CTRL_TXEN_BITS_ENABLE | UART_CTRL_RXDMAEN_BITS_ENABLE;
|
||||
@@ -89,16 +85,15 @@ void UART_Send(const void *pBuffer, uint32_t Size)
|
||||
const uint8_t *pData = (const uint8_t *)pBuffer;
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < Size; i++) {
|
||||
for (i = 0; i < Size; i++)
|
||||
{
|
||||
UART1->TDR = pData[i];
|
||||
while ((UART1->IF & UART_IF_TXFIFO_FULL_MASK) != UART_IF_TXFIFO_FULL_BITS_NOT_SET) {
|
||||
}
|
||||
while ((UART1->IF & UART_IF_TXFIFO_FULL_MASK) != UART_IF_TXFIFO_FULL_BITS_NOT_SET) {}
|
||||
}
|
||||
}
|
||||
|
||||
void UART_LogSend(const void *pBuffer, uint32_t Size)
|
||||
{
|
||||
if (UART_IsLogEnabled) {
|
||||
if (UART_IsLogEnabled)
|
||||
UART_Send(pBuffer, Size);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user