Paparazzi UAS  v5.18.0_stable
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 }
VCOM_check_available
int VCOM_check_available(void)
Checks if data available in VCOM buffer.
Definition: usb_ser_hw.c:420
c
VIC slots used for the LPC2148 define name e g gps UART1_VIC_SLOT e g modem SPI1_VIC_SLOT SPI1 in mcu_periph spi_arch c or spi_slave_hs_arch c(and some others not using the SPI peripheral yet..) I2C0_VIC_SLOT 8 mcu_periph/i2c_arch.c I2C1_VIC_SLOT 9 mcu_periph/i2c_arch.c USB_VIC_SLOT 10 usb
uint16_t
unsigned short uint16_t
Definition: types.h:16
event_usb_serial
void event_usb_serial(void)
Call VCOM_poll() from module event function.
Definition: usb_serial_stm32_example2.c:91
VCOM_event
void VCOM_event(void)
Definition: usb_ser_hw.c:571
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 ca...
Definition: usb_serial_stm32_example2.c:70
send_command
void send_command(void)
VCOM_send_message
void VCOM_send_message(void)
Definition: usb_ser_hw.c:574
prompt
uint8_t prompt
Definition: usb_serial_stm32_example2.c:35
big_buffer
uint8_t big_buffer[]
Definition: usb_serial_stm32_example2.c:38
VCOM_getchar
int VCOM_getchar(void)
Reads one character from VCOM port.
Definition: usb_ser_hw.c:386
init_usb_serial
void init_usb_serial(void)
Init module, call VCOM_init() from here.
Definition: usb_serial_stm32_example2.c:44
run
uint8_t run
Definition: usb_serial_stm32_example2.c:34
uint8_t
unsigned char uint8_t
Definition: types.h:14
periodic_usb_serial
void periodic_usb_serial(void)
Periodic function in case you needed to send data periodically like telemetry Note that the data are ...
Definition: usb_serial_stm32_example2.c:55
VCOM_putchar
int VCOM_putchar(int c)
Writes one character to VCOM port.
Definition: usb_ser_hw.c:376
usb_serial_stm32.h
VCOM_init
void VCOM_init(void)
Definition: usb_ser_hw.c:586