| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- //
- // Created by macheng on 2018/5/2.
- //
- #ifndef _INSTANCE_CONFIG_H_
- #define _INSTANCE_CONFIG_H_
- //slot count and time
- #define TA_SLOT_TIME (4)
- #define TA_SLOT_STEP (4)//5~7ms
- #define TA_SLOT_COUNT (3)
- #define TA_SLOT_FACTOR (1000)
- //this it the delay used for configuring the receiver on delay (wait for response delay)
- //NOTE: this RX_RESPONSE_TURNAROUND is dependent on the microprocessor and code optimisations
- #define RX_RESPONSEX_TURNAROUND (50) //takes about 100 us for response to come back
- #define RX_RESPONSE1_TURNAROUND (200) //takes about 200 us for the 1st response to come back (from A0)
- #define RX_RESPONSE1_TURNAROUND_6M81 (300) //takes about 100 us for response to come back
- #define RX_RESPONSE1_TURNAROUND_110K (300) //takes about 100 us for response to come back
- //Tag will range to 3 or 4 anchors
- //Each ranging exchange will consist of minimum of 3 messages (Poll, Response, Final)
- //and a maximum of 6 messages (Poll, Response x 4, Final)
- //Thus the ranging exchange will take either 28 ms for 110 kbps and 5 ms for 6.81 Mbps.
- //NOTE: the above times are for 110k rate with 64 symb non-standard SFD and 1024 preamble length
- #define MAX_TAG_LIST_SIZE (512)
- #define MAX_ANCHOR_LIST_SIZE (16) //this is limited to 4 in this application
- #define NUM_EXPECTED_RESPONSES (4) //e.g. MAX_ANCHOR_LIST_SIZE - 1
- #define NUM_EXPECTED_RESPONSES_ANC (1) //anchors A0, A1 and A2 are involved in anchor to anchor ranging
- #define NUM_EXPECTED_RESPONSES_ANC0 (2) //anchor A0 expects response from A1 and A2
- #define TAG_LIST_INDEX_MASK (MAX_TAG_LIST_SIZE-1)
- #define ANCHOR_LIST_INDEX_MASK (MAX_ANCHOR_LIST_SIZE-1)
- #define TAG_SLOT_FIRST_MASK ((MAX_TAG_LIST_SIZE>>1)-1) //low half of all slot
- #define RESP_RECORD_COUNT 4 ///Musb be 2, 4, 8, and so on
- #define RESP_RECORD_MASK (RESP_RECORD_COUNT - 1)
- #define RESP_RECORD_BUFSIZE (MAX_TAG_LIST_SIZE * RESP_RECORD_COUNT)
- #define GATEWAY_ANCHOR_ADDR (0x8000)
- #define A1_ANCHOR_ADDR (0x8001)
- #define A2_ANCHOR_ADDR (0x8002)
- #define A3_ANCHOR_ADDR (0x8003)
- #define BROADCAST_ADDR (0xffff)
- #define ANCHOR_SHORT_MASK (3)
- typedef struct
- {
- uint16_t slotPeriod ; //slot period (time for 1 tag to range to 4 anchors)
- uint16_t numSlots ; // number of slots in one superframe (number of tags supported)
- uint16_t sfPeriod ; // superframe period in ms
- uint16_t pollSleepDly ; // the minimum SLEEP time should be FRAME PERIOD so that tags don't interfere
- uint16_t replyDly ; //response delay time (Tag or Anchor when sending Final/Response messages respectively)
- } sfConfig_t ;
- typedef struct
- {
- uint8_t channelNumber ; // valid range is 1 to 11
- uint8_t preambleCode ; // 00 = use NS code, 1 to 24 selects code
- uint8_t pulseRepFreq ; // NOMINAL_4M, NOMINAL_16M, or NOMINAL_64M
- uint8_t dataRate ; // DATA_RATE_1 (110K), DATA_RATE_2 (850K), DATA_RATE_3 (6M81)
- uint8_t preambleLen ; // values expected are 64, (128), (256), (512), 1024, (2048), and 4096
- uint8_t pacSize ;
- uint8_t nsSFD ;
- uint8_t txPower ;
- uint16_t sfdTO; //!< SFD timeout value (in symbols) e.g. preamble length (128) + SFD(8) - PAC + some margin ~ 135us... DWT_SFDTOC_DEF; //default value
- } instanceConfig_t ;
- typedef struct {
- //configuration structures
- dwt_config_t configData ; //DW1000 channel configuration
- dwt_txconfig_t configTX ; //DW1000 TX power configuration
- uint16_t txAntennaDelay ; //DW1000 TX antenna delay
- uint16_t rxAntennaDelay ; //DW1000 RX antenna delay
- uint32_t txPower ; //DW1000 TX power
- uint8_t txPowerChanged ; //power has been changed - update the register on next TWR exchange
- uint8_t antennaDelayChanged; //antenna delay has been changed - update the register on next TWR exchange
- uint16_t instanceAddress16; //contains tag/anchor address
- //this is the delay used for the delayed transmit
- uint64_t pollTx2FinalTxDelay ; //this is delay from Poll Tx time to Final Tx time in DW1000 units (40-bit)
- uint64_t pollTx2FinalTxDelayAnc ; //this is delay from Poll Tx time to Final Tx time in DW1000 units (40-bit) for Anchor to Anchor ranging
- uint64_t fixedReplyDelayAnc ;
- uint32_t fixedReplyDelayAncP ;
- uint16_t pollRx2FinalRxDelay ;
- //Tag function address/message configuration
- uint8_t shortAdd_idx ; // device's 16-bit address low byte (used as index into arrays [0 - 3])
- uint8_t eui64[8]; // device's EUI 64-bit address
- uint16_t panID ; // panid used in the frames
- uint16_t sframePeriod;
- uint16_t slotPeriod;
- uint16_t numSlots;
- int fwtoTime_sy ; //this is final message duration (longest out of ranging messages)
- int fwtoTimeAnc_sy ;
- int ancRespRxDelay ;
- }inst_setting;
- #endif //HSS200ANC1701_REFACTOR_CONFIG_H
|