Paparazzi UAS  v5.17_devel-24-g2ae834f
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
usb_serial_stm32_example2.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Michal Podhradsky
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  *
21  */
22 
31 
32 void send_command(void);
33 
36 
37 /* A lot of text */
39  " ASCII stands for American Standard Code for Information Interchange. Computers can only understand numbers, so an ASCII code is the numerical representation of a character such as 'a' or '@' or an action of some sort. ASCII was developed a long time ago and now the non-printing characters are rarely used for their original purpose. Below is the ASCII character table and this includes descriptions of the first 32 non-printing characters. ASCII was actually designed for use with teletypes and so the descriptions are somewhat obscure. If someone says they want your CV however in ASCII format, all this means is they want 'plain' text with no formatting such as tabs, bold or underscoring - the raw format that any computer can understand. This is usually so they can easily import the file into their own applications without issues. Notepad.exe creates ASCII text, or in MS Word you can save a file as 'text only' ";
40 
44 void init_usb_serial(void)
45 {
46  VCOM_init();
47  run = false;
48 }
49 
56 {
57  if (run) {
58  for (uint16_t i = 0; i < sizeof(big_buffer); i++) {
60  }
61  }
62 }
63 
71 {
72  if (data == -1) { return; }
73  uint8_t c = (uint8_t)data;
75  VCOM_putchar(data);
76  VCOM_putchar('\r');
77  VCOM_putchar('\n');
78 
79  if (c == 'S') {
80  run = false;
81  }
82  if (c == 'R') {
83  run = true;
84  }
86 }
87 
91 void event_usb_serial(void)
92 {
93  VCOM_event();
94  if (VCOM_check_available()) {
96  }
97 }
unsigned short uint16_t
Definition: types.h:16
void init_usb_serial(void)
Init module, call VCOM_init() from here.
void VCOM_send_message(void)
Definition: usb_ser_hw.c:574
void VCOM_event(void)
Definition: usb_ser_hw.c:571
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 ca...
int VCOM_getchar(void)
Reads one character from VCOM port.
Definition: usb_ser_hw.c:386
void event_usb_serial(void)
Call VCOM_poll() from module event function.
void send_command(void)
uint8_t big_buffer[]
unsigned char uint8_t
Definition: types.h:14
uint8_t run
header for serial over USB modules
int VCOM_putchar(int c)
Writes one character to VCOM port.
Definition: usb_ser_hw.c:376
void periodic_usb_serial(void)
Periodic function in case you needed to send data periodically like telemetry Note that the data are ...
uint8_t prompt
int VCOM_check_available(void)
Checks if data available in VCOM buffer.
Definition: usb_ser_hw.c:420
void VCOM_init(void)
Definition: usb_ser_hw.c:586