Open FFBoard
Open source force feedback firmware
USBdevice Class Reference

#include <USBdevice.h>

Inheritance diagram for USBdevice:
cpp_freertos::Thread

Public Member Functions

 USBdevice (const tusb_desc_device_t *deviceDesc, const uint8_t(*confDesc), const usb_string_desc_t *strings, uint8_t appendSerial=4)
 
virtual ~USBdevice ()
 
void Run ()
 
virtual void registerUsb ()
 
virtual const uint8_t * getUsbDeviceDesc ()
 
virtual const uint8_t * getUsbConfigurationDesc (uint8_t index)
 
virtual uint16_t * getUsbStringDesc (uint8_t index, uint16_t langid)
 
virtual std::string getUsbSerial ()
 
- Public Member Functions inherited from cpp_freertos::Thread
 Thread (const std::string Name, uint16_t StackDepth, UBaseType_t Priority)
 
 Thread (const char *Name, uint16_t StackDepth, UBaseType_t Priority)
 
 Thread (uint16_t StackDepth, UBaseType_t Priority)
 
bool Start ()
 
virtual ~Thread ()
 
TaskHandle_t GetHandle ()
 
void Suspend ()
 
void Resume ()
 
void ResumeFromISR ()
 
void Notify ()
 
void NotifyFromISR ()
 
uint32_t WaitForNotification (TickType_t Timeout=portMAX_DELAY)
 
UBaseType_t GetPriority ()
 
UBaseType_t GetPriorityFromISR ()
 
void SetPriority (UBaseType_t NewPriority)
 
std::string GetName ()
 
char * GetName ()
 

Protected Attributes

const tusb_desc_device_tdesc_device
 
const uint8_t * desc_conf
 
const usb_string_desc_tstring_desc
 
uint8_t appendSerial
 

Additional Inherited Members

- Static Public Member Functions inherited from cpp_freertos::Thread
static void Yield ()
 
static void StartScheduler ()
 
static void EndScheduler ()
 
- Protected Member Functions inherited from cpp_freertos::Thread
virtual void Cleanup ()
 
void Delay (const TickType_t Delay)
 
void DelayUntil (const TickType_t Period)
 
void ResetDelayUntil ()
 
bool Wait (ConditionVariable &Cv, Mutex &CvLock, TickType_t Timeout=portMAX_DELAY)
 

Detailed Description

This class defines a usb device and implements callbacks for getting the basic usb descriptors for tinyusb. Different usb configurations are predefined in usb_descriptors.c appendSerial: adds the last n chars of the serial number to the interface strings

Definition at line 26 of file USBdevice.h.

Constructor & Destructor Documentation

◆ USBdevice()

USBdevice::USBdevice ( const tusb_desc_device_t deviceDesc,
const uint8_t *  confDesc,
const usb_string_desc_t strings,
uint8_t  appendSerial = 4 
)

Definition at line 13 of file USBdevice.cpp.

◆ ~USBdevice()

USBdevice::~USBdevice ( )
virtual

Definition at line 18 of file USBdevice.cpp.

Member Function Documentation

◆ getUsbConfigurationDesc()

const uint8_t * USBdevice::getUsbConfigurationDesc ( uint8_t  index)
virtual

Definition at line 53 of file USBdevice.cpp.

◆ getUsbDeviceDesc()

const uint8_t * USBdevice::getUsbDeviceDesc ( )
virtual

Definition at line 49 of file USBdevice.cpp.

◆ getUsbSerial()

std::string USBdevice::getUsbSerial ( )
virtual

Generates a unique id string from the hardware id

Definition at line 43 of file USBdevice.cpp.

◆ getUsbStringDesc()

uint16_t * USBdevice::getUsbStringDesc ( uint8_t  index,
uint16_t  langid 
)
virtual

Returns a usb formatted string from the stringtable

Definition at line 60 of file USBdevice.cpp.

◆ registerUsb()

void USBdevice::registerUsb ( )
virtual

Registers the usb callbacks and starts the tinyusb main thread

Definition at line 25 of file USBdevice.cpp.

◆ Run()

void USBdevice::Run ( )
virtual

Implementation of your actual thread code. You must override this function.

Note
If INCLUDE_vTaskDelete is defined, then you may return from your Run method. This will cause the task to be deleted from FreeRTOS, however you are still responsible to delete the task object. If this is not defined, then retuning from your Run() method will result in an assert.

Implements cpp_freertos::Thread.

Definition at line 33 of file USBdevice.cpp.

Member Data Documentation

◆ appendSerial

uint8_t USBdevice::appendSerial
protected

Definition at line 42 of file USBdevice.h.

◆ desc_conf

const uint8_t* USBdevice::desc_conf
protected

Definition at line 40 of file USBdevice.h.

◆ desc_device

const tusb_desc_device_t* USBdevice::desc_device
protected

Definition at line 39 of file USBdevice.h.

◆ string_desc

const usb_string_desc_t* USBdevice::string_desc
protected

Definition at line 41 of file USBdevice.h.


The documentation for this class was generated from the following files: