mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-25 14:22:27 +03:00
SubGhz: fix cc1101_read_fifo func (#2379)
This commit is contained in:
parent
4265057ee8
commit
82c730b6be
@ -150,9 +150,8 @@ uint8_t cc1101_write_fifo(FuriHalSpiBusHandle* handle, const uint8_t* data, uint
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t cc1101_read_fifo(FuriHalSpiBusHandle* handle, uint8_t* data, uint8_t* size) {
|
uint8_t cc1101_read_fifo(FuriHalSpiBusHandle* handle, uint8_t* data, uint8_t* size) {
|
||||||
uint8_t buff_tx[64];
|
uint8_t buff_trx[2];
|
||||||
buff_tx[0] = CC1101_FIFO | CC1101_READ | CC1101_BURST;
|
buff_trx[0] = CC1101_FIFO | CC1101_READ | CC1101_BURST;
|
||||||
uint8_t buff_rx[2];
|
|
||||||
|
|
||||||
// Start transaction
|
// Start transaction
|
||||||
// Wait IC to become ready
|
// Wait IC to become ready
|
||||||
@ -160,15 +159,15 @@ uint8_t cc1101_read_fifo(FuriHalSpiBusHandle* handle, uint8_t* data, uint8_t* si
|
|||||||
;
|
;
|
||||||
|
|
||||||
// First byte - packet length
|
// First byte - packet length
|
||||||
furi_hal_spi_bus_trx(handle, buff_tx, buff_rx, 2, CC1101_TIMEOUT);
|
furi_hal_spi_bus_trx(handle, buff_trx, buff_trx, 2, CC1101_TIMEOUT);
|
||||||
|
|
||||||
// Check that the packet is placed in the receive buffer
|
// Check that the packet is placed in the receive buffer
|
||||||
if(buff_rx[1] > 64) {
|
if(buff_trx[1] > 64) {
|
||||||
*size = 64;
|
*size = 64;
|
||||||
} else {
|
} else {
|
||||||
*size = buff_rx[1];
|
*size = buff_trx[1];
|
||||||
}
|
}
|
||||||
furi_hal_spi_bus_trx(handle, &buff_tx[1], data, *size, CC1101_TIMEOUT);
|
furi_hal_spi_bus_trx(handle, NULL, data, *size, CC1101_TIMEOUT);
|
||||||
|
|
||||||
return *size;
|
return *size;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user