diff --git a/source/_static/amebapro2/Example_Guides/HTTP/HTTP_FS_MP4/image01.png b/source/_static/amebapro2/Example_Guides/HTTP/HTTP_FS_MP4/image01.png new file mode 100644 index 0000000..c058298 Binary files /dev/null and b/source/_static/amebapro2/Example_Guides/HTTP/HTTP_FS_MP4/image01.png differ diff --git a/source/_static/amebapro2/Example_Guides/HTTP/HTTP_FS_MP4/image02.png b/source/_static/amebapro2/Example_Guides/HTTP/HTTP_FS_MP4/image02.png new file mode 100644 index 0000000..618a339 Binary files /dev/null and b/source/_static/amebapro2/Example_Guides/HTTP/HTTP_FS_MP4/image02.png differ diff --git a/source/_static/amebapro2/Example_Guides/HTTP/HTTP_FS_MP4/image03.png b/source/_static/amebapro2/Example_Guides/HTTP/HTTP_FS_MP4/image03.png new file mode 100644 index 0000000..309f802 Binary files /dev/null and b/source/_static/amebapro2/Example_Guides/HTTP/HTTP_FS_MP4/image03.png differ diff --git a/source/_static/amebapro2/Example_Guides/HTTP/HTTP_FS_MP4/image04.png b/source/_static/amebapro2/Example_Guides/HTTP/HTTP_FS_MP4/image04.png new file mode 100644 index 0000000..33b5d75 Binary files /dev/null and b/source/_static/amebapro2/Example_Guides/HTTP/HTTP_FS_MP4/image04.png differ diff --git a/source/amebapro2/API_Documents/FileSystem/Class AmebaFatFS.rst b/source/amebapro2/API_Documents/FileSystem/Class AmebaFatFS.rst index 9bb201c..57f1ce3 100644 --- a/source/amebapro2/API_Documents/FileSystem/Class AmebaFatFS.rst +++ b/source/amebapro2/API_Documents/FileSystem/Class AmebaFatFS.rst @@ -177,12 +177,15 @@ Open a file. The file will be created if it does not already exist. .. code-block:: c++ File open(const String& path); + File open(const String &path, int fileType); File open(const char* path); + File open(const char *path, int fileType); **Parameters** ~~~~~~~~~~~~~~ path: The full path of the file to open. Expressed as a String class object or a pointer to a char array. +fileType: The macro of the file type defined in AmebaFatFSFile.h to support different opening steps for different types of file. **Returns** ~~~~~~~~~~~ diff --git a/source/amebapro2/API_Documents/FileSystem/Class File.rst b/source/amebapro2/API_Documents/FileSystem/Class File.rst index cad4ada..23878c6 100644 --- a/source/amebapro2/API_Documents/FileSystem/Class File.rst +++ b/source/amebapro2/API_Documents/FileSystem/Class File.rst @@ -58,6 +58,10 @@ A class for data manipulation of files in a file system. +---------------------------+------------------------------------------+ | File::convertMp3ToArray | Convert MP3 file to MP3data and MP3size. | +---------------------------+------------------------------------------+ +| File::setMp3DigitalVol | Control the digital gain of DAC. | ++---------------------------+------------------------------------------+ +| File::playmp3 | Execute convertMp3TArray. | ++---------------------------+------------------------------------------+ **File::File** -------------- @@ -74,11 +78,13 @@ Constructs a File object. File::File(void); File::File(const char* filename); + File::File(const char *filename, int fileType); **Parameters** ~~~~~~~~~~~~~~ filename: pointer to a char array containing the path of the file to open. +fileType: The macro of the file type defined in AmebaFatFSFile.h to support different opening steps for different types of file. **Returns** ~~~~~~~~~~~ @@ -106,6 +112,7 @@ Open a file from the file system. .. code-block:: c++ bool open(const char* filename); + bool open(const char *filename, int fileType); **Parameters** ~~~~~~~~~~~~~~ @@ -521,3 +528,75 @@ This function convert MP3 file into character array containing the MP3data witho NA .. note :: "AmebaFatFSFile.h" must be included to use the class function. + +**File::setMp3DigitalVol** +-------------------------- + +**Description** +~~~~~~~~~~~~~~~ + +Control the digital gain of DAC. + +**Syntax** +~~~~~~~~~~ + +.. code-block:: c++ + + void setMp3DigitalVol(uint8_t digitalVol); + +**Parameters** +~~~~~~~~~~~~~~ + +digitalVol: output digital volume + +.. note:: + Every Step is 0.375dB. + + | 0xAF: 0dB. + | 0xAE: -0.375dB. + | ... + | 0x00: -65.625dB. + +**Returns** +~~~~~~~~~~~ + +NA + +**Example Code** +~~~~~~~~~~~~~~~~ + +NA + +.. note :: "AmebaFatFSFile.h" must be included to use the class function. + +**File::playMp3** +----------------- + +**Description** +~~~~~~~~~~~~~~~ + +Execute convertMp3TArray. + +**Syntax** +~~~~~~~~~~ + +.. code-block:: c++ + + void playMp3(void); + +**Parameters** +~~~~~~~~~~~~~~ + +NA + +**Returns** +~~~~~~~~~~~ + +NA + +**Example Code** +~~~~~~~~~~~~~~~~ + +NA + +.. note :: "AmebaFatFSFile.h" must be included to use the class function. \ No newline at end of file diff --git a/source/amebapro2/API_Documents/HTTP/Class Httpfs.rst b/source/amebapro2/API_Documents/HTTP/Class Httpfs.rst new file mode 100644 index 0000000..76d0b62 --- /dev/null +++ b/source/amebapro2/API_Documents/HTTP/Class Httpfs.rst @@ -0,0 +1,134 @@ +Class Httpfs +============ + +.. contents:: + :local: + :depth: 2 + +**Httpfs Class** +----------------- + +**Description** +~~~~~~~~~~~~~~~~~ + +A class used HTTP File Server. + +**Syntax** +~~~~~~~~~~ + +.. code-block:: c++ + + class Httpfs + +**Members** +~~~~~~~~~~~ + ++-----------------------------------+-----------------------------------+ +| **Public Constructors** | | ++===================================+===================================+ +| Httpfs::Httpfs | Constructs a Httpfs object. | ++-----------------------------------+-----------------------------------+ +| **Public Methods** | ++-----------------------------------+-----------------------------------+ +| Httpfs::begin | Initializes the HTTP file server, | +| | set parameter, response callback | +| | function of the file server. | ++-----------------------------------+-----------------------------------+ +| Httpfs::mp4DirectoryInit | Initializes the directory to save | +| | MP4 recordings on SD card. | ++-----------------------------------+-----------------------------------+ +| Httpfs::end | Deinitializes the HTTP file | +| | server. | ++-----------------------------------+-----------------------------------+ + +**Httpfs::begin** +----------------- + +**Description** +~~~~~~~~~~~~~~~ + +Initializes the HTTP file server, set parameter, response callback function of the file server. + +**Syntax** +~~~~~~~~~~ + +.. code-block:: c++ + + void begin(void); + +**Parameters** +~~~~~~~~~~~~~~ + +NA + +**Returns** +~~~~~~~~~~~ + +NA + +**Example Code** +~~~~~~~~~~~~~~~~ + +Example: `Httpfs_mp4 `_ + +**Httpfs::mp4DirectoryInit** +---------------------------- + +**Description** +~~~~~~~~~~~~~~~ + +Initializes the directory to save MP4 recordings on SD card. + +**Syntax** +~~~~~~~~~~ + +.. code-block:: c++ + + void mp4DirectoryInit(void); + +**Parameters** +~~~~~~~~~~~~~~ + +NA + +**Returns** +~~~~~~~~~~~ + +NA + +**Example Code** +~~~~~~~~~~~~~~~~ + +Example: `Httpfs_mp4 `_ + +**Httpfs::end** +--------------- + +**Description** +~~~~~~~~~~~~~~~ + +Deinitializes the HTTP file server. + +**Syntax** +~~~~~~~~~~ + +.. code-block:: c++ + + void end(void); + +**Parameters** +~~~~~~~~~~~~~~ + +NA + +**Returns** +~~~~~~~~~~~ + +NA + +**Example Code** +~~~~~~~~~~~~~~~~ + +Example: `Httpfs_mp4 `_ + + diff --git a/source/amebapro2/API_Documents/HTTP/index.rst b/source/amebapro2/API_Documents/HTTP/index.rst new file mode 100644 index 0000000..d719319 --- /dev/null +++ b/source/amebapro2/API_Documents/HTTP/index.rst @@ -0,0 +1,7 @@ +HTTP +==== + +.. toctree:: + :maxdepth: 1 + + Class Httpfs \ No newline at end of file diff --git a/source/amebapro2/API_Documents/index.rst b/source/amebapro2/API_Documents/index.rst index a22e78c..7b06ef3 100644 --- a/source/amebapro2/API_Documents/index.rst +++ b/source/amebapro2/API_Documents/index.rst @@ -10,6 +10,7 @@ API Documents FlashMemory/index GPIO/index Gtimer/index + HTTP/index Multimedia/index NeuralNetwork/index NTPClient/index diff --git a/source/amebapro2/Example_Guides/HTTP/HTTP File Server and MP4.rst b/source/amebapro2/Example_Guides/HTTP/HTTP File Server and MP4.rst new file mode 100644 index 0000000..f9b1812 --- /dev/null +++ b/source/amebapro2/Example_Guides/HTTP/HTTP File Server and MP4.rst @@ -0,0 +1,58 @@ +HTTP File Server and MP4 +======================== + +.. contents:: + :local: + :depth: 2 + +Materials +--------- + +- `AMB82-mini `_ x 1 + +- MicroSD card x1 + +Example +------- + +In this example, we will use AmebaPro2 development board to establish a file server for mp4 recordings access. + +Open “File” -> “Examples” -> “AmebaHttp” -> “Http_fs_mp4”. + +|image01| + +In the highlighted section, kindly modify it according to your WiFi SSID and password. + +|image02| + +You may also change the mp4 recording duration (in seconds) and filecount. Please do not change the filename ("folder"/"file"). + +|image03| + +Then, compile and upload the code to AMB82 Mini. + +.. note :: Kindly insert SD card before pressing the reset button + +Open the serial monitor to view the logs. Please copy down the IP address and paste it on a web browser to view the file server page created. + +|image04| + +You may follow the instruction shown to download the mp4 recordings from AMB82 Mini over HTTP. + +.. note :: Kindly refresh the page to view the latest update on the file server + +.. |image01| image:: ../../../_static/amebapro2/Example_Guides/HTTP/HTTP_FS_MP4/image01.png + :width: 799 px + :height: 812 px + +.. |image02| image:: ../../../_static/amebapro2/Example_Guides/HTTP/HTTP_FS_MP4/image02.png + :width: 879 px + :height: 332 px + +.. |image03| image:: ../../../_static/amebapro2/Example_Guides/HTTP/HTTP_FS_MP4/image03.png + :width: 803 px + :height: 224 px + +.. |image04| image:: ../../../_static/amebapro2/Example_Guides/HTTP/HTTP_FS_MP4/image04.png + :width: 609 px + :height: 261 px \ No newline at end of file diff --git a/source/amebapro2/Example_Guides/HTTP/index.rst b/source/amebapro2/Example_Guides/HTTP/index.rst index a06fc16..ed94ad3 100644 --- a/source/amebapro2/Example_Guides/HTTP/index.rst +++ b/source/amebapro2/Example_Guides/HTTP/index.rst @@ -4,6 +4,7 @@ HTTP .. toctree:: :maxdepth: 1 + HTTP File Server and MP4 HTTP Post Image and MP4 HTTP Post MP4 Retrieve HTTP webs diff --git a/source/amebapro2/Example_Guides/Neural Network/Object Detection Image.rst b/source/amebapro2/Example_Guides/Neural Network/Object Detection Image.rst index c518adf..2778d31 100644 --- a/source/amebapro2/Example_Guides/Neural Network/Object Detection Image.rst +++ b/source/amebapro2/Example_Guides/Neural Network/Object Detection Image.rst @@ -142,7 +142,6 @@ Kindly refer to the list of objects below recognized by the default YOLO model, {78, "hair dryer" }, {79, "toothbrush" }`` - .. |image01| image:: ../../../_static/amebapro2/Example_Guides/Neural_Network/Neural_Network_-_Object_Detection_Image/image01.png :width: 1114 px :height: 963 px diff --git a/source/amebapro2/Example_Guides/Neural Network/Text-to-Speech NTP.rst b/source/amebapro2/Example_Guides/Neural Network/Text-to-Speech NTP.rst index 2e87a1d..b0aeb79 100644 --- a/source/amebapro2/Example_Guides/Neural Network/Text-to-Speech NTP.rst +++ b/source/amebapro2/Example_Guides/Neural Network/Text-to-Speech NTP.rst @@ -81,7 +81,3 @@ Resources .. |image_3rd_party| image:: ../../../_static/3rd_party_logo.png :scale: 10% - - - - diff --git a/source/amebapro2/Example_Guides/Neural Network/Text-to-Speech.rst b/source/amebapro2/Example_Guides/Neural Network/Text-to-Speech.rst index 9162fad..5e8651b 100644 --- a/source/amebapro2/Example_Guides/Neural Network/Text-to-Speech.rst +++ b/source/amebapro2/Example_Guides/Neural Network/Text-to-Speech.rst @@ -84,7 +84,3 @@ Resources .. |image_3rd_party| image:: ../../../_static/3rd_party_logo.png :scale: 10% - - - -