#ifndef __DW_APP_H__
|
#define __DW_APP_H__
|
#include "stdint.h"
|
void SetANCTimestap(uint8_t i,uint8_t* pollrx,uint8_t* resptx,uint32_t resprx,uint8_t* distoffset,int32_t anc_clockoffset_from_MK,uint32_t polltx);
|
void CalculateDists1(int64_t poll_tx_ts);
|
void CalculateDists(int64_t poll_tx_ts);
|
int64_t ranging_timestamp_diff(int64_t ts_a, int64_t ts_b);
|
typedef enum
|
{ UN_BIND=0,
|
LINK_SUCCESS,
|
SEARCH_DEV,
|
} Operation_step;
|
|
//BITSTATE
|
#define GOINGSLEEPBIT 1
|
|
//#define NEWBOARD
|
//#define TAG_OUTPUT
|
#define MAX_RFPOWER 67
|
#define DEFAULT_RFPOWER 30
|
#define REGISTER_FREQUENCY 1
|
#define HEX_OUTPUT
|
#define TOTAL_SLOTNUM 200
|
#define SLOTTIME_MS 48
|
#define SLOT_SCALE 0.8
|
#define MAX_NEARBASE_NUM 12
|
#define KEEP_TIMES 3
|
|
#define REPOET_ANC_NUM 1
|
#define REPOET_ANC_NUM_MIN 1
|
#define TAG_ID_START 0// 0x00980000
|
#define GROUP_TAG_NUM 2
|
#define TAG_NUM_IN_SYS 25
|
#define DFT_RAND_DLY_TIM_MS 1
|
#define THRESHOLD_CHANGE_MAINBASE_DIST 50
|
#define MIN_ANCHOR_NUM 2
|
#define SYNC_SEQ_IDX 5
|
#define REMOTEPARA_LEN 18
|
#define OUTRANGE_RESTARTTIMES 5
|
|
|
#define POLL 0x01
|
#define RESPONSE 0x02
|
#define FINAL 0x03
|
#define SYNC 0x04
|
#define NEAR_MSG 0x05
|
#define NEAR_POLL 0x06
|
#define NEAR_RESPONSE 0x07
|
#define NEAR_FINAL 0x08
|
#define SPOLL 0x09
|
#define DISCOVERPOLL 0x0A
|
#define DISCOVERRESPONSE 0x0B
|
#define DISCOVERFINAL 0x0C
|
#define DISCOVERPOLL2 0x1A
|
|
#define POS_MSG 0x15
|
#define POS_POLL 0x16
|
#define POS_RESPONSE 0x17
|
#define POS_FINAL 0x18
|
|
#define REG_POLL 0x10 //
|
#define REG_RESPONSE 0x11 //
|
#define REG_POLL2 0x20 //
|
//General
|
#define GROUP_ID_IDX 0
|
#define ANCHOR_ID_IDX 1
|
#define TAG_ID_IDX 5
|
#define MESSAGE_TYPE_IDX 9
|
|
#define NEARBASENUM_INDEX 18
|
#define NEARBASEID_INDEX 19
|
//Poll
|
#define TAGSTATE 7
|
#define ANC_TYPE_IDX 14
|
//respose
|
#define DIST_IDX 10
|
#define ANCTIMEMS 14
|
#define ANCTIMEUS 16
|
#define TAGSLOTPOS 7
|
#define MOTORSTATE_INDEX 19
|
#define NR_NEARSWITCH_DISTANCE 20
|
#define REMOTEPARA_INDEX 22
|
#define MAXRANGE_DISTANCE 22
|
#define ANC_SIGNALPOWER 24
|
#define RESP_MSG_POLL_RX_TS_IDX 26
|
#define RESP_MSG_RESP_TX_TS_IDX 30
|
#define RESP_MSG_ANC_DISTOFFSET 34
|
|
//Final
|
#define TAGCONFIGSUCCESS_INDEX 7
|
#define FINAL_MSG_POLL_TX_TS_IDX 10
|
#define FINAL_MSG_RESP_RX_TS_IDX 14
|
#define FINAL_MSG_FINAL_TX_TS_IDX 18
|
#define FINAL_MSG_RESP_RX_NEARBASE_IDX 22
|
#define FINAL_MSG_TS_LEN 4
|
//SYNC
|
#define SYNC_SEQ_IDX 5
|
//NEAR MSG
|
#define NEARMSG_EMPTYSLOTPOS_INDEX 1 //RESPONSE
|
//NEAR POLL
|
#define NEARP_TAGFREQ_INDEX 10
|
#define NEARP_TAGSLOTPOS_INDEX 12
|
|
|
//REG POLL
|
#define REGP_TAGSTATE_INDEX 10
|
#define REGP_VERSION_INDEX 11
|
#define REGP_FREQUENCY_INDEX 13
|
#define REGP_POWER_INDEX 14
|
#define REGP_IMUTHRES_INDEX 15
|
#define REGP_NOMOVESLEEPTIME_INDEX 17
|
#define REGP_HEIGHTOFFSET_INDEX 19
|
#define REGP_BATTARY_INDEX 19
|
//REG RESPONSE
|
#define REGR_TAGFREQ_INDEX 10
|
#define REGR_TAGSLOTPOS_INDEX 12
|
#define REGR_BASENUM_INDEX 18
|
#define REGR_BASEID_INDEX 19
|
|
|
#define SEQUENCE_IDX 3
|
#define BATTARY_IDX 4
|
#define BUTTON_IDX 7
|
#define SEQUENCEH_IDX 8
|
|
|
|
#define MBX_RESPONSE 0x21
|
#define MBX_POLL 0x20
|
#define MBX_RESPONSE 0x21
|
#define MBX_FINAL 0x22
|
#define MBX_PRAAREPLY 0x23
|
#define MBX_REG 0x24
|
|
#define MESSAGE_TYPE_IDX 9
|
#define TAG_ID_IDX 5
|
#define GROUP_ID_IDX 0
|
#define ANCHOR_ID_IDX 1
|
//#define MAX_NEARBASE_NUM 25
|
#define TAG_KEEPTIMES 30 //±êÇ©´æ»îʱ¼ä
|
//#define KEEP_TIMES 5
|
#define TAG_NUM_IN_SYS 25
|
|
#define SEQUENCE_IDX 3
|
#define BATTARY_IDX 4
|
//NEAR POLL
|
#define RESP_MSG_POLL_RX_TS_IDX 26
|
#define RESP_MSG_RESP_TX_TS_IDX 30
|
#define RESP_MSG_ANC_DISTOFFSET 34
|
|
////NEAR MSG
|
//#define NEARBASENUM_INDEX 10
|
//#define NEARBASEID_INDEX 11
|
|
#define TAG_KEEPTIMES 30 //±êÇ©´æ»îʱ¼ä
|
#define MAX_TAG_LIST_NUM 200 //ͬʱͨѶ±êÇ©×î´óÊýÁ¿
|
|
#define FREQ_OFFSET_MULTIPLIER (998.4e6/2.0/1024.0/131072.0)
|
#define FREQ_OFFSET_MULTIPLIER_110KB (998.4e6/2.0/8192.0/131072.0)
|
|
#define HERTZ_TO_PPM_MULTIPLIER_CHAN_1 (-1.0e6/3494.4e6)
|
#define HERTZ_TO_PPM_MULTIPLIER_CHAN_2 (-1.0e6/3993.6e6)
|
#define HERTZ_TO_PPM_MULTIPLIER_CHAN_3 (-1.0e6/4492.8e6)
|
#define HERTZ_TO_PPM_MULTIPLIER_CHAN_5 (-1.0e6/6489.6e6)
|
#endif
|