daisy::USBHostHandle¶
Presents a USB Mass Storage Device host interface. More...
#include <usb_host.h>
Public Classes¶
Name | |
---|---|
struct | Config Configuration structure for interfacing with MSD Driver. |
Public Types¶
Name | |
---|---|
enum class | Result { OK, BUSY, FAIL, NOT_SUPPORTED, UNRECOVERED_ERROR, ERROR_SPEED_UNKNOWN} 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. |
typedef void(*)(void *data) | ConnectCallback User defineable callback for USB Connection. |
typedef void(*)(void *data) | DisconnectCallback User defineable callback for USB Disconnection. |
typedef void(*)(void *userdata) | ClassActiveCallback User defineable callback upon completion of class initialization For example, when a USB drive is connected and the mass storage class initialization has finished, this callback will fire. |
typedef void(*)(void *data) | ErrorCallback User defineable callback for USB Unrecoverable Error. |
Public Functions¶
Name | |
---|---|
Result | Init(Config config) |
Result | Deinit() |
Result | Process() |
Result | ReEnumerate() |
bool | GetReady() |
bool | GetPresent() |
USBHostHandle() | |
USBHostHandle(const USBHostHandle & other) =default | |
USBHostHandle & | operator=(const USBHostHandle & other) =default |
Detailed Description¶
Presents a USB Mass Storage Device host interface.
Author: Gabriel Ball
Date: September 16, 2021
Public Types Documentation¶
enum Result¶
Enumerator | Value | Description |
---|---|---|
OK | ||
BUSY | ||
FAIL | ||
NOT_SUPPORTED | ||
UNRECOVERED_ERROR | ||
ERROR_SPEED_UNKNOWN |
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.
At this time, these correlate directly to the ST Middleware USBH_StatusTypeDef codes
typedef ConnectCallback¶
User defineable callback for USB Connection.
typedef DisconnectCallback¶
User defineable callback for USB Disconnection.
typedef ClassActiveCallback¶
User defineable callback upon completion of class initialization For example, when a USB drive is connected and the mass storage 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 ErrorCallback¶
User defineable callback for USB Unrecoverable Error.
Todo: add some sort of feedback about the type of error, etc. if possible
Public Functions Documentation¶
function Init¶
Parameters:
- config Configuration struct for initialization
Initializes the USB drivers and starts timeout.
function Deinit¶
Deinitializes MSD-related peripherals
function Process¶
Manages usb host functionality
function ReEnumerate¶
Forces USB host to re-enumerate device
function GetReady¶
Returns true if a Mass Storage Device is connected and ready for communicaton
function GetPresent¶
Run after the first Process
call to detect if a device is present
function USBHostHandle¶
function USBHostHandle¶
function operator=¶
---¶
Updated on 2024-01-03 at 19:41:00 +0000