Merge pull request #3 from m5stack/dev-readthedocs

Dev readthedocs
This commit is contained in:
LiHuashen
2018-08-07 11:21:15 +08:00
committed by GitHub
27 changed files with 417 additions and 82 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 14 KiB

+113
View File
@@ -0,0 +1,113 @@
Timer API
**********
-----------------------------
Description
------------
The ESP32 chip contains two hardware timer groups. Each group has two general-purpose hardware timers. They are all 64-bit generic timers based on 16-bit prescalers and 64-bit auto-reload-capable up / down counters.
*Note: Due to MicroPython callback latency, some callbacks may not be executed if the timer period is less than 15 ms.
The number of events and executed callbacks can be checked using tm.events() method.*
-----------------------------
Function
---------
machine.Timer(timer_no)
>>>>>>>>>>>>>>>>>>>>>>>>
| **Description:**   
| Create the Timer instance object
| **Parament:**
| **timer_no:** the timer number to be used for the timer
| **Example:**
.. code:: python
import machine
p1 = machine.Pin(27)
init(period, mode, callback, dbgpin)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
| **Description:**   
| initialize paraments of the timer
| **Parament:**
| **period:** Timer period(Default: 10 ms)
| *Note: Timer period in ms, only used for PERIODIC and ONE_SHOT timers*
| **mode:** Timer mode of operation(Default: PERIODIC)
| **callback:** The Python callback function to be executed on timer event(Default: None)
| **dbgpin:** GPIO pin to be used as debug output(Default: -1 (not used))
| *Note: If used, the gpio level will toggle on each timer event*
| **Return:**
| None
| **Example:**
.. code:: python
from machine import SPI, Pin
spi = SPI(
spihost=SPI.HSPI,
baudrate=2600000
sck=Pin(18),
mosi=Pin(23),
miso=Pin(19),
cs=Pin(4)
)
spi.write(buf) #NOHEAP
value()
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
| **Description:**   
| **Return:**
| Returns the current timer counter value in **µs** if timer mode is CHRONO or in **ms** for other modes
| **Example:**
.. code:: python
import machine
p1 = machine.Pin(27)
p1.init(p1.OUT)
p1.value(1)
---------------------
Usage
------
.. code:: python
import machine
tcounter = 0
p1 = machine.Pin(27)
p1.init(p1.OUT)
p1.value(1)
def tcb(timer):
global tcounter
if tcounter & 1:
p1.value(0)
else:
p1.value(1)
tcounter += 1
if (tcounter % 10000) == 0:
print("[tcb] timer: {} counter: {}".format(timer.timernum(), tcounter))
t1 = machine.Timer(2)
t1.init(period=20, mode=t1.PERIODIC, callback=tcb)
+108
View File
@@ -0,0 +1,108 @@
UART API
*********
-----------------------------
Description
------------
An Universal Asynchronous Receiver/Transmitter (UART) is a component known to handle the timing requirements for a variety of widely-adapted protocols (RS232, RS485, RS422, …).
An UART provides a widely adopted and cheap method to realize full-duplex data exchange among different devices.
There are three UART controllers available on the ESP32 chip. They are compatible with UART-enabled devices from various manufacturers. All UART controllers integrated in the ESP32 feature an identical set of registers for ease of programming and flexibility. In this documentation, these controllers are referred to as UART0, UART1, and UART2.
-----------------------------
Function
---------
machine.UART(uart_num, tx=pin, rx=pin [,args])
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
| **Description:**   
| Create the uart instance object
| **Parament:**
| **uart_num:** The hardware SPI host. machine-SPI.HSPI (1) or machine.SPI.VSPI (2) can be used. Default: 1
| **tx:** the gpio used for tx
| **rx:** the gpio used for rx
| **Example:**
.. code:: python
from machine import UART
uart2 = UART(2, tx=17, rx=16)
uart2.init(115200, bits=8, parity=None, stop=1)
write(buf [, len [, off]])
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
| **Description:**   
| Write bytes from buffer object ḃuf to UART
| **Parament:**
| **buf:** data buffer to be write
| **len:** writes `ŀen` bytes
| **off:** starts writting from `off` position in `buf`
| **Example:**
.. code:: python
from machine import UART
uart2 = UART(2, tx=17, rx=16)
uart2.init(115200, bits=8, parity=None, stop=1)
uart2.write('abc') # write the 3 characters
read()
>>>>>>>
| **Description:**   
| read all available characters
| **Example:**
.. code:: python
from machine import UART
uart2 = UART(2, tx=17, rx=16)
uart2.init(115200, bits=8, parity=None, stop=1)
uart2.read() # read all available characters
readline([max_len])
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
| **Description:**   
| Reads all bytes from the receive buffer up to the line end character **\n**
| **Parament:**
| **max_len:** maximum length to be read
| **Example:**
.. code:: python
from machine import UART
uart2 = UART(2, tx=17, rx=16)
uart2.init(115200, bits=8, parity=None, stop=1)
uart2.readline() # read a line
---------------------
Usage
------
.. code:: python
from machine import UART
uart2 = UART(2, tx=17, rx=16)
uart2.init(115200, bits=8, parity=None, stop=1)
uart2.read(10) # read 10 characters, returns a bytes object
uart2.read() # read all available characters
uart2.readline() # read a line
uart2.readinto(buf) # read and store into the given buffer
uart2.write('abc') # write the 3 characters
+3 -1
View File
@@ -1,2 +1,4 @@
ESP32CAM Cases
****************
****************
*Coming soon! Please wait!*
+1
View File
@@ -9,6 +9,7 @@ Basic Cases
M5GO <m5go/index>
ESP32CAM <esp32cam/index>
*Coming soon! Please wait!*
+3 -1
View File
@@ -1,2 +1,4 @@
M5GO Cases
****************
****************
*Coming soon! Please wait!*
+4 -1
View File
@@ -1,2 +1,5 @@
M5Stack Core Cases
*******************
*******************
*Coming soon! Please wait!*
@@ -0,0 +1,9 @@
### M5Stack Game
#### 1. M5Stack-nesemu
This is a quick and dirty port of Nofrendo, a Nintendo Entertainment System emulator. It lacks sound, but can emulate a NES at close to full speed, albeit with some framedrop due to the way the display is driven.
https://github.com/m5stack/M5Stack-nesemu
+26 -24
View File
@@ -1,19 +1,19 @@
Establish Serial Connection with ESP32
======================================
Establish Serial Connection with M5Stack Board based on ESP32
==============================================================
This section provides guidance how to establish serial connection between ESP32 and PC.
This section provides guidance how to establish serial connection between your board and PC.
Connect ESP32 to PC
--------------------
Connect your board to PC
-------------------------
Connect the ESP32 board to the PC using the USB cable. If device driver does not install automatically, identify USB to serial converter chip on your ESP32 board (or external converter dongle), search for drivers in internet and install them.
Connect the your board board to the PC using the USB cable. If device driver does not install automatically, identify USB to serial converter chip on your your board board (or external converter dongle), search for drivers in internet and install them.
Below are the links to drivers for ESP32 boards produced by Espressif:
Below are the links to drivers for your board boards produced by Espressif:
* ESP32-PICO-KIT and ESP32-DevKitC - `CP210x USB to UART Bridge VCP Drivers <https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers>`_
* your board-PICO-KIT and your board-DevKitC - `CP210x USB to UART Bridge VCP Drivers <https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers>`_
* ESP32-WROVER-KIT and ESP32 Demo Board - `FTDI Virtual COM Port Drivers <http://www.ftdichip.com/Drivers/VCP.htm>`_
* your board-WROVER-KIT and your board Demo Board - `FTDI Virtual COM Port Drivers <http://www.ftdichip.com/Drivers/VCP.htm>`_
Above drivers are primarily for reference. They should already be bundled with the operating system and installed automatically once one of listed boards is connected to the PC.
@@ -21,18 +21,18 @@ Above drivers are primarily for reference. They should already be bundled with t
Check port on Windows
---------------------
Check the list of identified COM ports in the Windows Device Manager. Disconnect ESP32 and connect it back, to verify which port disappears from the list and then shows back again.
Check the list of identified COM ports in the Windows Device Manager. Disconnect your board and connect it back, to verify which port disappears from the list and then shows back again.
Figures below show serial port for ESP32 DevKitC and ESP32 WROVER KIT
Figures below show serial port for your board DevKitC and your board WROVER KIT
.. figure:: ../../_static/esp32-devkitc-in-device-manager.png
.. figure:: ../../_static/establish_serial_port/your board-devkitc-in-device-manager.png
:align: center
:alt: USB to UART bridge of ESP32-DevKitC in Windows Device Manager
:alt: USB to UART bridge of your board-DevKitC in Windows Device Manager
:figclass: align-center
USB to UART bridge of ESP32-DevKitC in Windows Device Manager
USB to UART bridge of your board-DevKitC in Windows Device Manager
.. figure:: ../../_static/esp32-wrover-kit-in-device-manager.png
.. figure:: ../../_static/establish_serial_port/your board-wrover-kit-in-device-manager.png
:align: center
:alt: Two USB Serial Ports of ESP-WROVER-KIT in Windows Device Manager
:figclass: align-center
@@ -43,7 +43,7 @@ Figures below show serial port for ESP32 DevKitC and ESP32 WROVER KIT
Check port on Linux and MacOS
-----------------------------
To check the device name for the serial port of your ESP32 board (or external converter dongle), run this command two times, first with the board / dongle unplugged, then with plugged in. The port which appears the second time is the one you need:
To check the device name for the serial port of your your board board (or external converter dongle), run this command two times, first with the board / dongle unplugged, then with plugged in. The port which appears the second time is the one you need:
Linux ::
@@ -73,14 +73,14 @@ Now verify that the serial connection is operational. You can do this using a se
Run terminal, set identified serial port, baud rate = 115200, data bits = 8, stop bits = 1, and parity = N. Below are example screen shots of setting the port and such transmission parameters (in short described as 115200-8-1-N) on Windows and Linux. Remember to select exactly the same serial port you have identified in steps above.
.. figure:: ../../_static/putty-settings-windows.png
.. figure:: ../../_static/establish_serial_port/putty-settings-windows.png
:align: center
:alt: Setting Serial Communication in PuTTY on Windows
:figclass: align-center
Setting Serial Communication in PuTTY on Windows
.. figure:: ../../_static/putty-settings-linux.png
.. figure:: ../../_static/establish_serial_port/putty-settings-linux.png
:align: center
:alt: Setting Serial Communication in PuTTY on Linux
:figclass: align-center
@@ -88,7 +88,7 @@ Run terminal, set identified serial port, baud rate = 115200, data bits = 8, sto
Setting Serial Communication in PuTTY on Linux
Then open serial port in terminal and check, if you see any log printed out by ESP32. The log contents will depend on application loaded to ESP32. An example log by ESP32 is shown below.
Then open serial port in terminal and check, if you see any log printed out by your board. The log contents will depend on application loaded to your board. An example log by your board is shown below.
.. highlight:: none
@@ -113,20 +113,22 @@ Then open serial port in terminal and check, if you see any log printed out by E
...
If you see some legible log, it means serial connection is working and you are ready to proceed with installation and finally upload of application to ESP32.
If you see some legible log, it means serial connection is working and you are ready to proceed with installation and finally upload of application to your board.
.. note::
For some serial port wiring configurations, the serial RTS & DTR pins need to be disabled in the terminal program before the ESP32 will boot and produce serial output. This depends on the hardware itself, most development boards (including all Espressif boards) *do not* have this issue. The issue is present if RTS & DTR are wired directly to the EN & GPIO0 pins. See the `esptool documentation`_ for more details.
For some serial port wiring configurations, the serial RTS & DTR pins need to be disabled in the terminal program before the your board will boot and produce serial output. This depends on the hardware itself, most development boards (including all Espressif boards) *do not* have this issue. The issue is present if RTS & DTR are wired directly to the EN & GPIO0 pins. See the `esptool documentation`_ for more details.
.. note::
Close serial terminal after verification that communication is working. In next step we are going to use another application to upload ESP32. This application will not be able to access serial port while it is open in terminal.
Close serial terminal after verification that communication is working. In next step we are going to use another application to upload your board. This application will not be able to access serial port while it is open in terminal.
If you got here from section :ref:`get-started-connect` when installing s/w for ESP32 development, then go back to section :ref:`get-started-configure`.
If you got here from section :ref:`get-started-connect` when installing s/w for your board development, then go back to section :ref:`get-started-configure`.
.. _esptool documentation: https://github.com/espressif/esptool/wiki/ESP32-Boot-Mode-Selection#automatic-bootloader
.. _esptool documentation: https://github.com/espressif/esptool/wiki/your board-Boot-Mode-Selection#automatic-bootloader
*Note: This article based on `Establish Serial Connection with ESP32 <https://docs.espressif.com/projects/esp-idf/en/latest/get-started/establish-serial-connection.html>`_ supported by Espressif Inc.*
+3 -3
View File
@@ -6,17 +6,17 @@ It is really really out of the box. Your ESP32CAM will immediately run without a
1. plug usb cable into ESP32CAM and open the serial terminal on your computer.
![image](screenshots/ESP32CAM_Terminal.png)
![image](../../_static/screenshots/ESP32CAM_Terminal.png)
2. Then waitting a few seconds, you connect to a AP named "`M5CAM`" with your computer(or mobile phone).
![image](screenshots/ESP32CAM_M5CAM.png)
![image](../../_static/screenshots/ESP32CAM_M5CAM.png)
3. And you open the browser on the computer(or mobile phone), enter a URL `http://192.168.4.1`. At the moment, your can see the real-time transmission of video by ESP32CAM on the browser.
![image](screenshots/ESP32CAM_Browser.png)
![image](../../_static/screenshots/ESP32CAM_Browser.png)
Now, A WebCam you achieved successfully !
@@ -0,0 +1,4 @@
#### Q1. How use RGB LED on M5 FIRE?
*Thank you for being interested in our products and services, Please contact us by [tech support email](tech@m5stack.com) or [forum](forum.m5stack.com) if you need any assistance.*
+3 -1
View File
@@ -6,4 +6,6 @@ M5Stack-FAQ
:maxdepth: 2
m5stack-core <m5stack-core/index>
m5stack-module <m5stack-module/index>
m5stack-module <m5stack-module/index>
`Thank you for being interested in our products and services, Please contact us by `tech support email <tech@m5stack.com>`_ or `forum <forum.m5stack.com>`_ if you need any assistance.`
@@ -0,0 +1,4 @@
#### Q1. How use RGB LED on M5 FIRE?
*Thank you for being interested in our products and services, Please contact us by [tech support email](tech@m5stack.com) or [forum](forum.m5stack.com) if you need any assistance.*
+8
View File
@@ -0,0 +1,8 @@
#### Q1. How to set up PlatformIO for M5Stack development?
A: https://github.com/m5stack/M5Stack-platformio
#### Q2. Cannot boot M5Cloud firmware on M5Stack FIRE on Windows PC using flash download tool?
*Thank you for being interested in our products and services, Please contact us by [tech support email](tech@m5stack.com) or [forum](forum.m5stack.com) if you need any assistance.*
+12 -14
View File
@@ -2,20 +2,6 @@
Product Documents
******************
STEAM Kit
~~~~~~~~~~~~~~~~~~~
.. toctree::
:maxdepth: 1
M5Stack M5GO <STEAM Kit/M5GO/m5go>
M5GO Unit ENV <STEAM Kit/M5GO/m5go_unit_env>
M5GO Unit HUB <STEAM Kit/M5GO/m5go_unit_hub>
M5GO Unit IR <STEAM Kit/M5GO/m5go_unit_ir>
M5GO Unit PIR <STEAM Kit/M5GO/m5go_unit_pir>
M5GO Unit POT <STEAM Kit/M5GO/m5go_unit_pot>
M5GO Unit RGB <STEAM Kit/M5GO/m5go_unit_rgb>
M5Stack Core
~~~~~~~~~~~~~~~~~~~
.. toctree::
@@ -42,7 +28,19 @@ Modules
M5Stack PROTO Module <modules/m5stack_proto_module>
M5Stack PROTO Kit <modules/m5stack_proto_kit>
STEAM Kit
~~~~~~~~~~~~~~~~~~~
.. toctree::
:maxdepth: 1
M5Stack M5GO <STEAM Kit/M5GO/m5go>
M5GO Unit ENV <STEAM Kit/M5GO/m5go_unit_env>
M5GO Unit HUB <STEAM Kit/M5GO/m5go_unit_hub>
M5GO Unit IR <STEAM Kit/M5GO/m5go_unit_ir>
M5GO Unit PIR <STEAM Kit/M5GO/m5go_unit_pir>
M5GO Unit POT <STEAM Kit/M5GO/m5go_unit_pot>
M5GO Unit RGB <STEAM Kit/M5GO/m5go_unit_rgb>
Tools
~~~~~~~~~~~~~~~~~~~
.. toctree::
@@ -62,8 +62,16 @@ DOCUMENTS
---------
- `Schematic <https://github.com/m5stack/M5-3D_and_PCB/blob/master/M5_Core_SCH(20171206).pdf>`__
- `Example <https://github.com/m5stack/M5Stack/tree/master/examples>`__
- `Datasheet <https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_cn.pdf>`__
(ESP32)
- `GitHub <https://github.com/m5stack/M5Stack>`__
- Example
+ `Arduino Example <https://github.com/m5stack/M5Stack/tree/master/examples>`__
- Datasheet
+ `ESP32 <https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_cn.pdf>`__
- GitHub
+ `Arduino GitHub <https://github.com/m5stack/M5Stack>`__

Some files were not shown because too many files have changed in this diff Show More