Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
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 }
void VCOM_event(void)
Poll usb (required by libopencm3).
Definition: usb_ser_hw.c:468
int VCOM_getchar(void)
Reads one character from VCOM port.
Definition: usb_ser_hw.c:425
int VCOM_putchar(int c)
Writes one character to VCOM port fifo.
Definition: usb_ser_hw.c:397
int VCOM_check_available(void)
Checks if data available in VCOM buffer.
Definition: usb_ser_hw.c:459
void VCOM_init(void)
Definition: usb_ser_hw.c:565
void VCOM_send_message(void)
Send data from fifo right now.
Definition: usb_ser_hw.c:487
header for serial over USB modules
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...
void periodic_usb_serial(void)
Periodic function in case you needed to send data periodically like telemetry Note that the data are ...
void send_command(void)
uint8_t big_buffer[]
uint8_t prompt
uint8_t run
void init_usb_serial(void)
Init module, call VCOM_init() from here.
void event_usb_serial(void)
Call VCOM_poll() from module event function.
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
Definition: vl53l1_types.h:88
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98