zhangbo
2025-02-13 b32910bdb85c6e9d19abf97f1465c573a0bf9d38
keil/include/components/hal/pan_rf.c
@@ -9,6 +9,7 @@
#include "pan_port.h"
#include "pan_param.h"
#include "lora_3029.h"
#include "PCA9555.h"
/*
 * flag that indicate if a new packet is received.
*/
@@ -2343,6 +2344,7 @@
 * @param[in] <none>
 * @return result
 */
uint16_t rx_timeout=0;
void rf_irq_process(void)
{
    if(CHECK_IRQ())
@@ -2383,8 +2385,9 @@
        if(irq & REG_IRQ_RX_TIMEOUT)
        {
            rf_refresh();
         irq &= ~REG_IRQ_RX_TIMEOUT;
         rf_clr_irq(REG_IRQ_RX_TIMEOUT);
            irq &= ~REG_IRQ_RX_TIMEOUT;
            rf_clr_irq(REG_IRQ_RX_TIMEOUT);
               rx_timeout++;
            rf_set_recv_flag(RADIO_FLAG_RXTIMEOUT);
        }
        if(irq & REG_IRQ_TX_DONE)
@@ -2432,20 +2435,38 @@
    return LEVEL_ACTIVE;
}
void set_test_mode1_reg(void)
{
   uint8_t tmpreg;
   tmpreg = rf_read_spec_page_reg(PAGE3_SEL, 0x12);
   rf_write_spec_page_reg(PAGE1_SEL, 0x25, 0x48);
   rf_write_spec_page_reg(PAGE3_SEL, 0x12, (0x02|(tmpreg&0x08)));
}
/**
 * @brief set rf default para
 * @param[in] <none>
 * @return result
 */
RF_Err_t rf_set_default_para(void)
//RF_Err_t rf_set_default_para(void)
//{
//    RF_ASSERT(rf_set_freq(DEFAULT_FREQ));
//     RF_ASSERT(rf_set_sf(DEFAULT_SF));
//    RF_ASSERT(rf_set_code_rate(DEFAULT_CR));
//    RF_ASSERT(rf_set_bw(DEFAULT_BW));
//    RF_ASSERT(rf_set_crc(CRC_OFF));
//    RF_ASSERT(rf_set_tx_power(DEFAULT_PWR));
//    return OK;
//}
RF_Err_t rf_set_default_para(uint32_t freq, uint8_t sf)
{
    RF_ASSERT(rf_set_freq(DEFAULT_FREQ));
    RF_ASSERT(rf_set_freq(freq));
    RF_ASSERT(rf_set_sf(sf));
    RF_ASSERT(rf_set_code_rate(DEFAULT_CR));
    RF_ASSERT(rf_set_bw(DEFAULT_BW));
    RF_ASSERT(rf_set_sf(DEFAULT_SF));
    RF_ASSERT(rf_set_crc(CRC_ON));
    RF_ASSERT(rf_set_crc(CRC_OFF));
    RF_ASSERT(rf_set_tx_power(DEFAULT_PWR));
    return OK;
}
}