27#include "hal_serial_usb.h"
33#define SERIAL_USB USBD1
39#ifndef USBD1_DATA_REQUEST_EP
40#define USBD1_DATA_REQUEST_EP 1
42#ifndef USBD1_DATA_AVAILABLE_EP
43#define USBD1_DATA_AVAILABLE_EP 1
45#ifndef USBD1_INTERRUPT_REQUEST_EP
46#define USBD1_INTERRUPT_REQUEST_EP 2
52#define USB_NUM_INTERFACES 2
53#define USB_CDC_CIF_NUM0 0
54#define USB_CDC_DIF_NUM0 1
59#ifndef USBD2_DATA_REQUEST_EP
60#define USBD2_DATA_REQUEST_EP 3
62#ifndef USBD2_DATA_AVAILABLE_EP
63#define USBD2_DATA_AVAILABLE_EP 3
65#ifndef USBD2_INTERRUPT_REQUEST_EP
66#define USBD2_INTERRUPT_REQUEST_EP 4
68#undef USB_NUM_INTERFACES
69#define USB_NUM_INTERFACES 4
70#define USB_CDC_CIF_NUM1 2
71#define USB_CDC_DIF_NUM1 3
75#define USB_INTERRUPT_REQUEST_SIZE 0x10
76#define USB_DATA_SIZE 0x40
80#if (CH_KERNEL_MAJOR == 2)
118#define CDC_IF_DESC_SET_SIZE \
119 (USB_DESC_INTERFACE_SIZE + 5 + 5 + 4 + 5 + USB_DESC_ENDPOINT_SIZE + \
120 USB_DESC_INTERFACE_SIZE + (USB_DESC_ENDPOINT_SIZE * 2))
122#define IAD_CDC_IF_DESC_SET_SIZE \
123 (USB_DESC_INTERFACE_ASSOCIATION_SIZE + CDC_IF_DESC_SET_SIZE)
125#define CONFIG_DESC_DATA_SIZE (USB_DESC_CONFIGURATION_SIZE + (IAD_CDC_IF_DESC_SET_SIZE*USBD_NUMBER))
285 'P', 0,
'a', 0,
'p', 0,
'a', 0,
'r', 0,
'a', 0,
'z', 0,
'z', 0,
286 'i', 0,
' ', 0,
'U', 0,
'A', 0,
'V', 0
295 'C', 0,
'D', 0,
'C', 0,
' ', 0,
'S', 0,
'e', 0,
'r', 0,
'i', 0,
296 'a', 0,
'l', 0,
' ', 0,
'S', 0,
'T', 0,
'M', 0,
'3', 0,
'2', 0
316 'P', 0,
'a', 0,
'p', 0,
'a', 0,
'r', 0,
'a', 0,
'z', 0,
'z', 0,
317 'i', 0,
' ', 0,
'U', 0,
'A', 0,
'V', 0,
' ', 0,
't', 0,
'e', 0,
318 'l', 0,
'e', 0,
'm', 0,
'e', 0,
't', 0,
'r', 0,
'y', 0,
' ', 0,
319 'P', 0,
'o', 0,
'r', 0,
't', 0
329 'P', 0,
'a', 0,
'p', 0,
'a', 0,
'r', 0,
'a', 0,
'z', 0,
'z', 0,
330 'i', 0,
' ', 0,
'U', 0,
'A', 0,
'V', 0,
' ', 0,
'd', 0,
'e', 0,
331 'b', 0,
'u', 0,
'g', 0,
' ', 0,
'P', 0,
'o', 0,
'r', 0,
't', 0
574#if (CH_KERNEL_MAJOR <= 3)
644 if(
p->nb_bytes > 0) {
665 if(
p->nb_bytes > 0) {
static uint8_t mode
mode holds the current sonar mode mode = 0 used at high altitude, uses 16 wave patterns mode = 1 used...
void VCOM_event(void)
Poll usb (required by libopencm3).
int VCOM_getchar(void)
Reads one character from VCOM port.
int VCOM_putchar(int c)
Writes one character to VCOM port fifo.
static int usb_serial_check_free_space(struct usb_serial_periph *p, long *fd, uint16_t len)
static void usb_serial_transmit_buffer(struct usb_serial_periph *p, long fd, uint8_t *data, uint16_t len)
static void usb_serial_transmit(struct usb_serial_periph *p, long fd, uint8_t byte)
int VCOM_check_available(void)
Checks if data available in VCOM buffer.
int VCOM_peekchar(int ofs)
Reads one character from VCOM port without removing it from the queue.
void VCOM_send_message(void)
Send data from fifo right now.
struct usb_serial_periph usb_serial
static uint8_t usb_serial_getch(struct usb_serial_periph *p)
static void usb_serial_send(struct usb_serial_periph *p, long fd)
static int usb_serial_char_available(struct usb_serial_periph *p)
bool VCOM_check_free_space(uint16_t len)
Checks if buffer free in VCOM buffer.
void VCOM_set_linecoding(uint8_t mode)
struct link_device device
Generic device interface.
void VCOM_allow_linecoding(uint8_t mode)
#define USB_RX_BUFFER_SIZE
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.