From 8036f1aec8206859d50944a0f6eac0080e439350 Mon Sep 17 00:00:00 2001 From: watson8544 <854410664@qq.com> Date: Wed, 19 Sep 2018 14:48:38 +0800 Subject: [PATCH] fixed some bug --- en/api-reference/mic/mic.rst | 41 ++++++---- .../ProgramSW_M5Flow_Get_Started_en.md | 1 + .../establish_serial_connection.rst | 62 ++++------------ en/get-started/how_to_burn_firmware_en.rst | 74 +++++++++---------- 4 files changed, 75 insertions(+), 103 deletions(-) create mode 100644 en/get-started/ProgramSW_M5Flow_Get_Started_en.md diff --git a/en/api-reference/mic/mic.rst b/en/api-reference/mic/mic.rst index 866532a4..6afe17a7 100644 --- a/en/api-reference/mic/mic.rst +++ b/en/api-reference/mic/mic.rst @@ -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() diff --git a/en/get-started/ProgramSW_M5Flow_Get_Started_en.md b/en/get-started/ProgramSW_M5Flow_Get_Started_en.md new file mode 100644 index 00000000..eac6d744 --- /dev/null +++ b/en/get-started/ProgramSW_M5Flow_Get_Started_en.md @@ -0,0 +1 @@ +# How to \ No newline at end of file diff --git a/en/get-started/establish_serial_connection.rst b/en/get-started/establish_serial_connection.rst index 625b5625..8e8b1449 100644 --- a/en/get-started/establish_serial_connection.rst +++ b/en/get-started/establish_serial_connection.rst @@ -16,46 +16,26 @@ Driver 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 `__ 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 `__ @@ -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.