SubGhz: sending / receiving messages via subghz (#851)

* SubGhz: add worker subghz_txrx
* SubGhz: added support for transferring Russian characters and support for backspace in CLI subghz_txrx
* SubGhz: refactoring subghz_txrx_worker, added a callback for accepting data in an empty one RX buffer
* SubGhz: fix conflict
* SubGhz: fix syntax errors
* Cli: document string_move usage and its behavior
* FuriHal: update subghz api and documentation. Subghz: move chat to subghz cli subcommand.
* Subghz: update text in chat cli

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
Skorpionm
2021-12-01 19:44:39 +04:00
committed by GitHub
parent 54c41e4189
commit b912cc7991
9 changed files with 715 additions and 44 deletions

View File

@@ -22,14 +22,14 @@ CC1101Status cc1101_write_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t
while(hal_gpio_read(handle->miso));
furi_hal_spi_bus_trx(handle, tx, (uint8_t*)rx, 2, CC1101_TIMEOUT);
assert((rx[0].CHIP_RDYn|rx[1].CHIP_RDYn) == 0);
assert((rx[0].CHIP_RDYn | rx[1].CHIP_RDYn) == 0);
return rx[1];
}
CC1101Status cc1101_read_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t* data) {
assert(sizeof(CC1101Status) == 1);
uint8_t tx[2] = { reg|CC1101_READ, 0};
CC1101Status rx[2] = { 0 };
uint8_t tx[2] = {reg | CC1101_READ, 0};
CC1101Status rx[2] = {0};
while(hal_gpio_read(handle->miso));
furi_hal_spi_bus_trx(handle, tx, (uint8_t*)rx, 2, CC1101_TIMEOUT);
@@ -58,8 +58,6 @@ uint8_t cc1101_get_rssi(FuriHalSpiBusHandle* handle) {
}
void cc1101_reset(FuriHalSpiBusHandle* handle) {
delay_us(1000);
delay_us(1000);
cc1101_strobe(handle, CC1101_STROBE_SRES);
}
@@ -130,7 +128,7 @@ void cc1101_set_pa_table(FuriHalSpiBusHandle* handle, const uint8_t value[8]) {
while(hal_gpio_read(handle->miso));
furi_hal_spi_bus_trx(handle, tx, (uint8_t*)rx, sizeof(rx), CC1101_TIMEOUT);
assert((rx[0].CHIP_RDYn|rx[8].CHIP_RDYn) == 0);
assert((rx[0].CHIP_RDYn | rx[8].CHIP_RDYn) == 0);
}
uint8_t cc1101_write_fifo(FuriHalSpiBusHandle* handle, const uint8_t* data, uint8_t size) {
@@ -159,9 +157,14 @@ uint8_t cc1101_read_fifo(FuriHalSpiBusHandle* handle, uint8_t* data, uint8_t* si
// First byte - packet length
furi_hal_spi_bus_trx(handle, buff_tx, buff_rx, 2, CC1101_TIMEOUT);
*size = buff_rx[1];
// Check that the packet is placed in the receive buffer
if(buff_rx[1] > 64) {
*size = 64;
} else {
*size = buff_rx[1];
}
furi_hal_spi_bus_trx(handle, &buff_tx[1], data, *size, CC1101_TIMEOUT);
cc1101_flush_rx(handle);
return *size;
}