Presents a USB Mass Storage Device host interface. More...
Presents a USB Mass Storage Device host interface.
#include <usb_host.h>
Classes | |
struct | Config |
Configuration structure for interfacing with USB host Driver. More... | |
Public Types | |
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. More... | |
typedef void(* | ConnectCallback) (void *data) |
User defineable callback for USB Connection. | |
typedef void(* | DisconnectCallback) (void *data) |
User defineable callback for USB Disconnection. | |
typedef void(* | ClassActiveCallback) (void *userdata) |
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(* | ErrorCallback) (void *data) |
User defineable callback for USB Unrecoverable Error. | |
Public Member Functions | |
Result | RegisterClass (USBH_ClassTypeDef *pClass) |
Result | Init (USBHostHandle::Config &config) |
Result | Deinit () |
bool | IsActiveClass (USBH_ClassTypeDef *usbClass) |
Result | Process () |
Result | ReEnumerate () |
bool | GetReady () |
bool | GetPresent () |
const char * | GetProductName () |
bool | IsPortEnabled () |
Returns if the HAL detects that the port is enabled. | |
bool | IsDeviceConnected () |
Returns if the ST Middleware detects a connected device. | |
USBHostHandle () | |
USBHostHandle (const USBHostHandle &other)=default | |
USBHostHandle & | operator= (const USBHostHandle &other)=default |
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.
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. |
User defineable callback for USB Connection.
User defineable callback for USB Disconnection.
User defineable callback for USB Unrecoverable Error.
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
Enumerator | |
---|---|
OK | |
BUSY | |
FAIL | |
NOT_SUPPORTED | |
UNRECOVERED_ERROR | |
ERROR_SPEED_UNKNOWN |
|
inline |
|
default |
Result daisy::USBHostHandle::Deinit | ( | ) |
Deinitializes USB host-related peripherals
bool daisy::USBHostHandle::GetPresent | ( | ) |
Run after the first Process
call to detect if a device is present
Returns name of the connected devices if there is one
bool daisy::USBHostHandle::GetReady | ( | ) |
Returns true if a Mass Storage Device is connected and ready for communicaton
Result daisy::USBHostHandle::Init | ( | USBHostHandle::Config & | config | ) |
Initializes the USB drivers and starts timeout.
config | Configuration struct for initialization |
bool daisy::USBHostHandle::IsActiveClass | ( | USBH_ClassTypeDef * | usbClass | ) |
Returns true if the specified class is active
bool daisy::USBHostHandle::IsDeviceConnected | ( | ) |
Returns if the ST Middleware detects a connected device.
bool daisy::USBHostHandle::IsPortEnabled | ( | ) |
Returns if the HAL detects that the port is enabled.
|
default |
Result daisy::USBHostHandle::Process | ( | ) |
Manages usb host functionality
Result daisy::USBHostHandle::ReEnumerate | ( | ) |
Forces USB host to re-enumerate device
Result daisy::USBHostHandle::RegisterClass | ( | USBH_ClassTypeDef * | pClass | ) |
Register a USB class