SubGhz: PTC timings tuning and new key (#431)
This commit is contained in:
parent
51d726c2d7
commit
b28863ae04
@ -21,22 +21,24 @@ static const uint32_t subghz_frequencies[] = {
|
|||||||
463000000,
|
463000000,
|
||||||
781000000,
|
781000000,
|
||||||
868000000,
|
868000000,
|
||||||
|
868350000,
|
||||||
915000000,
|
915000000,
|
||||||
925000000,
|
925000000,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const ApiHalSubGhzPath subghz_frequencies_paths[] = {
|
static const ApiHalSubGhzPath subghz_frequencies_paths[] = {
|
||||||
ApiHalSubGhzPath2,
|
ApiHalSubGhzPath2, /* 301000000 */
|
||||||
ApiHalSubGhzPath2,
|
ApiHalSubGhzPath2, /* 315000000 */
|
||||||
ApiHalSubGhzPath2,
|
ApiHalSubGhzPath2, /* 346000000 */
|
||||||
ApiHalSubGhzPath2,
|
ApiHalSubGhzPath2, /* 385000000 */
|
||||||
ApiHalSubGhzPath1,
|
ApiHalSubGhzPath1, /* 433920000 */
|
||||||
ApiHalSubGhzPath1,
|
ApiHalSubGhzPath1, /* 438900000 */
|
||||||
ApiHalSubGhzPath1,
|
ApiHalSubGhzPath1, /* 463000000 */
|
||||||
ApiHalSubGhzPath3,
|
ApiHalSubGhzPath3, /* 781000000 */
|
||||||
ApiHalSubGhzPath3,
|
ApiHalSubGhzPath3, /* 868000000 */
|
||||||
ApiHalSubGhzPath3,
|
ApiHalSubGhzPath3, /* 868350000 */
|
||||||
ApiHalSubGhzPath3,
|
ApiHalSubGhzPath3, /* 915000000 */
|
||||||
|
ApiHalSubGhzPath3, /* 925000000 */
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint32_t subghz_frequencies_count = sizeof(subghz_frequencies) / sizeof(uint32_t);
|
static const uint32_t subghz_frequencies_count = sizeof(subghz_frequencies) / sizeof(uint32_t);
|
||||||
|
@ -7,11 +7,16 @@
|
|||||||
#include <input/input.h>
|
#include <input/input.h>
|
||||||
|
|
||||||
static const uint8_t subghz_static_keys[][4] = {
|
static const uint8_t subghz_static_keys[][4] = {
|
||||||
{0x74, 0xBA, 0xDE, 0x80},
|
{0x74, 0xBA, 0xDE},
|
||||||
{0x74, 0xBA, 0xDD, 0x80},
|
{0x74, 0xBA, 0xDD},
|
||||||
{0x74, 0xBA, 0xDB, 0x80},
|
{0x74, 0xBA, 0xDB},
|
||||||
|
{0xE3, 0x4A, 0x4E},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define SUBGHZ_PT_ONE 376
|
||||||
|
#define SUBGHZ_PT_ZERO (SUBGHZ_PT_ONE * 3)
|
||||||
|
#define SUBGHZ_PT_GUARD 10600
|
||||||
|
|
||||||
struct SubghzStatic {
|
struct SubghzStatic {
|
||||||
View* view;
|
View* view;
|
||||||
};
|
};
|
||||||
@ -83,7 +88,7 @@ bool subghz_static_input(InputEvent* event, void* context) {
|
|||||||
} else if(event->key == InputKeyDown) {
|
} else if(event->key == InputKeyDown) {
|
||||||
if(model->button > 0) model->button--;
|
if(model->button > 0) model->button--;
|
||||||
} else if(event->key == InputKeyUp) {
|
} else if(event->key == InputKeyUp) {
|
||||||
if(model->button < 2) model->button++;
|
if(model->button < 3) model->button++;
|
||||||
}
|
}
|
||||||
model->path = subghz_frequencies_paths[model->frequency];
|
model->path = subghz_frequencies_paths[model->frequency];
|
||||||
}
|
}
|
||||||
@ -102,29 +107,24 @@ bool subghz_static_input(InputEvent* event, void* context) {
|
|||||||
|
|
||||||
api_hal_light_set(LightRed, 0xff);
|
api_hal_light_set(LightRed, 0xff);
|
||||||
__disable_irq();
|
__disable_irq();
|
||||||
gpio_write(&cc1101_g0_gpio, false);
|
for(uint8_t r = 0; r < 20; r++) {
|
||||||
delay_us(136);
|
//Payload
|
||||||
gpio_write(&cc1101_g0_gpio, true);
|
for(uint8_t i = 0; i < 24; i++) {
|
||||||
delay_us(10000);
|
|
||||||
for(uint8_t r = 0; r < 8; r++) {
|
|
||||||
for(uint8_t i = 0; i < 25; i++) {
|
|
||||||
uint8_t byte = i / 8;
|
uint8_t byte = i / 8;
|
||||||
uint8_t bit = i % 8;
|
uint8_t bit = i % 8;
|
||||||
bool value = (key[byte] >> (7 - bit)) & 1;
|
bool value = (key[byte] >> (7 - bit)) & 1;
|
||||||
|
// Payload send
|
||||||
gpio_write(&cc1101_g0_gpio, false);
|
gpio_write(&cc1101_g0_gpio, false);
|
||||||
if(value) {
|
delay_us(value ? SUBGHZ_PT_ONE : SUBGHZ_PT_ZERO);
|
||||||
delay_us(360);
|
|
||||||
} else {
|
|
||||||
delay_us(1086);
|
|
||||||
}
|
|
||||||
gpio_write(&cc1101_g0_gpio, true);
|
gpio_write(&cc1101_g0_gpio, true);
|
||||||
if(value) {
|
delay_us(value ? SUBGHZ_PT_ZERO : SUBGHZ_PT_ONE);
|
||||||
delay_us(1086);
|
|
||||||
} else {
|
|
||||||
delay_us(360);
|
|
||||||
}
|
}
|
||||||
}
|
// Last bit
|
||||||
delay_us(10000);
|
gpio_write(&cc1101_g0_gpio, false);
|
||||||
|
delay_us(SUBGHZ_PT_ONE);
|
||||||
|
gpio_write(&cc1101_g0_gpio, true);
|
||||||
|
// Guard time
|
||||||
|
delay_us(10600);
|
||||||
}
|
}
|
||||||
__enable_irq();
|
__enable_irq();
|
||||||
api_hal_light_set(LightRed, 0x00);
|
api_hal_light_set(LightRed, 0x00);
|
||||||
|
Loading…
Reference in New Issue
Block a user