Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
jingzhi-wang committed Mar 24, 2023
1 parent 7b4533a commit 17bae18
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions patch/sdk_v2.1.x.x_patch/platform/chip_8258/rf_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,18 +189,25 @@ typedef enum {
#define RF_BLE_PACKET_LENGTH_OK(p) (p[0] == (p[5]&0x3f)+13)//NONE
#define RF_BLE_PACKET_CRC_OK(p) ((p[p[0]+3] & 0x01) == 0)//NONE



#define RF_ZIGBEE_PACKET_LENGTH_OK(p) (p[0] == p[4]+9)//zigbee
#define RF_ZIGBEE_PACKET_CRC_OK(p) ((p[p[0]+3] & 0x51) == 0x10)//zigbee
#define RF_ZIGBEE_PACKET_RSSI_GET(p) (p[p[0]+2])
#define RF_ZIGBEE_PACKET_TIMESTAMP_GET(p) (p[p[0]-4] | (p[p[0]-3]<<8) | (p[p[0]-2]<<16) | (p[p[0]-1]<<24))
#define RF_ZIGBEE_PACKET_PAYLOAD_LENGTH_GET(p) (p[4])
#define RF_NRF_ESB_PACKET_LENGTH_OK(p) (p[0] == (p[4] & 0x3f) + 11)
#define RF_NRF_ESB_PACKET_CRC_OK(p) ((p[p[0]+3] & 0x01) == 0x00)
#define RF_NRF_ESB_PACKET_RSSI_GET(p) (p[p[0]+2])
#define RF_NRF_SB_PACKET_PAYLOAD_LENGTH_GET(p) (p[0] - 10)
#define RF_NRF_SB_PACKET_CRC_OK(p) ((p[p[0]+3] & 0x01) == 0x00)
#define RF_NRF_SB_PACKET_CRC_GET(p) ((p[p[0]-8]<<8) + p[p[0]-7]) //Note: here assume that the MSByte of CRC is received first
#define RF_NRF_SB_PACKET_RSSI_GET(p) (p[p[0]+2])

#define RF_TPLL_PACKET_LENGTH_OK(p) (p[0] == (p[4] & 0x3f) + 11)
#define RF_TPLL_PACKET_CRC_OK(p) ((p[p[0]+3] & 0x01) == 0x00)
#define RF_TPLL_PACKET_RSSI_GET(p) (p[p[0]+2])
#define RF_SB_PACKET_PAYLOAD_LENGTH_GET(p) (p[0] - 10)
#define RF_SB_PACKET_CRC_OK(p) ((p[p[0]+3] & 0x01) == 0x00)
#define RF_SB_PACKET_CRC_GET(p) ((p[p[0]-8]<<8) + p[p[0]-7]) //Note: here assume that the MSByte of CRC is received first
#define RF_SB_PACKET_RSSI_GET(p) (p[p[0]+2])
#define RF_TPLL_PACKET_TIMESTAMP_GET(p) (p[p[0]-4] | (p[p[0]-3]<<8) | (p[p[0]-2]<<16) | (p[p[0]-1]<<24))
#define RF_SB_PACKET_TIMESTAMP_GET(p) (p[p[0]-4] | (p[p[0]-3]<<8) | (p[p[0]-2]<<16) | (p[p[0]-1]<<24))


static inline void rf_ble_tx_on ()
{
write_reg8 (0x800f02, 0x45 | BIT(4)); // TX enable
Expand Down Expand Up @@ -403,17 +410,18 @@ static inline unsigned char rf_acc_len_get(unsigned char len)
}
extern void rf_acc_code_set(unsigned char pipe, const unsigned char *addr);
extern void rf_acc_code_get(unsigned char pipe, unsigned char *addr);
static inline void rf_rx_acc_code_enable(unsigned char pipe)
static inline void rf_rx_acc_code_enable(unsigned char pipe)static inline void rf_fix_payload_len_set(int len)
{
WRITE_REG8(0x407, (READ_REG8(0x407)&0xc0) | pipe); //rx_access_code_chn_en
}
static inline void rf_tx_acc_code_select(unsigned char pipe)
{
WRITE_REG8(0xf15, (READ_REG8(0xf15)&0xf8) | pipe); //Tx_Channel_man[2:0]
}
static inline void rf_nordic_shockburst(int len)

static inline void rf_fix_payload_len_set(int len)
{
WRITE_REG8(0x404, READ_REG8(0x404)|0x03); //select shockburst header mode
WRITE_REG8(0x404, READ_REG8(0x404)|0x03); //select private header mode
WRITE_REG8(0x406, len);
}

Expand Down

0 comments on commit 17bae18

Please sign in to comment.