62 lines
1.8 KiB
C
62 lines
1.8 KiB
C
#ifndef __APP_RF_H__
|
|
#define __APP_RF_H__
|
|
|
|
#include "app_data.h"
|
|
#include "rf_config.h"
|
|
//#include "rtt_platform.h"
|
|
#include "xc6xxx.h"
|
|
#include "xc6xxx_rf_2_4g.h"
|
|
#include "xc_software_crc.h"
|
|
|
|
typedef enum
|
|
{
|
|
RF_SEND_TIMER_INTER = 0,
|
|
RF_RECV_TIMER_INTER = 1,
|
|
RF_FREE_TIMER_INTER = 2
|
|
} rf_timer_stat_t; // PRX 状态
|
|
|
|
#define RECV_TIMERMS_OUT 1000 // 超时接收
|
|
//#define SEND_TIMERMS_CNT 10 * 1000 // 定时发射 ms
|
|
#define RECV_TIMERMS_CNT 50
|
|
#define ACK_SEND_TIMER 50
|
|
|
|
#define XC_SEND_NUM 1000 // 发射总包数
|
|
|
|
#define RF_TX_TIMERx TIMER0_IDX // 发射定时器号
|
|
#define RF_RX_TIMERx TIMER0_IDX // 接收定时器号
|
|
|
|
#define EXTEND_LEN (5)
|
|
|
|
extern uint8_t ret;
|
|
extern uint32_t count;
|
|
extern uint32_t send_ok;
|
|
extern uint32_t send_max;
|
|
extern bool rf_send_timer_flag;
|
|
extern bool rf_recv_timer_flag;
|
|
extern bool rf_prx_ack_flag;
|
|
extern rf_timer_stat_t timer_stat;
|
|
|
|
void timer_init(uint8_t timer_id, uint32_t timer_cnt);
|
|
void gpio_test(void);
|
|
void rf_debug_pin(uint8_t gpio_id);
|
|
uint16_t rf_get_addr_crc(void);
|
|
//void rf_buff_info(uint8_t *buff, uint8_t len);
|
|
void rf_rx_ack_payload_event(uint8_t *buff, uint8_t len);
|
|
void rf_set_agc(uint8_t adc_rssi_mean, uint8_t agc_gain_delay);
|
|
void rf_pwr_down_up(void);
|
|
// uint16_t rf_send_enhanced_data_cfg(uint8_t *buff, uint8_t len, uint8_t ack);
|
|
#if (XINCX_RF_COMPATIBILITY_MODE == PANCHIP_PACKET)
|
|
uint32_t rf_tx_manage(rf_data_typedef_t *rf_data);
|
|
void timer0_callback(void *context);
|
|
#endif
|
|
void xc_rf_send_ack(uint8_t *buff, uint8_t recv_len);
|
|
void rf_set_rx_mode(uint16_t channel, uint16_t fifo_len);
|
|
void rf_recv_sf_ack_payload(uint8_t *buff, uint8_t len);
|
|
uint8_t rf_recv_enhanced_data(uint8_t *buff);
|
|
void rf_set_agc_map(uint8_t agc_gain_1th, uint8_t agc_setp);
|
|
|
|
void rf_pwm_recv_data(void);
|
|
uint8_t rf_recv_addr(void);
|
|
|
|
#endif //__APP_RF_H__
|