PX4 Firmware
PX4 Autopilot Software http://px4.io
mavlink_main.cpp File Reference

MAVLink 1.0 protocol implementation. More...

#include <termios.h>
#include <lib/ecl/geo/geo.h>
#include <lib/mathlib/mathlib.h>
#include <lib/version/version.h>
#include <uORB/PublicationQueued.hpp>
#include "mavlink_receiver.h"
#include "mavlink_main.h"
Include dependency graph for mavlink_main.cpp:

Go to the source code of this file.

Macros

#define MAVLINK_NET_ADDED_STACK   0
 
#define FLOW_CONTROL_DISABLE_THRESHOLD   40
 picked so that some messages still would fit it. More...
 
#define MAX_DATA_RATE   10000000
 max data rate in bytes/s More...
 
#define MAIN_LOOP_DELAY   10000
 100 Hz @ 1000 bytes/s data rate More...
 
#define B460800   460800
 
#define B500000   500000
 
#define B921600   921600
 
#define B1000000   1000000
 

Functions

__EXPORT int mavlink_main (int argc, char *argv[])
 Mavlink app start / stop handling function. More...
 
void mavlink_send_uart_bytes (mavlink_channel_t chan, const uint8_t *ch, int length)
 Send multiple chars (uint8_t) over a comm channel. More...
 
void mavlink_start_uart_send (mavlink_channel_t chan, int length)
 
void mavlink_end_uart_send (mavlink_channel_t chan, int length)
 
mavlink_status_t * mavlink_get_channel_status (uint8_t channel)
 
mavlink_message_t * mavlink_get_channel_buffer (uint8_t channel)
 
static void usage ()
 

Variables

static Mavlink_mavlink_instances = nullptr
 

Detailed Description

MAVLink 1.0 protocol implementation.

Author
Lorenz Meier lm@in.nosp@m.f.et.nosp@m.hz.ch
Julian Oes julia.nosp@m.n@oe.nosp@m.s.ch
Anton Babushkin anton.nosp@m..bab.nosp@m.ushki.nosp@m.n@me.nosp@m..com

Definition in file mavlink_main.cpp.

Macro Definition Documentation

◆ B1000000

#define B1000000   1000000

◆ B460800

◆ B500000

#define B500000   500000

◆ B921600

#define B921600   921600

◆ FLOW_CONTROL_DISABLE_THRESHOLD

#define FLOW_CONTROL_DISABLE_THRESHOLD   40

picked so that some messages still would fit it.

Definition at line 75 of file mavlink_main.cpp.

Referenced by Mavlink::get_free_tx_buf().

◆ MAIN_LOOP_DELAY

#define MAIN_LOOP_DELAY   10000

100 Hz @ 1000 bytes/s data rate

Definition at line 77 of file mavlink_main.cpp.

Referenced by Mavlink::configure_stream_threadsafe(), and Mavlink::task_main().

◆ MAVLINK_NET_ADDED_STACK

#define MAVLINK_NET_ADDED_STACK   0

Definition at line 72 of file mavlink_main.cpp.

Referenced by Mavlink::start().

◆ MAX_DATA_RATE

#define MAX_DATA_RATE   10000000

max data rate in bytes/s

Definition at line 76 of file mavlink_main.cpp.

Referenced by Mavlink::task_main().

Function Documentation

◆ mavlink_end_uart_send()

void mavlink_end_uart_send ( mavlink_channel_t  chan,
int  length 
)

Definition at line 116 of file mavlink_main.cpp.

References Mavlink::get_instance(), and Mavlink::send_packet().

Here is the call graph for this function:

◆ mavlink_get_channel_buffer()

mavlink_message_t* mavlink_get_channel_buffer ( uint8_t  channel)

Definition at line 146 of file mavlink_main.cpp.

References Mavlink::_boot_complete, Mavlink::_first_start_time, Mavlink::get_buffer(), Mavlink::get_instance(), hrt_abstime, and usage().

Here is the call graph for this function:

◆ mavlink_get_channel_status()

mavlink_status_t* mavlink_get_channel_status ( uint8_t  channel)

Definition at line 131 of file mavlink_main.cpp.

References Mavlink::get_instance(), and Mavlink::get_status().

Here is the call graph for this function:

◆ mavlink_main()

int mavlink_main ( int  argc,
char *  argv[] 
)

Mavlink app start / stop handling function.

Definition at line 3087 of file mavlink_main.cpp.

References Mavlink::destroy_all_instances(), Mavlink::get_status_all_instances(), Mavlink::set_boot_complete(), Mavlink::start(), Mavlink::stream_command(), and usage().

Here is the call graph for this function:

◆ mavlink_send_uart_bytes()

void mavlink_send_uart_bytes ( mavlink_channel_t  chan,
const uint8_t *  ch,
int  length 
)

Send multiple chars (uint8_t) over a comm channel.

Parameters
chanMAVLink channel to use, usually MAVLINK_COMM_0 = UART0
chCharacter to send

Definition at line 88 of file mavlink_main.cpp.

References Mavlink::get_instance(), and Mavlink::send_bytes().

Here is the call graph for this function:

◆ mavlink_start_uart_send()

void mavlink_start_uart_send ( mavlink_channel_t  chan,
int  length 
)

Definition at line 104 of file mavlink_main.cpp.

References Mavlink::begin_send(), and Mavlink::get_instance().

Here is the call graph for this function:

◆ usage()

static void usage ( void  )
static

Definition at line 3014 of file mavlink_main.cpp.

References f().

Referenced by mavlink_get_channel_buffer(), mavlink_main(), Mavlink::stream_command(), and Mavlink::task_main().

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

Variable Documentation

◆ _mavlink_instances

Mavlink* _mavlink_instances = nullptr
static