Struct dw1000::hl::DW1000[][src]

pub struct DW1000<SPI, CS, State> { /* fields omitted */ }
Expand description

Entry point to the DW1000 driver API

Implementations

Returns the TX antenna delay

Returns the RX antenna delay

Returns the network id and address used for sending and receiving

Returns the current system time

Provides direct access to the register-level API

Be aware that by using the register-level API, you can invalidate various assumptions that the high-level API makes about the operation of the DW1000. Don’t use the register-level and high-level APIs in tandem, unless you know what you’re doing.

Sets the RX and TX antenna delays

Sets the network id and address used for sending and receiving

Sets up the sync pin functionality

After init, it is set to None

Set the polarity of the interrupt pin.

The default is ActiveHigh, which is also recommended for power savings.

Send an IEEE 802.15.4 MAC frame

The data argument is wrapped into an IEEE 802.15.4 MAC frame and sent to destination.

This operation can be delayed to aid in distance measurement, by setting delayed_time to Some(instant). If you want to send the frame as soon as possible, just pass None instead.

The config parameter struct allows for setting the channel, bitrate, and more. This configuration needs to be the same as the configuration used by the receiver, or the message may not be received. The defaults are a sane starting point.

This method starts the transmission and returns immediately thereafter. It consumes this instance of DW1000 and returns another instance which is in the Sending state, and can be used to wait for the transmission to finish and check its result.

Attempt to receive a single IEEE 802.15.4 MAC frame

Initializes the receiver. The method consumes this instance of DW1000 and returns another instance which is in the SingleBufferReceiving state, and can be used to wait for a message.

The config parameter allows for the configuration of bitrate, channel and more. Make sure that the values used are the same as of the frames that are transmitted. The default works with the TxConfig’s default and is a sane starting point.

Attempt to receive many IEEE 802.15.4 MAC frames. This is done in double buffered mode and auto re-enable. This means that once a message has been received, the radio will switch receive buffer and continue receiving.

If the double buffer is full while another message comes in, then the buffers will be corrupted. In that case, you will get the radio back in the Ready state and have to manually call this function again.

Initializes the receiver. The method consumes this instance of DW1000 and returns another instance which is in the AutoDoubleBufferReceiving state, and can be used to wait for a message.

The config parameter allows for the configuration of bitrate, channel and more. Make sure that the values used are the same as of the frames that are transmitted. The default works with the TxConfig’s default and is a sane starting point.

Enables transmit interrupts for the events that wait checks

Overwrites any interrupt flags that were previously set.

Enables receive interrupts for the events that wait checks

Overwrites any interrupt flags that were previously set.

Disables all interrupts

Configures the gpio pins to operate as LED output.

  • Note: This means that the function of the gpio pins change
  • Note: Both the kilohertz and debounce clock will be turned on or off

  • RXOKLED will change GPIO0
  • SFDLED will change GPIO1
  • RXLED will change GPIO2
  • TXLED will change GPIO3

blink_time is in units of 14 ms

Puts the dw1000 into sleep mode.

  • irq_on_wakeup: When set to true, the IRQ pin will be asserted when the radio wakes up
  • sleep_duration: When None, the radio will not wake up by itself and go into the deep sleep mode. When Some, then the radio will wake itself up after the given time. Every tick is ~431ms, but there may be a significant deviation from this due to the chip’s manufacturing process.

Note: The SPI speed may be at most 3 Mhz when calling this function.

Wait for receive operation to finish

This method returns an nb::Result to indicate whether the transmission has finished, or whether it is still ongoing. You can use this to busily wait for the transmission to finish, for example using nb’s block! macro, or you can use it in tandem with DW1000::enable_rx_interrupts and the DW1000 IRQ output to wait in a more energy-efficient manner.

Handling the DW1000’s IRQ output line is out of the scope of this driver, but please note that if you’re using the DWM1001 module or DWM1001-Dev board, that the dwm1001 crate has explicit support for this.

Reads the quality of the received message.

This must be called after the DW1000::wait_receive function has successfully returned.

Gets the external sync values from the registers.

The tuple contains (cycles_since_sync, nanos_until_tick, raw_timestamp). See the user manual at 6.1.3 to see how to calculate the actual time value. In the manual, the return values are named (N, T1, RX_RAWST) This is left to the user so the precision of the calculations are left to the user to decide.

Finishes receiving and returns to the Ready state

If the receive operation has finished, as indicated by wait, this is a no-op. If the receive operation is still ongoing, it will be aborted.

Try to continue receiving

Wait for the transmission to finish

This method returns an nb::Result to indicate whether the transmission has finished, or whether it is still ongoing. You can use this to busily wait for the transmission to finish, for example using nb’s block! macro, or you can use it in tandem with DW1000::enable_tx_interrupts and the DW1000 IRQ output to wait in a more energy-efficient manner.

Handling the DW1000’s IRQ output line is out of the scope of this driver, but please note that if you’re using the DWM1001 module or DWM1001-Dev board, that the dwm1001 crate has explicit support for this.

Finishes sending and returns to the Ready state

If the send operation has finished, as indicated by wait, this is a no-op. If the send operation is still ongoing, it will be aborted.

Wakes the radio up.

Create a new instance of DW1000

Requires the SPI peripheral and the chip select pin that are connected to the DW1000.

Initialize the DW1000

The DW1000’s default configuration is somewhat inconsistent, and the user manual (section 2.5.5) has a long list of default configuration values that should be changed to guarantee everything works correctly. This method does just that.

Please note that this method assumes that you kept the default configuration. It is generally recommended not to change configuration before calling this method.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Casts the value.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Casts the value.

Casts the value.

Casts the value.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Casts the value.

OverflowingCasts the value.

Should always be Self

Casts the value.

Casts the value.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Casts the value.

UnwrappedCasts the value.

Casts the value.

WrappingCasts the value.