This commit is contained in:
69
app/fm.c
69
app/fm.c
@@ -383,75 +383,6 @@ static void Key_FUNC(KEY_Code_t Key, uint8_t state) {
|
|||||||
gRequestSaveSettings = true;
|
gRequestSaveSettings = true;
|
||||||
gRequestSaveFM = true;
|
gRequestSaveFM = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_7:
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, true);
|
|
||||||
|
|
||||||
// mask just in case
|
|
||||||
uint32_t id24 = 0x00A38C;
|
|
||||||
uint8_t btn = 0x04;
|
|
||||||
uint8_t out[10];
|
|
||||||
|
|
||||||
// 3-byte big-endian ID
|
|
||||||
out[0] = (id24 >> 16) & 0xFF;
|
|
||||||
out[1] = (id24 >> 8) & 0xFF;
|
|
||||||
out[2] = (id24 >> 0) & 0xFF;
|
|
||||||
|
|
||||||
// first nibble<6C>\redundancy copy: 0xBB if btn=0xB
|
|
||||||
out[3] = (btn << 4) | 0x04;
|
|
||||||
|
|
||||||
// second copy with MSB flipped (btn ^ 0x8) in the high nibble
|
|
||||||
out[4] = ((btn ^ 0x8) << 4);
|
|
||||||
|
|
||||||
BK4819_EnterTxMute();
|
|
||||||
RADIO_SetTxParameters();
|
|
||||||
|
|
||||||
BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_ENABLE_TONE1 |
|
|
||||||
((127 & 0x7f) << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
|
|
||||||
uint16_t datX = BK4819_REG_30_ENABLE_VCO_CALIB |
|
|
||||||
BK4819_REG_30_ENABLE_UNKNOWN |
|
|
||||||
BK4819_REG_30_DISABLE_RX_LINK |
|
|
||||||
BK4819_REG_30_DISABLE_AF_DAC |
|
|
||||||
BK4819_REG_30_ENABLE_DISC_MODE |
|
|
||||||
BK4819_REG_30_ENABLE_PLL_VCO |
|
|
||||||
BK4819_REG_30_ENABLE_PA_GAIN |
|
|
||||||
BK4819_REG_30_DISABLE_MIC_ADC |
|
|
||||||
BK4819_REG_30_ENABLE_TX_DSP |
|
|
||||||
BK4819_REG_30_DISABLE_RX_DSP;
|
|
||||||
BK4819_WriteRegister(BK4819_REG_30,
|
|
||||||
datX);
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
|
|
||||||
SYSTEM_DelayMs(20);
|
|
||||||
|
|
||||||
for (unsigned int x = 0; x < 24; x++) {
|
|
||||||
for (unsigned int y = 0; y < sizeof(out); y++) {
|
|
||||||
for (unsigned char i = 7; i < 8; i--) {
|
|
||||||
if ((out[y] >> i) & 1) {
|
|
||||||
// datX |= BK4819_REG_30_ENABLE_PA_GAIN;
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, true);
|
|
||||||
SYSTICK_DelayUs(400 * 3 - 350);
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
|
|
||||||
// datX &= ~BK4819_REG_30_ENABLE_PA_GAIN;
|
|
||||||
SYSTICK_DelayUs(400 * 1 - 350);
|
|
||||||
} else {
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, true);
|
|
||||||
// datX |= BK4819_REG_30_ENABLE_PA_GAIN;
|
|
||||||
SYSTICK_DelayUs(400 * 1 - 350);
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
|
|
||||||
// datX &= ~BK4819_REG_30_ENABLE_PA_GAIN;
|
|
||||||
SYSTICK_DelayUs(400 * 3 - 350);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
|
|
||||||
SYSTEM_DelayMs(3);
|
|
||||||
}
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
|
|
||||||
SYSTEM_DelayMs(100);
|
|
||||||
BK4819_WriteRegister(BK4819_REG_30, 0xC1FE);
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case KEY_STAR:
|
case KEY_STAR:
|
||||||
ACTION_Scan(autoScan);
|
ACTION_Scan(autoScan);
|
||||||
break;
|
break;
|
||||||
|
@@ -5,6 +5,7 @@
|
|||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
#include "driver/uart.h"
|
#include "driver/uart.h"
|
||||||
|
#include "driver/systick.h"
|
||||||
|
|
||||||
#define T9Count 9
|
#define T9Count 9
|
||||||
|
|
||||||
@@ -120,8 +121,75 @@ void MESSAGES_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
|||||||
if (bKeyPressed) {
|
if (bKeyPressed) {
|
||||||
memset(dataPacket.data, 0, DataPacketDataSize);
|
memset(dataPacket.data, 0, DataPacketDataSize);
|
||||||
prepareDataPacket();
|
prepareDataPacket();
|
||||||
dataPacket.flags = 0x80 | (gCurrentVfo->OUTPUT_POWER & 0x07);
|
//dataPacket.flags = 0x80 | (gCurrentVfo->OUTPUT_POWER & 0x07);
|
||||||
gEnteringSMS = SMS_ENTERING_MESSAGE;
|
if (dataPacket.src == 665) {
|
||||||
|
|
||||||
|
const uint32_t id24 = 0xFFFFFF & (dataPacket.dest >> 4);
|
||||||
|
const uint8_t btn = 0x0F & (dataPacket.dest);
|
||||||
|
// mask just in case
|
||||||
|
// uint32_t id24 = 0x00A38C;
|
||||||
|
// uint8_t btn = 0x04;
|
||||||
|
uint8_t out[10];
|
||||||
|
|
||||||
|
// 3-byte big-endian ID
|
||||||
|
out[0] = (id24 >> 16) & 0xFF;
|
||||||
|
out[1] = (id24 >> 8) & 0xFF;
|
||||||
|
out[2] = (id24 >> 0) & 0xFF;
|
||||||
|
|
||||||
|
// first nibble redundancy copy: 0xBB if btn=0xB
|
||||||
|
out[3] = (btn << 4) | 0x04;
|
||||||
|
|
||||||
|
// second copy with MSB flipped (btn ^ 0x8) in the high nibble
|
||||||
|
out[4] = ((btn ^ 0x8) << 4);
|
||||||
|
|
||||||
|
BK4819_EnterTxMute();
|
||||||
|
RADIO_SetTxParameters();
|
||||||
|
|
||||||
|
uint16_t datX = BK4819_REG_30_ENABLE_VCO_CALIB |
|
||||||
|
BK4819_REG_30_ENABLE_UNKNOWN |
|
||||||
|
BK4819_REG_30_DISABLE_RX_LINK |
|
||||||
|
BK4819_REG_30_DISABLE_AF_DAC |
|
||||||
|
BK4819_REG_30_ENABLE_DISC_MODE |
|
||||||
|
BK4819_REG_30_ENABLE_PLL_VCO |
|
||||||
|
BK4819_REG_30_ENABLE_PA_GAIN |
|
||||||
|
BK4819_REG_30_DISABLE_MIC_ADC |
|
||||||
|
BK4819_REG_30_ENABLE_TX_DSP |
|
||||||
|
BK4819_REG_30_DISABLE_RX_DSP;
|
||||||
|
BK4819_WriteRegister(BK4819_REG_30,
|
||||||
|
datX);
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
|
||||||
|
SYSTEM_DelayMs(20);
|
||||||
|
|
||||||
|
for (unsigned int x = 0; x < 24; x++) {
|
||||||
|
for (unsigned int y = 0; y < sizeof(out); y++) {
|
||||||
|
for (unsigned char i = 7; i < 8; i--) {
|
||||||
|
if ((out[y] >> i) & 1) {
|
||||||
|
// datX |= BK4819_REG_30_ENABLE_PA_GAIN;
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, true);
|
||||||
|
SYSTICK_DelayUs(400 * 3 - 350);
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
|
||||||
|
// datX &= ~BK4819_REG_30_ENABLE_PA_GAIN;
|
||||||
|
SYSTICK_DelayUs(400 * 1 - 350);
|
||||||
|
} else {
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, true);
|
||||||
|
// datX |= BK4819_REG_30_ENABLE_PA_GAIN;
|
||||||
|
SYSTICK_DelayUs(400 * 1 - 350);
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
|
||||||
|
// datX &= ~BK4819_REG_30_ENABLE_PA_GAIN;
|
||||||
|
SYSTICK_DelayUs(400 * 3 - 350);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
|
||||||
|
SYSTEM_DelayMs(3);
|
||||||
|
}
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
|
||||||
|
SYSTEM_DelayMs(100);
|
||||||
|
BK4819_WriteRegister(BK4819_REG_30, 0xC1FE);
|
||||||
|
gEnteringSMS = SMS_NOT_ENTERING;
|
||||||
|
} else {
|
||||||
|
gEnteringSMS = SMS_ENTERING_MESSAGE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
} else if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
||||||
|
Reference in New Issue
Block a user