summaryrefslogtreecommitdiff
path: root/docs/pyboard
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2017-08-25 22:17:07 -0400
committerDan Halbert <halbert@halwitz.org>2017-08-25 22:17:07 -0400
commitef61b5ecb59e9b4e37e3e3c023c62d583c23eb16 (patch)
tree45a798fbed0dc673304597b29e0b60174195ce79 /docs/pyboard
parent266be307770abe11c220eb493388807920914b7a (diff)
parent1f78e7a43130acfa4bedf16c1007a1b0f37c75c3 (diff)
Initial merge of micropython v1.9.2 into circuitpython 2.0.0 (in development) master.
cpx build compiles and loads and works in repl; test suite not run yet esp8266 not tested yet
Diffstat (limited to 'docs/pyboard')
-rw-r--r--docs/pyboard/general.rst11
-rw-r--r--docs/pyboard/hardware/index.rst6
-rw-r--r--docs/pyboard/tutorial/amp_skin.rst28
-rw-r--r--docs/pyboard/tutorial/index.rst4
-rw-r--r--docs/pyboard/tutorial/switch.rst8
5 files changed, 50 insertions, 7 deletions
diff --git a/docs/pyboard/general.rst b/docs/pyboard/general.rst
index 1d040f6cc..97e9aabc0 100644
--- a/docs/pyboard/general.rst
+++ b/docs/pyboard/general.rst
@@ -1,6 +1,8 @@
General information about the pyboard
=====================================
+.. contents::
+
Local filesystem and SD card
----------------------------
@@ -67,3 +69,12 @@ There are currently 2 kinds of errors that you might see:
2. If all 4 LEDs cycle on and off slowly, then there was a hard fault.
This cannot be recovered from and you need to do a hard reset.
+Guide for using the pyboard with Windows
+----------------------------------------
+
+The following PDF guide gives information about using the pyboard with Windows,
+including setting up the serial prompt and downloading new firmware using
+DFU programming:
+`PDF guide <http://micropython.org/resources/Micro-Python-Windows-setup.pdf>`__.
+
+.. include:: hardware/index.rst
diff --git a/docs/pyboard/hardware/index.rst b/docs/pyboard/hardware/index.rst
index bc4726ce2..91fea24e7 100644
--- a/docs/pyboard/hardware/index.rst
+++ b/docs/pyboard/hardware/index.rst
@@ -1,7 +1,7 @@
.. _hardware_index:
The pyboard hardware
-====================
+--------------------
For the pyboard:
@@ -16,14 +16,14 @@ For the official skin modules:
* LCD160CRv1.0: see :mod:`lcd160cr`
Datasheets for the components on the pyboard
-============================================
+--------------------------------------------
* The microcontroller: `STM32F405RGT6 <http://www.st.com/web/catalog/mmc/FM141/SC1169/SS1577/LN1035/PF252144>`_ (link to manufacturer's site)
* The accelerometer: `Freescale MMA7660 <http://micropython.org/resources/datasheets/MMA7660FC.pdf>`_ (800kiB PDF)
* The LDO voltage regulator: `Microchip MCP1802 <http://micropython.org/resources/datasheets/MCP1802-22053C.pdf>`_ (400kiB PDF)
Datasheets for other components
-===============================
+-------------------------------
* The LCD display on the LCD touch-sensor skin: `Newhaven Display NHD-C12832A1Z-FSW-FBW-3V3 <http://micropython.org/resources/datasheets/NHD-C12832A1Z-FSW-FBW-3V3.pdf>`_ (460KiB PDF)
* The touch sensor chip on the LCD touch-sensor skin: `Freescale MPR121 <http://micropython.org/resources/datasheets/MPR121.pdf>`_ (280KiB PDF)
diff --git a/docs/pyboard/tutorial/amp_skin.rst b/docs/pyboard/tutorial/amp_skin.rst
index 64f139bb7..697637f9d 100644
--- a/docs/pyboard/tutorial/amp_skin.rst
+++ b/docs/pyboard/tutorial/amp_skin.rst
@@ -69,4 +69,30 @@ Then you can do::
>>> f = wave.open('test.wav')
>>> dac.write_timed(f.readframes(f.getnframes()), f.getframerate())
-This should play the WAV file.
+This should play the WAV file. Note that this will read the whole file into RAM
+so it has to be small enough to fit in it.
+
+To play larger wave files you will have to use the micro-SD card to store it.
+Also the file must be read and sent to the DAC in small chunks that will fit
+the RAM limit of the microcontroller. Here is an example function that can
+play 8-bit wave files with up to 16kHz sampling::
+
+ import wave
+ from pyb import DAC
+ from pyb import delay
+ dac = DAC(1)
+
+ def play(filename):
+ f = wave.open(filename, 'r')
+ total_frames = f.getnframes()
+ framerate = f.getframerate()
+
+ for position in range(0, total_frames, framerate):
+ f.setpos(position)
+ dac.write_timed(f.readframes(framerate), framerate)
+ delay(1000)
+
+This function reads one second worth of data and sends it to DAC. It then waits
+one second and moves the file cursor to the new position to read the next second
+of data in the next iteration of the for-loop. It plays one second of audio at
+a time every one second.
diff --git a/docs/pyboard/tutorial/index.rst b/docs/pyboard/tutorial/index.rst
index 07f136c9b..1dc155f14 100644
--- a/docs/pyboard/tutorial/index.rst
+++ b/docs/pyboard/tutorial/index.rst
@@ -1,7 +1,7 @@
.. _tutorial-index:
-MicroPython tutorial
-====================
+MicroPython tutorial for the pyboard
+====================================
This tutorial is intended to get you started with your pyboard.
All you need is a pyboard and a micro-USB cable to connect it to
diff --git a/docs/pyboard/tutorial/switch.rst b/docs/pyboard/tutorial/switch.rst
index 945e89aa0..91683fba4 100644
--- a/docs/pyboard/tutorial/switch.rst
+++ b/docs/pyboard/tutorial/switch.rst
@@ -15,12 +15,18 @@ the name ``pyb`` does not exist.
With the switch object you can get its status::
- >>> sw()
+ >>> sw.value()
False
This will print ``False`` if the switch is not held, or ``True`` if it is held.
Try holding the USR switch down while running the above command.
+There is also a shorthand notation to get the switch status, by "calling" the
+switch object::
+
+ >>> sw()
+ False
+
Switch callbacks
----------------