Arduino driver library for Decawave DW1000

- Main Page
- Data Structures
- Files

- Data Structures
- Data Structure Index
- Data Fields

All Data Structures Files Functions Variables Macros
Static Public Member Functions | Static Public Attributes
DW1000Class Class Reference

`#include <DW1000.h>`

## Static Public Member Functions
static void | begin (int irq, int rst)
static void | begin (int irq)
static void | select (int ss)
static void | reselect (int ss)
static void | end ()
static void | reset ()
static void | softReset ()
static void | getPrintableDeviceIdentifier (char msgBuffer[])
static void | getPrintableExtendedUniqueIdentifier (char msgBuffer[])
static void | getPrintableNetworkIdAndShortAddress (char msgBuffer[])
static void | getPrintableDeviceMode (char msgBuffer[])
static void | setNetworkId (unsigned int val)
static void | setDeviceAddress (unsigned int val)
static void | setReceiverAutoReenable (boolean val)
static void | setInterruptPolarity (boolean val)
static void | suppressFrameCheck (boolean val)
static void | setDataRate (byte rate)
static void | setPulseFrequency (byte freq)
static void | setPreambleLength (byte prealen)
static void | setChannel (byte channel)
static void | setPreambleCode (byte preacode)
static DW1000Time | setDelay (const DW1000Time &delay)
static void | receivePermanently (boolean val)
static void | setData (byte data[], unsigned int n)
static void | setData (const String &data)
static void | getData (byte data[], unsigned int n)
static void | getData (String &data)
static unsigned int | getDataLength ()
static void | getTransmitTimestamp (DW1000Time &time)
static void | getReceiveTimestamp (DW1000Time &time)
static void | getSystemTimestamp (DW1000Time &time)
static void | getTransmitTimestamp (byte data[])
static void | getReceiveTimestamp (byte data[])
static void | getSystemTimestamp (byte data[])
static float | getReceivePower ()
static float | getFirstPathPower ()
static float | getNoiseValue ()
static void | interruptOnSent (boolean val)
static void | interruptOnReceived (boolean val)
static void | interruptOnReceiveFailed (boolean val)
static void | interruptOnReceiveTimeout (boolean val)
static void | interruptOnReceiveTimestampAvailable (boolean val)
static void | interruptOnAutomaticAcknowledgeTrigger (boolean val)
static void | attachErrorHandler (void(*handleError)(void))
static void | attachSentHandler (void(*handleSent)(void))
static void | attachReceivedHandler (void(*handleReceived)(void))
static void | attachReceiveFailedHandler (void(*handleReceiveFailed)(void))
static void | attachReceiveTimeoutHandler (void(*handleReceiveTimeout)(void))
static void | attachReceiveTimestampAvailableHandler (void(*handleReceiveTimestampAvailable)(void))
static void | idle ()
static void | newConfiguration ()
static void | commitConfiguration ()
static void | newReceive ()
static void | startReceive ()
static void | newTransmit ()
static void | startTransmit ()
static void | enableMode (const byte mode[])
static void | setDefaults ()
static void | getPrettyBytes (byte cmd, word offset, char msgBuffer[], unsigned int n)
static void | getPrettyBytes (byte data[], char msgBuffer[], unsigned int n)

## Static Public Attributes
static const byte | TRX_RATE_110KBPS = 0x00
static const byte | TRX_RATE_850KBPS = 0x01
static const byte | TRX_RATE_6800KBPS = 0x02
static const byte | TX_PULSE_FREQ_16MHZ = 0x01
static const byte | TX_PULSE_FREQ_64MHZ = 0x02
static const byte | TX_PREAMBLE_LEN_64 = 0x01
static const byte | TX_PREAMBLE_LEN_128 = 0x05
static const byte | TX_PREAMBLE_LEN_256 = 0x09
static const byte | TX_PREAMBLE_LEN_512 = 0x0D
static const byte | TX_PREAMBLE_LEN_1024 = 0x02
static const byte | TX_PREAMBLE_LEN_1536 = 0x06
static const byte | TX_PREAMBLE_LEN_2048 = 0x0A
static const byte | TX_PREAMBLE_LEN_4096 = 0x03
static const byte | PAC_SIZE_8 = 8
static const byte | PAC_SIZE_16 = 16
static const byte | PAC_SIZE_32 = 32
static const byte | PAC_SIZE_64 = 64
static const byte | CHANNEL_1 = 1
static const byte | CHANNEL_2 = 2
static const byte | CHANNEL_3 = 3
static const byte | CHANNEL_4 = 4
static const byte | CHANNEL_5 = 5
static const byte | CHANNEL_7 = 7
static const byte | PREAMBLE_CODE_16MHZ_1 = 1
static const byte | PREAMBLE_CODE_16MHZ_2 = 2
static const byte | PREAMBLE_CODE_16MHZ_3 = 3
static const byte | PREAMBLE_CODE_16MHZ_4 = 4
static const byte | PREAMBLE_CODE_16MHZ_5 = 5
static const byte | PREAMBLE_CODE_16MHZ_6 = 6
static const byte | PREAMBLE_CODE_16MHZ_7 = 7
static const byte | PREAMBLE_CODE_16MHZ_8 = 8
static const byte | PREAMBLE_CODE_64MHZ_9 = 9
static const byte | PREAMBLE_CODE_64MHZ_10 = 10
static const byte | PREAMBLE_CODE_64MHZ_11 = 11
static const byte | PREAMBLE_CODE_64MHZ_12 = 12
static const byte | PREAMBLE_CODE_64MHZ_17 = 17
static const byte | PREAMBLE_CODE_64MHZ_18 = 18
static const byte | PREAMBLE_CODE_64MHZ_19 = 19
static const byte | PREAMBLE_CODE_64MHZ_20 = 20
static const byte | FRAME_LENGTH_NORMAL = 0x00
static const byte | FRAME_LENGTH_EXTENDED = 0x03
static const byte | MODE_LONGDATA_RANGE_LOWPOWER [] = {TRX_RATE_110KBPS, TX_PULSE_FREQ_16MHZ, TX_PREAMBLE_LEN_1024}
static const byte | MODE_SHORTDATA_FAST_LOWPOWER [] = {TRX_RATE_6800KBPS, TX_PULSE_FREQ_16MHZ, TX_PREAMBLE_LEN_128}
static const byte | MODE_LONGDATA_FAST_LOWPOWER [] = {TRX_RATE_6800KBPS, TX_PULSE_FREQ_16MHZ, TX_PREAMBLE_LEN_1024}
static const byte | MODE_SHORTDATA_FAST_ACCURACY [] = {TRX_RATE_6800KBPS, TX_PULSE_FREQ_64MHZ, TX_PREAMBLE_LEN_128}
static const byte | MODE_LONGDATA_FAST_ACCURACY [] = {TRX_RATE_6800KBPS, TX_PULSE_FREQ_64MHZ, TX_PREAMBLE_LEN_1024}
static const byte | MODE_LONGDATA_RANGE_ACCURACY [] = {TRX_RATE_110KBPS, TX_PULSE_FREQ_64MHZ, TX_PREAMBLE_LEN_1024}

## Member Function Documentation

static void DW1000Class::attachErrorHandler | ( | void(*)(void) | handleError | ) |
| inline static

static void DW1000Class::attachReceivedHandler | ( | void(*)(void) | handleReceived | ) |
| inline static

static void DW1000Class::attachReceiveFailedHandler | ( | void(*)(void) | handleReceiveFailed | ) |
| inline static

static void DW1000Class::attachReceiveTimeoutHandler | ( | void(*)(void) | handleReceiveTimeout | ) |
| inline static

static void DW1000Class::attachReceiveTimestampAvailableHandler | ( | void(*)(void) | handleReceiveTimestampAvailable | ) |
| inline static

static void DW1000Class::attachSentHandler | ( | void(*)(void) | handleSent | ) |
| inline static

void DW1000Class::begin | ( | int | irq,
|  | int | rst
| ) |  |
| static

Initiates and starts a sessions with one or more DW1000.

Parameters

  [in] | irq | The interrupt line/pin that connects the Arduino.
  [in] | rst | The reset line/pin for hard resets of ICs that connect to the Arduino.

void DW1000Class::begin | ( | int | irq | ) |
| static

Initiates and starts a sessions with one or more DW1000. Soft resets (i.e. command triggered) are used and it is assumed that no reset line is wired.

Parameters

  [in] | irq | The interrupt line/pin that connects the Arduino.

void DW1000Class::commitConfiguration | ( |  | ) |
| static

void DW1000Class::enableMode | ( | const byte | mode[] | ) |
| static

Specifies the mode of operation for the DW1000. Modes of operation are pre-defined combinations of data rate, pulse repetition frequency, preamble and channel settings that properly go together. If you simply want the chips to work, choosing a mode is preferred over manual configuration.

The following modes are pre-configured and one of them needs to be chosen:

- `MODE_LONGDATA_RANGE_LOWPOWER` (basically this is 110 kb/s data rate, 16 MHz PRF and long preambles)
- `MODE_SHORTDATA_FAST_LOWPOWER` (basically this is 6.8 Mb/s data rate, 16 MHz PRF and short preambles)
- `MODE_LONGDATA_FAST_LOWPOWER` (basically this is 6.8 Mb/s data rate, 16 MHz PRF and long preambles)
- `MODE_SHORTDATA_FAST_ACCURACY` (basically this is 6.8 Mb/s data rate, 64 MHz PRF and short preambles)
- `MODE_LONGDATA_FAST_ACCURACY` (basically this is 6.8 Mb/s data rate, 64 MHz PRF and long preambles)
- `MODE_LONGDATA_RANGE_ACCURACY` (basically this is 110 kb/s data rate, 64 MHz PRF and long preambles)

Note that LOWPOWER and ACCURACY refers to the better power efficiency and improved transmission performance of 16 MHZ and 64 MHZ PRF respectively (see `setPulseFrequency()`).

The default setting that is selected by `setDefaults()` is MODE_LONGDATA_RANGE_LOWPOWER.

Parameters

  [in] | mode | The mode of operation, encoded by the above defined constants.

void DW1000Class::end | ( |  | ) |
| static

Tells the driver library that no communication to a DW1000 will be required anymore. This basically just frees SPI and the previously used pins.

void DW1000Class::getData | ( | byte | data[],
|  | unsigned int | n
| ) |  |
| static

void DW1000Class::getData | ( | String & | data | ) |
| static

unsigned int DW1000Class::getDataLength | ( |  | ) |
| static

float DW1000Class::getFirstPathPower | ( |  | ) |
| static

float DW1000Class::getNoiseValue | ( |  | ) |
| static

void DW1000Class::getPrettyBytes | ( | byte | cmd,
|  | word | offset,
|  | char | msgBuffer[],
|  | unsigned int | n
| ) |  |
| static

void DW1000Class::getPrettyBytes | ( | byte | data[],
|  | char | msgBuffer[],
|  | unsigned int | n
| ) |  |
| static

void DW1000Class::getPrintableDeviceIdentifier | ( | char | msgBuffer[] | ) |
| static

Generates a String representation of the device identifier of the chip. That usually are the letters "DECA" plus the version and revision numbers of the chip.

Parameters

  [out] | msgBuffer | The String buffer to be filled with printable device information. Provide 128 bytes, this should be sufficient.

void DW1000Class::getPrintableDeviceMode | ( | char | msgBuffer[] | ) |
| static

Generates a String representation of the main operational settings of the chip. This includes data rate, pulse repetition frequency, preamble and channel settings.

Parameters

  [out] | msgBuffer | The String buffer to be filled with printable device information. Provide 128 bytes, this should be sufficient.

void DW1000Class::getPrintableExtendedUniqueIdentifier | ( | char | msgBuffer[] | ) |
| static

Generates a String representation of the extended unique identifier (EUI) of the chip.

Parameters

  [out] | msgBuffer | The String buffer to be filled with printable device information. Provide 128 bytes, this should be sufficient.

void DW1000Class::getPrintableNetworkIdAndShortAddress | ( | char | msgBuffer[] | ) |
| static

Generates a String representation of the short address and network identifier currently defined for the respective chip.

Parameters

  [out] | msgBuffer | The String buffer to be filled with printable device information. Provide 128 bytes, this should be sufficient.

float DW1000Class::getReceivePower | ( |  | ) |
| static

void DW1000Class::getReceiveTimestamp | ( | DW1000Time & | time | ) |
| static

void DW1000Class::getReceiveTimestamp | ( | byte | data[] | ) |
| static

void DW1000Class::getSystemTimestamp | ( | DW1000Time & | time | ) |
| static

void DW1000Class::getSystemTimestamp | ( | byte | data[] | ) |
| static

void DW1000Class::getTransmitTimestamp | ( | DW1000Time & | time | ) |
| static

void DW1000Class::getTransmitTimestamp | ( | byte | data[] | ) |
| static

void DW1000Class::idle | ( |  | ) |
| static

void DW1000Class::interruptOnAutomaticAcknowledgeTrigger | ( | boolean | val | ) |
| static

void DW1000Class::interruptOnReceived | ( | boolean | val | ) |
| static

void DW1000Class::interruptOnReceiveFailed | ( | boolean | val | ) |
| static

void DW1000Class::interruptOnReceiveTimeout | ( | boolean | val | ) |
| static

void DW1000Class::interruptOnReceiveTimestampAvailable | ( | boolean | val | ) |
| static

void DW1000Class::interruptOnSent | ( | boolean | val | ) |
| static

void DW1000Class::newConfiguration | ( |  | ) |
| static

void DW1000Class::newReceive | ( |  | ) |
| static

void DW1000Class::newTransmit | ( |  | ) |
| static

void DW1000Class::receivePermanently | ( | boolean | val | ) |
| static

void DW1000Class::reselect | ( | int | ss | ) |
| static

(Re-)selects a specific DW1000 chip for communication. In case of a single DW1000 chip in use this call is not needed; only a call to `select()` has to be performed once at start up. Other than a call to `select()` this function does not perform an initial setup of the (again-)selected chips and assumes it to have a valid configuration loaded.

Parameters

  [in] | ss | The chip select line/pin that connects the to-be-selected chip with the Arduino.

void DW1000Class::reset | ( |  | ) |
| static

Resets all connected or the currently selected DW1000 chip. A hard reset of all chips is preferred, although a soft reset of the currently selected one is executed if no reset pin has been specified (when using `begin(int)`, instead of `begin(int, int)`).

void DW1000Class::select | ( | int | ss | ) |
| static

Selects a specific DW1000 chip for communication. In case of a single DW1000 chip in use this call only needs to be done once at start up, but is still mandatory. Other than a call to `reselect()` this function performs an initial setup of the now-selected chip.

Parameters

  [in] | ss | The chip select line/pin that connects the to-be-selected chip with the Arduino.

void DW1000Class::setChannel | ( | byte | channel | ) |
| static

void DW1000Class::setData | ( | byte | data[],
|  | unsigned int | n
| ) |  |
| static

void DW1000Class::setData | ( | const String & | data | ) |
| static

void DW1000Class::setDataRate | ( | byte | rate | ) |
| static

Specifies the data transmission rate of the DW1000 chip. One of the values

- `TRX_RATE_110KBPS` (i.e. 110 kb/s)
- `TRX_RATE_850KBPS` (i.e. 850 kb/s)
- `TRX_RATE_6800KBPS` (i.e. 6.8 Mb/s) has to be provided.

See `setDefaults()` and `enableMode()` for additional information on data rate settings.

Parameters

  [in] | rate | The data transmission rate, encoded by the above defined constants.

void DW1000Class::setDefaults | ( |  | ) |
| static

DW1000Time DW1000Class::setDelay | ( | const DW1000Time & | delay | ) |
| static

void DW1000Class::setDeviceAddress | ( | unsigned int | val | ) |
| static

(Re-)set the device address (i.e. short address) for the currently selected chip. This setting is important for certain MAC address filtering rules.

Parameters

  [in] | val | An arbitrary numeric device address.

void DW1000Class::setInterruptPolarity | ( | boolean | val | ) |
| static

Specifies the interrupt polarity of the DW1000 chip.

As part of `setDefaults()` if the device is in idle mode, interrupt polarity is set to active high.

Parameters

  [in] | val | `true` for active high interrupts, `false` for active low interrupts.

void DW1000Class::setNetworkId | ( | unsigned int | val | ) |
| static

(Re-)set the network identifier which the selected chip should be associated with. This setting is important for certain MAC address filtering rules.

Parameters

  [in] | val | An arbitrary numeric network identifier.

void DW1000Class::setPreambleCode | ( | byte | preacode | ) |
| static

void DW1000Class::setPreambleLength | ( | byte | prealen | ) |
| static

void DW1000Class::setPulseFrequency | ( | byte | freq | ) |
| static

Specifies the pulse repetition frequency (PRF) of data transmissions with the DW1000. Either

- `TX_PULSE_FREQ_16MHZ` (i.e. 16 MHz)
- `TX_PULSE_FREQ_64MHZ` (i.e. 64 MHz) has to be chosen.

Note that the 16 MHz setting is more power efficient, while the 64 MHz setting requires more power, but also delivers slightly better transmission performance (i.e. on communication range and timestamp accuracy) (see DWM1000 User Manual, section 9.3).

See `setDefaults()` and `enableMode()` for additional information on PRF settings.

Parameters

  [in] | freq | The PRF, encoded by the above defined constants.

void DW1000Class::setReceiverAutoReenable | ( | boolean | val | ) |
| static

Specifies whether the DW1000 chip should, again, turn on its receiver in case that the last reception failed.

This setting is enabled as part of `setDefaults()` if the device is in idle mode.

Parameters

  [in] | val | `true` to enable, `false` to disable receiver auto-reenable.

void DW1000Class::softReset | ( |  | ) |
| static

Resets the currently selected DW1000 chip programmatically (via corresponding commands).

void DW1000Class::startReceive | ( |  | ) |
| static

void DW1000Class::startTransmit | ( |  | ) |
| static

void DW1000Class::suppressFrameCheck | ( | boolean | val | ) |
| static

Specifies whether to suppress any frame check measures while sending or receiving messages. If suppressed, no 2-byte checksum is appended to the message before sending and this checksum is also not expected at receiver side. Note that when suppressing frame checks, the error event handler (attached via `attachReceiveErrorHandler()`) will not be triggered if received data is corrupted.

Frame checks are enabled as part of `setDefaults()` if the device is in idle mode.

Parameters

  [in] | val | `true` to suppress frame check on sender and receiver side, `false` otherwise.

## Field Documentation

const byte DW1000Class::CHANNEL_1 = 1
| static

const byte DW1000Class::CHANNEL_2 = 2
| static

const byte DW1000Class::CHANNEL_3 = 3
| static

const byte DW1000Class::CHANNEL_4 = 4
| static

const byte DW1000Class::CHANNEL_5 = 5
| static

const byte DW1000Class::CHANNEL_7 = 7
| static

const byte DW1000Class::FRAME_LENGTH_EXTENDED = 0x03
| static

const byte DW1000Class::FRAME_LENGTH_NORMAL = 0x00
| static

const byte DW1000Class::MODE_LONGDATA_FAST_ACCURACY = {TRX_RATE_6800KBPS, TX_PULSE_FREQ_64MHZ, TX_PREAMBLE_LEN_1024}
| static

const byte DW1000Class::MODE_LONGDATA_FAST_LOWPOWER = {TRX_RATE_6800KBPS, TX_PULSE_FREQ_16MHZ, TX_PREAMBLE_LEN_1024}
| static

const byte DW1000Class::MODE_LONGDATA_RANGE_ACCURACY = {TRX_RATE_110KBPS, TX_PULSE_FREQ_64MHZ, TX_PREAMBLE_LEN_1024}
| static

const byte DW1000Class::MODE_LONGDATA_RANGE_LOWPOWER = {TRX_RATE_110KBPS, TX_PULSE_FREQ_16MHZ, TX_PREAMBLE_LEN_1024}
| static

const byte DW1000Class::MODE_SHORTDATA_FAST_ACCURACY = {TRX_RATE_6800KBPS, TX_PULSE_FREQ_64MHZ, TX_PREAMBLE_LEN_128}
| static

const byte DW1000Class::MODE_SHORTDATA_FAST_LOWPOWER = {TRX_RATE_6800KBPS, TX_PULSE_FREQ_16MHZ, TX_PREAMBLE_LEN_128}
| static

const byte DW1000Class::PAC_SIZE_16 = 16
| static

const byte DW1000Class::PAC_SIZE_32 = 32
| static

const byte DW1000Class::PAC_SIZE_64 = 64
| static

const byte DW1000Class::PAC_SIZE_8 = 8
| static

const byte DW1000Class::PREAMBLE_CODE_16MHZ_1 = 1
| static

const byte DW1000Class::PREAMBLE_CODE_16MHZ_2 = 2
| static

const byte DW1000Class::PREAMBLE_CODE_16MHZ_3 = 3
| static

const byte DW1000Class::PREAMBLE_CODE_16MHZ_4 = 4
| static

const byte DW1000Class::PREAMBLE_CODE_16MHZ_5 = 5
| static

const byte DW1000Class::PREAMBLE_CODE_16MHZ_6 = 6
| static

const byte DW1000Class::PREAMBLE_CODE_16MHZ_7 = 7
| static

const byte DW1000Class::PREAMBLE_CODE_16MHZ_8 = 8
| static

const byte DW1000Class::PREAMBLE_CODE_64MHZ_10 = 10
| static

const byte DW1000Class::PREAMBLE_CODE_64MHZ_11 = 11
| static

const byte DW1000Class::PREAMBLE_CODE_64MHZ_12 = 12
| static

const byte DW1000Class::PREAMBLE_CODE_64MHZ_17 = 17
| static

const byte DW1000Class::PREAMBLE_CODE_64MHZ_18 = 18
| static

const byte DW1000Class::PREAMBLE_CODE_64MHZ_19 = 19
| static

const byte DW1000Class::PREAMBLE_CODE_64MHZ_20 = 20
| static

const byte DW1000Class::PREAMBLE_CODE_64MHZ_9 = 9
| static

const byte DW1000Class::TRX_RATE_110KBPS = 0x00
| static

const byte DW1000Class::TRX_RATE_6800KBPS = 0x02
| static

const byte DW1000Class::TRX_RATE_850KBPS = 0x01
| static

const byte DW1000Class::TX_PREAMBLE_LEN_1024 = 0x02
| static

const byte DW1000Class::TX_PREAMBLE_LEN_128 = 0x05
| static

const byte DW1000Class::TX_PREAMBLE_LEN_1536 = 0x06
| static

const byte DW1000Class::TX_PREAMBLE_LEN_2048 = 0x0A
| static

const byte DW1000Class::TX_PREAMBLE_LEN_256 = 0x09
| static

const byte DW1000Class::TX_PREAMBLE_LEN_4096 = 0x03
| static

const byte DW1000Class::TX_PREAMBLE_LEN_512 = 0x0D
| static

const byte DW1000Class::TX_PREAMBLE_LEN_64 = 0x01
| static

const byte DW1000Class::TX_PULSE_FREQ_16MHZ = 0x01
| static

const byte DW1000Class::TX_PULSE_FREQ_64MHZ = 0x02
| static

The documentation for this class was generated from the following files:

- /home/thomas/git/arduino-dw1000/src/DW1000.h
- /home/thomas/git/arduino-dw1000/src/DW1000.cpp