Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
mateksys_3901_l0x.c File Reference
#include <stdlib.h>
#include "mateksys_3901_l0x.h"
#include "mcu_periph/uart.h"
#include "modules/core/abi.h"
#include "state.h"
#include "pprzlink/messages.h"
#include "modules/datalink/downlink.h"
#include "modules/datalink/telemetry.h"
+ Include dependency graph for mateksys_3901_l0x.c:

Go to the source code of this file.

Macros

#define MATEKSYS_3901_L0X_MOTION_THRES   100
 
#define MATEKSYS_3901_L0X_DISTANCE_THRES   200
 
#define MATEKSYS_3901_L0X_MAX_FLOW   300
 
#define MATEKSYS_3901_L0X_MAX_DISTANCE   3000
 
#define USE_MATEKSYS_3901_L0X_AGL   1
 
#define USE_MATEKSYS_3901_L0X_OPTICAL_FLOW   1
 
#define MATEKSYS_3901_L0X_COMPENSATE_ROTATION   1
 
#define MATEKSYS_3901_L0X_FLOW_X_SCALER   1
 
#define MATEKSYS_3901_L0X_FLOW_Y_SCALER   1
 

Functions

static void mateksys3901l0x_parse (uint8_t byte)
 Parse the sensor MSP output bytes 1 by 1. More...
 
static void mateksys3901l0x_send_optical_flow (struct transport_tx *trans, struct link_device *dev)
 Downlink message flow and lidar (included velocity estimation, not yet tested) More...
 
void mateksys3901l0x_init (void)
 Initialization function. More...
 
void mateksys_3901_l0x_scale_X (float scalex)
 Scale the Flow X. More...
 
void mateksys_3901_l0x_scale_Y (float scaley)
 Scale the Flow Y. More...
 
void mateksys3901l0x_event (void)
 Receive bytes from the UART port and parse them. More...
 

Variables

struct Mateksys3901l0X mateksys3901l0x
 

Macro Definition Documentation

◆ MATEKSYS_3901_L0X_COMPENSATE_ROTATION

#define MATEKSYS_3901_L0X_COMPENSATE_ROTATION   1

Definition at line 67 of file mateksys_3901_l0x.c.

◆ MATEKSYS_3901_L0X_DISTANCE_THRES

#define MATEKSYS_3901_L0X_DISTANCE_THRES   200

Definition at line 47 of file mateksys_3901_l0x.c.

◆ MATEKSYS_3901_L0X_FLOW_X_SCALER

#define MATEKSYS_3901_L0X_FLOW_X_SCALER   1

Definition at line 71 of file mateksys_3901_l0x.c.

◆ MATEKSYS_3901_L0X_FLOW_Y_SCALER

#define MATEKSYS_3901_L0X_FLOW_Y_SCALER   1

Definition at line 75 of file mateksys_3901_l0x.c.

◆ MATEKSYS_3901_L0X_MAX_DISTANCE

#define MATEKSYS_3901_L0X_MAX_DISTANCE   3000

Definition at line 55 of file mateksys_3901_l0x.c.

◆ MATEKSYS_3901_L0X_MAX_FLOW

#define MATEKSYS_3901_L0X_MAX_FLOW   300

Definition at line 51 of file mateksys_3901_l0x.c.

◆ MATEKSYS_3901_L0X_MOTION_THRES

#define MATEKSYS_3901_L0X_MOTION_THRES   100

Definition at line 43 of file mateksys_3901_l0x.c.

◆ USE_MATEKSYS_3901_L0X_AGL

#define USE_MATEKSYS_3901_L0X_AGL   1

Definition at line 59 of file mateksys_3901_l0x.c.

◆ USE_MATEKSYS_3901_L0X_OPTICAL_FLOW

#define USE_MATEKSYS_3901_L0X_OPTICAL_FLOW   1

Definition at line 63 of file mateksys_3901_l0x.c.

Function Documentation

◆ mateksys3901l0x_event()

void mateksys3901l0x_event ( void  )

Receive bytes from the UART port and parse them.

Definition at line 151 of file mateksys_3901_l0x.c.

References Mateksys3901l0X::device, mateksys3901l0x, mateksys3901l0x_parse(), MATEKSYS_3901_L0X_INITIALIZE, and Mateksys3901l0X::parse_status.

+ Here is the call graph for this function:

◆ mateksys3901l0x_init()

◆ mateksys3901l0x_parse()

static void mateksys3901l0x_parse ( uint8_t  byte)
static

Parse the sensor MSP output bytes 1 by 1.

Definition at line 161 of file mateksys_3901_l0x.c.

References AGL_LIDAR_MATEKSYS_3901_L0X_ID, byte, Mateksys3901l0X::distance_compensated, Mateksys3901l0X::distancemm, Mateksys3901l0X::distancemm_quality, Mateksys3901l0X::distancemm_temp, FLOW_OPTICFLOW_MATEKSYS_3901_L0X_ID, get_sys_time_usec(), mateksys3901l0x, MATEKSYS_3901_L0X_COMPENSATE_ROTATION, MATEKSYS_3901_L0X_DISTANCE_THRES, MATEKSYS_3901_L0X_INITIALIZE, MATEKSYS_3901_L0X_MAX_DISTANCE, MATEKSYS_3901_L0X_MAX_FLOW, MATEKSYS_3901_L0X_MOTION_THRES, MATEKSYS_3901_L0X_PARSE_CHECKSUM, MATEKSYS_3901_L0X_PARSE_DIRECTION, MATEKSYS_3901_L0X_PARSE_DISTANCE_B1, MATEKSYS_3901_L0X_PARSE_DISTANCE_B2, MATEKSYS_3901_L0X_PARSE_DISTANCE_B3, MATEKSYS_3901_L0X_PARSE_DISTANCE_B4, MATEKSYS_3901_L0X_PARSE_DISTANCEQUALITY, MATEKSYS_3901_L0X_PARSE_FUNCTION_ID_B1, MATEKSYS_3901_L0X_PARSE_FUNCTION_ID_B2, MATEKSYS_3901_L0X_PARSE_HEAD, MATEKSYS_3901_L0X_PARSE_HEAD2, MATEKSYS_3901_L0X_PARSE_LENGTH, MATEKSYS_3901_L0X_PARSE_MOTIONQUALITY, MATEKSYS_3901_L0X_PARSE_MOTIONX_B1, MATEKSYS_3901_L0X_PARSE_MOTIONX_B2, MATEKSYS_3901_L0X_PARSE_MOTIONX_B3, MATEKSYS_3901_L0X_PARSE_MOTIONX_B4, MATEKSYS_3901_L0X_PARSE_MOTIONY_B1, MATEKSYS_3901_L0X_PARSE_MOTIONY_B2, MATEKSYS_3901_L0X_PARSE_MOTIONY_B3, MATEKSYS_3901_L0X_PARSE_MOTIONY_B4, MATEKSYS_3901_L0X_PARSE_POINTER, MATEKSYS_3901_L0X_PARSE_SIZE, Mateksys3901l0X::motion_quality, Mateksys3901l0X::motionX, Mateksys3901l0X::motionX_temp, Mateksys3901l0X::motionY, Mateksys3901l0X::motionY_temp, Mateksys3901l0X::parse_crc, Mateksys3901l0X::parse_status, FloatEulers::phi, Mateksys3901l0X::scaler_x, Mateksys3901l0X::scaler_y, Mateksys3901l0X::sensor_id, stateGetNedToBodyEulers_f(), FloatEulers::theta, Mateksys3901l0X::time_usec, USE_MATEKSYS_3901_L0X_AGL, USE_MATEKSYS_3901_L0X_OPTICAL_FLOW, Mateksys3901l0X::velocityX, and Mateksys3901l0X::velocityY.

Referenced by mateksys3901l0x_event().

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

◆ mateksys3901l0x_send_optical_flow()

static void mateksys3901l0x_send_optical_flow ( struct transport_tx *  trans,
struct link_device *  dev 
)
static

◆ mateksys_3901_l0x_scale_X()

void mateksys_3901_l0x_scale_X ( float  scalex)

Scale the Flow X.

Definition at line 135 of file mateksys_3901_l0x.c.

References mateksys3901l0x, and Mateksys3901l0X::scaler_x.

◆ mateksys_3901_l0x_scale_Y()

void mateksys_3901_l0x_scale_Y ( float  scaley)

Scale the Flow Y.

Definition at line 143 of file mateksys_3901_l0x.c.

References mateksys3901l0x, and Mateksys3901l0X::scaler_y.

Variable Documentation

◆ mateksys3901l0x