Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
TinyUsbCdc.hxx
Go to the documentation of this file.
1
34#ifndef _FREERTOS_DRIVERS_TINYUSB_TINYUSBCDC_HXX_
35#define _FREERTOS_DRIVERS_TINYUSB_TINYUSBCDC_HXX_
36
37#include "Devtab.hxx"
38#include "os/OS.hxx"
39#include "utils/Singleton.hxx"
40
41class TinyUsbCdc : public Node, public Singleton<TinyUsbCdc>
42{
43public:
44 TinyUsbCdc(const char *name)
45 : Node(name)
46 {
47 }
49
50 // Call this function once from hw_postinit.
51 void hw_postinit();
52
53 // Called from static C callback functions.
54 inline void rx_available();
55 inline void tx_complete();
56
57private:
58 void enable() override
59 {
60 }
61 void disable() override
62 {
63 }
64 void flush_buffers() override
65 {
66 }
67
74 bool select(File *file, int mode) override;
75
83 ssize_t read(File *file, void *buf, size_t count) override;
84
92 ssize_t write(File *file, const void *buf, size_t count) override;
93
96 {
97 public:
98 void *entry() override;
99 } usbdThread_;
100
103
106};
107
108#endif // _FREERTOS_DRIVERS_TINYUSB_TINYUSBCDC_HXX_
const char * name
device name
Definition Devtab.hxx:266
Node information.
Definition Devtab.hxx:549
This class provides a threading API.
Definition OS.hxx:46
Singleton class.
Definition Singleton.hxx:65
Thread for running the tiny usb device stack.
void * entry() override
User entry point for the created thread.
ssize_t write(File *file, const void *buf, size_t count) override
Write to a file or device.
bool select(File *file, int mode) override
Device select method.
Device::SelectInfo selectInfoWrite_
Handles the select for outgoing data (write).
void flush_buffers() override
Instructs the device driver to drop all TX and RX queues.
void enable() override
This will be called once when reference-count goes from 0 to positive.
ssize_t read(File *file, void *buf, size_t count) override
Read from a file or device.
Device::SelectInfo selectInfoRead_
Handles the select for incoming data (read).
void disable() override
This will be called when reference count goes from non-zero to 0.
Select wakeup information.
Definition Devtab.hxx:491
File information.
Definition Devtab.hxx:52