Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
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()

uint8_t hex2nibble ( char a)
static

hex2nibble('B') = 0x0B

Definition at line 299 of file slcan.c.

Referenced by slcan_handle_frame().

Here is the caller graph for this function:

◆ nibble2hex()

uint8_t nibble2hex ( uint8_t x)
static

nibble2hex(2) == '2'

Definition at line 289 of file slcan.c.

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 )

Definition at line 233 of file slcan.c.

References CAN_FRAME_EFF, pprzcan_frame::can_id, can_len_to_dlc(), pprzcan_frame::data, pprzcan_frame::flags, idx, pprzcan_frame::len, nibble2hex(), pprz_mtx_lock(), pprz_mtx_unlock(), slcan, slcan_cmd_from_id(), and pprzcan_frame::timestamp.

Referenced by slcan_init().

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

◆ slcan_cmd_from_id()

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, SLCAN_CMD_BUF_LEN, and slcan_handle_cmd().

Here is the call graph for this function:

◆ slcan_handle_cmd()

void slcan_handle_cmd ( slcan_t * slcan)
static

Definition at line 76 of file slcan.c.

References slcan, slcan_handle_frame(), slcan_rsp_error(), slcan_rsp_ok(), and status.

Referenced by slcan_event().

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

◆ slcan_handle_frame()

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, can_transmit_frame(), pprzcan_frame::data, hex2nibble(), pprzcan_frame::len, 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 )

Definition at line 53 of file slcan.c.

References can_register_callback(), pprz_mtx_init(), slcan, and slcan_can_rx_cb().

Here is the call graph for this function:

◆ slcan_rsp_error()

void slcan_rsp_error ( slcan_t * slcan)
static

Definition at line 281 of file slcan.c.

References slcan.

Referenced by slcan_handle_cmd().

Here is the caller graph for this function:

◆ slcan_rsp_ok()

void slcan_rsp_ok ( slcan_t * slcan)
static

Definition at line 276 of file slcan.c.

References slcan.

Referenced by slcan_handle_cmd().

Here is the caller graph for this function:

Variable Documentation

◆ slcan