amiro-lld / include / DW1000 / v1 / alld_dw1000_v1.h @ b6364b51
History | View | Annotate | Download (77.117 KB)
1 | 69a601a5 | Cung Sang | /*
|
---|---|---|---|
2 | AMiRo-LLD is a compilation of low-level hardware drivers for the Autonomous Mini Robot (AMiRo) platform.
|
||
3 | Copyright (C) 2016..2018 Thomas Schöpping et al.
|
||
4 | |||
5 | This program is free software: you can redistribute it and/or modify
|
||
6 | it under the terms of the GNU Lesser General Public License as published by
|
||
7 | the Free Software Foundation, either version 3 of the License, or
|
||
8 | (at your option) any later version.
|
||
9 | |||
10 | This program is distributed in the hope that it will be useful,
|
||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
13 | GNU Lesser General Public License for more details.
|
||
14 | |||
15 | You should have received a copy of the GNU Lesser General Public License
|
||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
17 | */
|
||
18 | |||
19 | /*! ----------------------------------------------------------------------------
|
||
20 | * @file deca_device_api.h
|
||
21 | * @brief DW1000 API Functions
|
||
22 | *
|
||
23 | * @attention
|
||
24 | *
|
||
25 | * Copyright 2013 (c) Decawave Ltd, Dublin, Ireland.
|
||
26 | *
|
||
27 | * All rights reserved.
|
||
28 | *
|
||
29 | */
|
||
30 | |||
31 | #ifndef __AMIROLLD_DW1000_V1_H
|
||
32 | #define AMIROLLD_DW1000_V1_H
|
||
33 | |||
34 | |||
35 | #include <amiro-lld.h> |
||
36 | #if (defined(AMIROLLD_CFG_DW1000) && (AMIROLLD_CFG_DW1000 == 1)) || defined(__DOXYGEN__) |
||
37 | |||
38 | #include <stddef.h> |
||
39 | #include <stdint.h> |
||
40 | #include <stdbool.h> |
||
41 | |||
42 | #define DW1000_DRIVER_VERSION 0x040005 |
||
43 | #define DW1000_DEVICE_DRIVER_VER_STRING "DW1000 Device Driver Version 04.00.05" |
||
44 | |||
45 | #ifndef DWT_NUM_DW_DEV
|
||
46 | #define DWT_NUM_DW_DEV (1) |
||
47 | #endif
|
||
48 | |||
49 | #define DWT_SUCCESS (0) |
||
50 | #define DWT_ERROR (-1) |
||
51 | |||
52 | /**
|
||
53 | * Parameter declarations
|
||
54 | */
|
||
55 | |||
56 | #define NUM_BR 3 |
||
57 | #define NUM_PRF 2 |
||
58 | #define NUM_PACS 4 |
||
59 | #define NUM_BW 2 //2 bandwidths are supported |
||
60 | #define NUM_SFD 2 //supported number of SFDs - standard = 0, non-standard = 1 |
||
61 | #define NUM_CH 6 //supported channels are 1, 2, 3, 4, 5, 7 |
||
62 | #define NUM_CH_SUPPORTED 8 //supported channels are '0', 1, 2, 3, 4, 5, '6', 7 |
||
63 | #define PCODES 25 //supported preamble codes |
||
64 | |||
65 | extern const uint8_t chan_idx[NUM_CH_SUPPORTED]; |
||
66 | |||
67 | |||
68 | /**
|
||
69 | * @brief The DW1000 driver struct.
|
||
70 | */
|
||
71 | typedef struct { |
||
72 | apalSPIDriver_t* spid; /**< @brief The SPI Driver */
|
||
73 | const apalControlGpio_t* gpio_exti; /**< @brief The GPIO indicating external interrupt */ |
||
74 | const apalControlGpio_t* gpio_reset; /**< @brief The GPIO indicating reset sig*/ |
||
75 | // const apalGpio_t* gpio_exti; /**< @brief The GPIO indicating external interrupt */
|
||
76 | // const apalGpio_t* gpio_reset; /**< @brief The GPIO indicating reset sig*/
|
||
77 | /* TODO: better apalControlGpio_t instead of apalGpio_t ? */
|
||
78 | /* TODO: EXTI, GPIO (RESET) */
|
||
79 | } DW1000Driver; |
||
80 | |||
81 | |||
82 | #define DWT_TIME_UNITS (1.0/499.2e6/128.0) //!< = 15.65e-12 s |
||
83 | |||
84 | #define DWT_DEVICE_ID (0xDECA0130) //!< DW1000 MP device ID |
||
85 | |||
86 | #define BUFFLEN (4096+128) |
||
87 | |||
88 | //! constants for selecting the bit rate for data TX (and RX)
|
||
89 | //! These are defined for write (with just a shift) the TX_FCTRL register
|
||
90 | #define DWT_BR_110K 0 //!< UWB bit rate 110 kbits/s |
||
91 | #define DWT_BR_850K 1 //!< UWB bit rate 850 kbits/s |
||
92 | #define DWT_BR_6M8 2 //!< UWB bit rate 6.8 Mbits/s |
||
93 | |||
94 | //! constants for specifying the (Nominal) mean Pulse Repetition Frequency
|
||
95 | //! These are defined for direct write (with a shift if necessary) to CHAN_CTRL and TX_FCTRL regs
|
||
96 | #define DWT_PRF_16M 1 //!< UWB PRF 16 MHz |
||
97 | #define DWT_PRF_64M 2 //!< UWB PRF 64 MHz |
||
98 | |||
99 | //! constants for specifying Preamble Acquisition Chunk (PAC) Size in symbols
|
||
100 | #define DWT_PAC8 0 //!< PAC 8 (recommended for RX of preamble length 128 and below |
||
101 | #define DWT_PAC16 1 //!< PAC 16 (recommended for RX of preamble length 256 |
||
102 | #define DWT_PAC32 2 //!< PAC 32 (recommended for RX of preamble length 512 |
||
103 | #define DWT_PAC64 3 //!< PAC 64 (recommended for RX of preamble length 1024 and up |
||
104 | |||
105 | //! constants for specifying TX Preamble length in symbols
|
||
106 | //! These are defined to allow them be directly written into byte 2 of the TX_FCTRL register
|
||
107 | //! (i.e. a four bit value destined for bits 20..18 but shifted left by 2 for byte alignment)
|
||
108 | #define DWT_PLEN_4096 0x0C //! Standard preamble length 4096 symbols |
||
109 | #define DWT_PLEN_2048 0x28 //! Non-standard preamble length 2048 symbols |
||
110 | #define DWT_PLEN_1536 0x18 //! Non-standard preamble length 1536 symbols |
||
111 | #define DWT_PLEN_1024 0x08 //! Standard preamble length 1024 symbols |
||
112 | #define DWT_PLEN_512 0x34 //! Non-standard preamble length 512 symbols |
||
113 | #define DWT_PLEN_256 0x24 //! Non-standard preamble length 256 symbols |
||
114 | #define DWT_PLEN_128 0x14 //! Non-standard preamble length 128 symbols |
||
115 | #define DWT_PLEN_64 0x04 //! Standard preamble length 64 symbols |
||
116 | |||
117 | #define DWT_SFDTOC_DEF 0x1041 // default SFD timeout value |
||
118 | |||
119 | #define DWT_PHRMODE_STD 0x0 // standard PHR mode |
||
120 | #define DWT_PHRMODE_EXT 0x3 // DW proprietary extended frames PHR mode |
||
121 | |||
122 | // Defined constants for "mode" bitmask parameter passed into dwt_starttx() function.
|
||
123 | #define DWT_START_TX_IMMEDIATE 0 |
||
124 | #define DWT_START_TX_DELAYED 1 |
||
125 | #define DWT_RESPONSE_EXPECTED 2 |
||
126 | |||
127 | #define DWT_START_RX_IMMEDIATE 0 |
||
128 | #define DWT_START_RX_DELAYED 1 // Set up delayed RX, if "late" error triggers, then the RX will be enabled immediately |
||
129 | #define DWT_IDLE_ON_DLY_ERR 2 // If delayed RX failed due to "late" error then if this |
||
130 | // flag is set the RX will not be re-enabled immediately, and device will be in IDLE when function exits
|
||
131 | #define DWT_NO_SYNC_PTRS 4 // Do not try to sync IC side and Host side buffer pointers when enabling RX. This is used to perform manual RX |
||
132 | // re-enabling when receiving a frame in double buffer mode.
|
||
133 | |||
134 | // Defined constants for "mode" bit field parameter passed to dwt_setleds() function.
|
||
135 | #define DWT_LEDS_DISABLE 0x00 |
||
136 | #define DWT_LEDS_ENABLE 0x01 |
||
137 | #define DWT_LEDS_INIT_BLINK 0x02 |
||
138 | |||
139 | //frame filtering configuration options
|
||
140 | #define DWT_FF_NOTYPE_EN 0x000 // no frame types allowed (FF disabled) |
||
141 | #define DWT_FF_COORD_EN 0x002 // behave as coordinator (can receive frames with no dest address (PAN ID has to match)) |
||
142 | #define DWT_FF_BEACON_EN 0x004 // beacon frames allowed |
||
143 | #define DWT_FF_DATA_EN 0x008 // data frames allowed |
||
144 | #define DWT_FF_ACK_EN 0x010 // ack frames allowed |
||
145 | #define DWT_FF_MAC_EN 0x020 // mac control frames allowed |
||
146 | #define DWT_FF_RSVD_EN 0x040 // reserved frame types allowed |
||
147 | |||
148 | //DW1000 interrupt events
|
||
149 | #define DWT_INT_TFRS 0x00000080 // frame sent |
||
150 | #define DWT_INT_LDED 0x00000400 // micro-code has finished execution |
||
151 | #define DWT_INT_RFCG 0x00004000 // frame received with good CRC |
||
152 | #define DWT_INT_RPHE 0x00001000 // receiver PHY header error |
||
153 | #define DWT_INT_RFCE 0x00008000 // receiver CRC error |
||
154 | #define DWT_INT_RFSL 0x00010000 // receiver sync loss error |
||
155 | #define DWT_INT_RFTO 0x00020000 // frame wait timeout |
||
156 | #define DWT_INT_RXOVRR 0x00100000 // receiver overrun |
||
157 | #define DWT_INT_RXPTO 0x00200000 // preamble detect timeout |
||
158 | #define DWT_INT_SFDT 0x04000000 // SFD timeout |
||
159 | #define DWT_INT_ARFE 0x20000000 // frame rejected (due to frame filtering configuration) |
||
160 | |||
161 | |||
162 | //DW1000 SLEEP and WAKEUP configuration parameters
|
||
163 | #define DWT_PRESRV_SLEEP 0x0100 // PRES_SLEEP - on wakeup preserve sleep bit |
||
164 | #define DWT_LOADOPSET 0x0080 // ONW_L64P - on wakeup load operating parameter set for 64 PSR |
||
165 | #define DWT_CONFIG 0x0040 // ONW_LDC - on wakeup restore (load) the saved configurations (from AON array into HIF) |
||
166 | #define DWT_LOADEUI 0x0008 // ONW_LEUI - on wakeup load EUI |
||
167 | #define DWT_RX_EN 0x0002 // ONW_RX - on wakeup activate reception |
||
168 | #define DWT_TANDV 0x0001 // ONW_RADC - on wakeup run ADC to sample temperature and voltage sensor values |
||
169 | |||
170 | #define DWT_XTAL_EN 0x10 // keep XTAL running during sleep |
||
171 | #define DWT_WAKE_SLPCNT 0x8 // wake up after sleep count |
||
172 | #define DWT_WAKE_CS 0x4 // wake up on chip select |
||
173 | #define DWT_WAKE_WK 0x2 // wake up on WAKEUP PIN |
||
174 | #define DWT_SLP_EN 0x1 // enable sleep/deep sleep functionality |
||
175 | |||
176 | //DW1000 INIT configuration parameters
|
||
177 | #define DWT_LOADUCODE 0x1 |
||
178 | #define DWT_LOADNONE 0x0 |
||
179 | |||
180 | //DW1000 OTP operating parameter set selection
|
||
181 | #define DWT_OPSET_64LEN 0x0 |
||
182 | #define DWT_OPSET_TIGHT 0x1 |
||
183 | #define DWT_OPSET_DEFLT 0x2 |
||
184 | |||
185 | // Call-back data RX frames flags
|
||
186 | #define DWT_CB_DATA_RX_FLAG_RNG 0x1 // Ranging bit |
||
187 | |||
188 | |||
189 | // TX/RX call-back data
|
||
190 | typedef struct |
||
191 | { |
||
192 | uint32_t status; //initial value of register as ISR is entered
|
||
193 | uint16_t datalength; //length of frame
|
||
194 | uint8_t fctrl[2]; //frame control bytes |
||
195 | uint8_t rx_flags; //RX frame flags, see above
|
||
196 | } dwt_cb_data_t; |
||
197 | |||
198 | // Call-back type for all events
|
||
199 | typedef void (*dwt_cb_t)(const dwt_cb_data_t *); |
||
200 | |||
201 | |||
202 | // -------------------------------------------------------------------------------------------------------------------
|
||
203 | // Structure to hold device data
|
||
204 | typedef struct |
||
205 | { |
||
206 | uint32_t partID ; // IC Part ID - read during initialisation
|
||
207 | uint32_t lotID ; // IC Lot ID - read during initialisation
|
||
208 | uint8_t longFrames ; // Flag in non-standard long frame mode
|
||
209 | uint8_t otprev ; // OTP revision number (read during initialisation)
|
||
210 | uint32_t txFCTRL ; // Keep TX_FCTRL register config
|
||
211 | uint8_t init_xtrim; // initial XTAL trim value read from OTP (or defaulted to mid-range if OTP not programmed)
|
||
212 | uint8_t dblbuffon; // Double RX buffer mode flag
|
||
213 | uint32_t sysCFGreg ; // Local copy of system config register
|
||
214 | uint16_t sleep_mode; // Used for automatic reloading of LDO tune and microcode at wake-up
|
||
215 | uint8_t wait4resp ; // wait4response was set with last TX start command
|
||
216 | dwt_cb_data_t cbData; // Callback data structure
|
||
217 | dwt_cb_t cbTxDone; // Callback for TX confirmation event
|
||
218 | dwt_cb_t cbRxOk; // Callback for RX good frame event
|
||
219 | dwt_cb_t cbRxTo; // Callback for RX timeout events
|
||
220 | dwt_cb_t cbRxErr; // Callback for RX error events
|
||
221 | DW1000Driver *driver; // Reference to local hardware SPI, GPIO, ...
|
||
222 | } dwt_local_data_t ; |
||
223 | |||
224 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
225 | * Structure typedef: dwt_config_t
|
||
226 | *
|
||
227 | * Structure for setting device configuration via dwt_configure() function
|
||
228 | *
|
||
229 | */
|
||
230 | typedef struct |
||
231 | { |
||
232 | uint8_t chan ; //!< channel number {1, 2, 3, 4, 5, 7 }
|
||
233 | uint8_t prf ; //!< Pulse Repetition Frequency {DWT_PRF_16M or DWT_PRF_64M}
|
||
234 | uint8_t txPreambLength ; //!< DWT_PLEN_64..DWT_PLEN_4096
|
||
235 | uint8_t rxPAC ; //!< Acquisition Chunk Size (Relates to RX preamble length)
|
||
236 | uint8_t txCode ; //!< TX preamble code
|
||
237 | uint8_t rxCode ; //!< RX preamble code
|
||
238 | uint8_t nsSFD ; //!< Boolean should we use non-standard SFD for better performance
|
||
239 | uint8_t dataRate ; //!< Data Rate {DWT_BR_110K, DWT_BR_850K or DWT_BR_6M8}
|
||
240 | uint8_t phrMode ; //!< PHR mode {0x0 - standard DWT_PHRMODE_STD, 0x3 - extended frames DWT_PHRMODE_EXT}
|
||
241 | uint8_t smartPowerEn ; //!< Smart Power enable / disable (TODO: Added smartPowerEn in this struct )
|
||
242 | uint16_t sfdTO ; //!< SFD timeout value (in symbols)
|
||
243 | } dwt_config_t ; |
||
244 | |||
245 | |||
246 | typedef struct |
||
247 | { |
||
248 | uint8_t PGdly; |
||
249 | //TX POWER
|
||
250 | //31:24 BOOST_0.125ms_PWR
|
||
251 | //23:16 BOOST_0.25ms_PWR-TX_SHR_PWR
|
||
252 | //15:8 BOOST_0.5ms_PWR-TX_PHR_PWR
|
||
253 | //7:0 DEFAULT_PWR-TX_DATA_PWR
|
||
254 | uint32_t power; |
||
255 | } dwt_txconfig_t ; |
||
256 | |||
257 | |||
258 | typedef struct |
||
259 | { |
||
260 | |||
261 | uint16_t maxNoise ; // LDE max value of noise
|
||
262 | uint16_t firstPathAmp1 ; // Amplitude at floor(index FP) + 1
|
||
263 | uint16_t stdNoise ; // Standard deviation of noise
|
||
264 | uint16_t firstPathAmp2 ; // Amplitude at floor(index FP) + 2
|
||
265 | uint16_t firstPathAmp3 ; // Amplitude at floor(index FP) + 3
|
||
266 | uint16_t maxGrowthCIR ; // Channel Impulse Response max growth CIR
|
||
267 | uint16_t rxPreamCount ; // Count of preamble symbols accumulated
|
||
268 | uint16_t firstPath ; // First path index (10.6 bits fixed point integer)
|
||
269 | }dwt_rxdiag_t ; |
||
270 | |||
271 | |||
272 | typedef struct |
||
273 | { |
||
274 | //all of the below are mapped to a 12-bit register in DW1000
|
||
275 | uint16_t PHE ; //number of received header errors
|
||
276 | uint16_t RSL ; //number of received frame sync loss events
|
||
277 | uint16_t CRCG ; //number of good CRC received frames
|
||
278 | uint16_t CRCB ; //number of bad CRC (CRC error) received frames
|
||
279 | uint16_t ARFE ; //number of address filter errors
|
||
280 | uint16_t OVER ; //number of receiver overflows (used in double buffer mode)
|
||
281 | uint16_t SFDTO ; //SFD timeouts
|
||
282 | uint16_t PTO ; //Preamble timeouts
|
||
283 | uint16_t RTO ; //RX frame wait timeouts
|
||
284 | uint16_t TXF ; //number of transmitted frames
|
||
285 | uint16_t HPW ; //half period warn
|
||
286 | uint16_t TXW ; //power up warn
|
||
287 | |||
288 | } dwt_deviceentcnts_t ; |
||
289 | |||
290 | |||
291 | /********************************************************************************************************************/
|
||
292 | /* REMOVED API LIST */
|
||
293 | /********************************************************************************************************************/
|
||
294 | /*
|
||
295 | * From version 4.0.0:
|
||
296 | * - dwt_setGPIOforEXTTRX: Replaced by dwt_setlnapamode to get equivalent functionality.
|
||
297 | * - dwt_setGPIOdirection: Renamed to dwt_setgpiodirection.
|
||
298 | * - dwt_setGPIOvalue: Renamed to dwt_setgpiovalue.
|
||
299 | * - dwt_setrxmode: Replaced by dwt_setsniffmode and dwt_setlowpowerlistening depending on the RX mode the user
|
||
300 | * wants to set up.
|
||
301 | * - dwt_checkoverrun: As automatic RX re-enabling is not supported anymore, this functions has become useless.
|
||
302 | * - dwt_setautorxreenable: As automatic RX re-enabling is not supported anymore, this functions has become
|
||
303 | * useless.
|
||
304 | * - dwt_getrangebias: Range bias correction values are platform dependent and should therefore be managed at user
|
||
305 | * application level.
|
||
306 | * - dwt_xtaltrim: Renamed to dwt_setxtaltrim.
|
||
307 | * - dwt_checkIRQ: Renamed to dwt_checkirq.
|
||
308 | *
|
||
309 | * From version 3.0.0:
|
||
310 | * - dwt_getldotune: As LDO loading is now automatically managed by the driver, this function has become useless.
|
||
311 | * - dwt_getotptxpower: TX power values and location in OTP memory are platform dependent and should therefore be
|
||
312 | * managed at user application level.
|
||
313 | * - dwt_readantennadelay: Antenna delay values and location in OTP memory are platform dependent and should
|
||
314 | * therefore be managed at user application level.
|
||
315 | * - dwt_readdignostics: Renamed to dwt_readdiagnostics.
|
||
316 | */
|
||
317 | |||
318 | /********************************************************************************************************************/
|
||
319 | /* API LIST */
|
||
320 | /********************************************************************************************************************/
|
||
321 | |||
322 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
323 | * @fn dwt_setdevicedataptr()
|
||
324 | *
|
||
325 | * @brief This function sets the local data structure pointer to point to the structure in the local array as given by the index.
|
||
326 | *
|
||
327 | * input parameters
|
||
328 | * @param index - selects the array object to point to. Must be within the array bounds, i.e. < DWT_NUM_DW_DEV
|
||
329 | *
|
||
330 | * output parameters
|
||
331 | *
|
||
332 | * returns DWT_SUCCESS for success, or DWT_ERROR for error
|
||
333 | */
|
||
334 | int dwt_setdevicedataptr(unsigned int index); |
||
335 | |||
336 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
337 | * @fn dwt_getpartid()
|
||
338 | *
|
||
339 | * @brief This is used to return the read part ID of the device
|
||
340 | *
|
||
341 | * NOTE: dwt_initialise() must be called prior to this function so that it can return a relevant value.
|
||
342 | *
|
||
343 | * input parameters
|
||
344 | *
|
||
345 | * output parameters
|
||
346 | *
|
||
347 | * returns the 32 bit part ID value as programmed in the factory
|
||
348 | */
|
||
349 | uint32_t dwt_getpartid(void);
|
||
350 | |||
351 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
352 | * @fn dwt_getlotid()
|
||
353 | *
|
||
354 | * @brief This is used to return the read lot ID of the device
|
||
355 | *
|
||
356 | * NOTE: dwt_initialise() must be called prior to this function so that it can return a relevant value.
|
||
357 | *
|
||
358 | * input parameters
|
||
359 | *
|
||
360 | * output parameters
|
||
361 | *
|
||
362 | * returns the 32 bit lot ID value as programmed in the factory
|
||
363 | */
|
||
364 | uint32_t dwt_getlotid(void);
|
||
365 | |||
366 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
367 | * @fn dwt_readdevid()
|
||
368 | *
|
||
369 | * @brief This is used to return the read device type and revision information of the DW1000 device (MP part is 0xDECA0130)
|
||
370 | *
|
||
371 | * input parameters
|
||
372 | *
|
||
373 | * output parameters
|
||
374 | *
|
||
375 | * returns the read value which for DW1000 is 0xDECA0130
|
||
376 | */
|
||
377 | uint32_t dwt_readdevid(void);
|
||
378 | |||
379 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
380 | * @fn dwt_otprevision()
|
||
381 | *
|
||
382 | * @brief This is used to return the read OTP revision
|
||
383 | *
|
||
384 | * NOTE: dwt_initialise() must be called prior to this function so that it can return a relevant value.
|
||
385 | *
|
||
386 | * input parameters
|
||
387 | *
|
||
388 | * output parameters
|
||
389 | *
|
||
390 | * returns the read OTP revision value
|
||
391 | */
|
||
392 | uint8_t dwt_otprevision(void);
|
||
393 | |||
394 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
395 | * @fn dwt_setfinegraintxseq()
|
||
396 | *
|
||
397 | * @brief This function enables/disables the fine grain TX sequencing (enabled by default).
|
||
398 | *
|
||
399 | * input parameters
|
||
400 | * @param enable - 1 to enable fine grain TX sequencing, 0 to disable it.
|
||
401 | *
|
||
402 | * output parameters none
|
||
403 | *
|
||
404 | * no return value
|
||
405 | */
|
||
406 | void dwt_setfinegraintxseq(int enable); |
||
407 | |||
408 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
409 | * @fn dwt_setlnapamode()
|
||
410 | *
|
||
411 | * @brief This is used to enable GPIO for external LNA or PA functionality - HW dependent, consult the DW1000 User Manual.
|
||
412 | * This can also be used for debug as enabling TX and RX GPIOs is quite handy to monitor DW1000's activity.
|
||
413 | *
|
||
414 | * NOTE: Enabling PA functionality requires that fine grain TX sequencing is deactivated. This can be done using
|
||
415 | * dwt_setfinegraintxseq().
|
||
416 | *
|
||
417 | * input parameters
|
||
418 | * @param lna - 1 to enable LNA functionality, 0 to disable it
|
||
419 | * @param pa - 1 to enable PA functionality, 0 to disable it
|
||
420 | *
|
||
421 | * output parameters
|
||
422 | *
|
||
423 | * no return value
|
||
424 | */
|
||
425 | void dwt_setlnapamode(int lna, int pa); |
||
426 | |||
427 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
428 | * @fn dwt_setgpiodirection()
|
||
429 | *
|
||
430 | * @brief This is used to set GPIO direction as an input (1) or output (0)
|
||
431 | *
|
||
432 | * input parameters
|
||
433 | * @param gpioNum - this is the GPIO to configure - see GxM0... GxM8 in the deca_regs.h file
|
||
434 | * @param direction - this sets the GPIO direction - see GxP0... GxP8 in the deca_regs.h file
|
||
435 | *
|
||
436 | * output parameters
|
||
437 | *
|
||
438 | * no return value
|
||
439 | */
|
||
440 | void dwt_setgpiodirection(uint32_t gpioNum, uint32_t direction);
|
||
441 | |||
442 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
443 | * @fn dwt_setgpiovalue()
|
||
444 | *
|
||
445 | * @brief This is used to set GPIO value as (1) or (0) only applies if the GPIO is configured as output
|
||
446 | *
|
||
447 | * input parameters
|
||
448 | * @param gpioNum - this is the GPIO to configure - see GxM0... GxM8 in the deca_regs.h file
|
||
449 | * @param value - this sets the GPIO value - see GDP0... GDP8 in the deca_regs.h file
|
||
450 | *
|
||
451 | * output parameters
|
||
452 | *
|
||
453 | * no return value
|
||
454 | */
|
||
455 | void dwt_setgpiovalue(uint32_t gpioNum, uint32_t value);
|
||
456 | |||
457 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
458 | * @fn dwt_initialise()
|
||
459 | *
|
||
460 | * @brief This function initiates communications with the DW1000 transceiver
|
||
461 | * and reads its DEV_ID register (address 0x00) to verify the IC is one supported
|
||
462 | * by this software (e.g. DW1000 32-bit device ID value is 0xDECA0130). Then it
|
||
463 | * does any initial once only device configurations needed for use and initialises
|
||
464 | * as necessary any static data items belonging to this low-level driver.
|
||
465 | *
|
||
466 | * NOTES:
|
||
467 | * 1.this function needs to be run before dwt_configuresleep, also the SPI frequency has to be < 3MHz
|
||
468 | * 2.it also reads and applies LDO tune and crystal trim values from OTP memory
|
||
469 | *
|
||
470 | * input parameters
|
||
471 | * @param config - specifies what configuration to load
|
||
472 | * DWT_LOADUCODE 0x1 - load the LDE microcode from ROM - enabled accurate RX timestamp
|
||
473 | * DWT_LOADNONE 0x0 - do not load any values from OTP memory
|
||
474 | * @param drv - hardware specifc struct containg refernce to SPI, GPIO etc.
|
||
475 | *
|
||
476 | * output parameters
|
||
477 | *
|
||
478 | * returns DWT_SUCCESS for success, or DWT_ERROR for error
|
||
479 | */
|
||
480 | int dwt_initialise(uint16_t config) ; // TODO |
||
481 | //int dwt_initialise(uint16_t config, DW1000Driver* drv) ;
|
||
482 | |||
483 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
484 | * @fn dwt_configure()
|
||
485 | *
|
||
486 | * @brief This function provides the main API for the configuration of the
|
||
487 | * DW1000 and this low-level driver. The input is a pointer to the data structure
|
||
488 | * of type dwt_config_t that holds all the configurable items.
|
||
489 | * The dwt_config_t structure shows which ones are supported
|
||
490 | *
|
||
491 | * input parameters
|
||
492 | * @param config - pointer to the configuration structure, which contains the device configuration data.
|
||
493 | *
|
||
494 | * output parameters
|
||
495 | *
|
||
496 | * no return value
|
||
497 | */
|
||
498 | void dwt_configure(dwt_config_t* config) ;
|
||
499 | |||
500 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
501 | * @fn dwt_configuretxrf()
|
||
502 | *
|
||
503 | * @brief This function provides the API for the configuration of the TX spectrum
|
||
504 | * including the power and pulse generator delay. The input is a pointer to the data structure
|
||
505 | * of type dwt_txconfig_t that holds all the configurable items.
|
||
506 | *
|
||
507 | * input parameters
|
||
508 | * @param config - pointer to the txrf configuration structure, which contains the tx rf config data
|
||
509 | *
|
||
510 | * output parameters
|
||
511 | *
|
||
512 | * no return value
|
||
513 | */
|
||
514 | void dwt_configuretxrf(dwt_txconfig_t *config) ;
|
||
515 | |||
516 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
517 | * @fn dwt_setrxantennadelay()
|
||
518 | *
|
||
519 | * @brief This API function writes the antenna delay (in time units) to RX registers
|
||
520 | *
|
||
521 | * input parameters:
|
||
522 | * @param rxDelay - this is the total (RX) antenna delay value, which
|
||
523 | * will be programmed into the RX register
|
||
524 | *
|
||
525 | * output parameters
|
||
526 | *
|
||
527 | * no return value
|
||
528 | */
|
||
529 | void dwt_setrxantennadelay(uint16_t antennaDly);
|
||
530 | |||
531 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
532 | * @fn dwt_settxantennadelay()
|
||
533 | *
|
||
534 | * @brief This API function writes the antenna delay (in time units) to TX registers
|
||
535 | *
|
||
536 | * input parameters:
|
||
537 | * @param txDelay - this is the total (TX) antenna delay value, which
|
||
538 | * will be programmed into the TX delay register
|
||
539 | *
|
||
540 | * output parameters
|
||
541 | *
|
||
542 | * no return value
|
||
543 | */
|
||
544 | void dwt_settxantennadelay(uint16_t antennaDly);
|
||
545 | |||
546 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
547 | * @fn dwt_setsmarttxpower()
|
||
548 | *
|
||
549 | * @brief This call enables or disables the smart TX power feature.
|
||
550 | *
|
||
551 | * input parameters
|
||
552 | * @param enable - this enables or disables the TX smart power (1 = enable, 0 = disable)
|
||
553 | *
|
||
554 | * output parameters
|
||
555 | *
|
||
556 | * no return value
|
||
557 | */
|
||
558 | void dwt_setsmarttxpower(int enable); |
||
559 | |||
560 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
561 | * @fn dwt_writetxdata()
|
||
562 | *
|
||
563 | * @brief This API function writes the supplied TX data into the DW1000's
|
||
564 | * TX buffer. The input parameters are the data length in bytes and a pointer
|
||
565 | * to those data bytes.
|
||
566 | *
|
||
567 | * input parameters
|
||
568 | * @param txFrameLength - This is the total frame length, including the two byte CRC.
|
||
569 | * Note: this is the length of TX message (including the 2 byte CRC) - max is 1023
|
||
570 | * standard PHR mode allows up to 127 bytes
|
||
571 | * if > 127 is programmed, DWT_PHRMODE_EXT needs to be set in the phrMode configuration
|
||
572 | * see dwt_configure function
|
||
573 | * @param txFrameBytes - Pointer to the user’s buffer containing the data to send.
|
||
574 | * @param txBufferOffset - This specifies an offset in the DW1000’s TX Buffer at which to start writing data.
|
||
575 | *
|
||
576 | * output parameters
|
||
577 | *
|
||
578 | * returns DWT_SUCCESS for success, or DWT_ERROR for error
|
||
579 | */
|
||
580 | int dwt_writetxdata(uint16_t txFrameLength, uint8_t *txFrameBytes, uint16_t txBufferOffset) ;
|
||
581 | |||
582 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
583 | * @fn dwt_writetxfctrl()
|
||
584 | *
|
||
585 | * @brief This API function configures the TX frame control register before the transmission of a frame
|
||
586 | *
|
||
587 | * input parameters:
|
||
588 | * @param txFrameLength - this is the length of TX message (including the 2 byte CRC) - max is 1023
|
||
589 | * NOTE: standard PHR mode allows up to 127 bytes
|
||
590 | * if > 127 is programmed, DWT_PHRMODE_EXT needs to be set in the phrMode configuration
|
||
591 | * see dwt_configure function
|
||
592 | * @param txBufferOffset - the offset in the tx buffer to start writing the data
|
||
593 | * @param ranging - 1 if this is a ranging frame, else 0
|
||
594 | *
|
||
595 | * output parameters
|
||
596 | *
|
||
597 | * no return value
|
||
598 | */
|
||
599 | void dwt_writetxfctrl(uint16_t txFrameLength, uint16_t txBufferOffset, int ranging); |
||
600 | |||
601 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
602 | * @fn dwt_starttx()
|
||
603 | *
|
||
604 | * @brief This call initiates the transmission, input parameter indicates which TX mode is used see below
|
||
605 | *
|
||
606 | * input parameters:
|
||
607 | * @param mode - is a bitmask for which the following values can be combined to define the operation
|
||
608 | * DWT_START_TX_IMMEDIATE (0) - to begin transmission immediatelty.
|
||
609 | * DWT_START_TX_DELAYED (to set bit 0) - to begin TX at pre-configured delay time
|
||
610 | * DWT_RESPONSE_EXPECTED (to set bit 1) - to turn the receiver on automatically (after the TX) after a pre-programmed delay
|
||
611 | * output parameters
|
||
612 | *
|
||
613 | * returns DWT_SUCCESS for success, or DWT_ERROR for error (e.g. a delayed transmission will fail if the delayed time has passed)
|
||
614 | */
|
||
615 | int dwt_starttx(uint8_t mode) ;
|
||
616 | |||
617 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
618 | * @fn dwt_setdelayedtrxtime()
|
||
619 | *
|
||
620 | * @brief This API function configures the delayed transmit time or the delayed RX on time
|
||
621 | *
|
||
622 | * input parameters
|
||
623 | * @param starttime - the TX/RX start time (the 32 bits should be the high 32 bits of the system time at which to send the message,
|
||
624 | * or at which to turn on the receiver)
|
||
625 | *
|
||
626 | * output parameters none
|
||
627 | *
|
||
628 | * no return value
|
||
629 | */
|
||
630 | void dwt_setdelayedtrxtime(uint32_t starttime) ;
|
||
631 | |||
632 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
633 | * @fn dwt_readtxtimestamp()
|
||
634 | *
|
||
635 | * @brief This is used to read the TX timestamp (adjusted with the programmed antenna delay)
|
||
636 | *
|
||
637 | * input parameters
|
||
638 | * @param timestamp - a pointer to a 5-byte buffer which will store the read TX timestamp time
|
||
639 | *
|
||
640 | * output parameters - the timestamp buffer will contain the value after the function call
|
||
641 | *
|
||
642 | * no return value
|
||
643 | */
|
||
644 | void dwt_readtxtimestamp(uint8_t * timestamp);
|
||
645 | |||
646 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
647 | * @fn dwt_readtxtimestamphi32()
|
||
648 | *
|
||
649 | * @brief This is used to read the high 32-bits of the TX timestamp (adjusted with the programmed antenna delay)
|
||
650 | *
|
||
651 | * input parameters
|
||
652 | *
|
||
653 | * output parameters
|
||
654 | *
|
||
655 | * returns high 32-bits of TX timestamp
|
||
656 | */
|
||
657 | uint32_t dwt_readtxtimestamphi32(void);
|
||
658 | |||
659 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
660 | * @fn dwt_readtxtimestamplo32()
|
||
661 | *
|
||
662 | * @brief This is used to read the low 32-bits of the TX timestamp (adjusted with the programmed antenna delay)
|
||
663 | *
|
||
664 | * input parameters
|
||
665 | *
|
||
666 | * output parameters
|
||
667 | *
|
||
668 | * returns low 32-bits of TX timestamp
|
||
669 | */
|
||
670 | uint32_t dwt_readtxtimestamplo32(void);
|
||
671 | |||
672 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
673 | * @fn dwt_readrxtimestamp()
|
||
674 | *
|
||
675 | * @brief This is used to read the RX timestamp (adjusted time of arrival)
|
||
676 | *
|
||
677 | * input parameters
|
||
678 | * @param timestamp - a pointer to a 5-byte buffer which will store the read RX timestamp time
|
||
679 | *
|
||
680 | * output parameters - the timestamp buffer will contain the value after the function call
|
||
681 | *
|
||
682 | * no return value
|
||
683 | */
|
||
684 | void dwt_readrxtimestamp(uint8_t * timestamp);
|
||
685 | |||
686 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
687 | * @fn dwt_readrxtimestamphi32()
|
||
688 | *
|
||
689 | * @brief This is used to read the high 32-bits of the RX timestamp (adjusted with the programmed antenna delay)
|
||
690 | *
|
||
691 | * input parameters
|
||
692 | *
|
||
693 | * output parameters
|
||
694 | *
|
||
695 | * returns high 32-bits of RX timestamp
|
||
696 | */
|
||
697 | uint32_t dwt_readrxtimestamphi32(void);
|
||
698 | |||
699 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
700 | * @fn dwt_readrxtimestamplo32()
|
||
701 | *
|
||
702 | * @brief This is used to read the low 32-bits of the RX timestamp (adjusted with the programmed antenna delay)
|
||
703 | *
|
||
704 | * input parameters
|
||
705 | *
|
||
706 | * output parameters
|
||
707 | *
|
||
708 | * returns low 32-bits of RX timestamp
|
||
709 | */
|
||
710 | uint32_t dwt_readrxtimestamplo32(void);
|
||
711 | |||
712 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
713 | * @fn dwt_readsystimestamphi32()
|
||
714 | *
|
||
715 | * @brief This is used to read the high 32-bits of the system time
|
||
716 | *
|
||
717 | * input parameters
|
||
718 | *
|
||
719 | * output parameters
|
||
720 | *
|
||
721 | * returns high 32-bits of system time timestamp
|
||
722 | */
|
||
723 | uint32_t dwt_readsystimestamphi32(void);
|
||
724 | |||
725 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
726 | * @fn dwt_readsystime()
|
||
727 | *
|
||
728 | * @brief This is used to read the system time
|
||
729 | *
|
||
730 | * input parameters
|
||
731 | * @param timestamp - a pointer to a 5-byte buffer which will store the read system time
|
||
732 | *
|
||
733 | * output parameters
|
||
734 | * @param timestamp - the timestamp buffer will contain the value after the function call
|
||
735 | *
|
||
736 | * no return value
|
||
737 | */
|
||
738 | void dwt_readsystime(uint8_t * timestamp);
|
||
739 | |||
740 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
741 | * @fn dwt_forcetrxoff()
|
||
742 | *
|
||
743 | * @brief This is used to turn off the transceiver
|
||
744 | *
|
||
745 | * input parameters
|
||
746 | *
|
||
747 | * output parameters
|
||
748 | *
|
||
749 | * no return value
|
||
750 | */
|
||
751 | void dwt_forcetrxoff(void); |
||
752 | |||
753 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
754 | * @fn dwt_syncrxbufptrs()
|
||
755 | *
|
||
756 | * @brief this function synchronizes rx buffer pointers
|
||
757 | * need to make sure that the host/IC buffer pointers are aligned before starting RX
|
||
758 | *
|
||
759 | * input parameters:
|
||
760 | *
|
||
761 | * output parameters
|
||
762 | *
|
||
763 | * no return value
|
||
764 | */
|
||
765 | void dwt_syncrxbufptrs(void); |
||
766 | |||
767 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
768 | * @fn dwt_rxenable()
|
||
769 | *
|
||
770 | * @brief This call turns on the receiver, can be immediate or delayed (depending on the mode parameter). In the case of a
|
||
771 | * "late" error the receiver will only be turned on if the DWT_IDLE_ON_DLY_ERR is not set.
|
||
772 | * The receiver will stay turned on, listening to any messages until
|
||
773 | * it either receives a good frame, an error (CRC, PHY header, Reed Solomon) or it times out (SFD, Preamble or Frame).
|
||
774 | *
|
||
775 | * input parameters
|
||
776 | * @param mode - this can be one of the following allowed values:
|
||
777 | *
|
||
778 | * DWT_START_RX_IMMEDIATE 0 used to enbale receiver immediately
|
||
779 | * DWT_START_RX_DELAYED 1 used to set up delayed RX, if "late" error triggers, then the RX will be enabled immediately
|
||
780 | * (DWT_START_RX_DELAYED | DWT_IDLE_ON_DLY_ERR) 3 used to disable re-enabling of receiver if delayed RX failed due to "late" error
|
||
781 | * (DWT_START_RX_IMMEDIATE | DWT_NO_SYNC_PTRS) 4 used to re-enable RX without trying to sync IC and host side buffer pointers, typically when
|
||
782 | * performing manual RX re-enabling in double buffering mode
|
||
783 | *
|
||
784 | * returns DWT_SUCCESS for success, or DWT_ERROR for error (e.g. a delayed receive enable will be too far in the future if delayed time has passed)
|
||
785 | */
|
||
786 | int dwt_rxenable(int mode); |
||
787 | |||
788 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
789 | * @fn dwt_setsniffmode()
|
||
790 | *
|
||
791 | * @brief enable/disable and configure SNIFF mode.
|
||
792 | *
|
||
793 | * SNIFF mode is a low-power reception mode where the receiver is sequenced on and off instead of being on all the time.
|
||
794 | * The time spent in each state (on/off) is specified through the parameters below.
|
||
795 | * See DW1000 User Manual section 4.5 "Low-Power SNIFF mode" for more details.
|
||
796 | *
|
||
797 | * input parameters:
|
||
798 | * @param enable - 1 to enable SNIFF mode, 0 to disable. When 0, all other parameters are not taken into account.
|
||
799 | * @param timeOn - duration of receiver ON phase, expressed in multiples of PAC size. The counter automatically adds 1 PAC
|
||
800 | * size to the value set. Min value that can be set is 1 (i.e. an ON time of 2 PAC size), max value is 15.
|
||
801 | * @param timeOff - duration of receiver OFF phase, expressed in multiples of 128/125 µs (~1 µs). Max value is 255.
|
||
802 | *
|
||
803 | * output parameters
|
||
804 | *
|
||
805 | * no return value
|
||
806 | */
|
||
807 | void dwt_setsniffmode(int enable, uint8_t timeOn, uint8_t timeOff); |
||
808 | |||
809 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
810 | * @fn dwt_setlowpowerlistening()
|
||
811 | *
|
||
812 | * @brief enable/disable low-power listening mode.
|
||
813 | *
|
||
814 | * Low-power listening is a feature whereby the DW1000 is predominantly in the SLEEP state but wakes periodically, (after
|
||
815 | * this "long sleep"), for a very short time to sample the air for a preamble sequence. This preamble sampling "listening"
|
||
816 | * phase is actually two reception phases separated by a "short sleep" time. See DW1000 User Manual section "Low-Power
|
||
817 | * Listening" for more details.
|
||
818 | *
|
||
819 | * NOTE: Before enabling low-power listening, the following functions have to be called to fully configure it:
|
||
820 | * - dwt_configuresleep() to configure long sleep phase. "mode" parameter should at least have DWT_PRESRV_SLEEP,
|
||
821 | * DWT_CONFIG and DWT_RX_EN set and "wake" parameter should at least have both DWT_WAKE_SLPCNT and DWT_SLP_EN set.
|
||
822 | * - dwt_calibratesleepcnt() and dwt_configuresleepcnt() to define the "long sleep" phase duration.
|
||
823 | * - dwt_setsnoozetime() to define the "short sleep" phase duration.
|
||
824 | * - dwt_setpreambledetecttimeout() to define the reception phases duration.
|
||
825 | * - dwt_setinterrupt() to activate RX good frame interrupt (DWT_INT_RFCG) only.
|
||
826 | * When configured, low-power listening mode can be triggered either by putting the DW1000 to sleep (using
|
||
827 | * dwt_entersleep()) or by activating reception (using dwt_rxenable()).
|
||
828 | *
|
||
829 | * Please refer to the low-power listening examples (examples 8a/8b accompanying the API distribution on Decawave's
|
||
830 | * website). They form a working example code that shows how to use low-power listening correctly.
|
||
831 | *
|
||
832 | * input parameters:
|
||
833 | * @param enable - 1 to enable low-power listening, 0 to disable.
|
||
834 | *
|
||
835 | * output parameters
|
||
836 | *
|
||
837 | * no return value
|
||
838 | */
|
||
839 | void dwt_setlowpowerlistening(int enable); |
||
840 | |||
841 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
842 | * @fn dwt_setsnoozetime()
|
||
843 | *
|
||
844 | * @brief Set duration of "short sleep" phase when in low-power listening mode.
|
||
845 | *
|
||
846 | * input parameters:
|
||
847 | * @param snooze_time - "short sleep" phase duration, expressed in multiples of 512/19.2 µs (~26.7 µs). The counter
|
||
848 | * automatically adds 1 to the value set. The smallest working value that should be set is 1,
|
||
849 | * i.e. giving a snooze time of 2 units (or ~53 µs).
|
||
850 | *
|
||
851 | * output parameters
|
||
852 | *
|
||
853 | * no return value
|
||
854 | */
|
||
855 | void dwt_setsnoozetime(uint8_t snooze_time);
|
||
856 | |||
857 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
858 | * @fn dwt_setdblrxbuffmode()
|
||
859 | *
|
||
860 | * @brief This call enables the double receive buffer mode
|
||
861 | *
|
||
862 | * input parameters
|
||
863 | * @param enable - 1 to enable, 0 to disable the double buffer mode
|
||
864 | *
|
||
865 | * output parameters
|
||
866 | *
|
||
867 | * no return value
|
||
868 | */
|
||
869 | void dwt_setdblrxbuffmode(int enable); |
||
870 | |||
871 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
872 | * @fn dwt_setrxtimeout()
|
||
873 | *
|
||
874 | * @brief This call enables RX timeout (SY_STAT_RFTO event)
|
||
875 | *
|
||
876 | * input parameters
|
||
877 | * @param time - how long the receiver remains on from the RX enable command
|
||
878 | * The time parameter used here is in 1.0256 us (512/499.2MHz) units
|
||
879 | * If set to 0 the timeout is disabled.
|
||
880 | *
|
||
881 | * output parameters
|
||
882 | *
|
||
883 | * no return value
|
||
884 | */
|
||
885 | void dwt_setrxtimeout(uint16_t time);
|
||
886 | |||
887 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
888 | * @fn dwt_setpreambledetecttimeout()
|
||
889 | *
|
||
890 | * @brief This call enables preamble timeout (SY_STAT_RXPTO event)
|
||
891 | *
|
||
892 | * input parameters
|
||
893 | * @param timeout - Preamble detection timeout, expressed in multiples of PAC size. The counter automatically adds 1 PAC
|
||
894 | * size to the value set. Min value that can be set is 1 (i.e. a timeout of 2 PAC size).
|
||
895 | *
|
||
896 | * output parameters
|
||
897 | *
|
||
898 | * no return value
|
||
899 | */
|
||
900 | void dwt_setpreambledetecttimeout(uint16_t timeout);
|
||
901 | |||
902 | |||
903 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
904 | * @fn dwt_calibratesleepcnt()
|
||
905 | *
|
||
906 | * @brief calibrates the local oscillator as its frequency can vary between 7 and 13kHz depending on temp and voltage
|
||
907 | *
|
||
908 | * NOTE: this function needs to be run before dwt_configuresleepcnt, so that we know what the counter units are
|
||
909 | *
|
||
910 | * input parameters
|
||
911 | *
|
||
912 | * output parameters
|
||
913 | *
|
||
914 | * returns the number of XTAL/2 cycles per low-power oscillator cycle. LP OSC frequency = 19.2 MHz/return value
|
||
915 | */
|
||
916 | uint16_t dwt_calibratesleepcnt(void);
|
||
917 | |||
918 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
919 | * @fn dwt_configuresleepcnt()
|
||
920 | *
|
||
921 | * @brief sets the sleep counter to new value, this function programs the high 16-bits of the 28-bit counter
|
||
922 | *
|
||
923 | * NOTE: this function needs to be run before dwt_configuresleep, also the SPI frequency has to be < 3MHz
|
||
924 | *
|
||
925 | * input parameters
|
||
926 | * @param sleepcnt - this it value of the sleep counter to program
|
||
927 | *
|
||
928 | * output parameters
|
||
929 | *
|
||
930 | * no return value
|
||
931 | */
|
||
932 | void dwt_configuresleepcnt(uint16_t sleepcnt);
|
||
933 | |||
934 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
935 | * @fn dwt_configuresleep()
|
||
936 | *
|
||
937 | * @brief configures the device for both DEEP_SLEEP and SLEEP modes, and on-wake mode
|
||
938 | * i.e. before entering the sleep, the device should be programmed for TX or RX, then upon "waking up" the TX/RX settings
|
||
939 | * will be preserved and the device can immediately perform the desired action TX/RX
|
||
940 | *
|
||
941 | * NOTE: e.g. Tag operation - after deep sleep, the device needs to just load the TX buffer and send the frame
|
||
942 | *
|
||
943 | *
|
||
944 | * mode: the array and LDE code (OTP/ROM) and LDO tune, and set sleep persist
|
||
945 | * DWT_PRESRV_SLEEP 0x0100 - preserve sleep
|
||
946 | * DWT_LOADOPSET 0x0080 - load operating parameter set on wakeup
|
||
947 | * DWT_CONFIG 0x0040 - download the AON array into the HIF (configuration download)
|
||
948 | * DWT_LOADEUI 0x0008
|
||
949 | * DWT_GOTORX 0x0002
|
||
950 | * DWT_TANDV 0x0001
|
||
951 | *
|
||
952 | * wake: wake up parameters
|
||
953 | * DWT_XTAL_EN 0x10 - keep XTAL running during sleep
|
||
954 | * DWT_WAKE_SLPCNT 0x8 - wake up after sleep count
|
||
955 | * DWT_WAKE_CS 0x4 - wake up on chip select
|
||
956 | * DWT_WAKE_WK 0x2 - wake up on WAKEUP PIN
|
||
957 | * DWT_SLP_EN 0x1 - enable sleep/deep sleep functionality
|
||
958 | *
|
||
959 | * input parameters
|
||
960 | * @param mode - config on-wake parameters
|
||
961 | * @param wake - config wake up parameters
|
||
962 | *
|
||
963 | * output parameters
|
||
964 | *
|
||
965 | * no return value
|
||
966 | */
|
||
967 | void dwt_configuresleep(uint16_t mode, uint8_t wake);
|
||
968 | |||
969 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
970 | * @fn dwt_entersleep()
|
||
971 | *
|
||
972 | * @brief This function puts the device into deep sleep or sleep. dwt_configuresleep() should be called first
|
||
973 | * to configure the sleep and on-wake/wake-up parameters
|
||
974 | *
|
||
975 | * input parameters
|
||
976 | *
|
||
977 | * output parameters
|
||
978 | *
|
||
979 | * no return value
|
||
980 | */
|
||
981 | void dwt_entersleep(void); |
||
982 | |||
983 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
984 | * @fn dwt_entersleepaftertx(int enable)
|
||
985 | *
|
||
986 | * @brief sets the auto TX to sleep bit. This means that after a frame
|
||
987 | * transmission the device will enter deep sleep mode. The dwt_configuresleep() function
|
||
988 | * needs to be called before this to configure the on-wake settings
|
||
989 | *
|
||
990 | * NOTE: the IRQ line has to be low/inactive (i.e. no pending events)
|
||
991 | *
|
||
992 | * input parameters
|
||
993 | * @param enable - 1 to configure the device to enter deep sleep after TX, 0 - disables the configuration
|
||
994 | *
|
||
995 | * output parameters
|
||
996 | *
|
||
997 | * no return value
|
||
998 | */
|
||
999 | void dwt_entersleepaftertx(int enable); |
||
1000 | |||
1001 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1002 | * @fn dwt_spicswakeup()
|
||
1003 | *
|
||
1004 | * @brief wake up the device from sleep mode using the SPI read,
|
||
1005 | * the device will wake up on chip select line going low if the line is held low for at least 500us.
|
||
1006 | * To define the length depending on the time one wants to hold
|
||
1007 | * the chip select line low, use the following formula:
|
||
1008 | *
|
||
1009 | * length (bytes) = time (s) * byte_rate (Hz)
|
||
1010 | *
|
||
1011 | * where fastest byte_rate is spi_rate (Hz) / 8 if the SPI is sending the bytes back-to-back.
|
||
1012 | * To save time and power, a system designer could determine byte_rate value more precisely.
|
||
1013 | *
|
||
1014 | * NOTE: Alternatively the device can be waken up with WAKE_UP pin if configured for that operation
|
||
1015 | *
|
||
1016 | * input parameters
|
||
1017 | * @param buff - this is a pointer to the dummy buffer which will be used in the SPI read transaction used for the WAKE UP of the device
|
||
1018 | * @param length - this is the length of the dummy buffer
|
||
1019 | *
|
||
1020 | * output parameters
|
||
1021 | *
|
||
1022 | * returns DWT_SUCCESS for success, or DWT_ERROR for error
|
||
1023 | */
|
||
1024 | int dwt_spicswakeup(uint8_t *buff, uint16_t length);
|
||
1025 | |||
1026 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1027 | * @fn dwt_setcallbacks()
|
||
1028 | *
|
||
1029 | * @brief This function is used to register the different callbacks called when one of the corresponding event occurs.
|
||
1030 | *
|
||
1031 | * NOTE: Callbacks can be undefined (set to NULL). In this case, dwt_isr() will process the event as usual but the 'null'
|
||
1032 | * callback will not be called.
|
||
1033 | *
|
||
1034 | * input parameters
|
||
1035 | * @param cbTxDone - the pointer to the TX confirmation event callback function
|
||
1036 | * @param cbRxOk - the pointer to the RX good frame event callback function
|
||
1037 | * @param cbRxTo - the pointer to the RX timeout events callback function
|
||
1038 | * @param cbRxErr - the pointer to the RX error events callback function
|
||
1039 | *
|
||
1040 | * output parameters
|
||
1041 | *
|
||
1042 | * no return value
|
||
1043 | */
|
||
1044 | void dwt_setcallbacks(dwt_cb_t cbTxDone, dwt_cb_t cbRxOk, dwt_cb_t cbRxTo, dwt_cb_t cbRxErr);
|
||
1045 | |||
1046 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1047 | * @fn dwt_checkirq()
|
||
1048 | *
|
||
1049 | * @brief This function checks if the IRQ line is active - this is used instead of interrupt handler
|
||
1050 | *
|
||
1051 | * input parameters
|
||
1052 | *
|
||
1053 | * output parameters
|
||
1054 | *
|
||
1055 | * return value is 1 if the IRQS bit is set and 0 otherwise
|
||
1056 | */
|
||
1057 | uint8_t dwt_checkirq(void);
|
||
1058 | |||
1059 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1060 | * @fn dwt_isr()
|
||
1061 | *
|
||
1062 | * @brief This is the DW1000's general Interrupt Service Routine. It will process/report the following events:
|
||
1063 | * - RXFCG (through cbRxOk callback)
|
||
1064 | * - TXFRS (through cbTxDone callback)
|
||
1065 | * - RXRFTO/RXPTO (through cbRxTo callback)
|
||
1066 | * - RXPHE/RXFCE/RXRFSL/RXSFDTO/AFFREJ/LDEERR (through cbRxTo cbRxErr)
|
||
1067 | * For all events, corresponding interrupts are cleared and necessary resets are performed. In addition, in the RXFCG case,
|
||
1068 | * received frame information and frame control are read before calling the callback. If double buffering is activated, it
|
||
1069 | * will also toggle between reception buffers once the reception callback processing has ended.
|
||
1070 | *
|
||
1071 | * /!\ This version of the ISR supports double buffering but does not support automatic RX re-enabling!
|
||
1072 | *
|
||
1073 | * NOTE: In PC based system using (Cheetah or ARM) USB to SPI converter there can be no interrupts, however we still need something
|
||
1074 | * to take the place of it and operate in a polled way. In an embedded system this function should be configured to be triggered
|
||
1075 | * on any of the interrupts described above.
|
||
1076 | |||
1077 | * input parameters
|
||
1078 | *
|
||
1079 | * output parameters
|
||
1080 | *
|
||
1081 | * no return value
|
||
1082 | */
|
||
1083 | void dwt_isr(void); |
||
1084 | |||
1085 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1086 | * @fn dwt_isr_lplisten()
|
||
1087 | *
|
||
1088 | * @brief This is the DW1000's Interrupt Service Routine to use when low-power listening scheme is implemented. It will
|
||
1089 | * only process/report the RXFCG event (through cbRxOk callback).
|
||
1090 | * It clears RXFCG interrupt and reads received frame information and frame control before calling the callback.
|
||
1091 | *
|
||
1092 | * /!\ This version of the ISR is designed for single buffering case only!
|
||
1093 | *
|
||
1094 | * input parameters
|
||
1095 | *
|
||
1096 | * output parameters
|
||
1097 | *
|
||
1098 | * no return value
|
||
1099 | */
|
||
1100 | void dwt_lowpowerlistenisr(void); |
||
1101 | |||
1102 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1103 | * @fn void dwt_setinterrupt()
|
||
1104 | *
|
||
1105 | * @brief This function enables the specified events to trigger an interrupt.
|
||
1106 | * The following events can be enabled:
|
||
1107 | * DWT_INT_TFRS 0x00000080 // frame sent
|
||
1108 | * DWT_INT_RFCG 0x00004000 // frame received with good CRC
|
||
1109 | * DWT_INT_RPHE 0x00001000 // receiver PHY header error
|
||
1110 | * DWT_INT_RFCE 0x00008000 // receiver CRC error
|
||
1111 | * DWT_INT_RFSL 0x00010000 // receiver sync loss error
|
||
1112 | * DWT_INT_RFTO 0x00020000 // frame wait timeout
|
||
1113 | * DWT_INT_RXPTO 0x00200000 // preamble detect timeout
|
||
1114 | * DWT_INT_SFDT 0x04000000 // SFD timeout
|
||
1115 | * DWT_INT_ARFE 0x20000000 // frame rejected (due to frame filtering configuration)
|
||
1116 | *
|
||
1117 | *
|
||
1118 | * input parameters:
|
||
1119 | * @param bitmask - sets the events which will generate interrupt
|
||
1120 | * @param enable - if set the interrupts are enabled else they are cleared
|
||
1121 | *
|
||
1122 | * output parameters
|
||
1123 | *
|
||
1124 | * no return value
|
||
1125 | */
|
||
1126 | void dwt_setinterrupt( uint32_t bitmask, uint8_t enable);
|
||
1127 | |||
1128 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1129 | * @fn dwt_setpanid()
|
||
1130 | *
|
||
1131 | * @brief This is used to set the PAN ID
|
||
1132 | *
|
||
1133 | * input parameters
|
||
1134 | * @param panID - this is the PAN ID
|
||
1135 | *
|
||
1136 | * output parameters
|
||
1137 | *
|
||
1138 | * no return value
|
||
1139 | */
|
||
1140 | void dwt_setpanid(uint16_t panID);
|
||
1141 | |||
1142 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1143 | * @fn dwt_setaddress16()
|
||
1144 | *
|
||
1145 | * @brief This is used to set 16-bit (short) address
|
||
1146 | *
|
||
1147 | * input parameters
|
||
1148 | * @param shortAddress - this sets the 16 bit short address
|
||
1149 | *
|
||
1150 | * output parameters
|
||
1151 | *
|
||
1152 | * no return value
|
||
1153 | */
|
||
1154 | void dwt_setaddress16(uint16_t shortAddress);
|
||
1155 | |||
1156 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1157 | * @fn dwt_seteui()
|
||
1158 | *
|
||
1159 | * @brief This is used to set the EUI 64-bit (long) address
|
||
1160 | *
|
||
1161 | * input parameters
|
||
1162 | * @param eui64 - this is the pointer to a buffer that contains the 64bit address
|
||
1163 | *
|
||
1164 | * output parameters
|
||
1165 | *
|
||
1166 | * no return value
|
||
1167 | */
|
||
1168 | void dwt_seteui(uint8_t *eui64);
|
||
1169 | |||
1170 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1171 | * @fn dwt_geteui()
|
||
1172 | *
|
||
1173 | * @brief This is used to get the EUI 64-bit from the DW1000
|
||
1174 | *
|
||
1175 | * input parameters
|
||
1176 | * @param eui64 - this is the pointer to a buffer that will contain the read 64-bit EUI value
|
||
1177 | *
|
||
1178 | * output parameters
|
||
1179 | *
|
||
1180 | * no return value
|
||
1181 | */
|
||
1182 | void dwt_geteui(uint8_t *eui64);
|
||
1183 | |||
1184 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1185 | * @fn dwt_otpread()
|
||
1186 | *
|
||
1187 | * @brief This is used to read the OTP data from given address into provided array
|
||
1188 | *
|
||
1189 | * input parameters
|
||
1190 | * @param address - this is the OTP address to read from
|
||
1191 | * @param array - this is the pointer to the array into which to read the data
|
||
1192 | * @param length - this is the number of 32 bit words to read (array needs to be at least this length)
|
||
1193 | *
|
||
1194 | * output parameters
|
||
1195 | *
|
||
1196 | * no return value
|
||
1197 | */
|
||
1198 | void dwt_otpread(uint32_t address, uint32_t *array, uint8_t length);
|
||
1199 | |||
1200 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1201 | * @fn dwt_enableframefilter()
|
||
1202 | *
|
||
1203 | * @brief This is used to enable the frame filtering - (the default option is to
|
||
1204 | * accept any data and ACK frames with correct destination address
|
||
1205 | *
|
||
1206 | * input parameters
|
||
1207 | * @param - bitmask - enables/disables the frame filtering options according to
|
||
1208 | * DWT_FF_NOTYPE_EN 0x000 no frame types allowed
|
||
1209 | * DWT_FF_COORD_EN 0x002 behave as coordinator (can receive frames with no destination address (PAN ID has to match))
|
||
1210 | * DWT_FF_BEACON_EN 0x004 beacon frames allowed
|
||
1211 | * DWT_FF_DATA_EN 0x008 data frames allowed
|
||
1212 | * DWT_FF_ACK_EN 0x010 ack frames allowed
|
||
1213 | * DWT_FF_MAC_EN 0x020 mac control frames allowed
|
||
1214 | * DWT_FF_RSVD_EN 0x040 reserved frame types allowed
|
||
1215 | *
|
||
1216 | * output parameters
|
||
1217 | *
|
||
1218 | * no return value
|
||
1219 | */
|
||
1220 | void dwt_enableframefilter(uint16_t bitmask);
|
||
1221 | |||
1222 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1223 | * @fn dwt_enableautoack()
|
||
1224 | *
|
||
1225 | * @brief This call enables the auto-ACK feature. If the responseDelayTime (parameter) is 0, the ACK will be sent a.s.a.p.
|
||
1226 | * otherwise it will be sent with a programmed delay (in symbols), max is 255.
|
||
1227 | * NOTE: needs to have frame filtering enabled as well
|
||
1228 | *
|
||
1229 | * input parameters
|
||
1230 | * @param responseDelayTime - if non-zero the ACK is sent after this delay, max is 255.
|
||
1231 | *
|
||
1232 | * output parameters
|
||
1233 | *
|
||
1234 | * no return value
|
||
1235 | */
|
||
1236 | void dwt_enableautoack(uint8_t responseDelayTime);
|
||
1237 | |||
1238 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1239 | * @fn dwt_setrxaftertxdelay()
|
||
1240 | *
|
||
1241 | * @brief This sets the receiver turn on delay time after a transmission of a frame
|
||
1242 | *
|
||
1243 | * input parameters
|
||
1244 | * @param rxDelayTime - (20 bits) - the delay is in UWB microseconds
|
||
1245 | *
|
||
1246 | * output parameters
|
||
1247 | *
|
||
1248 | * no return value
|
||
1249 | */
|
||
1250 | void dwt_setrxaftertxdelay(uint32_t rxDelayTime);
|
||
1251 | |||
1252 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1253 | * @fn dwt_rxreset()
|
||
1254 | *
|
||
1255 | * @brief this function resets the receiver of the DW1000
|
||
1256 | *
|
||
1257 | * input parameters:
|
||
1258 | *
|
||
1259 | * output parameters
|
||
1260 | *
|
||
1261 | * no return value
|
||
1262 | */
|
||
1263 | void dwt_rxreset(void); |
||
1264 | |||
1265 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1266 | * @fn dwt_softreset()
|
||
1267 | *
|
||
1268 | * @brief this function resets the DW1000
|
||
1269 | *
|
||
1270 | * input parameters:
|
||
1271 | *
|
||
1272 | * output parameters
|
||
1273 | *
|
||
1274 | * no return value
|
||
1275 | */
|
||
1276 | void dwt_softreset(void) ; |
||
1277 | |||
1278 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1279 | * @fn dwt_readrxdata()
|
||
1280 | *
|
||
1281 | * @brief This is used to read the data from the RX buffer, from an offset location give by offset parameter
|
||
1282 | *
|
||
1283 | * input parameters
|
||
1284 | * @param buffer - the buffer into which the data will be read
|
||
1285 | * @param length - the length of data to read (in bytes)
|
||
1286 | * @param rxBufferOffset - the offset in the rx buffer from which to read the data
|
||
1287 | *
|
||
1288 | * output parameters
|
||
1289 | *
|
||
1290 | * no return value
|
||
1291 | */
|
||
1292 | void dwt_readrxdata(uint8_t *buffer, uint16_t length, uint16_t rxBufferOffset);
|
||
1293 | |||
1294 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1295 | * @fn dwt_readaccdata()
|
||
1296 | *
|
||
1297 | * @brief This is used to read the data from the Accumulator buffer, from an offset location give by offset parameter
|
||
1298 | *
|
||
1299 | * NOTE: Because of an internal memory access delay when reading the accumulator the first octet output is a dummy octet
|
||
1300 | * that should be discarded. This is true no matter what sub-index the read begins at.
|
||
1301 | *
|
||
1302 | * input parameters
|
||
1303 | * @param buffer - the buffer into which the data will be read
|
||
1304 | * @param length - the length of data to read (in bytes)
|
||
1305 | * @param accOffset - the offset in the acc buffer from which to read the data
|
||
1306 | *
|
||
1307 | * output parameters
|
||
1308 | *
|
||
1309 | * no return value
|
||
1310 | */
|
||
1311 | void dwt_readaccdata(uint8_t *buffer, uint16_t length, uint16_t rxBufferOffset);
|
||
1312 | |||
1313 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1314 | * @fn dwt_readdiagnostics()
|
||
1315 | *
|
||
1316 | * @brief this function reads the RX signal quality diagnostic data
|
||
1317 | *
|
||
1318 | * input parameters
|
||
1319 | * @param diagnostics - diagnostic structure pointer, this will contain the diagnostic data read from the DW1000
|
||
1320 | *
|
||
1321 | * output parameters
|
||
1322 | *
|
||
1323 | * no return value
|
||
1324 | */
|
||
1325 | void dwt_readdiagnostics(dwt_rxdiag_t * diagnostics);
|
||
1326 | |||
1327 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1328 | * @fn dwt_loadopsettabfromotp()
|
||
1329 | *
|
||
1330 | * @brief This is used to select which Operational Parameter Set table to load from OTP memory
|
||
1331 | *
|
||
1332 | * input parameters
|
||
1333 | * @param ops_sel - Operational Parameter Set table to load:
|
||
1334 | * DWT_OPSET_64LEN = 0x0 - load the operational parameter set table for 64 length preamble configuration
|
||
1335 | * DWT_OPSET_TIGHT = 0x1 - load the operational parameter set table for tight xtal offsets (<1ppm)
|
||
1336 | * DWT_OPSET_DEFLT = 0x2 - load the default operational parameter set table (this is loaded from reset)
|
||
1337 | *
|
||
1338 | * output parameters
|
||
1339 | *
|
||
1340 | * no return value
|
||
1341 | */
|
||
1342 | void dwt_loadopsettabfromotp(uint8_t ops_sel);
|
||
1343 | |||
1344 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1345 | * @fn dwt_configeventcounters()
|
||
1346 | *
|
||
1347 | * @brief This is used to enable/disable the event counter in the IC
|
||
1348 | *
|
||
1349 | * input parameters
|
||
1350 | * @param - enable - 1 enables (and reset), 0 disables the event counters
|
||
1351 | * output parameters
|
||
1352 | *
|
||
1353 | * no return value
|
||
1354 | */
|
||
1355 | void dwt_configeventcounters(int enable); |
||
1356 | |||
1357 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1358 | * @fn dwt_readeventcounters()
|
||
1359 | *
|
||
1360 | * @brief This is used to read the event counters in the IC
|
||
1361 | *
|
||
1362 | * input parameters
|
||
1363 | * @param counters - pointer to the dwt_deviceentcnts_t structure which will hold the read data
|
||
1364 | *
|
||
1365 | * output parameters
|
||
1366 | *
|
||
1367 | * no return value
|
||
1368 | */
|
||
1369 | void dwt_readeventcounters(dwt_deviceentcnts_t *counters);
|
||
1370 | |||
1371 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1372 | * @fn dwt_otpwriteandverify()
|
||
1373 | *
|
||
1374 | * @brief This is used to program 32-bit value into the DW1000 OTP memory.
|
||
1375 | *
|
||
1376 | * input parameters
|
||
1377 | * @param value - this is the 32-bit value to be programmed into OTP
|
||
1378 | * @param address - this is the 16-bit OTP address into which the 32-bit value is programmed
|
||
1379 | *
|
||
1380 | * output parameters
|
||
1381 | *
|
||
1382 | * returns DWT_SUCCESS for success, or DWT_ERROR for error
|
||
1383 | */
|
||
1384 | int dwt_otpwriteandverify(uint32_t value, uint16_t address);
|
||
1385 | |||
1386 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1387 | * @fn dwt_setleds()
|
||
1388 | *
|
||
1389 | * @brief This is used to set up Tx/Rx GPIOs which could be used to control LEDs
|
||
1390 | * Note: not completely IC dependent, also needs board with LEDS fitted on right I/O lines
|
||
1391 | * this function enables GPIOs 2 and 3 which are connected to LED3 and LED4 on EVB1000
|
||
1392 | *
|
||
1393 | * input parameters
|
||
1394 | * @param mode - this is a bit field interpreted as follows:
|
||
1395 | * - bit 0: 1 to enable LEDs, 0 to disable them
|
||
1396 | * - bit 1: 1 to make LEDs blink once on init. Only valid if bit 0 is set (enable LEDs)
|
||
1397 | * - bit 2 to 7: reserved
|
||
1398 | *
|
||
1399 | * output parameters none
|
||
1400 | *
|
||
1401 | * no return value
|
||
1402 | */
|
||
1403 | void dwt_setleds(uint8_t mode);
|
||
1404 | |||
1405 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1406 | * @fn dwt_setxtaltrim()
|
||
1407 | *
|
||
1408 | * @brief This is used to adjust the crystal frequency
|
||
1409 | *
|
||
1410 | * input parameters:
|
||
1411 | * @param value - crystal trim value (in range 0x0 to 0x1F) 31 steps (~1.5ppm per step)
|
||
1412 | *
|
||
1413 | * output parameters
|
||
1414 | *
|
||
1415 | * no return value
|
||
1416 | */
|
||
1417 | void dwt_setxtaltrim(uint8_t value);
|
||
1418 | |||
1419 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1420 | * @fn dwt_getinitxtaltrim()
|
||
1421 | *
|
||
1422 | * @brief This function returns the value of XTAL trim that has been applied during initialisation (dwt_init). This can
|
||
1423 | * be either the value read in OTP memory or a default value.
|
||
1424 | *
|
||
1425 | * NOTE: The value returned by this function is the initial value only! It is not updated on dwt_setxtaltrim calls.
|
||
1426 | *
|
||
1427 | * input parameters
|
||
1428 | *
|
||
1429 | * output parameters
|
||
1430 | *
|
||
1431 | * returns the XTAL trim value set upon initialisation
|
||
1432 | */
|
||
1433 | uint8_t dwt_getinitxtaltrim(void);
|
||
1434 | |||
1435 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1436 | * @fn dwt_configcwmode()
|
||
1437 | *
|
||
1438 | * @brief this function sets the DW1000 to transmit cw signal at specific channel frequency
|
||
1439 | *
|
||
1440 | * input parameters:
|
||
1441 | * @param chan - specifies the operating channel (e.g. 1, 2, 3, 4, 5, 6 or 7)
|
||
1442 | *
|
||
1443 | * output parameters
|
||
1444 | *
|
||
1445 | * no return value
|
||
1446 | */
|
||
1447 | void dwt_configcwmode(uint8_t chan);
|
||
1448 | |||
1449 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1450 | * @fn dwt_configcontinuousframemode()
|
||
1451 | *
|
||
1452 | * @brief this function sets the DW1000 to continuous tx frame mode for regulatory approvals testing.
|
||
1453 | *
|
||
1454 | * input parameters:
|
||
1455 | * @param framerepetitionrate - This is a 32-bit value that is used to set the interval between transmissions.
|
||
1456 | * The minimum value is 4. The units are approximately 8 ns. (or more precisely 512/(499.2e6*128) seconds)).
|
||
1457 | *
|
||
1458 | * output parameters
|
||
1459 | *
|
||
1460 | * no return value
|
||
1461 | */
|
||
1462 | void dwt_configcontinuousframemode(uint32_t framerepetitionrate);
|
||
1463 | |||
1464 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1465 | * @fn dwt_readtempvbat()
|
||
1466 | *
|
||
1467 | * @brief this function reads the battery voltage and temperature of the MP
|
||
1468 | * The values read here will be the current values sampled by DW1000 AtoD converters.
|
||
1469 | * Note on Temperature: the temperature value needs to be converted to give the real temperature
|
||
1470 | * the formula is: 1.13 * reading - 113.0
|
||
1471 | * Note on Voltage: the voltage value needs to be converted to give the real voltage
|
||
1472 | * the formula is: 0.0057 * reading + 2.3
|
||
1473 | *
|
||
1474 | * NB: To correctly read the temperature this read should be done with xtal clock
|
||
1475 | * however that means that the receiver will be switched off, if receiver needs to be on then
|
||
1476 | * the timer is used to make sure the value is stable before reading
|
||
1477 | *
|
||
1478 | * input parameters:
|
||
1479 | * @param fastSPI - set to 1 if SPI rate > than 3MHz is used
|
||
1480 | *
|
||
1481 | * output parameters
|
||
1482 | *
|
||
1483 | * returns (temp_raw<<8)|(vbat_raw)
|
||
1484 | */
|
||
1485 | uint16_t dwt_readtempvbat(uint8_t fastSPI); |
||
1486 | |||
1487 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1488 | * @fn dwt_readwakeuptemp()
|
||
1489 | *
|
||
1490 | * @brief this function reads the temperature of the DW1000 that was sampled
|
||
1491 | * on waking from Sleep/Deepsleep. They are not current values, but read on last
|
||
1492 | * wakeup if DWT_TANDV bit is set in mode parameter of dwt_configuresleep
|
||
1493 | *
|
||
1494 | * input parameters:
|
||
1495 | *
|
||
1496 | * output parameters:
|
||
1497 | *
|
||
1498 | * returns: 8-bit raw temperature sensor value
|
||
1499 | */
|
||
1500 | uint8_t dwt_readwakeuptemp(void) ;
|
||
1501 | |||
1502 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1503 | * @fn dwt_readwakeupvbat()
|
||
1504 | *
|
||
1505 | * @brief this function reads the battery voltage of the DW1000 that was sampled
|
||
1506 | * on waking from Sleep/Deepsleep. They are not current values, but read on last
|
||
1507 | * wakeup if DWT_TANDV bit is set in mode parameter of dwt_configuresleep
|
||
1508 | *
|
||
1509 | * input parameters:
|
||
1510 | *
|
||
1511 | * output parameters:
|
||
1512 | *
|
||
1513 | * returns: 8-bit raw battery voltage sensor value
|
||
1514 | */
|
||
1515 | uint8_t dwt_readwakeupvbat(void) ;
|
||
1516 | |||
1517 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1518 | * @fn dwt_calcbandwidthtempadj()
|
||
1519 | *
|
||
1520 | * @brief this function determines the corrected bandwidth setting (PG_DELAY register setting)
|
||
1521 | * of the DW1000 which changes over temperature.
|
||
1522 | *
|
||
1523 | * input parameters:
|
||
1524 | * @param target_count - uint16_t - the PG count target to reach in order to correct the bandwidth
|
||
1525 | *
|
||
1526 | * output parameters:
|
||
1527 | *
|
||
1528 | * returns: (uint32) The setting to be programmed into the PG_DELAY value
|
||
1529 | */
|
||
1530 | uint32_t dwt_calcbandwidthtempadj(uint16_t target_count); |
||
1531 | |||
1532 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1533 | * @fn dwt_calcpowertempadj()
|
||
1534 | *
|
||
1535 | * @brief this function determines the corrected power setting (TX_POWER setting) for the
|
||
1536 | * DW1000 which changes over temperature.
|
||
1537 | *
|
||
1538 | * input parameters:
|
||
1539 | * @param channel - uint8_t - the channel at which compensation of power level will be applied
|
||
1540 | * @param ref_powerreg - uint32_t - the TX_POWER register value recorded when reference measurements were made
|
||
1541 | * @param current_temperature - double - the current ambient temperature in degrees Celcius
|
||
1542 | * @param reference_temperature - double - the temperature at which reference measurements were made
|
||
1543 | * output parameters: None
|
||
1544 | *
|
||
1545 | * returns: (uint32) The corrected TX_POWER register value
|
||
1546 | */
|
||
1547 | uint32_t dwt_calcpowertempadj(uint8_t channel, uint32_t ref_powerreg, double current_temperature, double reference_temperature); |
||
1548 | |||
1549 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1550 | * @fn dwt_calcpgcount()
|
||
1551 | *
|
||
1552 | * @brief this function calculates the value in the pulse generator counter register (PGC_STATUS) for a given PG_DELAY
|
||
1553 | * This is used to take a reference measurement, and the value recorded as the reference is used to adjust the
|
||
1554 | * bandwidth of the device when the temperature changes.
|
||
1555 | *
|
||
1556 | * input parameters:
|
||
1557 | * @param pgdly - uint8_t - the PG_DELAY to set (to control bandwidth), and to find the corresponding count value for
|
||
1558 | * output parameters: None
|
||
1559 | *
|
||
1560 | * returns: (uint16) PGC_STATUS count value calculated from the provided PG_DELAY value - used as reference for later
|
||
1561 | * bandwidth adjustments
|
||
1562 | */
|
||
1563 | uint16_t dwt_calcpgcount(uint8_t pgdly); |
||
1564 | |||
1565 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1566 | * @fn dwt_writetodevice()
|
||
1567 | *
|
||
1568 | * @brief this function is used to write to the DW1000 device registers
|
||
1569 | * Notes:
|
||
1570 | * 1. Firstly we create a header (the first byte is a header byte)
|
||
1571 | * a. check if sub index is used, if subindexing is used - set bit-6 to 1 to signify that the sub-index address follows the register index byte
|
||
1572 | * b. set bit-7 (or with 0x80) for write operation
|
||
1573 | * c. if extended sub address index is used (i.e. if index > 127) set bit-7 of the first sub-index byte following the first header byte
|
||
1574 | *
|
||
1575 | * 2. Write the header followed by the data bytes to the DW1000 device
|
||
1576 | *
|
||
1577 | *
|
||
1578 | * input parameters:
|
||
1579 | * @param recordNumber - ID of register file or buffer being accessed
|
||
1580 | * @param index - byte index into register file or buffer being accessed
|
||
1581 | * @param length - number of bytes being written
|
||
1582 | * @param buffer - pointer to buffer containing the 'length' bytes to be written
|
||
1583 | *
|
||
1584 | * output parameters
|
||
1585 | *
|
||
1586 | * no return value
|
||
1587 | */
|
||
1588 | void dwt_writetodevice
|
||
1589 | ( |
||
1590 | uint16_t recordNumber, // input parameter - ID of register file or buffer being accessed
|
||
1591 | uint16_t index, // input parameter - byte index into register file or buffer being accessed
|
||
1592 | uint32_t length, // input parameter - number of bytes being written
|
||
1593 | const uint8_t *buffer // input parameter - pointer to buffer containing the 'length' bytes to be written |
||
1594 | ) ; |
||
1595 | |||
1596 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1597 | * @fn dwt_readfromdevice()
|
||
1598 | *
|
||
1599 | * @brief this function is used to read from the DW1000 device registers
|
||
1600 | * Notes:
|
||
1601 | * 1. Firstly we create a header (the first byte is a header byte)
|
||
1602 | * a. check if sub index is used, if subindexing is used - set bit-6 to 1 to signify that the sub-index address follows the register index byte
|
||
1603 | * b. set bit-7 (or with 0x80) for write operation
|
||
1604 | * c. if extended sub address index is used (i.e. if index > 127) set bit-7 of the first sub-index byte following the first header byte
|
||
1605 | *
|
||
1606 | * 2. Write the header followed by the data bytes to the DW1000 device
|
||
1607 | * 3. Store the read data in the input buffer
|
||
1608 | *
|
||
1609 | * input parameters:
|
||
1610 | * @param recordNumber - ID of register file or buffer being accessed
|
||
1611 | * @param index - byte index into register file or buffer being accessed
|
||
1612 | * @param length - number of bytes being read
|
||
1613 | * @param buffer - pointer to buffer in which to return the read data.
|
||
1614 | *
|
||
1615 | * output parameters
|
||
1616 | *
|
||
1617 | * no return value
|
||
1618 | */
|
||
1619 | void dwt_readfromdevice
|
||
1620 | ( |
||
1621 | uint16_t recordNumber, // input parameter - ID of register file or buffer being accessed
|
||
1622 | uint16_t index, // input parameter - byte index into register file or buffer being accessed
|
||
1623 | uint32_t length, // input parameter - number of bytes being read
|
||
1624 | uint8_t *buffer // input parameter - pointer to buffer in which to return the read data.
|
||
1625 | ) ; |
||
1626 | |||
1627 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1628 | * @fn dwt_read32bitoffsetreg()
|
||
1629 | *
|
||
1630 | * @brief this function is used to read 32-bit value from the DW1000 device registers
|
||
1631 | *
|
||
1632 | * input parameters:
|
||
1633 | * @param regFileID - ID of register file or buffer being accessed
|
||
1634 | * @param regOffset - the index into register file or buffer being accessed
|
||
1635 | *
|
||
1636 | * output parameters
|
||
1637 | *
|
||
1638 | * returns 32 bit register value
|
||
1639 | */
|
||
1640 | uint32_t dwt_read32bitoffsetreg(int regFileID, int regOffset) ; |
||
1641 | |||
1642 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1643 | * @fn dwt_write32bitoffsetreg()
|
||
1644 | *
|
||
1645 | * @brief this function is used to write 32-bit value to the DW1000 device registers
|
||
1646 | *
|
||
1647 | * input parameters:
|
||
1648 | * @param regFileID - ID of register file or buffer being accessed
|
||
1649 | * @param regOffset - the index into register file or buffer being accessed
|
||
1650 | * @param regval - the value to write
|
||
1651 | *
|
||
1652 | * output parameters
|
||
1653 | *
|
||
1654 | * no return value
|
||
1655 | */
|
||
1656 | void dwt_write32bitoffsetreg(int regFileID, int regOffset, uint32_t regval); |
||
1657 | |||
1658 | #define dwt_write32bitreg(x,y) dwt_write32bitoffsetreg(x,0,y) |
||
1659 | #define dwt_read32bitreg(x) dwt_read32bitoffsetreg(x,0) |
||
1660 | |||
1661 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1662 | * @fn dwt_read16bitoffsetreg()
|
||
1663 | *
|
||
1664 | * @brief this function is used to read 16-bit value from the DW1000 device registers
|
||
1665 | *
|
||
1666 | * input parameters:
|
||
1667 | * @param regFileID - ID of register file or buffer being accessed
|
||
1668 | * @param regOffset - the index into register file or buffer being accessed
|
||
1669 | *
|
||
1670 | * output parameters
|
||
1671 | *
|
||
1672 | * returns 16 bit register value
|
||
1673 | */
|
||
1674 | uint16_t dwt_read16bitoffsetreg(int regFileID, int regOffset); |
||
1675 | |||
1676 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1677 | * @fn dwt_write16bitoffsetreg()
|
||
1678 | *
|
||
1679 | * @brief this function is used to write 16-bit value to the DW1000 device registers
|
||
1680 | *
|
||
1681 | * input parameters:
|
||
1682 | * @param regFileID - ID of register file or buffer being accessed
|
||
1683 | * @param regOffset - the index into register file or buffer being accessed
|
||
1684 | * @param regval - the value to write
|
||
1685 | *
|
||
1686 | * output parameters
|
||
1687 | *
|
||
1688 | * no return value
|
||
1689 | */
|
||
1690 | void dwt_write16bitoffsetreg(int regFileID, int regOffset, uint16_t regval) ; |
||
1691 | |||
1692 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1693 | * @fn dwt_read8bitoffsetreg()
|
||
1694 | *
|
||
1695 | * @brief this function is used to read an 8-bit value from the DW1000 device registers
|
||
1696 | *
|
||
1697 | * input parameters:
|
||
1698 | * @param regFileID - ID of register file or buffer being accessed
|
||
1699 | * @param regOffset - the index into register file or buffer being accessed
|
||
1700 | *
|
||
1701 | * output parameters
|
||
1702 | *
|
||
1703 | * returns 8-bit register value
|
||
1704 | */
|
||
1705 | uint8_t dwt_read8bitoffsetreg(int regFileID, int regOffset); |
||
1706 | |||
1707 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1708 | * @fn dwt_write8bitoffsetreg()
|
||
1709 | *
|
||
1710 | * @brief this function is used to write an 8-bit value to the DW1000 device registers
|
||
1711 | *
|
||
1712 | * input parameters:
|
||
1713 | * @param regFileID - ID of register file or buffer being accessed
|
||
1714 | * @param regOffset - the index into register file or buffer being accessed
|
||
1715 | * @param regval - the value to write
|
||
1716 | *
|
||
1717 | * output parameters
|
||
1718 | *
|
||
1719 | * no return value
|
||
1720 | */
|
||
1721 | void dwt_write8bitoffsetreg(int regFileID, int regOffset, uint8_t regval); |
||
1722 | |||
1723 | |||
1724 | /****************************************************************************************************************************************************
|
||
1725 | *
|
||
1726 | * Declaration of platform-dependent lower level functions.
|
||
1727 | *
|
||
1728 | ****************************************************************************************************************************************************/
|
||
1729 | |||
1730 | |||
1731 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1732 | * @fn writetospi()
|
||
1733 | *
|
||
1734 | * @brief
|
||
1735 | * NB: In porting this to a particular microprocessor, the implementer needs to define the two low
|
||
1736 | * level abstract functions to write to and read from the SPI.
|
||
1737 | * Low level abstract function to write to the SPI
|
||
1738 | * Takes two separate byte buffers for write header and write data
|
||
1739 | * returns 0 for success, or -1 for error
|
||
1740 | *
|
||
1741 | * Note: The body of this function is platform specific
|
||
1742 | *
|
||
1743 | * input parameters:
|
||
1744 | * @param headerLength - number of bytes header being written
|
||
1745 | * @param headerBuffer - pointer to buffer containing the 'headerLength' bytes of header to be written
|
||
1746 | * @param bodylength - number of bytes data being written
|
||
1747 | * @param bodyBuffer - pointer to buffer containing the 'bodylength' bytes od data to be written
|
||
1748 | *
|
||
1749 | * output parameters
|
||
1750 | *
|
||
1751 | * returns DWT_SUCCESS for success, or DWT_ERROR for error
|
||
1752 | */
|
||
1753 | extern int writetospi(uint16_t headerLength, const uint8_t *headerBuffer, uint32_t bodylength, const uint8_t *bodyBuffer); |
||
1754 | |||
1755 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1756 | * @fn readfromspi()
|
||
1757 | *
|
||
1758 | * @brief
|
||
1759 | * NB: In porting this to a particular microprocessor, the implementer needs to define the two low
|
||
1760 | * level abstract functions to write to and read from the SPI.
|
||
1761 | * Low level abstract function to write to the SPI
|
||
1762 | * Takes two separate byte buffers for write header and write data
|
||
1763 | * returns 0 for success, or -1 for error
|
||
1764 | *
|
||
1765 | * Note: The body of this function is platform specific
|
||
1766 | *
|
||
1767 | * input parameters:
|
||
1768 | * @param headerLength - number of bytes header to write
|
||
1769 | * @param headerBuffer - pointer to buffer containing the 'headerLength' bytes of header to write
|
||
1770 | * @param readlength - number of bytes data being read
|
||
1771 | * @param readBuffer - pointer to buffer containing to return the data (NB: size required = headerLength + readlength)
|
||
1772 | *
|
||
1773 | * output parameters
|
||
1774 | *
|
||
1775 | * returns DWT_SUCCESS for success (and the position in the buffer at which data begins), or DWT_ERROR for error
|
||
1776 | */
|
||
1777 | extern int readfromspi(uint16_t headerLength, const uint8_t *headerBuffer, uint32_t readlength, uint8_t *readBuffer); |
||
1778 | |||
1779 | // ---------------------------------------------------------------------------
|
||
1780 | //
|
||
1781 | // NB: The purpose of the deca_mutex.c file is to provide for microprocessor interrupt enable/disable, this is used for
|
||
1782 | // controlling mutual exclusion from critical sections in the code where interrupts and background
|
||
1783 | // processing may interact. The code using this is kept to a minimum and the disabling time is also
|
||
1784 | // kept to a minimum, so blanket interrupt disable may be the easiest way to provide this. But at a
|
||
1785 | // minimum those interrupts coming from the decawave device should be disabled/re-enabled by this activity.
|
||
1786 | //
|
||
1787 | // In porting this to a particular microprocessor, the implementer may choose to use #defines here
|
||
1788 | // to map these calls transparently to the target system. Alternatively the appropriate code may
|
||
1789 | // be embedded in the functions provided in the deca_irq.c file.
|
||
1790 | //
|
||
1791 | // ---------------------------------------------------------------------------
|
||
1792 | |||
1793 | typedef int decaIrqStatus_t ; // Type for remembering IRQ status |
||
1794 | |||
1795 | |||
1796 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1797 | * @fn decamutexon()
|
||
1798 | *
|
||
1799 | * @brief This function should disable interrupts. This is called at the start of a critical section
|
||
1800 | * It returns the IRQ state before disable, this value is used to re-enable in decamutexoff call
|
||
1801 | *
|
||
1802 | * Note: The body of this function is platform specific
|
||
1803 | *
|
||
1804 | * input parameters:
|
||
1805 | *
|
||
1806 | * output parameters
|
||
1807 | *
|
||
1808 | * returns the state of the DW1000 interrupt
|
||
1809 | */
|
||
1810 | decaIrqStatus_t decamutexon(void) ;
|
||
1811 | |||
1812 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1813 | * @fn decamutexoff()
|
||
1814 | *
|
||
1815 | * @brief This function should re-enable interrupts, or at least restore their state as returned(&saved) by decamutexon
|
||
1816 | * This is called at the end of a critical section
|
||
1817 | *
|
||
1818 | * Note: The body of this function is platform specific
|
||
1819 | *
|
||
1820 | * input parameters:
|
||
1821 | * @param s - the state of the DW1000 interrupt as returned by decamutexon
|
||
1822 | *
|
||
1823 | * output parameters
|
||
1824 | *
|
||
1825 | * returns the state of the DW1000 interrupt
|
||
1826 | */
|
||
1827 | void decamutexoff(decaIrqStatus_t s) ;
|
||
1828 | |||
1829 | /*! ------------------------------------------------------------------------------------------------------------------
|
||
1830 | * @fn deca_sleep()
|
||
1831 | *
|
||
1832 | * @brief Wait for a given amount of time.
|
||
1833 | * NB: The body of this function is platform specific
|
||
1834 | *
|
||
1835 | * input parameters:
|
||
1836 | * @param time_ms - time to wait in milliseconds
|
||
1837 | *
|
||
1838 | * output parameters
|
||
1839 | *
|
||
1840 | * no return value
|
||
1841 | */
|
||
1842 | void deca_sleep(unsigned int time_ms); |
||
1843 | void Sleep(unsigned int time_ms); |
||
1844 | |||
1845 | |||
1846 | void port_EnableEXT_IRQ(void); |
||
1847 | void port_DisableEXT_IRQ(void); |
||
1848 | ITStatus port_GetEXT_IRQStatus(void);
|
||
1849 | |||
1850 | void port_set_dw1000_slowrate(void); |
||
1851 | void port_set_dw1000_fastrate(void); |
||
1852 | void port_wakeup_dw1000_fast(void); |
||
1853 | uint32_t portGetTickCnt(void);
|
||
1854 | |||
1855 | |||
1856 | /**
|
||
1857 | * @brief Pad specific IRQn handler. modify it if the PIN no. is changed
|
||
1858 | */
|
||
1859 | #define DW1000_EXTI_IRQn EXTI15_10_IRQn
|
||
1860 | |||
1861 | |||
1862 | /**
|
||
1863 | * @brief Flag to switch between two SPI speeds on the fly
|
||
1864 | */
|
||
1865 | extern bool isHighSpeedSpi; |
||
1866 | |||
1867 | |||
1868 | /**
|
||
1869 | * @brief Configuration for the Low Speed SPI interface driver to communicate with DW1000
|
||
1870 | */
|
||
1871 | //extern SPIConfig moduleHalSpiUwbLsConfig;
|
||
1872 | |||
1873 | |||
1874 | /**
|
||
1875 | * @brief Configuration for the High Speed SPI interface driver to communicate with DW1000
|
||
1876 | */
|
||
1877 | //extern SPIConfig moduleHalSpiUwbHsConfig;
|
||
1878 | |||
1879 | #endif /* defined(AMIROLLD_CFG_DW1000) && (AMIROLLD_CFG_DW1000 == 1) */ |
||
1880 | |||
1881 | #endif //AMIROLLD_DW1000_V1_H |