Go to the documentation of this file.
1 #ifndef VCP_CLASS_H
2 #define VCP_CLASS_H
4 #include "gpio.h"
5 #include "revo_f4.h"
6 #include "serial.h"
8 extern "C"
9 {
10 #include "stm32f4xx_conf.h"
11 #include "usb_conf.h"
12 #include "usbd_cdc_core.h"
13 #include "usbd_cdc_vcp.h"
14 #include "usbd_desc.h"
15 #include "usbd_ioreq.h"
16 #include "usbd_usr.h"
17 }
19 class VCP : public Serial
20 {
21 public:
22  void init();
23  virtual void write(const uint8_t *ch, uint8_t len) override;
24  uint32_t rx_bytes_waiting() override;
25  uint32_t tx_bytes_free() override;
26  uint8_t read_byte() override;
27  bool set_baud_rate(uint32_t baud);
28  bool tx_buffer_empty() override;
29  void put_byte(uint8_t ch) override;
30  bool flush() override;
31  void begin_write();
32  void end_write();
33  void register_rx_callback(void (*rx_callback_ptr)(uint8_t data)) override;
34  void unregister_rx_callback() override;
35  bool in_bulk_mode();
36  bool connected();
38  std::function<void(uint8_t)> cb_;
39  bool connected_ = false;
40  bool reset_ = false;
42 private:
43  void perform_maintenance();
47  uint8_t bulk_mode_buffer[64];
49  bool bulk_mode;
54 };
56 #endif
bool connected()
Definition: vcp.cpp:108
std::function< void(uint8_t)> cb_
Definition: vcp.h:38
GPIO tx_pin_
Definition: vcp.h:52
void begin_write()
Definition: vcp.cpp:118
bool flush() override
Definition: vcp.cpp:113
uint8_t bulk_mode_buffer_index
Definition: vcp.h:48
bool bulk_mode
Definition: vcp.h:49
void init()
Definition: vcp.cpp:24
header file for the usbd_cdc_core.c file.
void register_rx_callback(void(*rx_callback_ptr)(uint8_t data)) override
Definition: vcp.cpp:121
GPIO vbus_sens_
Definition: vcp.h:53
void perform_maintenance()
Definition: vcp.cpp:59
GPIO rx_pin_
Definition: vcp.h:51
void put_byte(uint8_t ch) override
Definition: vcp.cpp:102
uint32_t tx_bytes_free() override
Definition: vcp.cpp:79
virtual void write(const uint8_t *ch, uint8_t len) override
Definition: vcp.cpp:39
bool connected_
Definition: vcp.h:39
header file for the usbd_ioreq.c file
Definition: vcp.h:19
void end_write()
Definition: vcp.cpp:119
Header for usbd_cdc_vcp.c file.
Definition: serial.h:44
Definition: gpio.h:37
void unregister_rx_callback() override
Definition: vcp.cpp:126
bool set_baud_rate(uint32_t baud)
Header file for usbd_usr.c.
uint32_t rx_bytes_waiting() override
Definition: vcp.cpp:74
General low level driver configuration.
bool in_bulk_mode()
Definition: vcp.cpp:132
void send_disconnect_signal()
Definition: vcp.cpp:137
bool tx_buffer_empty() override
Definition: vcp.cpp:97
bool reset_
Definition: vcp.h:40
uint8_t bulk_mode_buffer[64]
Definition: vcp.h:47
uint8_t read_byte() override
Definition: vcp.cpp:84
header file for the usbd_desc.c file

Author(s): Daniel Koch , James Jackson
autogenerated on Thu Apr 15 2021 05:07:50