Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
usb_serial_stm32_example1.c File Reference

USB_SERIAL_STM32 example 1 - a template for a console to autopilot. More...

#include "modules/com/usb_serial_stm32.h"
#include <string.h>
+ Include dependency graph for usb_serial_stm32_example1.c:

Go to the source code of this file.

Functions

void send_command (void)
 
void cmd_execute (void)
 Execute command from user use strncmp. More...
 
void init_usb_serial (void)
 Init module, call VCOM_init() from here. More...
 
void usb_serial_parse_packet (int data)
 Parse data from buffer Note that the function receives int, not char Because we want to be able to catch -1 in case no more data were available. More...
 
static void ReadUsbBuffer (void)
 Helper function. More...
 
void event_usb_serial (void)
 Call VCOM_poll() from module event function. More...
 

Variables

char cmd_buf [64]
 
uint8_t cmd_idx
 
bool cmd_avail
 
uint8_t prompt = '$'
 

Detailed Description

USB_SERIAL_STM32 example 1 - a template for a console to autopilot.

Definition in file usb_serial_stm32_example1.c.

Function Documentation

◆ cmd_execute()

void cmd_execute ( void  )

Execute command from user use strncmp.

Definition at line 93 of file usb_serial_stm32_example1.c.

References cmd_buf, cmd_idx, prompt, VCOM_putchar(), and VCOM_send_message().

Referenced by event_usb_serial().

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

◆ event_usb_serial()

void event_usb_serial ( void  )

Call VCOM_poll() from module event function.

Definition at line 126 of file usb_serial_stm32_example1.c.

◆ init_usb_serial()

void init_usb_serial ( void  )

Init module, call VCOM_init() from here.

Definition at line 44 of file usb_serial_stm32_example1.c.

◆ ReadUsbBuffer()

static void ReadUsbBuffer ( void  )
inlinestatic

Helper function.

Definition at line 82 of file usb_serial_stm32_example1.c.

References cmd_avail, usb_serial_parse_packet(), VCOM_check_available(), and VCOM_getchar().

Referenced by event_usb_serial().

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

◆ send_command()

void send_command ( void  )

◆ usb_serial_parse_packet()

void usb_serial_parse_packet ( int  data)

Parse data from buffer Note that the function receives int, not char Because we want to be able to catch -1 in case no more data were available.

Definition at line 58 of file usb_serial_stm32_example1.c.

Referenced by ReadUsbBuffer().

+ Here is the caller graph for this function:

Variable Documentation

◆ cmd_avail

bool cmd_avail

◆ cmd_buf

char cmd_buf[64]

◆ cmd_idx

uint8_t cmd_idx

◆ prompt

uint8_t prompt = '$'

Definition at line 39 of file usb_serial_stm32_example1.c.

Referenced by cmd_execute(), and usb_serial_parse_packet().