Class daisy::USBHostHandle¶
ClassList > daisy > USBHostHandle
Presents a USB Mass Storage Device host interface. More...
#include <usb_host.h>
Classes¶
Type | Name |
---|---|
struct | Config Configuration structure for interfacing with USB host Driver. |
Public Types¶
Type | Name |
---|---|
typedef void(* | ClassActiveCallback User defineable callback upon completion of class initialization For example, when a USB drive is connected and the usb device class initialization has finished, this callback will fire. |
typedef void(* | ConnectCallback User defineable callback for USB Connection. |
typedef void(* | DisconnectCallback User defineable callback for USB Disconnection. |
typedef void(* | ErrorCallback User defineable callback for USB Unrecoverable Error. |
enum | Result return codes from the USB Processing can be used to check the state of USB while running outside of what may be happening with the limited user callbacks. |
Public Functions¶
Type | Name |
---|---|
Result | Deinit () |
bool | GetPresent () |
const char * | GetProductName () |
bool | GetReady () |
Result | Init (USBHostHandle::Config & config) |
bool | IsActiveClass (USBH_ClassTypeDef * usbClass) |
bool | IsDeviceConnected () Returns if the ST Middleware detects a connected device. |
bool | IsPortEnabled () Returns if the HAL detects that the port is enabled. |
Result | Process () |
Result | ReEnumerate () |
Result | RegisterClass (USBH_ClassTypeDef * pClass) |
USBHostHandle () |
|
USBHostHandle (const USBHostHandle & other) = default |
|
USBHostHandle & | operator= (const USBHostHandle & other) = default |
Detailed Description¶
Author:
Gabriel Ball
Date:
September 16, 2021
Public Types Documentation¶
typedef ClassActiveCallback¶
User defineable callback upon completion of class initialization For example, when a USB drive is connected and the usb device class initialization has finished, this callback will fire.
Parameters:
userdata
a pointer to some arbitrary data for use by the user. this is supplied in the Config struct. Can be used to avoid globals.
Todo
At some point this may be replaced for individual callbacks for each supported USB Host class.
typedef ConnectCallback¶
User defineable callback for USB Connection.
typedef DisconnectCallback¶
User defineable callback for USB Disconnection.
typedef ErrorCallback¶
User defineable callback for USB Unrecoverable Error.
Todo
add some sort of feedback about the type of error, etc. if possible
enum Result¶
return codes from the USB Processing can be used to check the state of USB while running outside of what may be happening with the limited user callbacks.
enum daisy::USBHostHandle::Result {
OK,
BUSY,
FAIL,
NOT_SUPPORTED,
UNRECOVERED_ERROR,
ERROR_SPEED_UNKNOWN
};
At this time, these correlate directly to the ST Middleware USBH_StatusTypeDef codes
Public Functions Documentation¶
function Deinit¶
Deinitializes USB host-related peripherals
function GetPresent¶
Run after the first Process
call to detect if a device is present
function GetProductName¶
Returns name of the connected devices if there is one
function GetReady¶
Returns true if a Mass Storage Device is connected and ready for communicaton
function Init¶
Initializes the USB drivers and starts timeout.
Parameters:
config
Configuration struct for initialization
function IsActiveClass¶
Returns true if the specified class is active
function IsDeviceConnected¶
Returns if the ST Middleware detects a connected device.
function IsPortEnabled¶
Returns if the HAL detects that the port is enabled.
function Process¶
Manages usb host functionality
function ReEnumerate¶
Forces USB host to re-enumerate device
function RegisterClass¶
Register a USB class
function USBHostHandle [½]¶
function USBHostHandle [2/2]¶
function operator=¶
The documentation for this class was generated from the following file external-docs/libDaisy/src/hid/usb_host.h