| | |
| | | #ifndef _DECA_DEVICE_API_H_ |
| | | #define _DECA_DEVICE_API_H_ |
| | | |
| | | #include <stdint.h> |
| | | |
| | | #ifdef __cplusplus |
| | | extern "C" { |
| | | #endif |
| | | |
| | | |
| | | #ifndef uint8 |
| | | #ifndef _DECA_UINT8_ |
| | | #define _DECA_UINT8_ |
| | | typedef unsigned char uint8; |
| | | #endif |
| | | #endif |
| | | |
| | | #ifndef uint16 |
| | | #ifndef _DECA_UINT16_ |
| | | #define _DECA_UINT16_ |
| | | typedef unsigned short uint16; |
| | | #endif |
| | | #endif |
| | | |
| | | #ifndef uint32 |
| | | #ifndef _DECA_UINT32_ |
| | | #define _DECA_UINT32_ |
| | | typedef unsigned long uint32; |
| | | #endif |
| | | #endif |
| | | |
| | | #ifndef int8 |
| | | #ifndef _DECA_INT8_ |
| | | #define _DECA_INT8_ |
| | | typedef signed char int8; |
| | | #endif |
| | | #endif |
| | | |
| | | #ifndef int16 |
| | | #ifndef _DECA_INT16_ |
| | | #define _DECA_INT16_ |
| | | typedef signed short int16; |
| | | #endif |
| | | #endif |
| | | |
| | | #ifndef int32 |
| | | #ifndef _DECA_INT32_ |
| | | #define _DECA_INT32_ |
| | | typedef signed long int32; |
| | | #endif |
| | | #endif |
| | | |
| | | #define DWT_SUCCESS (0) |
| | |
| | | #define DWT_OPSET_TIGHT 0x1 |
| | | #define DWT_OPSET_DEFLT 0x2 |
| | | |
| | | typedef struct{ |
| | | typedef struct |
| | | { |
| | | |
| | | uint32 status; //initial value of register as ISR is entered |
| | | uint8 event; //event type |
| | | uint8 aatset; //auto ACK TX bit is set |
| | | uint16 datalength; //length of frame |
| | | uint8 fctrl[2]; //frame control bytes |
| | | uint8 dblbuff ; //set if double buffer is enabled |
| | | uint32_t status; //initial value of register as ISR is entered |
| | | uint8_t event; //event type |
| | | uint8_t aatset; //auto ACK TX bit is set |
| | | uint16_t datalength; //length of frame |
| | | uint8_t fctrl[2]; //frame control bytes |
| | | uint8_t dblbuff ; //set if double buffer is enabled |
| | | |
| | | }dwt_callback_data_t; |
| | | } dwt_callback_data_t; |
| | | |
| | | |
| | | typedef enum { |
| | | CHAN_CTRL_TXCHAN_1 = 0x01, /* Selects the transmit channel 1 */ |
| | | CHAN_CTRL_TXCHAN_2 = 0x02, /* Selects the transmit channel 2 */ |
| | | CHAN_CTRL_TXCHAN_3 = 0x03, /* Selects the transmit channel 3 */ |
| | | CHAN_CTRL_TXCHAN_4 = 0x04, /* Selects the transmit channel 4 */ |
| | | CHAN_CTRL_TXCHAN_5 = 0x05, /* Selects the transmit channel 5 */ |
| | | CHAN_CTRL_TXCHAN_7 = 0x07 /* Selects the transmit channel 7 */ |
| | | }eCHAN; |
| | | typedef enum |
| | | { |
| | | CHAN_CTRL_TXCHAN_1 = 0x01, /* Selects the transmit channel 1 */ |
| | | CHAN_CTRL_TXCHAN_2 = 0x02, /* Selects the transmit channel 2 */ |
| | | CHAN_CTRL_TXCHAN_3 = 0x03, /* Selects the transmit channel 3 */ |
| | | CHAN_CTRL_TXCHAN_4 = 0x04, /* Selects the transmit channel 4 */ |
| | | CHAN_CTRL_TXCHAN_5 = 0x05, /* Selects the transmit channel 5 */ |
| | | CHAN_CTRL_TXCHAN_7 = 0x07 /* Selects the transmit channel 7 */ |
| | | } eCHAN; |
| | | |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | |
| | | #pragma pack(1) |
| | | typedef struct |
| | | { |
| | | uint8 chan ; //!< channel number {1, 2, 3, 4, 5, 7 } |
| | | uint8 prf ; //!< Pulse Repetition Frequency {DWT_PRF_16M or DWT_PRF_64M} |
| | | uint8 txPreambLength ; //!< DWT_PLEN_64..DWT_PLEN_4096 |
| | | uint8 rxPAC ; //!< Acquisition Chunk Size (Relates to RX preamble length) |
| | | uint8 txCode ; //!< TX preamble code |
| | | uint8 rxCode ; //!< RX preamble code |
| | | uint8 nsSFD ; //!< Boolean should we use non-standard SFD for better performance |
| | | uint8 dataRate ; //!< Data Rate {DWT_BR_110K, DWT_BR_850K or DWT_BR_6M8} |
| | | uint8 phrMode ; //!< PHR mode {0x0 - standard DWT_PHRMODE_STD, 0x3 - extended frames DWT_PHRMODE_EXT} |
| | | uint16 sfdTO ; //!< SFD timeout value (in symbols) |
| | | }__attribute__ ((packed)) dwt_config_t ; |
| | | uint8_t chan ; //!< channel number {1, 2, 3, 4, 5, 7 } |
| | | uint8_t prf ; //!< Pulse Repetition Frequency {DWT_PRF_16M or DWT_PRF_64M} |
| | | uint8_t txPreambLength ; //!< DWT_PLEN_64..DWT_PLEN_4096 |
| | | uint8_t rxPAC ; //!< Acquisition Chunk Size (Relates to RX preamble length) |
| | | uint8_t txCode ; //!< TX preamble code |
| | | uint8_t rxCode ; //!< RX preamble code |
| | | uint8_t nsSFD ; //!< Boolean should we use non-standard SFD for better performance |
| | | uint8_t dataRate ; //!< Data Rate {DWT_BR_110K, DWT_BR_850K or DWT_BR_6M8} |
| | | uint8_t phrMode ; //!< PHR mode {0x0 - standard DWT_PHRMODE_STD, 0x3 - extended frames DWT_PHRMODE_EXT} |
| | | uint16_t sfdTO ; //!< SFD timeout value (in symbols) |
| | | } __attribute__ ((packed)) dwt_config_t ; |
| | | #pragma pack() |
| | | |
| | | |
| | | typedef struct |
| | | { |
| | | uint8 PGdly; |
| | | //TX POWER |
| | | //31:24 BOOST_0.125ms_PWR |
| | | //23:16 BOOST_0.25ms_PWR-TX_SHR_PWR |
| | | //15:8 BOOST_0.5ms_PWR-TX_PHR_PWR |
| | | //7:0 DEFAULT_PWR-TX_DATA_PWR |
| | | uint32 power; |
| | | uint8_t PGdly; |
| | | //TX POWER |
| | | //31:24 BOOST_0.125ms_PWR |
| | | //23:16 BOOST_0.25ms_PWR-TX_SHR_PWR |
| | | //15:8 BOOST_0.5ms_PWR-TX_PHR_PWR |
| | | //7:0 DEFAULT_PWR-TX_DATA_PWR |
| | | uint32_t power; |
| | | } |
| | | dwt_txconfig_t ; |
| | | |
| | |
| | | typedef struct |
| | | { |
| | | |
| | | uint16 maxNoise ; // LDE max value of noise |
| | | uint16 firstPathAmp1 ; // Amplitude at floor(index FP) + 1 |
| | | uint16 stdNoise ; // Standard deviation of noise |
| | | uint16 firstPathAmp2 ; // Amplitude at floor(index FP) + 2 |
| | | uint16 firstPathAmp3 ; // Amplitude at floor(index FP) + 3 |
| | | uint16 maxGrowthCIR ; // Channel Impulse Response max growth CIR |
| | | uint16 rxPreamCount ; // Count of preamble symbols accumulated |
| | | //uint32 debug1; |
| | | //uint32 debug2; |
| | | uint16 firstPath ; // First path index (10.6 bits fixed point integer) |
| | | }dwt_rxdiag_t ; |
| | | uint16_t maxNoise ; // LDE max value of noise |
| | | uint16_t firstPathAmp1 ; // Amplitude at floor(index FP) + 1 |
| | | uint16_t stdNoise ; // Standard deviation of noise |
| | | uint16_t firstPathAmp2 ; // Amplitude at floor(index FP) + 2 |
| | | uint16_t firstPathAmp3 ; // Amplitude at floor(index FP) + 3 |
| | | uint16_t maxGrowthCIR ; // Channel Impulse Response max growth CIR |
| | | uint16_t rxPreamCount ; // Count of preamble symbols accumulated |
| | | //uint32_t debug1; |
| | | //uint32_t debug2; |
| | | uint16_t firstPath ; // First path index (10.6 bits fixed point integer) |
| | | } dwt_rxdiag_t ; |
| | | |
| | | |
| | | typedef struct |
| | | { |
| | | //all of the below are mapped to a 12-bit register in DW1000 |
| | | uint16 PHE ; //number of received header errors |
| | | uint16 RSL ; //number of received frame sync loss events |
| | | uint16 CRCG ; //number of good CRC received frames |
| | | uint16 CRCB ; //number of bad CRC (CRC error) received frames |
| | | uint16 ARFE ; //number of address filter errors |
| | | uint16 OVER ; //number of receiver overflows (used in double buffer mode) |
| | | uint16 SFDTO ; //SFD timeouts |
| | | uint16 PTO ; //Preamble timeouts |
| | | uint16 RTO ; //RX frame wait timeouts |
| | | uint16 TXF ; //number of transmitted frames |
| | | uint16 HPW ; //half period warn |
| | | uint16 TXW ; //power up warn |
| | | //all of the below are mapped to a 12-bit register in DW1000 |
| | | uint16_t PHE ; //number of received header errors |
| | | uint16_t RSL ; //number of received frame sync loss events |
| | | uint16_t CRCG ; //number of good CRC received frames |
| | | uint16_t CRCB ; //number of bad CRC (CRC error) received frames |
| | | uint16_t ARFE ; //number of address filter errors |
| | | uint16_t OVER ; //number of receiver overflows (used in double buffer mode) |
| | | uint16_t SFDTO ; //SFD timeouts |
| | | uint16_t PTO ; //Preamble timeouts |
| | | uint16_t RTO ; //RX frame wait timeouts |
| | | uint16_t TXF ; //number of transmitted frames |
| | | uint16_t HPW ; //half period warn |
| | | uint16_t TXW ; //power up warn |
| | | |
| | | } dwt_deviceentcnts_t ; |
| | | |
| | |
| | | * |
| | | * returns the 32 bit part ID value as programmed in the factory |
| | | */ |
| | | uint32 dwt_getpartid(void); |
| | | uint32_t dwt_getpartid(void); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_getlotid() |
| | |
| | | * |
| | | * returns the 32 bit lot ID value as programmed in the factory |
| | | */ |
| | | uint32 dwt_getlotid(void); |
| | | uint32_t dwt_getlotid(void); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_readdevid() |
| | |
| | | * |
| | | * returns the read value which for DW1000 is 0xDECA0130 |
| | | */ |
| | | uint32 dwt_readdevid(void); |
| | | uint32_t dwt_readdevid(void); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_otprevision() |
| | |
| | | * |
| | | * returns the read OTP revision value |
| | | */ |
| | | uint8 dwt_otprevision(void); |
| | | uint8_t dwt_otprevision(void); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_setGPIOforEXTTRX() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_setGPIOdirection(uint32 gpioNum, uint32 direction); |
| | | void dwt_setGPIOdirection(uint32_t gpioNum, uint32_t direction); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_setGPIOvalue() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_setGPIOvalue(uint32 gpioNum, uint32 value); |
| | | void dwt_setGPIOvalue(uint32_t gpioNum, uint32_t value); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_initialise() |
| | |
| | | * |
| | | * returns DWT_SUCCESS for success, or DWT_ERROR for error |
| | | */ |
| | | int dwt_initialise(uint16 config) ; |
| | | int dwt_initialise(uint16_t config) ; |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_configure() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_setrxantennadelay(uint16 antennaDly); |
| | | void dwt_setrxantennadelay(uint16_t antennaDly); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_settxantennadelay() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_settxantennadelay(uint16 antennaDly); |
| | | void dwt_settxantennadelay(uint16_t antennaDly); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_setsmarttxpower() |
| | |
| | | * |
| | | * returns DWT_SUCCESS for success, or DWT_ERROR for error |
| | | */ |
| | | int dwt_writetxdata(uint16 txFrameLength, uint8 *txFrameBytes, uint16 txBufferOffset) ; |
| | | int dwt_writetxdata(uint16_t txFrameLength, uint8_t *txFrameBytes, uint16_t txBufferOffset) ; |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_writetxfctrl() |
| | |
| | | * |
| | | * returns DWT_SUCCESS for success, or DWT_ERROR for error |
| | | */ |
| | | int dwt_writetxfctrl(uint16 txFrameLength, uint16 txBufferOffset) ; |
| | | int dwt_writetxfctrl(uint16_t txFrameLength, uint16_t txBufferOffset) ; |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_starttx() |
| | |
| | | * |
| | | * returns DWT_SUCCESS for success, or DWT_ERROR for error (e.g. a delayed transmission will fail if the delayed time has passed) |
| | | */ |
| | | int dwt_starttx(uint8 mode) ; |
| | | int dwt_starttx(uint8_t mode) ; |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_setdelayedtrxtime() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_setdelayedtrxtime(uint32 starttime) ; |
| | | void dwt_setdelayedtrxtime(uint32_t starttime) ; |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_readtxtimestamp() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_readtxtimestamp(uint8 * timestamp); |
| | | void dwt_readtxtimestamp(uint8_t *timestamp); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_readtxtimestamphi32() |
| | |
| | | * |
| | | * returns high 32-bits of TX timestamp |
| | | */ |
| | | uint32 dwt_readtxtimestamphi32(void); |
| | | uint32_t dwt_readtxtimestamphi32(void); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_readtxtimestamplo32() |
| | |
| | | * |
| | | * returns low 32-bits of TX timestamp |
| | | */ |
| | | uint32 dwt_readtxtimestamplo32(void); |
| | | uint32_t dwt_readtxtimestamplo32(void); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_readrxtimestamp() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_readrxtimestamp(uint8 * timestamp); |
| | | void dwt_readrxtimestamp(uint8_t *timestamp); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_readrxtimestamphi32() |
| | |
| | | * |
| | | * returns high 32-bits of RX timestamp |
| | | */ |
| | | uint32 dwt_readrxtimestamphi32(void); |
| | | uint32_t dwt_readrxtimestamphi32(void); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_readrxtimestamplo32() |
| | |
| | | * |
| | | * returns low 32-bits of RX timestamp |
| | | */ |
| | | uint32 dwt_readrxtimestamplo32(void); |
| | | uint32_t dwt_readrxtimestamplo32(void); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_readsystimestamphi32() |
| | |
| | | * |
| | | * returns high 32-bits of system time timestamp |
| | | */ |
| | | uint32 dwt_readsystimestamphi32(void); |
| | | uint32_t dwt_readsystimestamphi32(void); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_readsystime() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_readsystime(uint8 * timestamp); |
| | | void dwt_readsystime(uint8_t *timestamp); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_checkoverrun() |
| | |
| | | #define DWT_RX_NORMAL (0x0) |
| | | #define DWT_RX_SNIFF (0x1) |
| | | |
| | | void dwt_setrxmode(int mode, uint8 rxON, uint8 rxOFF); |
| | | void dwt_setrxmode(int mode, uint8_t rxON, uint8_t rxOFF); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_setautorxreenable() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_setrxtimeout(uint16 time); |
| | | void dwt_setrxtimeout(uint16_t time); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_setpreambledetecttimeout() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_setpreambledetecttimeout(uint16 timeout); |
| | | void dwt_setpreambledetecttimeout(uint16_t timeout); |
| | | |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | |
| | | * |
| | | * returns the number of XTAL/2 cycles per low-power oscillator cycle. LP OSC frequency = 19.2 MHz/return value |
| | | */ |
| | | uint16 dwt_calibratesleepcnt(void); |
| | | uint16_t dwt_calibratesleepcnt(void); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_configuresleepcnt() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_configuresleepcnt(uint16 sleepcnt); |
| | | void dwt_configuresleepcnt(uint16_t sleepcnt); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_configuresleep() |
| | | * |
| | | * @brief configures the device for both DEEP_SLEEP and SLEEP modes, and on-wake mode |
| | | * i.e. before entering the sleep, the device should be programmed for TX or RX, then upon "waking up" the TX/RX settings |
| | | * will be preserved and the device can immediately perform the desired action TX/RX |
| | | * |
| | | * NOTE: e.g. Tag operation - after deep sleep, the device needs to just load the TX buffer and send the frame |
| | | * |
| | | * |
| | | * mode: the array and LDE code (OTP/ROM) and LDO tune, and set sleep persist |
| | | * DWT_PRESRV_SLEEP 0x0100 - preserve sleep |
| | | * DWT_LOADOPSET 0x0080 - load operating parameter set on wakeup |
| | | * DWT_CONFIG 0x0040 - download the AON array into the HIF (configuration download) |
| | | * DWT_LOADEUI 0x0008 |
| | | * DWT_GOTORX 0x0002 |
| | | * DWT_TANDV 0x0001 |
| | | * |
| | | * wake: wake up parameters |
| | | * DWT_XTAL_EN 0x10 - keep XTAL running during sleep |
| | | * DWT_WAKE_SLPCNT 0x8 - wake up after sleep count |
| | | * DWT_WAKE_CS 0x4 - wake up on chip select |
| | | * DWT_WAKE_WK 0x2 - wake up on WAKEUP PIN |
| | | * DWT_SLP_EN 0x1 - enable sleep/deep sleep functionality |
| | | * |
| | | * input parameters |
| | | * @param mode - config on-wake parameters |
| | | * @param wake - config wake up parameters |
| | | * |
| | | * output parameters |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_configuresleep(uint16 mode, uint8 wake); |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_configuresleep() |
| | | * |
| | | * @brief configures the device for both DEEP_SLEEP and SLEEP modes, and on-wake mode |
| | | * i.e. before entering the sleep, the device should be programmed for TX or RX, then upon "waking up" the TX/RX settings |
| | | * will be preserved and the device can immediately perform the desired action TX/RX |
| | | * |
| | | * NOTE: e.g. Tag operation - after deep sleep, the device needs to just load the TX buffer and send the frame |
| | | * |
| | | * |
| | | * mode: the array and LDE code (OTP/ROM) and LDO tune, and set sleep persist |
| | | * DWT_PRESRV_SLEEP 0x0100 - preserve sleep |
| | | * DWT_LOADOPSET 0x0080 - load operating parameter set on wakeup |
| | | * DWT_CONFIG 0x0040 - download the AON array into the HIF (configuration download) |
| | | * DWT_LOADEUI 0x0008 |
| | | * DWT_GOTORX 0x0002 |
| | | * DWT_TANDV 0x0001 |
| | | * |
| | | * wake: wake up parameters |
| | | * DWT_XTAL_EN 0x10 - keep XTAL running during sleep |
| | | * DWT_WAKE_SLPCNT 0x8 - wake up after sleep count |
| | | * DWT_WAKE_CS 0x4 - wake up on chip select |
| | | * DWT_WAKE_WK 0x2 - wake up on WAKEUP PIN |
| | | * DWT_SLP_EN 0x1 - enable sleep/deep sleep functionality |
| | | * |
| | | * input parameters |
| | | * @param mode - config on-wake parameters |
| | | * @param wake - config wake up parameters |
| | | * |
| | | * output parameters |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_configuresleep(uint16_t mode, uint8_t wake); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_entersleep() |
| | |
| | | * |
| | | * returns DWT_SUCCESS for success, or DWT_ERROR for error |
| | | */ |
| | | int dwt_spicswakeup(uint8 *buff, uint16 length); |
| | | int dwt_spicswakeup(uint8_t *buff, uint16_t length); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_setcallbacks() |
| | |
| | | * |
| | | * return value is 1 if the IRQS bit is set and 0 otherwise |
| | | */ |
| | | uint8 dwt_checkIRQ(void); |
| | | uint8_t dwt_checkIRQ(void); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_isr() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_setinterrupt( uint32 bitmask, uint8 enable); |
| | | void dwt_setinterrupt( uint32_t bitmask, uint8_t enable); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_setpanid() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_setpanid(uint16 panID); |
| | | void dwt_setpanid(uint16_t panID); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_setaddress16() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_setaddress16(uint16 shortAddress); |
| | | void dwt_setaddress16(uint16_t shortAddress); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_seteui() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_seteui(uint8 *eui64); |
| | | void dwt_seteui(uint8_t *eui64); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_geteui() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_geteui(uint8 *eui64); |
| | | void dwt_geteui(uint8_t *eui64); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_otpread() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_otpread(uint32 address, uint32 *array, uint8 length); |
| | | void dwt_otpread(uint32_t address, uint32_t *array, uint8_t length); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_enableframefilter() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_enableframefilter(uint16 bitmask); |
| | | void dwt_enableframefilter(uint16_t bitmask); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_enableautoack() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_enableautoack(uint8 responseDelayTime); |
| | | void dwt_enableautoack(uint8_t responseDelayTime); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_setrxaftertxdelay() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_setrxaftertxdelay(uint32 rxDelayTime); |
| | | void dwt_setrxaftertxdelay(uint32_t rxDelayTime); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_rxreset() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_readrxdata(uint8 *buffer, uint16 length, uint16 rxBufferOffset); |
| | | void dwt_readrxdata(uint8_t *buffer, uint16_t length, uint16_t rxBufferOffset); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_readaccdata() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_readaccdata(uint8 *buffer, uint16 length, uint16 rxBufferOffset); |
| | | void dwt_readaccdata(uint8_t *buffer, uint16_t length, uint16_t rxBufferOffset); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_readdiagnostics() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_readdiagnostics(dwt_rxdiag_t * diagnostics); |
| | | void dwt_readdiagnostics(dwt_rxdiag_t *diagnostics); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_loadopsettabfromotp() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_loadopsettabfromotp(uint8 gtab_sel); |
| | | void dwt_loadopsettabfromotp(uint8_t gtab_sel); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_configeventcounters() |
| | |
| | | * |
| | | * returns DWT_SUCCESS for success, or DWT_ERROR for error |
| | | */ |
| | | uint32 dwt_otpwriteandverify(uint32 value, uint16 address); |
| | | uint32_t dwt_otpwriteandverify(uint32_t value, uint16_t address); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_setleds() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_setleds(uint8 test); |
| | | void dwt_setleds(uint8_t test); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_xtaltrim() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_xtaltrim(uint8 value); |
| | | void dwt_xtaltrim(uint8_t value); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_configcwmode() |
| | |
| | | * |
| | | * returns DWT_SUCCESS for success, or DWT_ERROR for error |
| | | */ |
| | | int dwt_configcwmode(uint8 chan); |
| | | int dwt_configcwmode(uint8_t chan); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_configcontinuousframemode() |
| | |
| | | * |
| | | * no return value |
| | | */ |
| | | void dwt_configcontinuousframemode(uint32 framerepetitionrate); |
| | | void dwt_configcontinuousframemode(uint32_t framerepetitionrate); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_readtempvbat() |
| | |
| | | * |
| | | * returns (temp_raw<<8)|(vbat_raw) |
| | | */ |
| | | uint16 dwt_readtempvbat(uint8 fastSPI); |
| | | uint16_t dwt_readtempvbat(uint8_t fastSPI); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_readwakeuptemp() |
| | |
| | | * |
| | | * returns: 8-bit raw temperature sensor value |
| | | */ |
| | | uint8 dwt_readwakeuptemp(void) ; |
| | | uint8_t dwt_readwakeuptemp(void) ; |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_readwakeupvbat() |
| | |
| | | * |
| | | * returns: 8-bit raw battery voltage sensor value |
| | | */ |
| | | uint8 dwt_readwakeupvbat(void) ; |
| | | uint8_t dwt_readwakeupvbat(void) ; |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_writetodevice() |
| | |
| | | */ |
| | | int dwt_writetodevice // returns 0 for success, or, -1 for error. |
| | | ( |
| | | uint16 recordNumber, // input parameter - ID of register file or buffer being accessed |
| | | uint16 index, // input parameter - byte index into register file or buffer being accessed |
| | | uint32 length, // input parameter - number of bytes being written |
| | | const uint8 *buffer // input parameter - pointer to buffer containing the 'length' bytes to be written |
| | | uint16_t recordNumber, // input parameter - ID of register file or buffer being accessed |
| | | uint16_t index, // input parameter - byte index into register file or buffer being accessed |
| | | uint32_t length, // input parameter - number of bytes being written |
| | | const uint8_t *buffer // input parameter - pointer to buffer containing the 'length' bytes to be written |
| | | ) ; |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | |
| | | */ |
| | | int dwt_readfromdevice // returns offset where requested data begins in supplied buffer, or, -1 for error. |
| | | ( |
| | | uint16 recordNumber, // input parameter - ID of register file or buffer being accessed |
| | | uint16 index, // input parameter - byte index into register file or buffer being accessed |
| | | uint32 length, // input parameter - number of bytes being read |
| | | uint8 *buffer // input parameter - pointer to buffer in which to return the read data. |
| | | uint16_t recordNumber, // input parameter - ID of register file or buffer being accessed |
| | | uint16_t index, // input parameter - byte index into register file or buffer being accessed |
| | | uint32_t length, // input parameter - number of bytes being read |
| | | uint8_t *buffer // input parameter - pointer to buffer in which to return the read data. |
| | | ) ; |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | |
| | | * |
| | | * returns 32 bit register value (success), or DWT_ERROR for error |
| | | */ |
| | | uint32 dwt_read32bitoffsetreg(int regFileID, int regOffset) ; |
| | | uint32_t dwt_read32bitoffsetreg(int regFileID, int regOffset) ; |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_write32bitoffsetreg() |
| | |
| | | * |
| | | * returns DWT_SUCCESS for success, or DWT_ERROR for error |
| | | */ |
| | | int dwt_write32bitoffsetreg(int regFileID, int regOffset, uint32 regval); |
| | | int dwt_write32bitoffsetreg(int regFileID, int regOffset, uint32_t regval); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_read16bitoffsetreg() |
| | |
| | | * |
| | | * returns 16 bit register value (success), or DWT_ERROR for error |
| | | */ |
| | | uint16 dwt_read16bitoffsetreg(int regFileID, int regOffset); |
| | | uint16_t dwt_read16bitoffsetreg(int regFileID, int regOffset); |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * @fn dwt_write16bitoffsetreg() |
| | |
| | | * |
| | | * returns DWT_SUCCESS for success, or DWT_ERROR for error |
| | | */ |
| | | int dwt_write16bitoffsetreg(int regFileID, int regOffset, uint16 regval) ; |
| | | int dwt_write16bitoffsetreg(int regFileID, int regOffset, uint16_t regval) ; |
| | | |
| | | #define dwt_write32bitreg(x,y) dwt_write32bitoffsetreg(x,0,y) |
| | | #define dwt_read32bitreg(x) dwt_read32bitoffsetreg(x,0) |
| | |
| | | */ |
| | | extern int writetospi // returns 0 for success, or, -1 for error. |
| | | ( |
| | | uint16 headerLength, // input parameter - number of bytes header being written |
| | | const uint8 *headerBuffer, // input parameter - pointer to buffer containing the 'headerLength' bytes of header to be written |
| | | uint32 bodylength, // input parameter - number of bytes data being written |
| | | const uint8 *bodyBuffer // input parameter - pointer to buffer containing the 'bodylength' bytes od data to be written |
| | | uint16_t headerLength, // input parameter - number of bytes header being written |
| | | const uint8_t *headerBuffer, // input parameter - pointer to buffer containing the 'headerLength' bytes of header to be written |
| | | uint32_t bodylength, // input parameter - number of bytes data being written |
| | | const uint8_t *bodyBuffer // input parameter - pointer to buffer containing the 'bodylength' bytes od data to be written |
| | | ) ; |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | |
| | | */ |
| | | extern int readfromspi // returns offset where requested data begins in supplied buffer, or, -1 for error. |
| | | ( |
| | | uint16 headerLength, // input parameter - number of bytes header to write |
| | | const uint8 *headerBuffer, // input parameter - pointer to buffer containing the 'headerLength' bytes of header to write |
| | | uint32 readlength, // input parameter - number of bytes data being read |
| | | uint8 *readBuffer // input parameter - pointer to buffer containing to return the data (NB: size required = headerLength + readlength) |
| | | uint16_t headerLength, // input parameter - number of bytes header to write |
| | | const uint8_t *headerBuffer, // input parameter - pointer to buffer containing the 'headerLength' bytes of header to write |
| | | uint32_t readlength, // input parameter - number of bytes data being read |
| | | uint8_t *readBuffer // input parameter - pointer to buffer containing to return the data (NB: size required = headerLength + readlength) |
| | | ) ; |
| | | |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | |
| | | * |
| | | * returns correction needed in meters |
| | | */ |
| | | double dwt_getrangebias(uint8 chan, float range, uint8 prf); |
| | | double dwt_getrangebias(uint8_t chan, float range, uint8_t prf); |
| | | |
| | | |
| | | // --------------------------------------------------------------------------- |