2016-01-24 13:13:40 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "ringbuf.h"
|
|
|
|
#include "usbd_cdc_core.h"
|
|
|
|
|
|
|
|
#define APP_TX_BUF_SIZE 128
|
|
|
|
#define APP_RX_BUF_SIZE 128
|
|
|
|
|
|
|
|
/* These are external variables imported from CDC core to be used for IN
|
|
|
|
transfer management. */
|
2017-09-06 02:20:06 +00:00
|
|
|
extern uint8_t APP_Rx_Buffer[]; /* Write CDC received data in this buffer.
|
2016-01-24 13:13:40 +00:00
|
|
|
These data will be sent over USB IN endpoint
|
|
|
|
in the CDC core functions. */
|
2017-09-06 02:20:06 +00:00
|
|
|
extern uint32_t APP_Rx_ptr_in; /* Increment this pointer or roll it back to
|
2016-01-24 13:13:40 +00:00
|
|
|
start address when writing received data
|
|
|
|
in the buffer APP_Rx_Buffer. */
|
|
|
|
|
|
|
|
extern struct ringbuf usb_rx_buf;
|
|
|
|
extern struct ringbuf usb_tx_buf;
|
|
|
|
|
2017-09-06 02:20:06 +00:00
|
|
|
uint8_t USB_CDC_is_connected(void);
|
2016-01-24 13:13:40 +00:00
|
|
|
uint16_t USB_VCP_get_string(char *ptr);
|
|
|
|
void USB_VCP_send_string(unsigned char *ptr);
|
|
|
|
void usb_init(void);
|
2017-01-10 08:48:07 +00:00
|
|
|
|
|
|
|
void cdc_init(void);
|
2017-09-06 02:20:06 +00:00
|
|
|
int cdc_tx(void *data, uint32_t len);
|
2017-01-10 08:48:07 +00:00
|
|
|
int cdc_getline(char *ptr, int len);
|
|
|
|
int cdc_is_connected();
|
|
|
|
void cdc_poll();
|