Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
slcan.c File Reference
#include "modules/core/slcan.h"
#include "generated/airframe.h"
#include "mcu_periph/uart.h"
#include "mcu_periph/can.h"
#include "mcu_periph/usb_serial.h"
#include "pprzlink/pprzlink_device.h"
#include "stdio.h"
#include "string.h"
+ Include dependency graph for slcan.c:

Go to the source code of this file.

Functions

static void slcan_handle_cmd (slcan_t *slcan)
 
static void slcan_rsp_ok (slcan_t *slcan)
 
static void slcan_rsp_error (slcan_t *slcan)
 
static int slcan_handle_frame (slcan_t *slcan)
 
static uint8_t hex2nibble (char a)
 hex2nibble('B') = 0x0B
 
static uint8_t nibble2hex (uint8_t x)
 nibble2hex(2) == '2'
 
void slcan_can_rx_cb (struct pprzcan_frame *rxframe, struct pprzaddr_can *src_addr, void *user_data)
 
void slcan_init (void)
 
void slcan_event (void)
 
static uint8_t slcan_cmd_from_id (uint32_t can_id, uint8_t flags)
 

Variables

slcan_t slcan
 

Detailed Description

Author
Fabien-B fabie.nosp@m.n-b@.nosp@m.githu.nosp@m.b.co.nosp@m.m SLCAN interface. CAN over serial link. See https://www.canusb.com/files/can232_v3.pdf Useful for using DroneCAN GUI over serial USB.

Definition in file slcan.c.

Function Documentation

◆ hex2nibble()

static uint8_t hex2nibble ( char  a)
static

hex2nibble('B') = 0x0B

Definition at line 298 of file slcan.c.

Referenced by slcan_handle_frame().

+ Here is the caller graph for this function:

◆ nibble2hex()

static uint8_t nibble2hex ( uint8_t  x)
static

nibble2hex(2) == '2'

Definition at line 288 of file slcan.c.

References foo.

Referenced by slcan_can_rx_cb().

+ Here is the caller graph for this function:

◆ slcan_can_rx_cb()

void slcan_can_rx_cb ( struct pprzcan_frame rxframe,
struct pprzaddr_can src_addr,
void user_data 
)

◆ slcan_cmd_from_id()

static uint8_t slcan_cmd_from_id ( uint32_t  can_id,
uint8_t  flags 
)
static

Definition at line 209 of file slcan.c.

References CAN_FRAME_EFF, CAN_FRAME_RTR, pprzcan_frame::can_id, CANFD_FDF, and pprzcan_frame::flags.

Referenced by slcan_can_rx_cb().

+ Here is the caller graph for this function:

◆ slcan_event()

void slcan_event ( void  )

Definition at line 63 of file slcan.c.

References b, slcan_t::cmd_buf, slcan_t::cmd_buf_idx, slcan_t::dev, slcan, SLCAN_CMD_BUF_LEN, and slcan_handle_cmd().

+ Here is the call graph for this function:

◆ slcan_handle_cmd()

static void slcan_handle_cmd ( slcan_t slcan)
static

Definition at line 76 of file slcan.c.

References slcan_t::cmd_buf, slcan_t::cmd_buf_idx, slcan_t::dev, foo, slcan, slcan_handle_frame(), slcan_rsp_error(), slcan_rsp_ok(), status, and slcan_t::timestamp.

Referenced by slcan_event().

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

◆ slcan_handle_frame()

static int slcan_handle_frame ( slcan_t slcan)
static

Definition at line 159 of file slcan.c.

References can_dlc_to_len(), CAN_FRAME_EFF, CAN_FRAME_RTR, pprzcan_frame::can_id, slcan_t::can_if, can_transmit_frame(), slcan_t::cmd_buf, slcan_t::cmd_buf_idx, pprzcan_frame::data, foo, hex2nibble(), and slcan.

Referenced by slcan_handle_cmd().

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

◆ slcan_init()

void slcan_init ( void  )

◆ slcan_rsp_error()

static void slcan_rsp_error ( slcan_t slcan)
static

Definition at line 280 of file slcan.c.

References slcan_t::dev, and slcan.

Referenced by slcan_handle_cmd().

+ Here is the caller graph for this function:

◆ slcan_rsp_ok()

static void slcan_rsp_ok ( slcan_t slcan)
static

Definition at line 275 of file slcan.c.

References slcan_t::dev, and slcan.

Referenced by slcan_handle_cmd().

+ Here is the caller graph for this function:

Variable Documentation

◆ slcan