Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
pdec.h File Reference
#include <stdbool.h>
#include <stdint.h>
+ Include dependency graph for pdec.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  pdec_error_response
 
struct  pdec_distance_result
 
struct  pdec_device_list
 
struct  pdec_send_data_result
 
struct  pdec_ranging_event
 
struct  pdec_tdoa_report
 
struct  pdec_tdoa_report_event
 
struct  pdec_counters
 
struct  pdec_t
 

Macros

#define PDEC_MAX_DEVICES   32
 
#define PDEC_MAX_TDOA_REPORTS   32
 
#define PDEC_MAX_PAYLOAD_LEN   255
 
#define PDEC_MAX_DATA_LEN   252
 

Enumerations

enum  pdec_command { PDEC_CMD_RANGE = 0x01 , PDEC_CMD_GET_DISTANCE = 0x02 , PDEC_CMD_LIST_DEVICES = 0x03 , PDEC_CMD_SEND_DATA = 0x04 }
 
enum  pdec_msg {
  PDEC_MSG_ERROR = 0x7F , PDEC_MSG_RANGE_RESULT = 0x81 , PDEC_MSG_DISTANCE = 0x82 , PDEC_MSG_DEVICE_LIST = 0x83 ,
  PDEC_MSG_SEND_DATA_RESULT = 0x84 , PDEC_MSG_RANGING_EVENT = 0x90 , PDEC_MSG_TDOA_REPORT_EVENT = 0x92
}
 
enum  pdec_status {
  PDEC_STATUS_OK = 0x00 , PDEC_STATUS_ERROR = 0x01 , PDEC_STATUS_INVALID_LENGTH = 0x02 , PDEC_STATUS_NOT_FOUND = 0x03 ,
  PDEC_STATUS_RANGE_FAILED = 0x04 , PDEC_STATUS_MESSAGE_TOO_LONG = 0x05
}
 
enum  pdec_event_kind { PDEC_EVENT_SINGLE_SIDED = 0x00 , PDEC_EVENT_DOUBLE_SIDED = 0x01 , PDEC_EVENT_INDIRECT = 0x02 }
 
enum  pdec_rx_state {
  PDEC_RX_SYNC_1 , PDEC_RX_SYNC_2 , PDEC_RX_LEN , PDEC_RX_PAYLOAD ,
  PDEC_RX_CHECKSUM
}
 

Functions

void pdec_init (void)
 
void pdec_periodic_report (void)
 
void pdec_event (void)
 
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)
 

Variables

pdec_t pdec
 

Data Structure Documentation

◆ pdec_error_response

struct pdec_error_response

Definition at line 67 of file pdec.h.

Data Fields
uint8_t command
enum pdec_status status
bool updated

◆ pdec_distance_result

struct pdec_distance_result

Definition at line 73 of file pdec.h.

Data Fields
float distance
uint16_t dst_id
enum pdec_status status
bool updated

◆ pdec_device_list

struct pdec_device_list

Definition at line 80 of file pdec.h.

Data Fields
uint8_t count
uint16_t device_ids[PDEC_MAX_DEVICES]
uint8_t total_count
bool truncated
bool updated

◆ pdec_send_data_result

struct pdec_send_data_result

Definition at line 88 of file pdec.h.

Data Fields
uint16_t dst_id
uint8_t sent_len
enum pdec_status status
bool updated

◆ pdec_ranging_event

struct pdec_ranging_event

Definition at line 95 of file pdec.h.

Data Fields
float distance
uint16_t dst_id
enum pdec_event_kind kind
uint16_t src_id
bool updated

◆ pdec_tdoa_report

struct pdec_tdoa_report

Definition at line 103 of file pdec.h.

Data Fields
float distance
uint16_t reporter_id

◆ pdec_tdoa_report_event

struct pdec_tdoa_report_event

Definition at line 108 of file pdec.h.

+ Collaboration diagram for pdec_tdoa_report_event:
Data Fields
uint32_t blink_id
uint8_t count
uint8_t expected_count
struct pdec_tdoa_report reports[PDEC_MAX_TDOA_REPORTS]
bool timed_out
uint8_t total_count
bool truncated
bool updated

◆ pdec_counters

struct pdec_counters

Definition at line 119 of file pdec.h.

Data Fields
uint32_t rx_checksum_errors
uint32_t rx_frames
uint32_t rx_length_errors
uint32_t rx_unknown_messages
uint32_t tx_drops
uint32_t tx_frames

◆ pdec_t

struct pdec_t

Definition at line 128 of file pdec.h.

+ Collaboration diagram for pdec_t:
Data Fields
struct pdec_counters counters
struct uart_periph * dev
struct pdec_device_list devices
struct pdec_distance_result last_distance
struct pdec_error_response last_error
struct pdec_distance_result last_range
struct pdec_ranging_event last_ranging_event
struct pdec_send_data_result last_send_data
struct pdec_tdoa_report_event last_tdoa_report_event
uint8_t rx_checksum
uint8_t rx_idx
uint8_t rx_len
uint8_t rx_payload[PDEC_MAX_PAYLOAD_LEN]
enum pdec_rx_state rx_state

Macro Definition Documentation

◆ PDEC_MAX_DATA_LEN

#define PDEC_MAX_DATA_LEN   252

Definition at line 25 of file pdec.h.

◆ PDEC_MAX_DEVICES

#define PDEC_MAX_DEVICES   32

Definition at line 17 of file pdec.h.

◆ PDEC_MAX_PAYLOAD_LEN

#define PDEC_MAX_PAYLOAD_LEN   255

Definition at line 24 of file pdec.h.

◆ PDEC_MAX_TDOA_REPORTS

#define PDEC_MAX_TDOA_REPORTS   32

Definition at line 21 of file pdec.h.

Enumeration Type Documentation

◆ pdec_command

Enumerator
PDEC_CMD_RANGE 
PDEC_CMD_GET_DISTANCE 
PDEC_CMD_LIST_DEVICES 
PDEC_CMD_SEND_DATA 

Definition at line 27 of file pdec.h.

◆ pdec_event_kind

Enumerator
PDEC_EVENT_SINGLE_SIDED 
PDEC_EVENT_DOUBLE_SIDED 
PDEC_EVENT_INDIRECT 

Definition at line 53 of file pdec.h.

◆ pdec_msg

Enumerator
PDEC_MSG_ERROR 
PDEC_MSG_RANGE_RESULT 
PDEC_MSG_DISTANCE 
PDEC_MSG_DEVICE_LIST 
PDEC_MSG_SEND_DATA_RESULT 
PDEC_MSG_RANGING_EVENT 
PDEC_MSG_TDOA_REPORT_EVENT 

Definition at line 34 of file pdec.h.

◆ pdec_rx_state

Enumerator
PDEC_RX_SYNC_1 
PDEC_RX_SYNC_2 
PDEC_RX_LEN 
PDEC_RX_PAYLOAD 
PDEC_RX_CHECKSUM 

Definition at line 59 of file pdec.h.

◆ pdec_status

Enumerator
PDEC_STATUS_OK 
PDEC_STATUS_ERROR 
PDEC_STATUS_INVALID_LENGTH 
PDEC_STATUS_NOT_FOUND 
PDEC_STATUS_RANGE_FAILED 
PDEC_STATUS_MESSAGE_TOO_LONG 

Definition at line 44 of file pdec.h.

Function Documentation

◆ 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_target_cmd_payload::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_cmd_payload::id, pdec, PDEC_CMD_LIST_DEVICES, and pdec_send_frame().

+ Here is the call graph for this function:

◆ 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_target_cmd_payload::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 
)

Variable Documentation

◆ pdec