diff --git a/docs/develop/extendingmicropython.rst b/docs/develop/extendingmicropython.rst index 7fb1ae47a..b4029c421 100644 --- a/docs/develop/extendingmicropython.rst +++ b/docs/develop/extendingmicropython.rst @@ -16,4 +16,3 @@ live in the main MicroPython repository. cmodules.rst natmod.rst - \ No newline at end of file diff --git a/docs/develop/gettingstarted.rst b/docs/develop/gettingstarted.rst index 30b26071e..36062ddc0 100644 --- a/docs/develop/gettingstarted.rst +++ b/docs/develop/gettingstarted.rst @@ -4,7 +4,7 @@ Getting Started =============== This guide covers a step-by-step process on setting up version control, obtaining and building -a copy of the source code for a port, building the documentation, running tests, and a description of the +a copy of the source code for a port, building the documentation, running tests, and a description of the directory structure of the MicroPython code base. Source control with git @@ -16,7 +16,7 @@ code is pulled and pushed to and from the main repository. Install the respectiv of Git for your operating system to follow through the rest of the steps. .. note:: - For a reference on the installation instructions, please refer to + For a reference on the installation instructions, please refer to the `Git installation instructions `_. Learn about the basic git commands in this `Git Handbook `_ or any other sources on the internet. @@ -58,12 +58,12 @@ MicroPython repository. After the above configuration, your setup should be similar to this: .. code-block:: bash - + $ git remote -v - origin https://github.com//micropython (fetch) - origin https://github.com//micropython (push) - upstream https://github.com/micropython/micropython (fetch) - upstream https://github.com/micropython/micropython (push) + origin https://github.com//micropython (fetch) + origin https://github.com//micropython (push) + upstream https://github.com/micropython/micropython (fetch) + upstream https://github.com/micropython/micropython (push) You should now have a copy of the source code. By default, you are pointing to the master branch. To prepare for further development, it is recommended @@ -73,7 +73,7 @@ to work on a development branch. $ git checkout -b dev-branch -You can give it any name. You will have to compile MicroPython whenever you change +You can give it any name. You will have to compile MicroPython whenever you change to a different branch. Compile and build the code @@ -140,8 +140,8 @@ If it built successfully, you should see a message similar to this: .. code-block:: bash LINK mpy-cross - text data bss dec hex filename - 279328 776 880 280984 44998 mpy-cross + text data bss dec hex filename + 279328 776 880 280984 44998 mpy-cross .. note:: @@ -181,8 +181,8 @@ If MicroPython built correctly, you should see the following: .. code-block:: bash LINK micropython - text data bss dec hex filename - 412033 5680 2496 420209 66971 micropython + text data bss dec hex filename + 412033 5680 2496 420209 66971 micropython Now run it: @@ -215,7 +215,7 @@ as detailed in the :ref:`required_dependencies` section, then build: $ make submodules $ make -Please refer to the `stm32 documentation `_ +Please refer to the `stm32 documentation `_ for more details on flashing the firmware. .. note:: @@ -259,7 +259,7 @@ Build the docs: $ make html -Open ``docs/build/html/index.html`` in your browser to view the docs locally. Refer to the +Open ``docs/build/html/index.html`` in your browser to view the docs locally. Refer to the documentation on `importing your documentation `_ to use Read the Docs. diff --git a/docs/develop/index.rst b/docs/develop/index.rst index 7a6a6be67..327038f19 100644 --- a/docs/develop/index.rst +++ b/docs/develop/index.rst @@ -5,7 +5,7 @@ This chapter covers a tour of MicroPython from the perspective of a developer, c to MicroPython. It acts as a comprehensive resource on the implementation details of MicroPython for both novice and expert contributors. -Development around MicroPython usually involves modifying the core runtime, porting or +Development around MicroPython usually involves modifying the core runtime, porting or maintaining a new library. This guide describes at great depth, the implementation details of MicroPython including a getting started guide, compiler internals, porting MicroPython to a new platform and implementing a core MicroPython library. @@ -24,4 +24,3 @@ MicroPython to a new platform and implementing a core MicroPython library. publiccapi.rst extendingmicropython.rst porting.rst - \ No newline at end of file diff --git a/docs/develop/qstr.rst b/docs/develop/qstr.rst index cd1fc4786..5d1ac5bb4 100644 --- a/docs/develop/qstr.rst +++ b/docs/develop/qstr.rst @@ -59,7 +59,7 @@ Processing happens in the following stages: information. Note that this step only uses files that have changed, which means that ``qstr.i.last`` will only contain data from files that have changed since the last compile. - + 2. ``qstr.split`` is an empty file created after running ``makeqstrdefs.py split`` on qstr.i.last. It's just used as a dependency to indicate that the step ran. This script outputs one file per input C file, ``genhdr/qstr/...file.c.qstr``, diff --git a/docs/esp32/quickref.rst b/docs/esp32/quickref.rst index 97b6fba38..41c2fd6c6 100644 --- a/docs/esp32/quickref.rst +++ b/docs/esp32/quickref.rst @@ -415,14 +415,14 @@ I2S bus See :ref:`machine.I2S `. :: from machine import I2S, Pin - + i2s = I2S(0, sck=Pin(13), ws=Pin(14), sd=Pin(34), mode=I2S.TX, bits=16, format=I2S.STEREO, rate=44100, ibuf=40000) # create I2S object i2s.write(buf) # write buffer of audio samples to I2S device - + i2s = I2S(1, sck=Pin(33), ws=Pin(25), sd=Pin(32), mode=I2S.RX, bits=16, format=I2S.MONO, rate=22050, ibuf=40000) # create I2S object i2s.readinto(buf) # fill buffer with audio samples from I2S device - -The I2S class is currently available as a Technical Preview. During the preview period, feedback from + +The I2S class is currently available as a Technical Preview. During the preview period, feedback from users is encouraged. Based on this feedback, the I2S class API and implementation may be changed. ESP32 has two I2S buses with id=0 and id=1 diff --git a/docs/esp32/tutorial/intro.rst b/docs/esp32/tutorial/intro.rst index 4c5673834..8ed42dbd3 100644 --- a/docs/esp32/tutorial/intro.rst +++ b/docs/esp32/tutorial/intro.rst @@ -34,8 +34,8 @@ Please refer to the documentation for your board for further details. Getting the firmware -------------------- -The first thing you need to do is download the most recent MicroPython firmware -.bin file to load onto your ESP32 device. You can download it from the +The first thing you need to do is download the most recent MicroPython firmware +.bin file to load onto your ESP32 device. You can download it from the `MicroPython downloads page `_. From here, you have 3 main choices: diff --git a/docs/esp8266/tutorial/intro.rst b/docs/esp8266/tutorial/intro.rst index a5deb3532..ac46e68b5 100644 --- a/docs/esp8266/tutorial/intro.rst +++ b/docs/esp8266/tutorial/intro.rst @@ -41,8 +41,8 @@ Please refer to the documentation for your board for further details. Getting the firmware -------------------- -The first thing you need to do is download the most recent MicroPython firmware -.bin file to load onto your ESP8266 device. You can download it from the +The first thing you need to do is download the most recent MicroPython firmware +.bin file to load onto your ESP8266 device. You can download it from the `MicroPython downloads page `_. From here, you have 3 main choices @@ -64,7 +64,7 @@ such, only daily builds for 512kb modules are provided. Deploying the firmware ---------------------- -Once you have the MicroPython firmware (compiled code), you need to load it onto +Once you have the MicroPython firmware (compiled code), you need to load it onto your ESP8266 device. There are two main steps to do this: first you need to put your device in boot-loader mode, and second you need to copy across the firmware. The exact procedure for these steps is highly dependent on the diff --git a/docs/library/esp.rst b/docs/library/esp.rst index b9ae57bd9..5fb370065 100644 --- a/docs/library/esp.rst +++ b/docs/library/esp.rst @@ -4,7 +4,7 @@ .. module:: esp :synopsis: functions related to the ESP8266 and ESP32 -The ``esp`` module contains specific functions related to both the ESP8266 and +The ``esp`` module contains specific functions related to both the ESP8266 and ESP32 modules. Some functions are only available on one or the other of these ports. diff --git a/docs/library/heapq.rst b/docs/library/heapq.rst index 5e808d544..673871c5f 100644 --- a/docs/library/heapq.rst +++ b/docs/library/heapq.rst @@ -23,7 +23,7 @@ Functions Pop the first item from the ``heap``, and return it. Raise ``IndexError`` if ``heap`` is empty. - + The returned item will be the smallest item in the ``heap``. .. function:: heapify(x) diff --git a/docs/library/lcd160cr.rst b/docs/library/lcd160cr.rst index 85e4b8f07..25903eb22 100644 --- a/docs/library/lcd160cr.rst +++ b/docs/library/lcd160cr.rst @@ -313,7 +313,7 @@ Advanced commands specified by :meth:`LCD160CR.set_spi_win`, starting from the top-left corner. The `framebuf `_ module can be used to construct frame buffers - and provides drawing primitives. Using a frame buffer will improve + and provides drawing primitives. Using a frame buffer will improve performance of animations when compared to drawing directly to the screen. .. method:: LCD160CR.set_scroll(on) diff --git a/docs/library/machine.ADCWiPy.rst b/docs/library/machine.ADCWiPy.rst index e500d0089..d4ccde205 100644 --- a/docs/library/machine.ADCWiPy.rst +++ b/docs/library/machine.ADCWiPy.rst @@ -27,13 +27,13 @@ Constructors Create an ADC object associated with the given pin. This allows you to then read analog values on that pin. For more info check the `pinout and alternate functions - table. `_ + table. `_ - .. warning:: + .. warning:: - ADC pin input range is 0-1.4V (being 1.8V the absolute maximum that it - can withstand). When GP2, GP3, GP4 or GP5 are remapped to the - ADC block, 1.8 V is the maximum. If these pins are used in digital mode, + ADC pin input range is 0-1.4V (being 1.8V the absolute maximum that it + can withstand). When GP2, GP3, GP4 or GP5 are remapped to the + ADC block, 1.8 V is the maximum. If these pins are used in digital mode, then the maximum allowed input is 3.6V. Methods diff --git a/docs/library/machine.I2S.rst b/docs/library/machine.I2S.rst index d64fba33e..abfbb0878 100644 --- a/docs/library/machine.I2S.rst +++ b/docs/library/machine.I2S.rst @@ -4,91 +4,91 @@ class I2S -- Inter-IC Sound bus protocol ======================================== -I2S is a synchronous serial protocol used to connect digital audio devices. +I2S is a synchronous serial protocol used to connect digital audio devices. At the physical level, a bus consists of 3 lines: SCK, WS, SD. The I2S class supports controller operation. Peripheral operation is not supported. -The I2S class is currently available as a Technical Preview. During the preview period, feedback from +The I2S class is currently available as a Technical Preview. During the preview period, feedback from users is encouraged. Based on this feedback, the I2S class API and implementation may be changed. I2S objects can be created and initialized using:: from machine import I2S from machine import Pin - + # ESP32 sck_pin = Pin(14) # Serial clock output ws_pin = Pin(13) # Word clock output sd_pin = Pin(12) # Serial data output - + or - + # PyBoards sck_pin = Pin("Y6") # Serial clock output ws_pin = Pin("Y5") # Word clock output sd_pin = Pin("Y8") # Serial data output - - audio_out = I2S(2, + + audio_out = I2S(2, sck=sck_pin, ws=ws_pin, sd=sd_pin, - mode=I2S.TX, - bits=16, + mode=I2S.TX, + bits=16, format=I2S.MONO, - rate=44100, + rate=44100, ibuf=20000) - - audio_in = I2S(2, + + audio_in = I2S(2, sck=sck_pin, ws=ws_pin, sd=sd_pin, - mode=I2S.RX, - bits=32, + mode=I2S.RX, + bits=32, format=I2S.STEREO, - rate=22050, + rate=22050, ibuf=20000) - + 3 modes of operation are supported: - - blocking - - non-blocking + - blocking + - non-blocking - uasyncio - + blocking:: - + num_written = audio_out.write(buf) # blocks until buf emptied num_read = audio_in.readinto(buf) # blocks until buf filled - + non-blocking:: - + audio_out.irq(i2s_callback) # i2s_callback is called when buf is emptied num_written = audio_out.write(buf) # returns immediately - + audio_in.irq(i2s_callback) # i2s_callback is called when buf is filled - num_read = audio_in.readinto(buf) # returns immediately - + num_read = audio_in.readinto(buf) # returns immediately + uasyncio:: - + swriter = uasyncio.StreamWriter(audio_out) swriter.write(buf) await swriter.drain() - + sreader = uasyncio.StreamReader(audio_in) num_read = await sreader.readinto(buf) - + Constructor ----------- .. class:: I2S(id, *, sck, ws, sd, mode, bits, format, rate, ibuf) Construct an I2S object of the given id: - - - ``id`` identifies a particular I2S bus. + + - ``id`` identifies a particular I2S bus. ``id`` is board and port specific: - + - PYBv1.0/v1.1: has one I2S bus with id=2. - - PYBD-SFxW: has two I2S buses with id=1 and id=2. - - ESP32: has two I2S buses with id=0 and id=1. - + - PYBD-SFxW: has two I2S buses with id=1 and id=2. + - ESP32: has two I2S buses with id=0 and id=1. + Keyword-only parameters that are supported on all ports: - + - ``sck`` is a pin object for the serial clock line - ``ws`` is a pin object for the word select line - ``sd`` is a pin object for the serial data line @@ -97,9 +97,9 @@ Constructor - ``format`` specifies channel format, STEREO or MONO - ``rate`` specifies audio sampling rate (samples/s) - ``ibuf`` specifies internal buffer length (bytes) - - For all ports, DMA runs continuously in the background and allows user applications to perform other operations while - sample data is transfered between the internal buffer and the I2S peripheral unit. + + For all ports, DMA runs continuously in the background and allows user applications to perform other operations while + sample data is transfered between the internal buffer and the I2S peripheral unit. Increasing the size of the internal buffer has the potential to increase the time that user applications can perform non-I2S operations before underflow (e.g. ``write`` method) or overflow (e.g. ``readinto`` method). @@ -109,37 +109,37 @@ Methods .. method:: I2S.init(sck, ...) see Constructor for argument descriptions - + .. method:: I2S.deinit() Deinitialize the I2S bus - + .. method:: I2S.readinto(buf) - Read audio samples into the buffer specified by ``buf``. ``buf`` must support the buffer protocol, such as bytearray or array. - "buf" byte ordering is little-endian. For Stereo format, left channel sample precedes right channel sample. For Mono format, + Read audio samples into the buffer specified by ``buf``. ``buf`` must support the buffer protocol, such as bytearray or array. + "buf" byte ordering is little-endian. For Stereo format, left channel sample precedes right channel sample. For Mono format, the left channel sample data is used. - Returns number of bytes read - + Returns number of bytes read + .. method:: I2S.write(buf) Write audio samples contained in ``buf``. ``buf`` must support the buffer protocol, such as bytearray or array. - "buf" byte ordering is little-endian. For Stereo format, left channel sample precedes right channel sample. For Mono format, + "buf" byte ordering is little-endian. For Stereo format, left channel sample precedes right channel sample. For Mono format, the sample data is written to both the right and left channels. - Returns number of bytes written - + Returns number of bytes written + .. method:: I2S.irq(handler) - Set a callback. ``handler`` is called when ``buf`` is emptied (``write`` method) or becomes full (``readinto`` method). + Set a callback. ``handler`` is called when ``buf`` is emptied (``write`` method) or becomes full (``readinto`` method). Setting a callback changes the ``write`` and ``readinto`` methods to non-blocking operation. ``handler`` is called in the context of the MicroPython scheduler. - + .. staticmethod:: I2S.shift(*, buf, bits, shift) - bitwise shift of all samples contained in ``buf``. ``bits`` specifies sample size in bits. ``shift`` specifies the number of bits to shift each sample. - Positive for left shift, negative for right shift. + bitwise shift of all samples contained in ``buf``. ``bits`` specifies sample size in bits. ``shift`` specifies the number of bits to shift each sample. + Positive for left shift, negative for right shift. Typically used for volume control. Each bit shift changes sample volume by 6dB. - + Constants --------- diff --git a/docs/library/machine.SD.rst b/docs/library/machine.SD.rst index d985db231..c736dc4d2 100644 --- a/docs/library/machine.SD.rst +++ b/docs/library/machine.SD.rst @@ -32,7 +32,7 @@ Constructors .. class:: SD(id,... ) - Create a SD card object. See ``init()`` for parameters if initialization. + Create a SD card object. See ``init()`` for parameters if initialization. Methods ------- diff --git a/docs/library/machine.SDCard.rst b/docs/library/machine.SDCard.rst index 96fb5b01c..b07ad37d3 100644 --- a/docs/library/machine.SDCard.rst +++ b/docs/library/machine.SDCard.rst @@ -50,7 +50,7 @@ vary from platform to platform. - *mosi* can be used to specify an SPI mosi pin. - *cs* can be used to specify an SPI chip select pin. - + - *freq* selects the SD/MMC interface frequency in Hz (only supported on the ESP32). Implementation-specific details diff --git a/docs/library/machine.TimerWiPy.rst b/docs/library/machine.TimerWiPy.rst index 39afc23bc..f8c8bb29d 100644 --- a/docs/library/machine.TimerWiPy.rst +++ b/docs/library/machine.TimerWiPy.rst @@ -50,9 +50,9 @@ Methods - ``mode`` can be one of: - - ``TimerWiPy.ONE_SHOT`` - The timer runs once until the configured + - ``TimerWiPy.ONE_SHOT`` - The timer runs once until the configured period of the channel expires. - - ``TimerWiPy.PERIODIC`` - The timer runs periodically at the configured + - ``TimerWiPy.PERIODIC`` - The timer runs periodically at the configured frequency of the channel. - ``TimerWiPy.PWM`` - Output a PWM signal on a pin. @@ -74,7 +74,7 @@ Methods The operating mode is is the one configured to the Timer object that was used to create the channel. - - ``channel`` if the width of the timer is 16-bit, then must be either ``TIMER.A``, ``TIMER.B``. + - ``channel`` if the width of the timer is 16-bit, then must be either ``TIMER.A``, ``TIMER.B``. If the width is 32-bit then it **must be** ``TIMER.A | TIMER.B``. Keyword only arguments: diff --git a/docs/library/machine.UART.rst b/docs/library/machine.UART.rst index 2eb2e20cb..8fb42cfe8 100644 --- a/docs/library/machine.UART.rst +++ b/docs/library/machine.UART.rst @@ -64,7 +64,7 @@ Methods - *timeout_char* specifies the time to wait between characters (in ms). - *invert* specifies which lines to invert. - *flow* specifies which hardware flow control signals to use. The value - is a bitmask. + is a bitmask. - ``0`` will ignore hardware flow control signals. - ``UART.RTS`` will enable receive flow control by using the RTS output pin to diff --git a/docs/library/machine.WDT.rst b/docs/library/machine.WDT.rst index 612f23ba3..3c799583e 100644 --- a/docs/library/machine.WDT.rst +++ b/docs/library/machine.WDT.rst @@ -24,7 +24,7 @@ Constructors Create a WDT object and start it. The timeout must be given in milliseconds. Once it is running the timeout cannot be changed and the WDT cannot be stopped either. - + Notes: On the esp32 the minimum timeout is 1 second. On the esp8266 a timeout cannot be specified, it is determined by the underlying system. diff --git a/docs/library/machine.rst b/docs/library/machine.rst index c2a6b3900..5f45168ed 100644 --- a/docs/library/machine.rst +++ b/docs/library/machine.rst @@ -203,7 +203,7 @@ Classes machine.UART.rst machine.SPI.rst machine.I2C.rst - machine.I2S.rst + machine.I2S.rst machine.RTC.rst machine.Timer.rst machine.WDT.rst diff --git a/docs/library/pyb.Pin.rst b/docs/library/pyb.Pin.rst index 6465653f7..97dfbffbc 100644 --- a/docs/library/pyb.Pin.rst +++ b/docs/library/pyb.Pin.rst @@ -120,7 +120,7 @@ Methods - *value* if not None will set the port output value before enabling the pin. - *alt* can be used when mode is ``Pin.AF_PP`` or ``Pin.AF_OD`` to set the - index or name of one of the alternate functions associated with a pin. + index or name of one of the alternate functions associated with a pin. This arg was previously called *af* which can still be used if needed. Returns: ``None``. diff --git a/docs/pyboard/quickref.rst b/docs/pyboard/quickref.rst index ed56811dd..62157bff0 100644 --- a/docs/pyboard/quickref.rst +++ b/docs/pyboard/quickref.rst @@ -225,20 +225,20 @@ I2S bus See :ref:`machine.I2S `. :: from machine import I2S, Pin - + i2s = I2S(2, sck=Pin('Y6'), ws=Pin('Y5'), sd=Pin('Y8'), mode=I2S.TX, bits=16, format=I2S.STEREO, rate=44100, ibuf=40000) # create I2S object i2s.write(buf) # write buffer of audio samples to I2S device - + i2s = I2S(1, sck=Pin('X5'), ws=Pin('X6'), sd=Pin('Y4'), mode=I2S.RX, bits=16, format=I2S.MONO, rate=22050, ibuf=40000) # create I2S object i2s.readinto(buf) # fill buffer with audio samples from I2S device - -The I2S class is currently available as a Technical Preview. During the preview period, feedback from + +The I2S class is currently available as a Technical Preview. During the preview period, feedback from users is encouraged. Based on this feedback, the I2S class API and implementation may be changed. -PYBv1.0/v1.1 has one I2S bus with id=2. -PYBD-SFxW has two I2S buses with id=1 and id=2. -I2S is shared with SPI. - +PYBv1.0/v1.1 has one I2S bus with id=2. +PYBD-SFxW has two I2S buses with id=1 and id=2. +I2S is shared with SPI. + CAN bus (controller area network) --------------------------------- diff --git a/docs/pyboard/tutorial/accel.rst b/docs/pyboard/tutorial/accel.rst index 58170e74f..dff71f2ee 100644 --- a/docs/pyboard/tutorial/accel.rst +++ b/docs/pyboard/tutorial/accel.rst @@ -29,7 +29,7 @@ We will start by using the accelerometer to turn on a light if it is not flat. : while True: x = accel.x() - if abs(x) > SENSITIVITY: + if abs(x) > SENSITIVITY: light.on() else: light.off() @@ -61,7 +61,7 @@ use the ``y()`` value and more LEDs we can turn the pyboard into a spirit level. while True: x = accel.x() - if x > SENSITIVITY: + if x > SENSITIVITY: xlights[0].on() xlights[1].off() elif x < -SENSITIVITY: @@ -72,7 +72,7 @@ use the ``y()`` value and more LEDs we can turn the pyboard into a spirit level. xlights[1].off() y = accel.y() - if y > SENSITIVITY: + if y > SENSITIVITY: ylights[0].on() ylights[1].off() elif y < -SENSITIVITY: diff --git a/docs/pyboard/tutorial/leds.rst b/docs/pyboard/tutorial/leds.rst index 05f3b619e..63acc63ce 100644 --- a/docs/pyboard/tutorial/leds.rst +++ b/docs/pyboard/tutorial/leds.rst @@ -47,7 +47,7 @@ Here, n keeps track of the current LED and every time the loop is executed we cy One problem you might find is that if you stop the script and then start it again that the LEDs are stuck on from the previous run, ruining our carefully choreographed disco. We can fix this by turning all the LEDs off when we initialise the script and then using a try/finally block. When you press CTRL-C, MicroPython generates a VCPInterrupt exception. Exceptions normally mean something has gone wrong and you can use a try: command to "catch" an exception. In this case it is just the user interrupting the script, so we don't need to catch the error but just tell MicroPython what to do when we exit. The finally block does this, and we use it to make sure all the LEDs are off. The full code is:: leds = [pyb.LED(i) for i in range(1,5)] - for l in leds: + for l in leds: l.off() n = 0 diff --git a/docs/pyboard/tutorial/repl.rst b/docs/pyboard/tutorial/repl.rst index 973d1846a..b28d9cd57 100644 --- a/docs/pyboard/tutorial/repl.rst +++ b/docs/pyboard/tutorial/repl.rst @@ -73,7 +73,7 @@ indicate that you should type the text after it at the prompt. In the end, once you have entered the text ``print("hello pyboard!")`` and pressed Enter, the output on your screen should look like it does above. -If you already know some python you can now try some basic commands here. +If you already know some python you can now try some basic commands here. If any of this is not working you can try either a hard reset or a soft reset; see below. diff --git a/docs/pyboard/tutorial/reset.rst b/docs/pyboard/tutorial/reset.rst index 0cd5ac21c..59a3cd82a 100644 --- a/docs/pyboard/tutorial/reset.rst +++ b/docs/pyboard/tutorial/reset.rst @@ -21,7 +21,7 @@ To enter safe mode, do the following steps: 4. The LEDs will then cycle green to orange to green+orange and back again. 5. Keep holding down USR until *only the orange LED is lit*, and then let go of the USR switch. -6. The orange LED should flash quickly 4 times, and then turn off. +6. The orange LED should flash quickly 4 times, and then turn off. 7. You are now in safe mode. In safe mode, the ``boot.py`` and ``main.py`` files are not executed, and so diff --git a/docs/reference/asm_thumb2_hints_tips.rst b/docs/reference/asm_thumb2_hints_tips.rst index 062a3c844..361e44380 100644 --- a/docs/reference/asm_thumb2_hints_tips.rst +++ b/docs/reference/asm_thumb2_hints_tips.rst @@ -3,7 +3,7 @@ Hints and tips The following are some examples of the use of the inline assembler and some information on how to work around its limitations. In this document the term -"assembler function" refers to a function declared in Python with the +"assembler function" refers to a function declared in Python with the ``@micropython.asm_thumb`` decorator, whereas "subroutine" refers to assembler code called from within an assembler function. @@ -106,8 +106,8 @@ function can return multiple values by assigning them to array elements. Assembler functions have no means of determining the length of an array: this will need to be passed to the function. -This use of arrays can be extended to enable more than three arrays to be used. -This is done using indirection: the ``uctypes`` module supports ``addressof()`` +This use of arrays can be extended to enable more than three arrays to be used. +This is done using indirection: the ``uctypes`` module supports ``addressof()`` which will return the address of an array passed as its argument. Thus you can populate an integer array with the addresses of other arrays: diff --git a/docs/reference/constrained.rst b/docs/reference/constrained.rst index 2a5f9d7fd..816a20f9d 100644 --- a/docs/reference/constrained.rst +++ b/docs/reference/constrained.rst @@ -144,7 +144,7 @@ store constant data: As in the string example, at runtime a reference to the arbitrarily large integer is assigned to the variable ``bar``. That reference occupies a -single machine word. +single machine word. It might be expected that tuples of integers could be employed for the purpose of storing constant data with minimal RAM use. With the current compiler this diff --git a/docs/reference/speed_python.rst b/docs/reference/speed_python.rst index 85e956e8e..834a53b0a 100644 --- a/docs/reference/speed_python.rst +++ b/docs/reference/speed_python.rst @@ -36,7 +36,7 @@ Algorithms ~~~~~~~~~~ The most important aspect of designing any routine for performance is ensuring that -the best algorithm is employed. This is a topic for textbooks rather than for a +the best algorithm is employed. This is a topic for textbooks rather than for a MicroPython guide but spectacular performance gains can sometimes be achieved by adopting algorithms known for their efficiency. @@ -210,7 +210,7 @@ no adaptation (but see below). It is invoked by means of a function decorator: buf = self.linebuf # Cached object # code -There are certain limitations in the current implementation of the native code emitter. +There are certain limitations in the current implementation of the native code emitter. * Context managers are not supported (the ``with`` statement). * Generators are not supported. @@ -222,7 +222,7 @@ increase in compiled code size. The Viper code emitter ---------------------- -The optimisations discussed above involve standards-compliant Python code. The +The optimisations discussed above involve standards-compliant Python code. The Viper code emitter is not fully compliant. It supports special Viper native data types in pursuit of performance. Integer processing is non-compliant because it uses machine words: arithmetic on 32 bit hardware is performed modulo 2**32. @@ -237,7 +237,7 @@ bit manipulations. It is invoked using a decorator: def foo(self, arg: int) -> int: # code -As the above fragment illustrates it is beneficial to use Python type hints to assist the Viper optimiser. +As the above fragment illustrates it is beneficial to use Python type hints to assist the Viper optimiser. Type hints provide information on the data types of arguments and of the return value; these are a standard Python language feature formally defined here `PEP0484 `_. Viper supports its own set of types namely ``int``, ``uint`` (unsigned integer), ``ptr``, ``ptr8``, diff --git a/docs/wipy/quickref.rst b/docs/wipy/quickref.rst index f9ea3d501..4c3b969bd 100644 --- a/docs/wipy/quickref.rst +++ b/docs/wipy/quickref.rst @@ -154,7 +154,7 @@ See :ref:`machine.RTC ` :: pass # do some non blocking operations # warning printing on an irq via telnet is not - # possible, only via UART + # possible, only via UART # create a RTC alarm that expires after 5 seconds rtc.alarm(time=5000, repeat=False) @@ -179,7 +179,7 @@ See :ref:`machine.SD `. :: sd = SD() os.mount(sd, '/sd') -WLAN (WiFi) +WLAN (WiFi) ----------- See :ref:`network.WLAN ` and :mod:`machine`. :: diff --git a/docs/wipy/tutorial/reset.rst b/docs/wipy/tutorial/reset.rst index ece28498b..1715d3e29 100644 --- a/docs/wipy/tutorial/reset.rst +++ b/docs/wipy/tutorial/reset.rst @@ -1,10 +1,10 @@ Reset and boot modes ==================== -There are soft resets and hard resets. +There are soft resets and hard resets. - - A soft reset simply clears the state of the MicroPython virtual machine, - but leaves hardware peripherals unaffected. To do a soft reset, simply press + - A soft reset simply clears the state of the MicroPython virtual machine, + but leaves hardware peripherals unaffected. To do a soft reset, simply press **Ctrl+D** on the REPL, or within a script do:: import sys diff --git a/docs/wipy/tutorial/timer.rst b/docs/wipy/tutorial/timer.rst index c87ac4495..7cd7d0f13 100644 --- a/docs/wipy/tutorial/timer.rst +++ b/docs/wipy/tutorial/timer.rst @@ -5,7 +5,7 @@ Timers can be used for a great variety of tasks, calling a function periodically counting events, and generating a PWM signal are among the most common use cases. Each timer consists of two 16-bit channels and this channels can be tied together to form one 32-bit timer. The operating mode needs to be configured per timer, but then -the period (or the frequency) can be independently configured on each channel. +the period (or the frequency) can be independently configured on each channel. By using the callback method, the timer event can call a Python function. Example usage to toggle an LED at a fixed frequency:: diff --git a/docs/wipy/tutorial/wlan.rst b/docs/wipy/tutorial/wlan.rst index 434367cd9..bdfd3e0a5 100644 --- a/docs/wipy/tutorial/wlan.rst +++ b/docs/wipy/tutorial/wlan.rst @@ -13,9 +13,9 @@ You can check the current mode (which is always ``WLAN.AP`` after power up):: >>> wlan.mode() -.. warning:: - When you change the WLAN mode following the instructions below, your WLAN - connection to the WiPy will be broken. This means you will not be able +.. warning:: + When you change the WLAN mode following the instructions below, your WLAN + connection to the WiPy will be broken. This means you will not be able to run these commands interactively over the WLAN. There are two ways around this::