This commit is contained in:
@@ -42,6 +42,8 @@
|
||||
#include "settings.h"
|
||||
#include "ui/inputbox.h"
|
||||
#include "ui/ui.h"
|
||||
#include "driver/st7565.h"
|
||||
|
||||
#ifdef ENABLE_REGA
|
||||
#include "app/rega.h"
|
||||
#endif
|
||||
@@ -58,6 +60,11 @@ static void ACTION_Scan_FM(bool bRestart);
|
||||
static void ACTION_AlarmOr1750(bool b1750);
|
||||
inline static void ACTION_Alarm() { ACTION_AlarmOr1750(false); }
|
||||
inline static void ACTION_1750() { ACTION_AlarmOr1750(true); };
|
||||
|
||||
inline static void ACTION_SSTV() {
|
||||
gFlagPrepareTX = gAlarmState != ALARM_STATE_OFF;
|
||||
gAlarmState = ALARM_STATE_SSTV;
|
||||
};
|
||||
#endif
|
||||
|
||||
inline static void ACTION_ScanRestart() { ACTION_Scan(true); };
|
||||
@@ -102,6 +109,8 @@ void (*action_opt_table[])(void) = {
|
||||
[ACTION_OPT_1750] = &FUNCTION_NOP,
|
||||
#endif
|
||||
|
||||
[ACTION_REQ_SSTV] = &ACTION_SSTV,
|
||||
|
||||
#ifdef ENABLE_BLMIN_TMP_OFF
|
||||
[ACTION_OPT_BLMIN_TMP_OFF] = &ACTION_BlminTmpOff,
|
||||
#else
|
||||
|
@@ -1395,9 +1395,9 @@ void APP_TimeSlice10ms(void) {
|
||||
|
||||
SCANNER_TimeSlice10ms();
|
||||
|
||||
if (gEnteringSMS == SMS_NOT_ENTERING) {
|
||||
MSG_FSKReceiveData();
|
||||
}
|
||||
// if (gEnteringSMS == SMS_NOT_ENTERING) {
|
||||
// MSG_FSKReceiveData();
|
||||
// }
|
||||
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
if (gScreenToDisplay == DISPLAY_AIRCOPY && gAircopyState == AIRCOPY_TRANSFER && gAirCopyIsSendMode == 1) {
|
||||
|
@@ -977,7 +977,7 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
|
||||
MSG_FSKSendData(&dataPacket);
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
|
||||
MSG_EnableRX(true);
|
||||
//MSG_EnableRX(true);
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
dataPTR = dataPacket.data;
|
||||
memset(dataPacket.data, 0, DataPacketDataSize);
|
||||
|
@@ -42,7 +42,7 @@ static uint16_t gBK4819_GpioOutState;
|
||||
|
||||
bool gRxIdleMode;
|
||||
|
||||
__inline uint16_t scale_freq(const uint16_t freq)
|
||||
__inline uint16_t scale_freq(uint16_t freq)
|
||||
{
|
||||
// return (((uint32_t)freq * 1032444u) + 50000u) / 100000u; // with rounding
|
||||
return (((uint32_t)freq * 1353245u) + (1u << 16)) >> 17; // with rounding
|
||||
|
@@ -65,6 +65,8 @@ typedef enum BK4819_CssScanResult_t BK4819_CssScanResult_t;
|
||||
// radio is asleep, not listening
|
||||
extern bool gRxIdleMode;
|
||||
|
||||
uint16_t scale_freq(uint16_t freq);
|
||||
|
||||
void BK4819_Init(void);
|
||||
uint16_t BK4819_ReadRegister(BK4819_REGISTER_t Register);
|
||||
void BK4819_WriteRegister(BK4819_REGISTER_t Register, uint16_t Data);
|
||||
|
51
functions.c
51
functions.c
@@ -48,6 +48,7 @@
|
||||
#include "ui/status.h"
|
||||
#include "ui/ui.h"
|
||||
#include "app/app.h"
|
||||
#include "driver/systick.h"
|
||||
|
||||
|
||||
FUNCTION_Type_t gCurrentFunction;
|
||||
@@ -150,6 +151,52 @@ void FUNCTION_PowerSave() {
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
}
|
||||
|
||||
#define SSTV_MULT 1
|
||||
|
||||
#define SCALE_FREQ(freq) ((((uint32_t)(freq) * 1353245u) + (1u << 16)) >> 17)
|
||||
|
||||
void BK4819_PlaySSTV_Robot8() {
|
||||
|
||||
|
||||
BK4819_EnterTxMute();
|
||||
BK4819_SetAF(gEeprom.DTMF_SIDE_TONE);
|
||||
BK4819_TransmitTone(true, 1000);
|
||||
SYSTEM_DelayMs(100);
|
||||
BK4819_WriteRegister(BK4819_REG_70,
|
||||
BK4819_REG_70_MASK_ENABLE_TONE1 | (66u << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
|
||||
BK4819_EnableTXLink();
|
||||
|
||||
SYSTEM_DelayMs(50);
|
||||
// **Send 9x Vertical Sync Pulses (1,900 Hz, 50ms each)**
|
||||
|
||||
// **Send 3x Vertical Sync Pulses (1,900 Hz, 30ms each)**
|
||||
for (int i = 0; i < 3; i++) {
|
||||
BK4819_WriteRegister(BK4819_REG_71, SCALE_FREQ(1900));
|
||||
SYSTEM_DelayMs(30);
|
||||
}
|
||||
|
||||
// **Transmit Image Data**
|
||||
for (uint8_t y = 0; y < 8; y++) {
|
||||
for (uint8_t rep = 0; rep < 2; rep++) {
|
||||
BK4819_WriteRegister(BK4819_REG_71, SCALE_FREQ(1200));
|
||||
SYSTEM_DelayMs(5);
|
||||
for (uint8_t bit = 0; bit < 8; bit++) {
|
||||
for (uint8_t x = 0; x < 128; x++) {
|
||||
uint8_t byte = gFrameBuffer[y][x];
|
||||
uint8_t bitV = byte & (1 << bit);
|
||||
uint16_t freq = (bitV) ? 2300 : 1200;
|
||||
BK4819_WriteRegister(BK4819_REG_71, SCALE_FREQ(freq));
|
||||
SYSTICK_DelayUs(432); // Pixel time = ~0.432ms
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BK4819_WriteRegister(BK4819_REG_70, 0x0000);
|
||||
// **End Transmission: Mute Transmitter**
|
||||
BK4819_ExitTxMute();
|
||||
}
|
||||
|
||||
void FUNCTION_Transmit() {
|
||||
// if DTMF is enabled when TX'ing, it changes the TX audio filtering !! .. 1of11
|
||||
|
||||
@@ -216,6 +263,10 @@ void FUNCTION_Transmit() {
|
||||
}
|
||||
#endif
|
||||
|
||||
if (gAlarmState == ALARM_STATE_SSTV) {
|
||||
BK4819_PlaySSTV_Robot8();
|
||||
gAlarmState = ALARM_STATE_OFF;
|
||||
}
|
||||
#ifdef ENABLE_ALARM
|
||||
if (gAlarmState == ALARM_STATE_TXALARM)
|
||||
BK4819_TransmitTone(true, 500);
|
||||
|
3
misc.h
3
misc.h
@@ -61,7 +61,8 @@ enum AlarmState_t {
|
||||
ALARM_STATE_OFF = 0,
|
||||
ALARM_STATE_TXALARM,
|
||||
ALARM_STATE_SITE_ALARM,
|
||||
ALARM_STATE_TX1750
|
||||
ALARM_STATE_TX1750,
|
||||
ALARM_STATE_SSTV
|
||||
};
|
||||
typedef enum AlarmState_t AlarmState_t;
|
||||
|
||||
|
@@ -139,6 +139,7 @@ enum ACTION_OPT_t {
|
||||
ACTION_OPT_REGA_ALARM,
|
||||
ACTION_OPT_REGA_TEST,
|
||||
#endif
|
||||
ACTION_REQ_SSTV,
|
||||
ACTION_OPT_LEN
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user