Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
dw1000_range_arduino.c File Reference

Copyright (C) 2026 Fabien-B fabie.nosp@m.n-b@.nosp@m.githu.nosp@m.b.co.nosp@m.m This file is part of paparazzi. More...

#include "modules/decawave/dw1000_range_arduino.h"
#include "std.h"
#include "mcu_periph/uart.h"
#include "modules/core/abi.h"
#include "modules/core/abi_sender_ids.h"
#include "modules/decawave/trilateration.h"
#include "generated/airframe.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+ Include dependency graph for dw1000_range_arduino.c:

Go to the source code of this file.

Data Structures

struct  DW1000RangeArduino
 DW1000 Arduino range parser state. More...
 

Macros

#define DW_STX   0xFE
 frame sync byte
 
#define DW_WAIT_STX   0
 Parsing states.
 
#define DW_GET_DATA   1
 
#define DW_GET_CK   2
 
#define DW_NB_DATA   6
 

Functions

static float float_from_buf (uint8_t *b)
 Utility function to get float from buffer.
 
static uint16_t uint16_from_buf (uint8_t *b)
 Utility function to get uint16_t from buffer.
 
static void send_anchor_data (struct DW1000RangeArduino *dw)
 Send range data decoded from the serial frame.
 
static void dw1000_range_arduino_parse (struct DW1000RangeArduino *dw, uint8_t c)
 Data parsing function.
 
void dw1000_range_arduino_init (void)
 
void dw1000_range_arduino_event (void)
 

Variables

struct DW1000RangeArduino dw1000_range_arduino
 

Detailed Description

Copyright (C) 2026 Fabien-B fabie.nosp@m.n-b@.nosp@m.githu.nosp@m.b.co.nosp@m.m This file is part of paparazzi.

See LICENCE file.

Author
Fabien-B fabie.nosp@m.n-b@.nosp@m.githu.nosp@m.b.co.nosp@m.m

Driver to get ranging data from Decawave DW1000 modules connected to Arduino Decawave DW1000 modules (http://www.decawave.com/products/dwm1000-module) are Ultra-Wide-Band devices that can be used for communication and ranging. Especially, using 3 modules as anchors can provide data for a localization system based on trilateration. The DW1000 is using a SPI connection, but an arduino-compatible board can be used with the library https://github.com/thotro/arduino-dw1000 to hyde the low level drivers and provide direct ranging informations.

Definition in file dw1000_range_arduino.c.


Data Structure Documentation

◆ DW1000RangeArduino

struct DW1000RangeArduino

DW1000 Arduino range parser state.

Definition at line 38 of file dw1000_range_arduino.c.

+ Collaboration diagram for DW1000RangeArduino:
Data Fields
uint8_t buf[DW_NB_DATA] incoming data buffer
uint8_t ck checksum
struct uart_periph * dev
uint8_t idx buffer index
uint8_t state parser state

Macro Definition Documentation

◆ DW_GET_CK

#define DW_GET_CK   2

Definition at line 34 of file dw1000_range_arduino.c.

◆ DW_GET_DATA

#define DW_GET_DATA   1

Definition at line 33 of file dw1000_range_arduino.c.

◆ DW_NB_DATA

#define DW_NB_DATA   6

Definition at line 35 of file dw1000_range_arduino.c.

◆ DW_STX

#define DW_STX   0xFE

frame sync byte

Definition at line 29 of file dw1000_range_arduino.c.

◆ DW_WAIT_STX

#define DW_WAIT_STX   0

Parsing states.

Definition at line 32 of file dw1000_range_arduino.c.

Function Documentation

◆ dw1000_range_arduino_event()

void dw1000_range_arduino_event ( void  )

Definition at line 114 of file dw1000_range_arduino.c.

References DW1000RangeArduino::dev, dw1000_range_arduino, dw1000_range_arduino_parse(), foo, uart_char_available(), and uart_getch().

+ Here is the call graph for this function:

◆ dw1000_range_arduino_init()

void dw1000_range_arduino_init ( void  )

Definition at line 109 of file dw1000_range_arduino.c.

References DW1000RangeArduino::dev, dw1000_range_arduino, and foo.

◆ dw1000_range_arduino_parse()

static void dw1000_range_arduino_parse ( struct DW1000RangeArduino dw,
uint8_t  c 
)
static

Data parsing function.

Definition at line 74 of file dw1000_range_arduino.c.

References DW_GET_CK, DW_GET_DATA, DW_NB_DATA, DW_STX, DW_WAIT_STX, foo, and send_anchor_data().

Referenced by dw1000_range_arduino_event().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ float_from_buf()

static float float_from_buf ( uint8_t b)
inlinestatic

Utility function to get float from buffer.

Definition at line 50 of file dw1000_range_arduino.c.

References b, f, and foo.

Referenced by send_anchor_data().

+ Here is the caller graph for this function:

◆ send_anchor_data()

static void send_anchor_data ( struct DW1000RangeArduino dw)
static

Send range data decoded from the serial frame.

Definition at line 64 of file dw1000_range_arduino.c.

References float_from_buf(), foo, get_sys_time_usec(), uint16_from_buf(), UWB_DW1000_ARDUINO_ID, and UWB_POSITIONING_TAG_ID.

Referenced by dw1000_range_arduino_parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ uint16_from_buf()

static uint16_t uint16_from_buf ( uint8_t b)
inlinestatic

Utility function to get uint16_t from buffer.

Definition at line 57 of file dw1000_range_arduino.c.

References b, and foo.

Referenced by send_anchor_data().

+ Here is the caller graph for this function:

Variable Documentation

◆ dw1000_range_arduino

struct DW1000RangeArduino dw1000_range_arduino

Definition at line 46 of file dw1000_range_arduino.c.

Referenced by dw1000_range_arduino_event(), and dw1000_range_arduino_init().