Skip to content

Commit 8c33a4c

Browse files
committed
Add USB Mass Storage Example Guide and API
Add USB Mass Storage Example Guide and API
1 parent a88295c commit 8c33a4c

File tree

7 files changed

+353
-0
lines changed

7 files changed

+353
-0
lines changed
Loading
Loading
Loading
Lines changed: 311 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,311 @@
1+
Class USB Mass Storage
2+
=======================
3+
4+
.. contents::
5+
:local:
6+
:depth: 2
7+
8+
**USB Mass Storage Class**
9+
---------------------------
10+
11+
**Description**
12+
~~~~~~~~~~~~~~~
13+
14+
A class for USB Mass Storage API.
15+
16+
**Syntax**
17+
~~~~~~~~~~
18+
19+
.. code-block:: c++
20+
21+
class USBMassStorage
22+
23+
**Members**
24+
~~~~~~~~~~~
25+
26+
+------------------------------------------+-------------------------------------+
27+
| **Public Constructors** |
28+
+==========================================+=====================================+
29+
| USBMassStorage::USBMassStorage | Constructs a USBMassStorage object. |
30+
| | Initialize/Re-initialize of |
31+
| | using USB Mass Storage device. |
32+
+------------------------------------------+-------------------------------------+
33+
| **Public Methods** |
34+
+------------------------------------------+-------------------------------------+
35+
| USBMassStorage::USBInit | Initialize the USB hardware. |
36+
+------------------------------------------+-------------------------------------+
37+
| USBMassStorage::SDIOInit | Initialize the SDIO and related |
38+
| | GPIOs for SD card access. |
39+
+------------------------------------------+-------------------------------------+
40+
| USBMassStorage::USBStatus | Check the USB connection and |
41+
| | initialization status. |
42+
+------------------------------------------+-------------------------------------+
43+
| USBMassStorage::initializeDisk | Initialize disk operations for USB |
44+
| | Mass Storage. |
45+
+------------------------------------------+-------------------------------------+
46+
| USBMassStorage::loadUSBMassStorageDriver | Load and initialize the USB |
47+
| | Mass Storage Class (MSC) driver. |
48+
+------------------------------------------+-------------------------------------+
49+
| USBMassStorage::USBDeinit | Deinitialize the USB MSC driver |
50+
| | and free allocated resources. |
51+
+------------------------------------------+-------------------------------------+
52+
| USBMassStorage::isConnected | Check whether a USB host is |
53+
| | connected. |
54+
+------------------------------------------+-------------------------------------+
55+
56+
**USBMassStorage::USBMassStorage**
57+
----------------------------------
58+
59+
**Description**
60+
~~~~~~~~~~~~~~~
61+
62+
Constructs a USBMassStorage object. Initialize/Re-initialize of using USB Mass Storage device.
63+
64+
**Syntax**
65+
~~~~~~~~~~
66+
67+
.. code-block:: c++
68+
69+
USBMassStorage(void);
70+
71+
**Parameters**
72+
~~~~~~~~~~~~~~
73+
74+
NA
75+
76+
**Returns**
77+
~~~~~~~~~~~
78+
79+
NA
80+
81+
**Example Code**
82+
~~~~~~~~~~~~~~~~
83+
84+
Example: `USB_Mass_Storage <https://github.com/Ameba-AIoT/ameba-arduino-pro2/blob/dev/Arduino_package/hardware/libraries/USB/examples/USB_Mass_Storage/USB_Mass_Storage.ino>`_
85+
86+
.. note :: "USBMassStorage.h" must be included to use the class function.
87+
88+
**USBMassStorage::USBInit**
89+
----------------------------
90+
91+
**Description**
92+
~~~~~~~~~~~~~~~
93+
94+
Initialize the USB hardware.
95+
96+
**Syntax**
97+
~~~~~~~~~~
98+
99+
.. code-block:: c++
100+
101+
void USBInit(void);
102+
103+
**Parameters**
104+
~~~~~~~~~~~~~~
105+
106+
NA
107+
108+
**Returns**
109+
~~~~~~~~~~~
110+
111+
NA
112+
113+
**Example Code**
114+
~~~~~~~~~~~~~~~~
115+
116+
Example: `USB_Mass_Storage <https://github.com/Ameba-AIoT/ameba-arduino-pro2/blob/dev/Arduino_package/hardware/libraries/USB/examples/USB_Mass_Storage/USB_Mass_Storage.ino>`_
117+
118+
.. note :: "USBMassStorage.h" must be included to use the class function.
119+
120+
**USBMassStorage::SDIOInit**
121+
----------------------------
122+
123+
**Description**
124+
~~~~~~~~~~~~~~~
125+
126+
Initialize the SDIO and related GPIOs for SD card access.
127+
128+
**Syntax**
129+
~~~~~~~~~~
130+
131+
.. code-block:: c++
132+
133+
void SDIOInit(void);
134+
135+
**Parameters**
136+
~~~~~~~~~~~~~~
137+
138+
NA
139+
140+
**Returns**
141+
~~~~~~~~~~~
142+
143+
NA
144+
145+
**Example Code**
146+
~~~~~~~~~~~~~~~~
147+
148+
Example: `USB_Mass_Storage <https://github.com/Ameba-AIoT/ameba-arduino-pro2/blob/dev/Arduino_package/hardware/libraries/USB/examples/USB_Mass_Storage/USB_Mass_Storage.ino>`_
149+
150+
.. note :: "USBMassStorage.h" must be included to use the class function.
151+
152+
**USBMassStorage::USBStatus**
153+
-------------------------------
154+
155+
**Description**
156+
~~~~~~~~~~~~~~~
157+
158+
Check the USB connection and initialization status.
159+
160+
**Syntax**
161+
~~~~~~~~~~
162+
163+
.. code-block:: c++
164+
165+
int USBStatus(void);
166+
167+
**Parameters**
168+
~~~~~~~~~~~~~~
169+
170+
NA
171+
172+
**Returns**
173+
~~~~~~~~~~~
174+
175+
This function returns the USB status.
176+
177+
**Example Code**
178+
~~~~~~~~~~~~~~~~
179+
180+
Example: `USB_Mass_Storage <https://github.com/Ameba-AIoT/ameba-arduino-pro2/blob/dev/Arduino_package/hardware/libraries/USB/examples/USB_Mass_Storage/USB_Mass_Storage.ino>`_
181+
182+
.. note :: "USBMassStorage.h" must be included to use the class function.
183+
184+
**USBMassStorage::initializeDisk**
185+
-----------------------------------
186+
187+
**Description**
188+
~~~~~~~~~~~~~~~
189+
190+
Initialize disk operations for USB Mass Storage.
191+
192+
**Syntax**
193+
~~~~~~~~~~
194+
195+
.. code-block:: c++
196+
197+
void initializeDisk(void);
198+
199+
**Parameters**
200+
~~~~~~~~~~~~~~
201+
202+
NA
203+
204+
**Returns**
205+
~~~~~~~~~~~
206+
207+
NA
208+
209+
**Example Code**
210+
~~~~~~~~~~~~~~~~
211+
212+
Example: `USB_Mass_Storage <https://github.com/Ameba-AIoT/ameba-arduino-pro2/blob/dev/Arduino_package/hardware/libraries/USB/examples/USB_Mass_Storage/USB_Mass_Storage.ino>`_
213+
214+
.. note :: "USBMassStorage.h" must be included to use the class function.
215+
216+
**USBMassStorage::loadUSBMassStorageDriver**
217+
---------------------------------------------
218+
219+
**Description**
220+
~~~~~~~~~~~~~~~
221+
222+
Load and initialize the USB Mass Storage Class (MSC) driver
223+
224+
**Syntax**
225+
~~~~~~~~~~
226+
227+
.. code-block:: c++
228+
229+
void loadUSBMassStorageDriver(void);
230+
231+
**Parameters**
232+
~~~~~~~~~~~~~~
233+
234+
NA
235+
236+
**Returns**
237+
~~~~~~~~~~~
238+
239+
NA
240+
241+
**Example Code**
242+
~~~~~~~~~~~~~~~~
243+
244+
Example: `USB_Mass_Storage <https://github.com/Ameba-AIoT/ameba-arduino-pro2/blob/dev/Arduino_package/hardware/libraries/USB/examples/USB_Mass_Storage/USB_Mass_Storage.ino>`_
245+
246+
.. note :: "USBMassStorage.h" must be included to use the class function.
247+
248+
249+
**USBMassStorage::USBDeinit**
250+
------------------------------
251+
252+
**Description**
253+
~~~~~~~~~~~~~~~
254+
255+
Deinitialize the USB MSC driver and free allocated resources.
256+
257+
**Syntax**
258+
~~~~~~~~~~
259+
260+
.. code-block:: c++
261+
262+
void USBDeinit(void);
263+
264+
**Parameters**
265+
~~~~~~~~~~~~~~
266+
267+
NA
268+
269+
**Returns**
270+
~~~~~~~~~~~
271+
272+
NA
273+
274+
**Example Code**
275+
~~~~~~~~~~~~~~~~
276+
277+
NA
278+
279+
.. note :: "USBMassStorage.h" must be included to use the class function.
280+
281+
**USBMassStorage::isConnected**
282+
--------------------------------
283+
284+
**Description**
285+
~~~~~~~~~~~~~~~
286+
287+
Check whether a USB host is connected.
288+
289+
**Syntax**
290+
~~~~~~~~~~
291+
292+
.. code-block:: c++
293+
294+
void isConnected(void);
295+
296+
**Parameters**
297+
~~~~~~~~~~~~~~
298+
299+
NA
300+
301+
**Returns**
302+
~~~~~~~~~~~
303+
304+
This function returns the USB attach status, indicating whether a USB device is currently connected (attached) or not.
305+
306+
**Example Code**
307+
~~~~~~~~~~~~~~~~
308+
309+
Example: `USB_Mass_Storage <https://github.com/Ameba-AIoT/ameba-arduino-pro2/blob/dev/Arduino_package/hardware/libraries/USB/examples/USB_Mass_Storage/USB_Mass_Storage.ino>`_
310+
311+
.. note :: "USBMassStorage.h" must be included to use the class function.

source/ameba_pro2/amb82-mini/API_Documents/USB/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ USB
55
:maxdepth: 1
66

77
Class UVCD
8+
Class USB Mass Storage
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
USB Mass Storage
2+
================
3+
4+
.. contents::
5+
:local:
6+
:depth: 2
7+
8+
Materials
9+
---------
10+
11+
- `AMB82-mini <https://www.amebaiot.com/en/where-to-buy-link/#buy_amb82_mini>`_ x 1
12+
- SD Card x 1
13+
14+
Example
15+
-------
16+
17+
In this example, the device is setup to function as a USB Mass Storage and uses SD card as its physical memory medium.
18+
USB host end can recognize device and write data to and read data from SD card via USB interface.
19+
20+
Open the example in “File” -> “Examples” -> “AmebaUSB” -> “USB_Mass_Storage”. Compile and upload to Ameba, then press the reset button.
21+
22+
|image01|
23+
24+
Connect the “USB OTG” via micro-USB cable to the target device such as PC, then use the Ameba device as a mass storage.
25+
26+
Set “PRINT_USB_OTG_CONNECTION_STATUS” to 1 to enable printing of attached status in Serial Monitor.
27+
28+
|image02|
29+
30+
|image03|
31+
32+
.. |image01| image:: ../../../../_static/amebapro2/Example_Guides/USB/USB_Mass_Storage/image01.png
33+
:width: 697 px
34+
:height: 817 px
35+
.. |image02| image:: ../../../../_static/amebapro2/Example_Guides/USB/USB_Mass_Storage/image02.png
36+
:width: 547 px
37+
:height: 551 px
38+
.. |image03| image:: ../../../../_static/amebapro2/Example_Guides/USB/USB_Mass_Storage/image03.png
39+
:width: 476 px
40+
:height: 295 px

source/ameba_pro2/amb82-mini/Example_Guides/USB/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ USB
55
:maxdepth: 1
66

77
UVC Device
8+
USB Mass Storage

0 commit comments

Comments
 (0)