Fixed correct BK4819 GPIO pins.

This commit is contained in:
Dual Tachyon 2023-10-16 20:14:16 +01:00
parent 22bd27ea70
commit 8a64bcd15e
6 changed files with 24 additions and 25 deletions

View File

@ -51,7 +51,7 @@ void AIRCOPY_SendMessage(void)
RADIO_SetTxParameters();
BK4819_SendFSKData(g_FSK_Buffer);
BK4819_SetupPowerAmplifier(0, 0);
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1, false);
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29, false);
gAircopySendCountdown = 30;
}

View File

@ -562,11 +562,11 @@ void APP_CheckRadioInterrupts(void)
}
if (Mask & BK4819_REG_02_SQUELCH_LOST) {
g_SquelchLost = true;
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, true);
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, true);
}
if (Mask & BK4819_REG_02_SQUELCH_FOUND) {
g_SquelchLost = false;
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, false);
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false);
}
#if defined(ENABLE_AIRCOPY)
if (Mask & BK4819_REG_02_FSK_FIFO_ALMOST_FULL && gScreenToDisplay == DISPLAY_AIRCOPY && gAircopyState == AIRCOPY_TRANSFER && gAirCopyIsSendMode == 0) {
@ -777,7 +777,7 @@ void APP_Update(void)
gRxIdleMode = true;
BK4819_DisableVox();
BK4819_Sleep();
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28, false);
// Authentic device checked removed
} else {
DUALWATCH_Alternate();
@ -930,14 +930,14 @@ void APP_TimeSlice10ms(void)
gAlarmState = ALARM_STATE_ALARM;
RADIO_EnableCxCSS();
BK4819_SetupPowerAmplifier(0, 0);
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1, false);
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29, false);
BK4819_Enable_AfDac_DiscMode_TxDsp();
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, false);
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
GUI_DisplayScreen();
} else {
gAlarmState = ALARM_STATE_TXALARM;
GUI_DisplayScreen();
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, true);
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
RADIO_SetTxParameters();
BK4819_TransmitTone(true, 500);
SYSTEM_DelayMs(2);

View File

@ -95,13 +95,12 @@ enum BK4819_REGISTER_t {
typedef enum BK4819_REGISTER_t BK4819_REGISTER_t;
enum BK4819_GPIO_PIN_t {
BK4819_GPIO6_PIN2 = 0,
BK4819_GPIO5_PIN1 = 1,
BK4819_GPIO4_PIN32 = 2,
BK4819_GPIO0_PIN28 = 0,
BK4819_GPIO1_PIN29= 1,
BK4819_GPIO3_PIN31 = 3,
BK4819_GPIO2_PIN30 = 4,
BK4819_GPIO1_PIN29_RED = 5,
BK4819_GPIO0_PIN28_GREEN = 6,
BK4819_GPIO4_PIN32 = 4,
BK4819_GPIO5_PIN1_RED = 5,
BK4819_GPIO6_PIN2_GREEN = 6,
};
typedef enum BK4819_GPIO_PIN_t BK4819_GPIO_PIN_t;

View File

@ -377,13 +377,13 @@ void BK4819_RX_TurnOn(void)
void BK4819_SelectFilter(uint32_t Frequency)
{
if (Frequency < 28000000) {
BK4819_ToggleGpioOut(BK4819_GPIO2_PIN30, true);
BK4819_ToggleGpioOut(BK4819_GPIO4_PIN32, true);
BK4819_ToggleGpioOut(BK4819_GPIO3_PIN31, false);
} else if (Frequency == 0xFFFFFFFF) {
BK4819_ToggleGpioOut(BK4819_GPIO2_PIN30, false);
BK4819_ToggleGpioOut(BK4819_GPIO4_PIN32, false);
BK4819_ToggleGpioOut(BK4819_GPIO3_PIN31, false);
} else {
BK4819_ToggleGpioOut(BK4819_GPIO2_PIN30, false);
BK4819_ToggleGpioOut(BK4819_GPIO4_PIN32, false);
BK4819_ToggleGpioOut(BK4819_GPIO3_PIN31, true);
}
}
@ -545,7 +545,7 @@ void BK4819_ExitSubAu(void)
void BK4819_Conditional_RX_TurnOn_and_GPIO6_Enable(void)
{
if (gRxIdleMode) {
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, true);
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28, true);
BK4819_RX_TurnOn();
}
}

View File

@ -117,7 +117,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
gRxIdleMode = true;
BK4819_DisableVox();
BK4819_Sleep();
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28, false);
gBatterySaveCountdownExpired = false;
gUpdateStatus = true;
GUI_SelectNextDisplay(DISPLAY_MAIN);
@ -149,7 +149,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
GUI_DisplayScreen();
RADIO_SetTxParameters();
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, true);
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
DTMF_Reply();

12
radio.c
View File

@ -484,7 +484,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
gEnableSpeaker = false;
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, false);
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false);
if (gRxVfo->CHANNEL_BANDWIDTH == BK4819_FILTER_BW_WIDE) {
Bandwidth = gRxVfo->CHANNEL_BANDWIDTH;
@ -493,9 +493,9 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
}
BK4819_SetFilterBandwidth(Bandwidth);
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, false);
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
BK4819_SetupPowerAmplifier(0, 0);
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1, false);
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29, false);
while (1) {
Status = BK4819_ReadRegister(BK4819_REG_0C);
@ -522,7 +522,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
gRxVfo->SquelchOpenNoise, gRxVfo->SquelchCloseNoise,
gRxVfo->SquelchCloseGlitch, gRxVfo->SquelchOpenGlitch);
BK4819_SelectFilter(Frequency);
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, true);
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28, true);
BK4819_WriteRegister(BK4819_REG_48, 0xB3A8);
InterruptMask = 0
@ -663,7 +663,7 @@ void RADIO_SetTxParameters(void)
gEnableSpeaker = false;
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28, false);
Bandwidth = gCurrentVfo->CHANNEL_BANDWIDTH;
if (Bandwidth != BK4819_FILTER_BW_WIDE) {
Bandwidth = BK4819_FILTER_BW_NARROW;
@ -674,7 +674,7 @@ void RADIO_SetTxParameters(void)
SYSTEM_DelayMs(10);
BK4819_SelectFilter(gCurrentVfo->pTX->Frequency);
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1, true);
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29, true);
SYSTEM_DelayMs(5);
BK4819_SetupPowerAmplifier(gCurrentVfo->TXP_CalculatedSetting, gCurrentVfo->pTX->Frequency);