Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
pdec.c File Reference
#include "modules/decawave/pdec.h"
#include "mcu_periph/uart.h"
#include "modules/datalink/downlink.h"
#include "modules/core/abi.h"
#include "modules/core/abi_sender_ids.h"
#include <stdio.h>
#include <string.h>
Include dependency graph for pdec.c:

Go to the source code of this file.

Data Structures

struct  pdec_cmd_payload
struct  pdec_target_cmd_payload
struct  pdec_error_payload
struct  pdec_distance_payload
struct  pdec_device_list_payload
struct  pdec_send_data_result_payload
struct  pdec_ranging_event_payload
struct  pdec_tdoa_report_payload
struct  pdec_tdoa_report_event_payload

Macros

#define PDEC_SYNC_BYTE   0xff
#define PDEC_FRAME_OVERHEAD   4
#define PDEC_PACKED   __attribute__((packed))

Functions

static void _pdec_init (pdec_t *pdec)
static void _pdec_periodic_report (pdec_t *pdec)
static void _pdec_event (pdec_t *pdec)
static bool pdec_send_frame (pdec_t *pdec, const uint8_t *payload, uint8_t payload_len)
static void pdec_parse_distance_result (struct pdec_distance_result *result, const struct pdec_distance_payload *payload)
static void pdec_dispatch_frame (pdec_t *pdec)
static void pdec_parse_byte (pdec_t *pdec, uint8_t byte)
bool pdec_range (uint16_t dst_id)
bool pdec_get_distance (uint16_t dst_id)
bool pdec_list_devices (void)
bool pdec_send_data (uint16_t dst_id, const uint8_t *data, uint8_t len)
void pdec_init (void)
void pdec_periodic_report (void)
void pdec_event (void)
void uwb_range (uint16_t dst_id)

Variables

pdec_t pdec
struct pdec_cmd_payload PDEC_PACKED

Data Structure Documentation

◆ pdec_cmd_payload

struct pdec_cmd_payload

Definition at line 28 of file pdec.c.

Data Fields
uint8_t id

◆ pdec_target_cmd_payload

struct pdec_target_cmd_payload

Definition at line 32 of file pdec.c.

Data Fields
uint16_t dst_id
uint8_t id

◆ pdec_error_payload

struct pdec_error_payload

Definition at line 37 of file pdec.c.

Data Fields
uint8_t command
uint8_t id
uint8_t status

◆ pdec_distance_payload

struct pdec_distance_payload

Definition at line 43 of file pdec.c.

Data Fields
float distance
uint16_t dst_id
uint8_t id
uint8_t status

◆ pdec_device_list_payload

struct pdec_device_list_payload

Definition at line 50 of file pdec.c.

Data Fields
uint8_t count
uint16_t device_ids[]
uint8_t id

◆ pdec_send_data_result_payload

struct pdec_send_data_result_payload

Definition at line 56 of file pdec.c.

Data Fields
uint16_t dst_id
uint8_t id
uint8_t sent_len
uint8_t status

◆ pdec_ranging_event_payload

struct pdec_ranging_event_payload

Definition at line 63 of file pdec.c.

Data Fields
float distance
uint16_t dst_id
uint8_t id
uint8_t kind
uint16_t src_id

◆ pdec_tdoa_report_payload

struct pdec_tdoa_report_payload

Definition at line 71 of file pdec.c.

Data Fields
float distance
uint16_t reporter_id

◆ pdec_tdoa_report_event_payload

struct pdec_tdoa_report_event_payload

Definition at line 76 of file pdec.c.

Collaboration diagram for pdec_tdoa_report_event_payload:
Data Fields
uint32_t blink_id
uint8_t count
uint8_t expected_count
uint8_t id
struct pdec_tdoa_report_payload reports[]
uint8_t timed_out

Macro Definition Documentation

◆ PDEC_FRAME_OVERHEAD

#define PDEC_FRAME_OVERHEAD   4

Definition at line 19 of file pdec.c.

Referenced by pdec_send_frame().

◆ PDEC_PACKED

struct pdec_tdoa_report_event_payload PDEC_PACKED   __attribute__((packed))

Definition at line 20 of file pdec.c.

◆ PDEC_SYNC_BYTE

#define PDEC_SYNC_BYTE   0xff

Definition at line 18 of file pdec.c.

Referenced by pdec_parse_byte(), and pdec_send_frame().

Function Documentation

◆ _pdec_event()

void _pdec_event ( pdec_t * pdec)
static

Definition at line 361 of file pdec.c.

References pdec, pdec_parse_byte(), uart_char_available(), and uart_getch().

Referenced by pdec_event().

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

◆ _pdec_init()

void _pdec_init ( pdec_t * pdec)
static

Definition at line 310 of file pdec.c.

References pdec, and PDEC_RX_SYNC_1.

Referenced by pdec_init().

Here is the caller graph for this function:

◆ _pdec_periodic_report()

void _pdec_periodic_report ( pdec_t * pdec)
static

Definition at line 317 of file pdec.c.

References DefaultChannel, DefaultDevice, offset, and pdec.

Referenced by pdec_periodic_report().

Here is the caller graph for this function:

◆ pdec_dispatch_frame()

◆ pdec_event()

void pdec_event ( void )

Definition at line 427 of file pdec.c.

References _pdec_event(), and pdec.

Here is the call graph for this function:

◆ pdec_get_distance()

bool pdec_get_distance ( uint16_t dst_id)

Definition at line 377 of file pdec.c.

References pdec_target_cmd_payload::dst_id, pdec, PDEC_CMD_GET_DISTANCE, and pdec_send_frame().

Here is the call graph for this function:

◆ pdec_init()

void pdec_init ( void )

Definition at line 417 of file pdec.c.

References _pdec_init(), and pdec.

Here is the call graph for this function:

◆ pdec_list_devices()

bool pdec_list_devices ( void )

Definition at line 386 of file pdec.c.

References pdec, PDEC_CMD_LIST_DEVICES, and pdec_send_frame().

Here is the call graph for this function:

◆ pdec_parse_byte()

void pdec_parse_byte ( pdec_t * pdec,
uint8_t byte )
static

Definition at line 263 of file pdec.c.

References pdec, pdec_dispatch_frame(), PDEC_RX_CHECKSUM, PDEC_RX_LEN, PDEC_RX_PAYLOAD, PDEC_RX_SYNC_1, PDEC_RX_SYNC_2, and PDEC_SYNC_BYTE.

Referenced by _pdec_event().

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

◆ pdec_parse_distance_result()

void pdec_parse_distance_result ( struct pdec_distance_result * result,
const struct pdec_distance_payload * payload )
static

◆ pdec_periodic_report()

void pdec_periodic_report ( void )

Definition at line 422 of file pdec.c.

References _pdec_periodic_report(), and pdec.

Here is the call graph for this function:

◆ pdec_range()

bool pdec_range ( uint16_t dst_id)

Definition at line 368 of file pdec.c.

References pdec_target_cmd_payload::dst_id, pdec, PDEC_CMD_RANGE, and pdec_send_frame().

Referenced by uwb_range().

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

◆ pdec_send_data()

bool pdec_send_data ( uint16_t dst_id,
const uint8_t * data,
uint8_t len )

Definition at line 394 of file pdec.c.

References pdec_target_cmd_payload::dst_id, pdec, PDEC_CMD_SEND_DATA, PDEC_MAX_DATA_LEN, and pdec_send_frame().

Here is the call graph for this function:

◆ pdec_send_frame()

bool pdec_send_frame ( pdec_t * pdec,
const uint8_t * payload,
uint8_t payload_len )
static

Definition at line 85 of file pdec.c.

References checksum, fd, frame, pdec, PDEC_FRAME_OVERHEAD, PDEC_MAX_PAYLOAD_LEN, PDEC_SYNC_BYTE, and uart_put_buffer().

Referenced by pdec_get_distance(), pdec_list_devices(), pdec_range(), and pdec_send_data().

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

◆ uwb_range()

void uwb_range ( uint16_t dst_id)

Definition at line 433 of file pdec.c.

References pdec_target_cmd_payload::dst_id, and pdec_range().

Here is the call graph for this function:

Variable Documentation

◆ pdec

◆ PDEC_PACKED

struct pdec_tdoa_report_event_payload PDEC_PACKED