vcp.h
Go to the documentation of this file.
1 #ifndef VCP_CLASS_H
2 #define VCP_CLASS_H
3 
4 #include "revo_f4.h"
5 
6 #include "serial.h"
7 #include "gpio.h"
8 
9 extern "C" {
10 #include "stm32f4xx_conf.h"
11 #include "usbd_cdc_core.h"
12 #include "usb_conf.h"
13 #include "usbd_desc.h"
14 #include "usbd_cdc_vcp.h"
15 #include "usbd_usr.h"
16 #include "usbd_ioreq.h"
17 }
18 
19 
20 class VCP : public Serial
21 {
22 public:
23  void init();
24  virtual void write(const uint8_t *ch, uint8_t len) override;
25  uint32_t rx_bytes_waiting() override;
26  uint32_t tx_bytes_free() override;
27  uint8_t read_byte() override;
28  bool set_baud_rate(uint32_t baud);
29  bool tx_buffer_empty() override;
30  void put_byte(uint8_t ch) override;
31  bool flush() override;
32  void begin_write();
33  void end_write();
34  void register_rx_callback(void (*rx_callback_ptr)(uint8_t data)) override;
35  void unregister_rx_callback() override;
36  bool in_bulk_mode();
37  bool connected();
38 
39  std::function<void(uint8_t)> cb_;
40  bool connected_ = false;
41  bool reset_ = false;
42 
43 private:
44 
45  void perform_maintenance();
46 
48 
49  uint8_t bulk_mode_buffer[64];
51  bool bulk_mode;
52 
56 };
57 
58 #endif
bool connected()
Definition: vcp.cpp:112
std::function< void(uint8_t)> cb_
Definition: vcp.h:39
GPIO tx_pin_
Definition: vcp.h:54
void begin_write()
Definition: vcp.cpp:122
bool flush() override
Definition: vcp.cpp:117
uint8_t bulk_mode_buffer_index
Definition: vcp.h:50
bool bulk_mode
Definition: vcp.h:51
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:126
GPIO vbus_sens_
Definition: vcp.h:55
void perform_maintenance()
Definition: vcp.cpp:59
GPIO rx_pin_
Definition: vcp.h:53
void put_byte(uint8_t ch) override
Definition: vcp.cpp:106
uint32_t tx_bytes_free() override
Definition: vcp.cpp:81
virtual void write(const uint8_t *ch, uint8_t len) override
Definition: vcp.cpp:39
bool connected_
Definition: vcp.h:40
header file for the usbd_ioreq.c file
Definition: vcp.h:20
void end_write()
Definition: vcp.cpp:123
Header for usbd_cdc_vcp.c file.
Definition: serial.h:43
Definition: gpio.h:37
void unregister_rx_callback() override
Definition: vcp.cpp:131
bool set_baud_rate(uint32_t baud)
Header file for usbd_usr.c.
uint32_t rx_bytes_waiting() override
Definition: vcp.cpp:75
General low level driver configuration.
bool in_bulk_mode()
Definition: vcp.cpp:138
void send_disconnect_signal()
Definition: vcp.cpp:144
bool tx_buffer_empty() override
Definition: vcp.cpp:100
bool reset_
Definition: vcp.h:41
uint8_t bulk_mode_buffer[64]
Definition: vcp.h:49
uint8_t read_byte() override
Definition: vcp.cpp:87
header file for the usbd_desc.c file


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Wed Jul 3 2019 19:59:26