Finish the OOK remote sender, fix F+EXIT
OOK sender for 433 MHz remotes: PT2262, EV1527, rc-switch protocols 1-7, Intertechno self-learning and raw Manchester. The carrier is keyed with the PA enable line through a new fast BK4819 GPIO write (~25 us instead of ~300 us), and every edge is scheduled on an absolute SysTick clock. F+EXIT never opened the OOK sender: APP_ProcessKey cancels the F state for EXIT before the screen handler runs. Open it there instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
No files matched your search
@@ -394,6 +394,49 @@ void BK4819_ToggleGpioOut(BK4819_GPIO_PIN_t Pin, bool bSet)
|
||||
BK4819_WriteRegister(BK4819_REG_33, gBK4819_GpioOutState);
|
||||
}
|
||||
|
||||
// ~250 ns at 48 MHz: keeps the bit-banged SPI clock around 1 MHz
|
||||
#define BK4819_FAST_SPI_WAIT() __asm volatile ("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop")
|
||||
|
||||
// BK4819_WriteRegister() without the SYSTICK_DelayUs(1) calls (their overhead makes a
|
||||
// write take ~300 us).
|
||||
static void BK4819_WriteRegisterFast(BK4819_REGISTER_t Register, uint16_t Data)
|
||||
{
|
||||
uint32_t word = ((uint32_t) Register << 16) | Data;
|
||||
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCN);
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL);
|
||||
BK4819_FAST_SPI_WAIT();
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCN);
|
||||
|
||||
for (unsigned int i = 0; i < 24; i++) {
|
||||
if (word & 0x800000U)
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SDA);
|
||||
else
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SDA);
|
||||
BK4819_FAST_SPI_WAIT();
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL);
|
||||
BK4819_FAST_SPI_WAIT();
|
||||
word <<= 1;
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL);
|
||||
BK4819_FAST_SPI_WAIT();
|
||||
}
|
||||
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCN);
|
||||
BK4819_FAST_SPI_WAIT();
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL);
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SDA);
|
||||
}
|
||||
|
||||
void BK4819_ToggleGpioOutFast(BK4819_GPIO_PIN_t Pin, bool bSet)
|
||||
{
|
||||
if (bSet)
|
||||
gBK4819_GpioOutState |= (0x40u >> Pin);
|
||||
else
|
||||
gBK4819_GpioOutState &= ~(0x40u >> Pin);
|
||||
|
||||
BK4819_WriteRegisterFast(BK4819_REG_33, gBK4819_GpioOutState);
|
||||
}
|
||||
|
||||
void BK4819_SetCDCSSCodeWord(uint32_t CodeWord)
|
||||
{
|
||||
// REG_51
|
||||
|
||||
@@ -80,6 +80,9 @@ void BK4819_SetAGC(bool enable);
|
||||
void BK4819_InitAGC(bool amModulation);
|
||||
|
||||
void BK4819_ToggleGpioOut(BK4819_GPIO_PIN_t Pin, bool bSet);
|
||||
// Same as BK4819_ToggleGpioOut() with a fast SPI write (~25 us instead of ~300 us),
|
||||
// for timing critical keying such as OOK.
|
||||
void BK4819_ToggleGpioOutFast(BK4819_GPIO_PIN_t Pin, bool bSet);
|
||||
|
||||
void BK4819_ResetFSK(void);
|
||||
void BK4819_FskClearFifo(void);
|
||||
|
||||
Reference in New Issue
Block a user