Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: F401RE-USBHostMIDI_RecieveExample
Fork of F401RE-USBHost by
Diff: USBHost/USBHALHost_F401RE.h
- Revision:
- 11:61843badd06e
- Child:
- 16:981c3104f6c0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/USBHost/USBHALHost_F401RE.h Mon Jun 09 09:00:49 2014 +0000
@@ -0,0 +1,43 @@
+// Simple USBHost for Nucleo F401RE
+#pragma once
+#include "mbed.h"
+#include "USBHostTypes.h"
+#include "USBEndpoint.h"
+
+struct SETUP_PACKET {
+ uint8_t bmRequestType;
+ uint8_t bRequest;
+ uint16_t wValue;
+ uint16_t wIndex;
+ uint16_t wLength;
+};
+
+class USBHALHost {
+public:
+ uint8_t LastStatus;
+ uint8_t prev_LastStatus;
+
+protected:
+ USBHALHost();
+ void init();
+ virtual bool addDevice(USBDeviceConnected* parent, int port, bool lowSpeed) = 0;
+ void setAddr(int addr, bool lowSpeed = false){}
+ void setEndpoint(){}
+ void token_transfer_init(){}
+ int token_setup(USBEndpoint* ep, SETUP_PACKET* setup, uint16_t wLength = 0);
+ int token_in(USBEndpoint* ep, uint8_t* data = NULL, int size = 0, int retryLimit = 10);
+ int token_out(USBEndpoint* ep, const uint8_t* data = NULL, int size = 0, int retryLimit = 10);
+ int token_iso_in(USBEndpoint* ep, uint8_t* data, int size);
+ void token_ready(){}
+
+private:
+ int token_ctl_in(USBEndpoint* ep, uint8_t* data, int size, int retryLimit);
+ int token_int_in(USBEndpoint* ep, uint8_t* data, int size);
+ int token_blk_in(USBEndpoint* ep, uint8_t* data, int size, int retryLimit);
+ int token_ctl_out(USBEndpoint* ep, const uint8_t* data, int size, int retryLimit);
+ int token_int_out(USBEndpoint* ep, const uint8_t* data, int size);
+ int token_blk_out(USBEndpoint* ep, const uint8_t* data, int size, int retryLimit);
+ bool wait_attach();
+ static USBHALHost * instHost;
+};
+
