1#include "sx1262/sx1262.h"
5static uint32_t last_cmd_status = 0;
6static uint32_t last_chip_mode = 0;
7static uint32_t rx_time_ctr = 0;
8static long int rx_time = 0;
9static byte need_reset = 0;
10extern int sx1262_transmit_fail_counter;
15 if ((rs.cmd_status == last_cmd_status) && (rs.chip_mode == last_chip_mode)) {
18 last_cmd_status = rs.cmd_status;
19 last_chip_mode = rs.chip_mode;
21 if (rs.chip_mode == SX126X_CHIP_MODE_RX) {
23 if (sx1262_is_transmitting()) {
26 transmit_complete_irq();
29 if (mculib_has_time_passed(2, &rx_time)) {
32 if (rx_time_ctr > 5) {
33 print_chip_status(nctx, 1);
34 printf(
"[sx1262] detected chip is no longer in rx mode (ctr=%i). fixing. \r\n", rx_time_ctr);
35 sx1262_switch_to_rx(nctx);
42 if (sx1262_is_transmitting() == 1) {
44 sx1262_done_transmit();
46 if (sx1262_is_transmitting() != 0) {
49 if (rs.chip_mode != SX126X_CHIP_MODE_TX) {
51 transmit_complete_irq();
55 maybe_print_chip(nctx);
56 if (need_reset > 10) {
61 if (sx1262_transmit_fail_counter > 10) {
62 sx1262_init_or_reinit(nctx, 1);
SX126X chip status structure definition.
SX126x radio driver definition.
sx126x_status_t sx126x_get_status(struct network_context *nctx, sx126x_chip_status_t *radio_status)
Get the chip status.