From f517688ce71fbcc147946b2255c1d1279bb85d6e Mon Sep 17 00:00:00 2001 From: Carlos Pereira Atencio Date: Tue, 3 May 2022 11:33:16 +0100 Subject: [PATCH] docs: Backport last V2 changes to V1 docs. The main change is removing the Installation page, as I forgot to remove the file in PR https://github.com/bbcmicrobit/micropython/pull/745 Took the opportunity to add a few very minor formatting changes from the v2-docs branch, which wil reduce the diff with the main branch. --- docs/devguide/installation.rst | 118 ------------------------------ docs/index.rst | 7 +- docs/microbit_micropython_api.rst | 10 ++- docs/music.rst | 8 +- 4 files changed, 15 insertions(+), 128 deletions(-) delete mode 100644 docs/devguide/installation.rst diff --git a/docs/devguide/installation.rst b/docs/devguide/installation.rst deleted file mode 100644 index 236b8b690..000000000 --- a/docs/devguide/installation.rst +++ /dev/null @@ -1,118 +0,0 @@ -.. _install-dev: - -============ -Installation -============ - -This section will help you set up the tools and programs needed for -developing programs and firmware to flash to the BBC micro:bit using MicroPython. - -Dependencies ------------- - - -Development Environment ------------------------ - -You will need: - -* git -* yotta - -Depending on your operating system, the installation instructions vary. Use -the installation scenario that best suits your system. - -Yotta will require an ARM mbed account. It will walk you through signing up -if you are not registered. - -Installation Scenarios ----------------------- - -* :ref:`Windows ` -* :ref:`OS X ` -* :ref:`Linux ` -* :ref:`Debian and Ubuntu ` -* :ref:`Red Hat Fedora/CentOS ` -* :ref:`Raspberry Pi ` - - -.. _microbit-windows: - -Windows -~~~~~~~ - -When installing `Yotta -`_, make sure you have these components ticked to install. - -- python -- gcc -- cMake -- ninja -- Yotta -- git-scm -- mbed serial driver - - - -.. _microbit-osx: - -OS X -~~~~ - -After cloning the repository, install yotta using the app and launch the app. -You can find the latest release of yotta for OS X at -``_ . - - -.. _microbit-linux: - -Linux -~~~~~ - -These steps will cover the basic flavors of Linux and working with the -micro:bit and MicroPython. See also the specific sections for Raspberry Pi, -Debian/Ubuntu, and Red Hat Fedora/Centos. - - -.. _microbit-debian-ubuntu: - -Debian and Ubuntu -^^^^^^^^^^^^^^^^^ - -The following commands should install the toolchain on a modern Debian/Ubuntu -variant:: - - sudo add-apt-repository -y ppa:team-gcc-arm-embedded - sudo apt-get update - sudo apt-get install gcc-arm-embedded - sudo apt-get install cmake ninja-build srecord libssl-dev - sudo -H pip3 install yotta - -In order to make development life a bit easier, you can (on Ubuntu) add yourself -to the ``dialout`` group, which grants write access to the serial device -``/dev/ttyACM0``:: - - sudo usermod -a -G dialout ${USER} - -You may need to relogin in order for the changes to groups to take effect. - -.. _microbit-redhat: - -Red Hat Fedora/CentOS -^^^^^^^^^^^^^^^^^^^^^ - - -.. _microbit-rpi: - -Raspberry Pi -^^^^^^^^^^^^ - - - -.. _next-steps: - -Next steps ----------- - -Congratulations. You have installed your development environment and are ready to -begin :ref:`flashing firmware ` to the micro:bit. diff --git a/docs/index.rst b/docs/index.rst index 2cec4bf33..b49c12182 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -8,9 +8,10 @@ BBC micro:bit MicroPython documentation Welcome! -The BBC micro:bit is a small computing device for children. One of the -languages it understands is the popular Python programming language. The -version of Python that runs on the BBC micro:bit is called MicroPython. +The `BBC micro:bit `_ is a small computing device for +children. One of the languages it understands is the popular Python programming +language. The version of Python that runs on the BBC micro:bit is called +MicroPython. This documentation includes lessons for teachers and API documentation for developers (check out the index on the left). We hope diff --git a/docs/microbit_micropython_api.rst b/docs/microbit_micropython_api.rst index 093356372..05eb322d3 100644 --- a/docs/microbit_micropython_api.rst +++ b/docs/microbit_micropython_api.rst @@ -73,9 +73,12 @@ The LED display is exposed via the `display` object:: Pins ---- -Provide digital and analog input and output functionality, for the pins in the connector. Some pins are connected internally to the I/O that drives the LED matrix and the buttons. +Provide digital and analog input and output functionality, for the pins in the +connector. Some pins are connected +internally to the I/O that drives the LED matrix and the buttons. -Each pin is provided as an object directly in the ``microbit`` module. This keeps the API relatively flat, making it very easy to use: +Each pin is provided as an object directly in the ``microbit`` module. This +keeps the API relatively flat, making it very easy to use: * pin0 * pin1 @@ -102,7 +105,8 @@ Each of these pins are instances of the ``MicroBitPin`` class, which offers the # sets the period of the PWM output of the pin in microseconds # (see https://en.wikipedia.org/wiki/Pulse-width_modulation) pin.set_analog_period_microseconds(int) - # returns boolean + # Only available for touch pins 0, 1, and 2. Returns boolean if the pin + # is touched pin.is_touched() Images diff --git a/docs/music.rst b/docs/music.rst index e2000e69f..c63bb5f09 100644 --- a/docs/music.rst +++ b/docs/music.rst @@ -109,12 +109,12 @@ Functions If ``wait`` is set to ``True``, this function is blocking. - If ``duration`` is negative the pitch is played continuously until either the - blocking call is interrupted or, in the case of a background call, a new - frequency is set or ``stop`` is called (see below). + If ``duration`` is negative the pitch is played continuously until either + the blocking call is interrupted or, in the case of a background call, a + new frequency is set or ``stop`` is called (see below). .. py:function:: stop(pin=pin0) - + Stops all music playback on a given pin, eg. ``music.stop(pin1)``. If no pin is given, eg. ``music.stop()`` pin0 is assumed.