Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • card10/firmware
  • annejan/firmware
  • astro/firmware
  • fpletz/firmware
  • gerd/firmware
  • fleur/firmware
  • swym/firmware
  • l/firmware
  • uberardy/firmware
  • wink/firmware
  • madonius/firmware
  • mot/firmware
  • filid/firmware
  • q3k/firmware
  • hauke/firmware
  • Woazboat/firmware
  • pink/firmware
  • mossmann/firmware
  • omniskop/firmware
  • zenox/firmware
  • trilader/firmware
  • Danukeru/firmware
  • shoragan/firmware
  • zlatko/firmware
  • sistason/firmware
  • datenwolf/firmware
  • bene/firmware
  • amedee/firmware
  • martinling/firmware
  • griffon/firmware
  • chris007/firmware
  • adisbladis/firmware
  • dbrgn/firmware
  • jelly/firmware
  • rnestler/firmware
  • mh/firmware
  • ln/firmware
  • penguineer/firmware
  • monkeydom/firmware
  • jens/firmware
  • jnaulty/firmware
  • jeffmakes/firmware
  • marekventur/firmware
  • pete/firmware
  • h2obrain/firmware
  • DooMMasteR/firmware
  • jackie/firmware
  • prof_r/firmware
  • Draradech/firmware
  • Kartoffel/firmware
  • hinerk/firmware
  • abbradar/firmware
  • JustTB/firmware
  • LuKaRo/firmware
  • iggy/firmware
  • ente/firmware
  • flgr/firmware
  • Lorphos/firmware
  • matejo/firmware
  • ceddral7/firmware
  • danb/firmware
  • joshi/firmware
  • melle/firmware
  • fitch/firmware
  • deurknop/firmware
  • sargon/firmware
  • markus/firmware
  • kloenk/firmware
  • lucaswerkmeister/firmware
  • derf/firmware
  • meh/firmware
  • dx/card10-firmware
  • torben/firmware
  • yuvadm/firmware
  • AndyBS/firmware
  • klausdieter1/firmware
  • katzenparadoxon/firmware
  • xiretza/firmware
  • ole/firmware
  • techy/firmware
  • thor77/firmware
  • TilCreator/firmware
  • fuchsi/firmware
  • dos/firmware
  • yrlf/firmware
  • PetePriority/firmware
  • SuperVirus/firmware
  • sur5r/firmware
  • tazz/firmware
  • Alienmaster/firmware
  • flo_h/firmware
  • baldo/firmware
  • mmu_man/firmware
  • Foaly/firmware
  • sodoku/firmware
  • Guinness/firmware
  • ssp/firmware
  • led02/firmware
  • Stormwind/firmware
  • arist/firmware
  • coon/firmware
  • mdik/firmware
  • pippin/firmware
  • royrobotiks/firmware
  • zigot83/firmware
  • mo_k/firmware
106 results
Show changes
Showing
with 1068 additions and 193 deletions
......@@ -52,7 +52,10 @@ class CAutoDocDirective(Directive):
env = self.state.document.settings.env
for (severity, filename, lineno, msg) in errors:
toprint = '{}:{}: {}'.format(filename, lineno, msg)
if filename:
toprint = '{}:{}: {}'.format(filename, lineno, msg)
else:
toprint = '{}'.format(msg)
if severity.value <= env.app.verbosity:
self.logger.log(self._log_lvl[severity], toprint,
......@@ -109,7 +112,7 @@ class CAutoDocDirective(Directive):
return node.children
def setup(app):
app.require_sphinx('1.8')
app.require_sphinx('3.0')
app.add_config_value('cautodoc_root', app.confdir, 'env')
app.add_config_value('cautodoc_compat', None, 'env')
app.add_config_value('cautodoc_clang', None, 'env')
......
......@@ -39,7 +39,10 @@ def main():
print(doc)
for (severity, filename, lineno, msg) in errors:
print('{}: {}:{}: {}'.format(severity.name,
filename, lineno, msg), file=sys.stderr)
if filename:
print('{}: {}:{}: {}'.format(severity.name,
filename, lineno, msg), file=sys.stderr)
else:
print('{}: {}'.format(severity.name, msg), file=sys.stderr)
main()
# Copyright (c) 2016-2017 Jani Nikula <jani@nikula.org>
# Copyright (c) 2018-2019 Bruno Santos <brunomanuelsantos@tecnico.ulisboa.pt>
# Copyright (c) 2018-2020 Bruno Santos <brunomanuelsantos@tecnico.ulisboa.pt>
# Licensed under the terms of BSD 2-Clause, see LICENSE for details.
"""
Documentation comment extractor
......@@ -34,7 +34,7 @@ Otherwise, documentation comments are passed through verbatim.
"""
import enum
import itertools
import re
import sys
from clang.cindex import CursorKind, TypeKind
......@@ -75,18 +75,22 @@ def comment_extract(tu):
current_comment = token
continue
# Store off the token's cursor for a slight performance improvement
# instead of accessing the `cursor` property multiple times.
token_cursor = token.cursor
# cursors that are 1) never documented themselves, and 2) allowed
# between comment and the actual cursor being documented
if (token.cursor.kind == CursorKind.INVALID_FILE or
token.cursor.kind == CursorKind.TYPE_REF or
token.cursor.kind == CursorKind.PREPROCESSING_DIRECTIVE or
token.cursor.kind == CursorKind.MACRO_INSTANTIATION):
if (token_cursor.kind == CursorKind.INVALID_FILE or
token_cursor.kind == CursorKind.TYPE_REF or
token_cursor.kind == CursorKind.PREPROCESSING_DIRECTIVE or
token_cursor.kind == CursorKind.MACRO_INSTANTIATION):
continue
if cursor is not None and token.cursor == cursor:
if cursor is not None and token_cursor == cursor:
continue
cursor = token.cursor
cursor = token_cursor
# Note: current_comment may be None
if current_comment != None and docstr.is_doc(current_comment.spelling):
......@@ -125,16 +129,18 @@ def _get_macro_args(cursor):
if cursor.kind != CursorKind.MACRO_DEFINITION:
return None
tokens = cursor.get_tokens()
# Use the first two tokens to make sure this starts with 'IDENTIFIER('
x = [token for token in itertools.islice(cursor.get_tokens(), 2)]
if (len(x) != 2 or x[0].spelling != cursor.spelling or
x[1].spelling != '(' or x[0].extent.end != x[1].extent.start):
one = next(tokens)
two = next(tokens, None)
if two is None or one.extent.end != two.extent.start or two.spelling != '(':
return None
# Naïve parsing of macro arguments
# FIXME: This doesn't handle GCC named vararg extension FOO(vararg...)
args = []
for token in itertools.islice(cursor.get_tokens(), 2, None):
for token in tokens:
if token.spelling == ')':
return args
elif token.spelling == ',':
......@@ -161,8 +167,26 @@ def _recursive_parse(comments, cursor, nest, compat):
return _result(comment, cursor=cursor, fmt=fmt,
nest=nest, name=name, args=args, compat=compat)
elif cursor.kind == CursorKind.VAR_DECL:
fmt = docstr.Type.VAR
elif cursor.kind in [CursorKind.VAR_DECL, CursorKind.FIELD_DECL]:
if cursor.kind == CursorKind.VAR_DECL:
fmt = docstr.Type.VAR
else:
fmt = docstr.Type.MEMBER
# If this is an array, the dimensions should be applied to the name, not
# the type.
dims = ttype.rsplit(' ', 1)[-1]
if dims.startswith('[') and dims.endswith(']'):
ttype = ttype.rsplit(' ', 1)[0]
name = name + dims
# If this is a function pointer, or an array of function pointers, the
# name should be within the parenthesis as in (*name) or (*name[N]).
fptr_type = re.sub(r'\((\*+)(\[[^]]*\])?\)', r'(\1{}\2)'.format(name),
ttype, count=1)
if fptr_type != ttype:
name = fptr_type
ttype = ''
return _result(comment, cursor=cursor, fmt=fmt,
nest=nest, name=name, ttype=ttype, compat=compat)
......@@ -188,9 +212,15 @@ def _recursive_parse(comments, cursor, nest, compat):
# FIXME: Handle anonymous enumerators.
fmt = docstr.Type.TYPE
fmts = {CursorKind.STRUCT_DECL: docstr.Type.STRUCT,
CursorKind.UNION_DECL: docstr.Type.UNION,
CursorKind.ENUM_DECL: docstr.Type.ENUM}
fmt = fmts[cursor.kind]
# name may be empty for typedefs
result = _result(comment, cursor=cursor, fmt=fmt,
nest=nest, name=ttype, compat=compat)
nest=nest, name=name if name else ttype, compat=compat)
nest += 1
for c in cursor.get_children():
......@@ -205,12 +235,6 @@ def _recursive_parse(comments, cursor, nest, compat):
return _result(comment, cursor=cursor, fmt=fmt,
nest=nest, name=name, compat=compat)
elif cursor.kind == CursorKind.FIELD_DECL:
fmt = docstr.Type.MEMBER
return _result(comment, cursor=cursor, fmt=fmt,
nest=nest, name=name, ttype=ttype, compat=compat)
elif cursor.kind == CursorKind.FUNCTION_DECL:
# FIXME: check args against comment
# FIXME: children may contain extra stuff if the return type is a
......@@ -261,7 +285,8 @@ def clang_diagnostics(errors, diagnostics):
4: ErrorLevel.ERROR}
for diag in diagnostics:
errors.extend([(sev[diag.severity], diag.location.file.name,
filename = diag.location.file.name if diag.location.file else None
errors.extend([(sev[diag.severity], filename,
diag.location.line, diag.spelling)])
# return a list of (comment, metadata) tuples
......
# Copyright (c) 2016-2017 Jani Nikula <jani@nikula.org>
# Copyright (c) 2018-2019 Bruno Santos <brunomanuelsantos@tecnico.ulisboa.pt>
# Copyright (c) 2016-2020 Jani Nikula <jani@nikula.org>
# Copyright (c) 2018-2020 Bruno Santos <brunomanuelsantos@tecnico.ulisboa.pt>
# Licensed under the terms of BSD 2-Clause, see LICENSE for details.
"""
Documentation strings manipulation library
......@@ -17,6 +17,9 @@ class Type(Enum):
TEXT = auto()
VAR = auto()
TYPE = auto()
STRUCT = auto()
UNION = auto()
ENUM = auto()
ENUM_VAL = auto()
MEMBER = auto()
MACRO = auto()
......@@ -31,10 +34,13 @@ _doc_fmt = {
Type.TEXT: (0, '\n{text}\n'),
Type.VAR: (1, '\n.. c:var:: {ttype} {name}\n\n{text}\n'),
Type.TYPE: (1, '\n.. c:type:: {name}\n\n{text}\n'),
Type.ENUM_VAL: (1, '\n.. c:macro:: {name}\n\n{text}\n'),
Type.STRUCT: (1, '\n.. c:struct:: {name}\n\n{text}\n'),
Type.UNION: (1, '\n.. c:union:: {name}\n\n{text}\n'),
Type.ENUM: (1, '\n.. c:enum:: {name}\n\n{text}\n'),
Type.ENUM_VAL: (1, '\n.. c:enumerator:: {name}\n\n{text}\n'),
Type.MEMBER: (1, '\n.. c:member:: {ttype} {name}\n\n{text}\n'),
Type.MACRO: (1, '\n.. c:macro:: {name}\n\n{text}\n'),
Type.MACRO_FUNC: (1, '\n.. c:function:: {name}({args})\n\n{text}\n'),
Type.MACRO_FUNC: (1, '\n.. c:macro:: {name}({args})\n\n{text}\n'),
Type.FUNC: (1, '\n.. c:function:: {ttype} {name}({args})\n\n{text}\n')
}
......
# Copyright (c) 2021, Jani Nikula <jani@nikula.org>
# Licensed under the terms of BSD 2-Clause, see LICENSE for details.
"""
Read the Docs Helpers
=====================
Helpers for setting up and using Hawkmoth on Read the Docs.
"""
import os
import subprocess
def clang_setup(force=False):
"""Try to find and configure libclang location on RTD."""
if 'READTHEDOCS' in os.environ or force:
try:
result = subprocess.run(['llvm-config', '--libdir'],
check=True, capture_output=True, encoding='utf-8')
libdir = result.stdout.strip()
# For some reason there is no plain libclang.so symlink on RTD.
from clang.cindex import Config
Config.set_library_file(os.path.join(libdir, 'libclang.so.1'))
except Exception as e:
print(e)
......@@ -29,7 +29,7 @@ Dependencies
dnf install arm-none-eabi-gcc arm-none-eabi-binutils arm-none-eabi-newlib
- macOS (Note: The card10 firmware team used Linux so far. macOS recommendations here are experimental.)
- macOS (Note: The card10 firmware team used Linux so far. macOS recommendations here are experimental.)
You can use `Homebrew`_ to install the required tools. The version of the
ARM crosscompiler tool chain is quite important; with the wrong version,
......@@ -63,22 +63,50 @@ Dependencies
.. code-block:: shell-session
pacman -S meson
- macOS
- macOS
.. code-block:: shell-session
brew install ninja
pip3 install --user meson # see https://mesonbuild.com/Getting-meson.html - you will have to add ~/.local/bin to your PATH.
* **python3-crc16**: Install with ``pip3 install --user crc16``.
* **python3-pillow**: Python Image Library ``pip3 install --user pillow``.
* One of two CRC packages is required. Pick one:
- Ubuntu / Debian / macOS
.. code-block:: shell-session
pip3 install --user crc16
or
.. code-block:: shell-session
apt install python3-crcmod
or
.. code-block:: shell-session
pip3 install --user crcmod
- Arch
.. code-block:: shell-session
pacman -S python-crc16
* **python3-pillow**: Python Image Library
.. code-block:: shell-session
pip3 install --user pillow
- Arch
.. code-block:: shell-session
pacman -S python-crc16 python-pillow
pacman -S python-pillow
.. _ARM's GNU toolchain: https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads
......@@ -107,7 +135,6 @@ firmware features:
info related to BLE.
- ``-Ddebug_core1=true``: Enable the core 1 SWD lines which are exposed on the
SAO connector. Only use this if you have a debugger which is modified for core 1.
- ``-Djailbreak_card10=true``: Enable execution of .elf l0dables on core 1.
.. warning::
......@@ -146,10 +173,41 @@ Otherwise, rerunning ``./bootstrap.sh`` will also clean the build-directory.
.. note::
If you try to flash pycardium_epicardium.bin (renamed to card10.bin)
**macOS**: If ``strip`` fails to work on the freshly compiled ``mpy-cross``:
"strip: object: (...)/lib/micropython/micropython/mpy-cross/mpy-cross
malformed object (unknown load command 9)", you a likely not using the
`strip` that matches to your ``clang``. Do ``which strip && which clang``,
and if the paths don't match, clean up your PATHs, or as a quick hack,
create a symlink for strip.
.. note::
If you try to flash pycardium_epicardium.bin (renamed to card10.bin)
and the bootloader does not finish updating, the file might be too large.
~700kB is the normal size, but problems were reported where the file size
was >1MB. This was caused by the ``tr`` tool in the build process
(it's supposed to create a large file with 0xff in it) - this requires the
LC_ALL environment variable to be not set, or set to "C"
(but not UTF8 or similar).
\ No newline at end of file
~700kB is the normal size, but problems were reported where the file size
was >1MB. This was caused by the ``tr`` tool in the build process
(it's supposed to create a large file with 0xff in it) - this requires the
LC_ALL environment variable to be not set, or set to "C"
(but not UTF8 or similar).
Docker
======
Alternatively, clone the ``master`` branch of the firmware repository and enter it:
.. code-block:: shell-session
$ git clone https://git.card10.badge.events.ccc.de/card10/firmware.git
$ cd firmware
Afterwards, build a docker-container which will build the firmware via:
.. code-block:: shell-session
$ docker build -f docker/Dockerfile_fwbuild -t card10-firmware-builder .
Now, you can start the container with the firmware directory mounted, which will build the
firmware into the firmware/build directory:
.. code-block:: shell-session
$ docker run -v $(pwd):/firmware card10-firmware-builder
......@@ -5,27 +5,14 @@ method of flashing:
Flash Without Debugger
----------------------
If you do not have a debugger, you have to update the firmware using our
bootloader. To do so, you need to reboot card10 while keeping the buttom on
the bottom right pressed. Rebooting is done by either short pressing the power
button (top left) while you have a working firmware, or turning the card10 off
completely (by pressing the power button for 8 seconds) and then starting it again.
.. image:: static/bootloader-buttons.png
If you did everything correctly, the bootloader will display:
.. code-block:: text
Bootloader
Jul 28 2019
USB activated.
Ready.
If you do not have a debugger, you have to update the firmware using our
bootloader by going into :ref:`usb_file_transfer`.
On your host, you should now see an 8MB flash-device appear. You can now drop
the firmware's ``.bin`` (from ``build/pycardium/pycardium_epicardium.bin`` in
most cases) into this flash-storage. You **must** call the file ``card10.bin``
for the bootloader to use it.
After you get your badge into :ref:`usb_file_transfer`, you can drop the firmware's
``.bin`` (from ``build/pycardium/pycardium_epicardium.bin`` in most cases) into
this flash-storage. You **must** call the file ``card10.bin`` for the
bootloader to use it.
The bootloader will then display ``Writing.`` in red while it is actually
writing the file to external flash. Please wait until it displays ``Ready.``
......
......@@ -23,32 +23,40 @@ Last but not least, if you want to start hacking the lower-level firmware, the
pycardium/overview
pycardium/stdlib
pycardium/bhi160
pycardium/ble_hid
pycardium/bme680
pycardium/max30001
pycardium/max86150
pycardium/buttons
pycardium/color
pycardium/config
pycardium/display
pycardium/gpio
pycardium/leds
pycardium/light-sensor
pycardium/os
pycardium/personal_state
pycardium/png
pycardium/power
pycardium/pride
pycardium/simple_menu
pycardium/utime
pycardium/vibra
pycardium/ws2812
.. toctree::
:maxdepth: 1
:caption: Firmware
overview
card10-cfg
usb-file-transfer
how-to-build
how-to-flash
debugger
pycardium-guide
memorymap
epicardium/mutex
epicardium/sensor-streams
.. toctree::
......@@ -58,13 +66,18 @@ Last but not least, if you want to start hacking the lower-level firmware, the
epicardium/overview
epicardium/api
epicardium-guide
epicardium/internal
.. toctree::
:maxdepth: 1
:caption: Bluetooth
bluetooth/overview
bluetooth/ess
bluetooth/file-transfer
bluetooth/card10
bluetooth/ecg
bluetooth/nimble
Indices and tables
==================
......
......@@ -14,24 +14,39 @@ Epicardium
Epicardium is based on `FreeRTOS <https://www.freertos.org/>`_. There are a
number of tasks that will have been keeping card10 running. These are:
* **Dispatcher**: The dispatcher task handles API calls from core 1.
* **PMIC**: The power manager task checks the battery level and other interesting
statistics that can be gathered from our power manager IC (MAX77650).
* **Serial**: Handles serial communication via *UART*, *CDC ACM* and possibly
Bluetooth.
* **BHI160**: Housekeeping task for interaction with the `BHI160`_.
+--------------------+-------------------------------+----------+-------------------------------------------+
| Name | ID Global | Priority | Description |
+====================+===============================+==========+===========================================+
| `vPmicTask`_ | ``pmic_task_id`` (static) | +4 | Power Management (and Reset Button) |
+--------------------+-------------------------------+----------+-------------------------------------------+
| `vLifecycleTask`_ | ``lifecycle_task`` (static) | +3 | Control of the payload running on core 1. |
+--------------------+-------------------------------+----------+-------------------------------------------+
| `vBleTask`_ | ``ble_task_id`` (static) | +3 | Bluetooth Low Energy Stack |
+--------------------+-------------------------------+----------+-------------------------------------------+
| `vSerialTask`_ | ``serial_task_id`` | +3 | Serial Output via UART/CDC-ACM/BLE |
+--------------------+-------------------------------+----------+-------------------------------------------+
| `vApiDispatcher`_ | ``dispatcher_task_id`` | +2 | Epicardium API dispatcher |
+--------------------+-------------------------------+----------+-------------------------------------------+
| `vInterruptsTask`_ | ``interrupts_task`` (static) | +2 | Interrupt dispatcher worker |
+--------------------+-------------------------------+----------+-------------------------------------------+
| `vMAX30001Task`_ | ``max30001_task_id`` (static) | +1 | `MAX30001`_ ECG driver |
+--------------------+-------------------------------+----------+-------------------------------------------+
| `vBhi160Task`_ | ``bhi160_task_id`` (static) | +1 | `BHI160`_ sensor fusion driver |
+--------------------+-------------------------------+----------+-------------------------------------------+
.. _vPmicTask: https://git.card10.badge.events.ccc.de/card10/firmware/blob/master/epicardium/modules/pmic.c#L281
.. _vLifecycleTask: https://git.card10.badge.events.ccc.de/card10/firmware/blob/master/epicardium/modules/lifecycle.c#L361
.. _vBleTask: https://git.card10.badge.events.ccc.de/card10/firmware/blob/master/epicardium/ble/ble.c#L237
.. _vSerialTask: https://git.card10.badge.events.ccc.de/card10/firmware/blob/master/epicardium/modules/serial.c#L289
.. _vApiDispatcher: https://git.card10.badge.events.ccc.de/card10/firmware/blob/master/epicardium/modules/dispatcher.c#L25
.. _vInterruptsTask: https://git.card10.badge.events.ccc.de/card10/firmware/blob/master/epicardium/modules/interrupts.c#L119
.. _vLedTask: https://git.card10.badge.events.ccc.de/card10/firmware/blob/master/epicardium/modules/personal_state.c#L58
.. _vMAX30001Task: https://git.card10.badge.events.ccc.de/card10/firmware/blob/master/epicardium/modules/max30001.c#L378
.. _vBhi160Task: https://git.card10.badge.events.ccc.de/card10/firmware/blob/master/epicardium/modules/bhi.c#L419
.. _MAX30001: https://www.maximintegrated.com/en/products/analog/data-converters/analog-front-end-ics/MAX30001.html
.. _BHI160: https://www.bosch-sensortec.com/bst/products/all_products/bhi160
.. todo::
The following tasks have not yet been implemented/are currently in the works:
- **Bluetooth**: The bluetooth stack (`#23`_)
- **Payload Controller**: Control what is running on core 1
.. _#23: https://git.card10.badge.events.ccc.de/card10/firmware/issues/23
Epicardium API
--------------
Epicardium exposes lots of functionality via the *Epicardium API*. The
......@@ -41,23 +56,30 @@ you should probably read the :ref:`epicardium_api_guide` guide.
Pycardium
---------
Pycardium is our MicroPython fork. Its purpose is to make it as easy as
possible to interact with card10. If you are interested in working on
Pycardium, take a look at the :ref:`pycardium_guide` guide.
L0dables
.. _l0dables:
l0dables
--------
Next to Pycardium, other bare-metal code can also run on core 1. For example,
a Rustcardium or C-cardium. These l0dables must be compiled using our special
a `Rustcardium`_ or C-cardium. These l0dables must be compiled using our special
linker script and should link against the api-caller library so they can
interface with the :ref:`epicardium_api`.
Note: this feature is disabled by default and has to be enabled at build time.
To do this, run ``bootstrap.sh`` with the option ``-Djailbreak_card10=true``
and rebuild the firmware as described in :ref:`how_to_build`.
.. todo::
Note: this feature is disabled by default and has to be enabled in :ref:`card10_cfg`. A :ref:`card10_cfg` file dropped into the :ref:`usb_file_transfer` of the badge containing ``execute_elf = true`` is enough.
l0dables are currently built within the source tree of the main repository. See |l0dables_blinky|_ for an example of a hello-world-like program. Within those programs, you can access the :ref:`epicardium_api` to control the hardware and behaviour of the badge.
Once you have a built ELF file, you can drop it into the FAT filesystem of the flash (eg. via :ref:`usb_file_transfer`) and it will be available from the menu program of the badge.
Provide more details how this works
.. _Rustcardium: https://git.card10.badge.events.ccc.de/astro/rust-card10
.. |l0dables_blinky| replace:: ``l0dables/blinky``
.. _l0dables_blinky: https://git.card10.badge.events.ccc.de/card10/firmware/-/tree/master/l0dables
Program Flow Diagram
--------------------
......
......@@ -2,101 +2,66 @@
``bhi160`` - Sensor Fusion
==========================
.. versionadded:: 1.4
Supports the BHI160 sensor on the card10 for accelerometer, gyroscope...
Supports the BHI160 sensor on the card10 for accelerometer, gyroscope,
magnetometer and orientation.
The coordinate system of the BHI160 sensor data looks like this:
.. image:: ../static/bhi160-coordinates.png
* The **accelerometer** axes are just the ones shown in the picture.
* The **gyroscope**'s angular velocities rotate counter clockwise around
their respective axis.
* The **orientation** sensor uses the following mapping:
+---------------------+----------------------+-------------------+
| X | Y | Z |
+=====================+======================+===================+
| Azimuth (0° - 360°) | Pitch (-180° - 180°) | Roll (-90° - 90°) |
+---------------------+----------------------+-------------------+
**Example**:
.. code-block:: python
import bhi160
import utime
import time
bhi = bhi160.BHI160Orientation()
while True:
samples = bhi.read()
print(samples)
utime.sleep(0.5)
.. class:: bhi160.BHI160Orientation(sample_rate,dynamic_range,callback,sample_buffer_len)
Orientation of the BHI160
Parameters:
sample_rate: int, optional
Sample rate (default is 4)
dynamic_range: int, optional
Dynamic range (default is 2)
callback: callable, optional
Call this callback when enough data is collected (default is None)
.. todo:: The callback functionality is untested, so do not be confused if it does not work.
sample_buffer_len: int, optional
Length of sample buffer (default is 200)
.. py:method:: read():
Read sensor values
:returns: Collected sensor values as list
.. py:method:: close():
Close the connection to the sensor
.. class:: bhi160.BHI160Accelerometer
Accelerometer of the BHI160
Parameters:
sample_rate: int, optional
Sample rate (default is 4)
dynamic_range: int, optional
Dynamic range (default is 2)
callback: callable, optional
Call this callback when enough data is collected (default is None)
.. todo:: The callback functionality is untested, so do not be confused if it does not work.
sample_buffer_len: int, optional
Length of sample buffer (default is 200)
.. py:method:: read():
Read sensor values
:returns: Collected sensor values as list
.. py:method:: close():
Close the connection to the sensor
.. class:: bhi160.BHI160Gyroscope
Gyroscope of the BHI160
Parameters:
sample_rate: int, optional
Sample rate (default is 4)
dynamic_range: int, optional
Dynamic range (default is 2)
callback: callable, optional
Call this callback when enough data is collected (default is None)
.. todo:: The callback functionality is untested, so do not be confused if it does not work.
sample_buffer_len: int, optional
Length of sample buffer (default is 200)
.. py:method:: read():
Read sensor values
:returns: Collected sensor values as list
.. py:method:: close():
Close the connection to the sensor
if len(samples) == 0:
time.sleep(0.25)
continue
# print the latest sample
print(samples[-1])
time.sleep(0.25)
Orientation
-----------
.. autoclass:: bhi160.BHI160Orientation
:members:
:inherited-members:
Accelerometer
-------------
.. autoclass:: bhi160.BHI160Accelerometer
:members:
:inherited-members:
Gyroscope
---------
.. autoclass:: bhi160.BHI160Gyroscope
:members:
:inherited-members:
Magnetometer
------------
.. autoclass:: bhi160.BHI160Magnetometer
:members:
:inherited-members:
``ble_hid`` - BLE HID
=====================
The ``ble_hid`` module provides access to the BLE Human Interface Device functionality.
.. note::
Make sure to enable the BLE HID functionality in :ref:`card10_cfg` and reboot your card10
if you want to use BLE HID.
Also make sure that the ``adafruit_hid`` folder from the card10 release archive is placed
on the file system of your card10.
.. warning::
At least Ubuntu Linux will keep auto connecting to BLE HID devices once they are
paired to the host computer. If you want to connect your card10 to a phone again,
you might have to temporarily turn off Bluetooth on your computer.
An example application can be found in the preload directory (named ``HID Demo``). It provides
examples how to use the card10 as keyboard, mouse or volume control.
Please refer to the Adafruit CircuitPython HID library for examples how to use the HID service.
The card10 implements the same HID descriptors as the Adafruit CircuitPython BLE library and
should be compatible with all uses of the Adafruit CircuitPython HID library.
**Example emulating a keyboard**:
Adapted from https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/master/CPB_Keybutton_BLE/cpb_keybutton_ble.py
A more complete version of this example can be found in the HID Demo app on your card10.
.. code-block:: python
import ble_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.keycode import Keycode
k = Keyboard(ble_hid.devices)
kl = KeyboardLayoutUS(k)
k.send(Keycode.BACKSPACE)
# use keyboard_layout for words
kl.write("Demo with a long text to show how fast a card10 can type!")
# add shift modifier
k.send(Keycode.SHIFT, Keycode.F19)
**Example emulating a mouse**:
.. code-block:: python
import ble_hid
import bhi160
import buttons
from adafruit_hid.mouse import Mouse
m = Mouse(ble_hid.devices)
def send_report(samples):
if len(samples) > 0:
x = -int(samples[0].z)
y = -int(samples[0].y)
m.move(x, y)
sensor = bhi160.BHI160Orientation(sample_rate=10, callback=send_report)
b_old = buttons.read()
while True:
b_new = buttons.read()
if not b_old == b_new:
print(b_new)
b_old = b_new
if b_new == buttons.TOP_RIGHT:
m.click(Mouse.MIDDLE_BUTTON)
elif b_new == buttons.BOTTOM_RIGHT:
m.click(Mouse.RIGHT_BUTTON)
elif b_new == buttons.BOTTOM_LEFT:
m.click(Mouse.LEFT_BUTTON)
.. note::
Make sure to catch ``OSError`` exceptions in real applications. The exception will be thrown if
there is connection to the host (or if it is lost) and you want to send an event.
.. automodule:: ble_hid
:members:
......@@ -2,24 +2,83 @@
``bme680`` - Environmental Sensor
=================================
Allows access to environmental data of card10's surroundings.
If ``bsec_enable`` is set in :ref:`card10_cfg`, the proprietary Bosch BSEC
library will be activated which offers the following extra functionality:
- Manual temperature offset compensation
The ``bsec_offset`` configuration allows to configure a static temperature
offset. Please use a reference thermometer to determine the offset of your
card10. If no offset is provided a default offset for a card10 which is
connected to USB, has BLE active and is without a case is used.
- A fixed measurement interval of 3 seconds
This helps to stabilize the temperature of the card10.
- An indoor air quality (IAQ) and equivalent CO2 estimation algorithm
Please refer to the :ref:`bsec_api` API documentation to get more information
about how to interpret these estimates.
.. note::
Please keep in mind that the BME680 can not directly measure CO2. It measures
Volatile Organic Compounds (VOCs). The BSEC library uses this measurement
to compute an Indoor Air Quality (IAQ) indication. It also assumes that all VOCs
in the air are from human breath and computes an equivalent CO2 (eCO2)
value from this. Please be aware of these facts when judging the accuracy
of the IAQ and eCO2 values. Some more information can be found in the
:ref:`bsec_api` API documentation.
.. warning::
For the BSEC library to properly work the card10 should be kept running
for at least 10 hours at least once. This is needed as the BSEC library
periodically writes calibration information about the sensor to the
card10's file system.
Please make sure to observe the IAQ accuracy field. It will tell you if the
IAQ and eCO2 measurements are deemed "accurate" by the BSEC library. Your
application should either inform the user about the current accuracy (e.g.
by color coding) or simply not show any values if the accuracy is below 2.
.. note::
See also the BLE :ref:`ESS`.
**Example**:
.. code-block:: python
import bme680, utime
import bme680, time
with bme680.Bme680() as environment:
while True:
d = environment.get_data()
print("Temperature: {:10.2f} °C".format(d.temperature))
print("Humidity: {:10.2f} % r.h.".format(d.humidity))
print("Pressure: {:10.2f} hPa".format(d.pressure))
print("Gas Resistance: {:10.2f} Ω".format(d.resistance))
time.sleep(1)
You can use the return type of :py:meth:`~bme680.Bme680.get_data` to decide
if you want to use/display the additonal fields returned if BSEC is enabled.
.. code-block:: python
bme680.init()
if isinstance(d, bme680.BSECData):
print("Air quality: {:7d}".format(d.iaq))
while True:
temperature, humidity, pressure, resistance = bme680.get_data()
Sensor Class
------------
print("Temperature: {:10.2f} °C".format(temperature))
print("Humidity: {:10.2f} % r.h.".format(humidity))
print("Pressure: {:10.2f} hPa".format(pressure))
print("Gas Resistance: {:10.2f} Ω".format(resistance))
.. autoclass:: bme680.Bme680
:members:
utime.sleep(1)
Deprecated Interface
--------------------
The following functions should no longer be used directly. The only exist for
compatibility as they were the old BME680 interface in previous firmware
versions.
.. py:function:: init()
......@@ -29,6 +88,8 @@
:py:func:`bme680.init`.
.. versionadded:: 1.4
.. deprecated:: 1.10
Use the :py:class:`bme680.Bme680` class instead.
.. py:function:: get_data()
......@@ -38,9 +99,13 @@
``pressure`` (hPa) and ``gas resistance`` (Ohm).
.. versionadded:: 1.4
.. deprecated:: 1.10
Use the :py:class:`bme680.Bme680` class instead.
.. py:function:: deinit()
Deinitialize the sensor.
.. versionadded:: 1.4
.. deprecated:: 1.10
Use the :py:class:`bme680.Bme680` class instead.
......@@ -14,23 +14,65 @@ The color module also contains a few constanst for commonly used colors:
Camp Colors
~~~~~~~~~~~
.. py:data:: CHAOSBLUE
.. color-example:: #0076BA
.. py:data:: CHAOSBLUE_DARK
.. color-example:: #005383
.. py:data:: COMMYELLOW
.. color-example:: #FFC600
.. py:data:: COMMYELLOW_DARK
.. color-example:: #D39A00
.. py:data:: CAMPGREEN
.. color-example:: #99BA00
.. py:data:: CAMPGREEN_DARK
.. color-example:: #6F8700
General
~~~~~~~
.. py:data:: BLACK
.. color-example:: #000
.. py:data:: WHITE
.. color-example:: #fff
.. py:data:: RED
.. color-example:: #f00
.. py:data:: GREEN
.. color-example:: #0f0
.. py:data:: YELLOW
.. color-example:: #ff0
.. py:data:: BLUE
.. color-example:: #00f
.. py:data:: MAGENTA
.. color-example:: #f0f
.. py:data:: CYAN
.. color-example:: #0ff
.. py:module:: htmlcolor
``htmlcolor`` - Color Constants
......@@ -39,142 +81,561 @@ The ``htmlcolor`` module contains even more color constants. Note
that loading the ``htmlcolor`` module will require ~12K of RAM.
.. py:data:: ALICEBLUE
.. color-example:: aliceblue
.. py:data:: ANTIQUEWHITE
.. color-example:: antiquewhite
.. py:data:: AQUA
.. color-example:: aqua
.. py:data:: AQUAMARINE
.. color-example:: aquamarine
.. py:data:: AZURE
.. color-example:: azure
.. py:data:: BEIGE
.. color-example:: beige
.. py:data:: BISQUE
.. color-example:: bisque
.. py:data:: BLACK
.. color-example:: black
.. py:data:: BLANCHEDALMOND
.. color-example:: blanchedalmond
.. py:data:: BLUE
.. color-example:: blue
.. py:data:: BLUEVIOLET
.. color-example:: blueviolet
.. py:data:: BROWN
.. color-example:: brown
.. py:data:: BURLYWOOD
.. color-example:: burlywood
.. py:data:: CADETBLUE
.. color-example:: cadetblue
.. py:data:: CHARTREUSE
.. color-example:: chartreuse
.. py:data:: CHOCOLATE
.. color-example:: chocolate
.. py:data:: CORAL
.. color-example:: coral
.. py:data:: CORNFLOWERBLUE
.. color-example:: cornflowerblue
.. py:data:: CORNSILK
.. color-example:: cornsilk
.. py:data:: CRIMSON
.. color-example:: crimson
.. py:data:: CYAN
.. color-example:: cyan
.. py:data:: DARKBLUE
.. color-example:: darkblue
.. py:data:: DARKCYAN
.. color-example:: darkcyan
.. py:data:: DARKGOLDENROD
.. color-example:: darkgoldenrod
.. py:data:: DARKGRAY
.. color-example:: darkgray
.. py:data:: DARKGREEN
.. color-example:: darkgreen
.. py:data:: DARKKHAKI
.. color-example:: darkkhaki
.. py:data:: DARKMAGENTA
.. color-example:: darkmagenta
.. py:data:: DARKOLIVEGREEN
.. color-example:: darkolivegreen
.. py:data:: DARKORANGE
.. color-example:: darkorange
.. py:data:: DARKORCHID
.. color-example:: darkorchid
.. py:data:: DARKRED
.. color-example:: darkred
.. py:data:: DARKSALMON
.. color-example:: darksalmon
.. py:data:: DARKSEAGREEN
.. color-example:: darkseagreen
.. py:data:: DARKSLATEBLUE
.. color-example:: darkslateblue
.. py:data:: DARKSLATEGRAY
.. color-example:: darkslategray
.. py:data:: DARKTURQUOISE
.. color-example:: darkturquoise
.. py:data:: DARKVIOLET
.. color-example:: darkviolet
.. py:data:: DEEPPINK
.. color-example:: deeppink
.. py:data:: DEEPSKYBLUE
.. color-example:: deepskyblue
.. py:data:: DIMGRAY
.. color-example:: dimgray
.. py:data:: DODGERBLUE
.. color-example:: dodgerblue
.. py:data:: FIREBRICK
.. color-example:: firebrick
.. py:data:: FLORALWHITE
.. color-example:: floralwhite
.. py:data:: FORESTGREEN
.. color-example:: forestgreen
.. py:data:: FUCHSIA
.. color-example:: fuchsia
.. py:data:: GAINSBORO
.. color-example:: gainsboro
.. py:data:: GHOSTWHITE
.. color-example:: ghostwhite
.. py:data:: GOLD
.. color-example:: gold
.. py:data:: GOLDENROD
.. color-example:: goldenrod
.. py:data:: GRAY
.. color-example:: gray
.. py:data:: GREEN
.. color-example:: green
.. py:data:: GREENYELLOW
.. color-example:: greenyellow
.. py:data:: HONEYDEW
.. color-example:: honeydew
.. py:data:: HOTPINK
.. color-example:: hotpink
.. py:data:: INDIANRED
.. color-example:: indianred
.. py:data:: INDIGO
.. color-example:: indigo
.. py:data:: IVORY
.. color-example:: ivory
.. py:data:: KHAKI
.. color-example:: khaki
.. py:data:: LAVENDER
.. color-example:: lavender
.. py:data:: LAVENDERBLUSH
.. color-example:: lavenderblush
.. py:data:: LAWNGREEN
.. color-example:: lawngreen
.. py:data:: LEMONCHIFFON
.. color-example:: lemonchiffon
.. py:data:: LIGHTBLUE
.. color-example:: lightblue
.. py:data:: LIGHTCORAL
.. color-example:: lightcoral
.. py:data:: LIGHTCYAN
.. color-example:: lightcyan
.. py:data:: LIGHTGOLDENRODYELLOW
.. color-example:: lightgoldenrodyellow
.. py:data:: LIGHTGRAY
.. color-example:: lightgray
.. py:data:: LIGHTGREEN
.. color-example:: lightgreen
.. py:data:: LIGHTPINK
.. color-example:: lightpink
.. py:data:: LIGHTSALMON
.. color-example:: lightsalmon
.. py:data:: LIGHTSEAGREEN
.. color-example:: lightseagreen
.. py:data:: LIGHTSKYBLUE
.. color-example:: lightskyblue
.. py:data:: LIGHTSLATEGRAY
.. color-example:: lightslategray
.. py:data:: LIGHTSTEELBLUE
.. color-example:: lightsteelblue
.. py:data:: LIGHTYELLOW
.. color-example:: lightyellow
.. py:data:: LIME
.. color-example:: lime
.. py:data:: LIMEGREEN
.. color-example:: limegreen
.. py:data:: LINEN
.. color-example:: linen
.. py:data:: MAGENTA
.. color-example:: magenta
.. py:data:: MAROON
.. color-example:: maroon
.. py:data:: MEDIUMAQUAMARINE
.. color-example:: mediumaquamarine
.. py:data:: MEDIUMBLUE
.. color-example:: mediumblue
.. py:data:: MEDIUMORCHID
.. color-example:: mediumorchid
.. py:data:: MEDIUMPURPLE
.. color-example:: mediumpurple
.. py:data:: MEDIUMSEAGREEN
.. color-example:: mediumseagreen
.. py:data:: MEDIUMSLATEBLUE
.. color-example:: mediumslateblue
.. py:data:: MEDIUMSPRINGGREEN
.. color-example:: mediumspringgreen
.. py:data:: MEDIUMTURQUOISE
.. color-example:: mediumturquoise
.. py:data:: MEDIUMVIOLETRED
.. color-example:: mediumvioletred
.. py:data:: MIDNIGHTBLUE
.. color-example:: midnightblue
.. py:data:: MINTCREAM
.. color-example:: mintcream
.. py:data:: MISTYROSE
.. color-example:: mistyrose
.. py:data:: MOCCASIN
.. color-example:: moccasin
.. py:data:: NAVAJOWHITE
.. color-example:: navajowhite
.. py:data:: NAVY
.. color-example:: navy
.. py:data:: OLDLACE
.. color-example:: oldlace
.. py:data:: OLIVE
.. color-example:: olive
.. py:data:: OLIVEDRAB
.. color-example:: olivedrab
.. py:data:: ORANGE
.. color-example:: orange
.. py:data:: ORANGERED
.. color-example:: orangered
.. py:data:: ORCHID
.. color-example:: orchid
.. py:data:: PALEGOLDENROD
.. color-example:: palegoldenrod
.. py:data:: PALEGREEN
.. color-example:: palegreen
.. py:data:: PALETURQUOISE
.. color-example:: paleturquoise
.. py:data:: PALEVIOLETRED
.. color-example:: palevioletred
.. py:data:: PAPAYAWHIP
.. color-example:: papayawhip
.. py:data:: PEACHPUFF
.. color-example:: peachpuff
.. py:data:: PERU
.. color-example:: peru
.. py:data:: PINK
.. color-example:: pink
.. py:data:: PLUM
.. color-example:: plum
.. py:data:: POWDERBLUE
.. color-example:: powderblue
.. py:data:: PURPLE
.. color-example:: purple
.. py:data:: RED
.. color-example:: red
.. py:data:: ROSYBROWN
.. color-example:: rosybrown
.. py:data:: ROYALBLUE
.. color-example:: royalblue
.. py:data:: SADDLEBROWN
.. color-example:: saddlebrown
.. py:data:: SALMON
.. color-example:: salmon
.. py:data:: SANDYBROWN
.. color-example:: sandybrown
.. py:data:: SEAGREEN
.. color-example:: seagreen
.. py:data:: SEASHELL
.. color-example:: seashell
.. py:data:: SIENNA
.. color-example:: sienna
.. py:data:: SILVER
.. color-example:: silver
.. py:data:: SKYBLUE
.. color-example:: skyblue
.. py:data:: SLATEBLUE
.. color-example:: slateblue
.. py:data:: SLATEGRAY
.. color-example:: slategray
.. py:data:: SNOW
.. color-example:: snow
.. py:data:: SPRINGGREEN
.. color-example:: springgreen
.. py:data:: STEELBLUE
.. color-example:: steelblue
.. py:data:: TAN
.. color-example:: tan
.. py:data:: TEAL
.. color-example:: teal
.. py:data:: THISTLE
.. color-example:: thistle
.. py:data:: TOMATO
.. color-example:: tomato
.. py:data:: TURQUOISE
.. color-example:: turquoise
.. py:data:: VIOLET
.. color-example:: violet
.. py:data:: WHEAT
.. color-example:: wheat
.. py:data:: WHITE
.. color-example:: white
.. py:data:: WHITESMOKE
.. color-example:: whitesmoke
.. py:data:: YELLOW
.. color-example:: yellow
.. py:data:: YELLOWGREEN
.. color-example:: yellowgreen
``config`` - Configuration
==========================
The ``config`` module provides functions to interact with card10's
configuration file (:ref:`card10_cfg`).
.. automodule:: config
:members:
``display`` - Display
=====================
The display module let's you draw on the card10's display.
Pixels are addressed from top left to bottom right with a range of x: 0 to 159 and y: 0 to 79.
.. code-block:: text
0,0
+---------------------+
| |
| |
| |
| |
+---------------------+
159,79
Drawing operations are clipped, pixels outside of the screen will be ignored.
.. automodule:: display
:members:
......@@ -25,7 +25,10 @@ output in your scripts.
:param int pin: ID of the pin to be configured.
:param int mode: An integer with the bits for the wanted mode set. Create your
integer by ORing :py:data:`gpio.mode.OUTPUT`, :py:data:`gpio.mode.INPUT`,
:py:data:`gpio.mode.PULL_UP`, :py:data:`gpio.mode.PULL_DOWN`.
:py:data:`gpio.mode.ADC`, :py:data:`gpio.mode.PULL_UP`,
:py:data:`gpio.mode.PULL_DOWN`.
.. note:: On WRISTBAND_3, there is no ADC functionality available
.. py:function:: get_mode(pin)
......@@ -47,6 +50,9 @@ output in your scripts.
:param int pin: ID of the pin of to get the mode of.
:returns: Current value of the GPIO pin.
If the pin is configured as ADC, the value returned
will be between 0 and 1000, representing voltages from
0V to 3.3V (:py:data:`gpio.ADC` is only available in 1.9+).
.. py:data:: WRISTBAND_1
......@@ -75,6 +81,12 @@ output in your scripts.
Configures a pin as input.
.. py:data:: ADC
Configure pin as ADC input.
.. versionadded: 1.9
.. py:data:: PULL_UP
Enables the internal pull-up resistor of a pin.
......
......@@ -25,3 +25,13 @@ be fairly stable.
.. py:function:: stop()
Stop the ADC.
.. py:function:: read()
Direct readout of the light-sensor.
Use this function for low latency readout. The time between polls can have
an effect on the values measures. If you do not need low latency, prefer
:py:func:`light_sensor.get_reading`.
.. versionadded:: 1.8
``max86150`` - MAX86150
=======================
.. automodule:: max86150
:members:
......@@ -8,12 +8,6 @@ functions found in CPythons ``os`` module.
CPython-Like
------------
.. py:function:: unlink(path)
Unlink (remove) a file.
:param str path: The file to remove.
.. py:function:: listdir(dir)
List contents of a directory.
......@@ -22,6 +16,28 @@ CPython-Like
:returns: A list of entities (files or subdirectories) in the directory
``dir``.
.. py:function:: mkdir(path)
Create a directory named *path*.
:param str path: Path to the directory to create. Only the last component
of this path will be created.
.. py:function:: rename(src, dst)
Rename the file or directory *src* to *dst*. If *dst* exists, the operation
will fail.
:param str src: Path to source file to rename.
:param str dst: Destination path to rename to. Must not exist before
calling :py:func:`os.rename`.
.. py:function:: unlink(path)
Unlink (remove) a file.
:param str path: The file to remove.
.. py:function:: urandom(n)
Return ``n`` random bytes.
......@@ -72,3 +88,44 @@ Card10-Specific
Please only call this function if absolutely necessary. In most cases
you'll want to just :py:func:`os.exit` instead.
.. py:function:: usbconfig(config_type)
Change active USB configuration. By default, card10 boots with
:py:data:`os.USB_SERIAL` active.
This will deactivate the currently active USB configuration. This means
that, if you activate :py:data:`os.USB_FLASH` while :py:data:`os.USB_SERIAL`
was active, the USB serial will be disconnected.
:param config_type: Selects which config to activate. Possible
values are :py:data:`os.USB_SERIAL`, :py:data:`os.USB_FLASH`,
or :py:data:`os.USB_NONE`.
.. versionadded:: 1.11
.. py:data:: USB_NONE
No USB device active.
.. py:data:: USB_SERIAL
CDC-ACM serial device active.
.. py:data:: USB_FLASH
Mass-Storage device active.
.. py:function:: fs_is_attached()
Check whether the filesystem is currently attached to card10 (or whether a connected
USB host is currently holding control over it and possibly writing to it).
:returns:
- ``True`` if the filesystem is attached to card10 and an app can read and
write files.
- ``False`` if the filesystem is not available to card10 because a USB
host is currently controlling it.
.. versionadded: 1.18
......@@ -36,8 +36,53 @@ Baud-rate is 115200. Some options are:
* **screen**: ``sudo screen /dev/ttyACM0 115200``
* **picocom**: ``sudo picocom -b 115200 /dev/ttyACM0``
After connecting, reboot card10 and you should see the MicroPython REPL pop up.
After connecting, reboot reset the card10 via the power button (left upper
corner) and you should see the output of **menu.py** script (it's located in
*preload/menu.py*). You can press CTRL-C to interrupt the script and jump into
the MicroPython prompt.
.. todo::
To switch on the blue fairy dust you must import the led python module::
Getting Started Guide for people interested in writing Python code.
import leds
and power it on::
leds.set_rocket(0, 31)
.. note::
If you're using iOS/Mac then you can connect to your serial console using:
.. code-block:: shell-session
screen /dev/tty.usbmodem* 115200
You can now see in your console what buttons you have pressed and your
console outputs/logs. With ``CTRL+C`` you exit the console.
REPL modes
^^^^^^^^^^
MicroPython supports a different REPL modes over the serial console. The modes
can be changed on every new line.
Normal mode
"""""""""""
This is the mode you will first see. You can switch to it by pressing CTRL-B.
If you are in a other mode you can return to this mode by pressing CTRL-B too.
Paste mode
""""""""""
You can enter the paste mode by pressing CTRL-E and you can simple copy 'n'
paste your source code into the console and it will be interpreted and executed
line by line. Every new line will be reply by the prompt with **===**.
RAW mode
""""""""
The RAW mode to be intendend for the usage with tools. By pressing CTRL-A you
will enter the RAW REPL mode. The type in code will not printed. By pressing
CTRL-D the whole entered code will be evaluated and executed. The board will
reply with **OK** and print after that the output (print commands) of the code
or give you tracebacks if an error occured.
You can use **pycard10** (tools/pycard10.py) to execute python files from your
PC directly on the card10.