fixed some bug

This commit is contained in:
watson8544
2018-09-19 14:48:38 +08:00
parent ce92178a73
commit 8036f1aec8
4 changed files with 75 additions and 103 deletions
+26 -15
View File
@@ -1,37 +1,48 @@
# Usage
.. code:: python
Mic API
********
-----------------------------
Function
---------
---------------------
Usage
------
.. code:: python
from m5stack import *
import machine, _thread
import machine, _thread
mic_adc = 0
buffer = []
def microphone_enter():
def microphone_enter():
print('microphone_enter')
global mic_adc, buffer
try:
mic_adc = machine.ADC(34)
global mic_adc, buffer
try:
mic_adc = machine.ADC(34)
mic_adc.atten(mic_adc.ATTN_11DB)
dac = machine.DAC(machine.Pin(25))
dac.write(0)
except:
except:
pass
buffer = []
for i in range(0, 55):
for i in range(0, 55):
buffer.append(0)
def microphone_loop():
def microphone_loop():
global mic_adc, buffer
val = 0
for i in range(0, 32):
for i in range(0, 32):
raw = (mic_adc.readraw() - 1845) // 10
if raw > 20:
raw = 20
elif raw < -20:
raw = -20
val += raw
val += raw
val = val // 32
buffer.pop()
buffer.insert(0, val)
@@ -41,5 +52,5 @@
microphone_enter()
while 1:
while 1:
microphone_loop()
@@ -0,0 +1 @@
# How to
+15 -47
View File
@@ -16,46 +16,26 @@ Driver <https://www.silabs.com/documents/public/software/Mac_OSX_VCP_Driver.zip>
As the disk image SiLabsUSBDriverDisk.dmg is downloaded, mount it.
Proceed according to the instructions OK.
.. figure:: ../../_static/getting_started_pics/establish_serial_connection/macOS_CP2104_dmg.png
:alt: image
.. image:: ../../_static/getting_started_pics/establish_serial_connection/macOS_CP2104_dmg.png
image
.. figure:: ../../_static/getting_started_pics/establish_serial_connection/macOS_CP2104_pkg.png
:alt: image
.. image:: ../../_static/getting_started_pics/establish_serial_connection/macOS_CP2104_pkg.png
image
.. figure:: ../../_static/getting_started_pics/establish_serial_connection/2.png
:alt: image
.. image:: ../../_static/getting_started_pics/establish_serial_connection/2.png
image
.. figure:: ../../_static/getting_started_pics/establish_serial_connection/3.png
:alt: image
.. image:: ../../_static/getting_started_pics/establish_serial_connection/3.png
image
.. figure:: ../../_static/getting_started_pics/establish_serial_connection/4.png
:alt: image
.. image:: ../../_static/getting_started_pics/establish_serial_connection/4.png
image
.. figure:: ../../_static/getting_started_pics/establish_serial_connection/5.png
:alt: image
.. image:: ../../_static/getting_started_pics/establish_serial_connection/5.png
image
.. figure:: ../../_static/getting_started_pics/establish_serial_connection/6.png
:alt: image
.. image:: ../../_static/getting_started_pics/establish_serial_connection/6.png
image
.. figure:: ../../_static/getting_started_pics/establish_serial_connection/7.png
:alt: image
.. image:: ../../_static/getting_started_pics/establish_serial_connection/7.png
image
.. figure:: ../../_static/getting_started_pics/establish_serial_connection/8.png
:alt: image
.. image:: ../../_static/getting_started_pics/establish_serial_connection/8.png
image
.. figure:: ../../_static/getting_started_pics/establish_serial_connection/9.png
:alt: image
.. image:: ../../_static/getting_started_pics/establish_serial_connection/9.png
image
2. Check port on MacOS
^^^^^^^^^^^^^^^^^^^^^^
@@ -82,24 +62,16 @@ Driver <https://www.silabs.com/products/development-tools/software/usb-to-uart-b
Choice the version of USB driver according to your windows
version(Windows7/8/10).
.. figure:: ../../_static/getting_started_pics/establish_serial_connection/windows_download_CP2104_USB_driver.png
:alt: image
.. image:: ../../_static/getting_started_pics/establish_serial_connection/windows_download_CP2104_USB_driver.png
image
Choice the right version installer(x64/x86), and install it.
.. figure:: ../../_static/getting_started_pics/establish_serial_connection/windows_install_usb_driver01.png
:alt: image
.. image:: ../../_static/getting_started_pics/establish_serial_connection/windows_install_usb_driver01.png
image
.. figure:: ../../_static/getting_started_pics/establish_serial_connection/windows_install_usb_driver02.png
:alt: image
.. image:: ../../_static/getting_started_pics/establish_serial_connection/windows_install_usb_driver02.png
image
.. figure:: ../../_static/getting_started_pics/establish_serial_connection/windows_install_usb_driver03.png
:alt: image
.. image:: ../../_static/getting_started_pics/establish_serial_connection/windows_install_usb_driver03.png
image
2. Check port on Windows
^^^^^^^^^^^^^^^^^^^^^^^^
@@ -109,8 +81,4 @@ disappears from the list and then shows back again.
Figures below show serial port for M5Stack Core board
.. figure:: ../../_static/getting_started_pics/establish_serial_connection/windows_m5stack_in_device_manager.png
:alt: image
image
.. image:: ../../_static/getting_started_pics/establish_serial_connection/windows_m5stack_in_device_manager.png
+33 -41
View File
@@ -4,41 +4,42 @@ How to Burn Firmware
This article will guide you how to burn a right firmware to your board.
For MacOS
~~~~~~~~~
---------
***(Coming soon...)***
**(Coming soon...)**
For Windows
~~~~~~~~~~~
-----------
1. Download M5Burner
^^^^^^^^^^^^^^^^^^^^
::::::::::::::::::::
For downloading M5Burner, visit the `offical
website <http://www.m5stack.com>`__ please.
.. figure:: ../../_static/getting_started_pics/download_M5Burner.png
:alt: image
.. image:: ../../_static/getting_started_pics/download_M5Burner.png
image
2. Burn the firmware
^^^^^^^^^^^^^^^^^^^^
::::::::::::::::::::
Unpack the M5Burner tool which you donwloaded for official website just
now in any folder, then execute the executable file ``M5Burner.exe``.
.. figure:: ../../_static/getting_started_pics/burn_firmware_01.png
:alt: image
.. image:: ../../_static/getting_started_pics/burn_firmware_01.png
image
**Then choice the ``serial port`` which is connected with your board and
the ``Baud`` which is 921600 following below steps.**
Then choice the ``serial port`` which is connected with your board and
the ``Baud`` which is 921600 following below steps.
.. figure:: ../../_static/getting_started_pics/burn_firmware_02.png
:alt: image
.. image:: ../../_static/getting_started_pics/burn_firmware_02.png
image
**1. Choice a right firmware**
**Note:**
^^^^^^^^^^^
If only ``COM1`` exists at the option, you need to visit this article `establish_serial_connection`_ and reinstall the USB driver.
.. _establish_serial_connection: establish_serial_connection.html
a. Choice a right firmware
"""""""""""""""""""""""""""
a. select ``M5Flow-vx.x`` option, if you want to program with
`M5Flow <http://flow.m5stack.com>`__
@@ -46,38 +47,29 @@ a. select ``M5Flow-vx.x`` option, if you want to program with
b. select ``M5Cam-vx.x (/M5Cam-psram)`` option, if you own a ESP32CAM (/
M5CAMERA)
**2. Click ``Erase``**
b. Click Erase
"""""""""""""""""""""""""""
.. figure:: ../../_static/getting_started_pics/burn_firmware_06.png
:alt: image
.. image:: ../../_static/getting_started_pics/burn_firmware_06.png
image
*If M5Burner shows the information ``Hard resetting via RTS pin...``
below, it means chip has been erased successfully.*
If M5Burner shows the information ``Hard resetting via RTS pin...``
below, it means chip has been erased successfully.
.. figure:: ../../_static/getting_started_pics/burn_firmware_04.png
:alt: image
.. image:: ../../_static/getting_started_pics/burn_firmware_04.png
image
**3. Click ``Burn``**
c. Click Burn
"""""""""""""""""""""""""""
.. figure:: ../../_static/getting_started_pics/burn_firmware_03.png
:alt: image
.. image:: ../../_static/getting_started_pics/burn_firmware_03.png
image
*If M5Burner shows the information ``Leaving... Staying in bootloader.``
below, it means chip has been burnt successfully.*
If M5Burner shows the information ``Leaving... Staying in bootloader.``
below, it means chip has been burnt successfully.
.. figure:: ../../_static/getting_started_pics/burn_firmware_05.png
:alt: image
.. image:: ../../_static/getting_started_pics/burn_firmware_05.png
image
***Note:***
**Note:**
^^^^^^^^^^^
***1. If M5Burner means be busy after clicking ``Burn``, please wait for
a few minutes. It'll be normal after the firmware has been burnt
successfully.***
* If M5Burner means be busy after clicking ``Burn``, please wait for a few minutes. It'll be normal after the firmware has been burnt successfully.
***2. If the burning procedure has been interrupted(like M5Burner has
been closed suddenly...), it's better to burn your board again.***
* If the burning procedure has been interrupted(like M5Burner has been closed suddenly...), it's better to burn your board again.