Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
François Revol
firmware
Commits
0a00d50c
Commit
0a00d50c
authored
Jun 15, 2020
by
schneider
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(docs): Mention u-name and non-u-name modules in Documentation
parent
3e924664
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
15 deletions
+28
-15
Documentation/pycardium/bhi160.rst
Documentation/pycardium/bhi160.rst
+3
-3
Documentation/pycardium/bme680.rst
Documentation/pycardium/bme680.rst
+2
-2
Documentation/pycardium/stdlib.rst
Documentation/pycardium/stdlib.rst
+12
-2
Documentation/pycardium/utime.rst
Documentation/pycardium/utime.rst
+9
-6
Documentation/pycardium/ws2812.rst
Documentation/pycardium/ws2812.rst
+2
-2
No files found.
Documentation/pycardium/bhi160.rst
View file @
0a00d50c
...
...
@@ -28,18 +28,18 @@ The coordinate system of the BHI160 sensor data looks like this:
.. code-block:: python
import bhi160
import
u
time
import time
bhi = bhi160.BHI160Orientation()
while True:
samples = bhi.read()
if len(samples) == 0:
u
time.sleep(0.25)
time.sleep(0.25)
continue
# print the latest sample
print(samples[-1])
u
time.sleep(0.25)
time.sleep(0.25)
Orientation
...
...
Documentation/pycardium/bme680.rst
View file @
0a00d50c
...
...
@@ -8,7 +8,7 @@ Allows access to environmental data of card10's surroundings.
.. code-block:: python
import bme680,
u
time
import bme680, time
with bme680.Bme680() as environment:
while True:
...
...
@@ -19,7 +19,7 @@ Allows access to environmental data of card10's surroundings.
print("Pressure: {:10.2f} hPa".format(d.pressure))
print("Gas Resistance: {:10.2f} Ω".format(d.resistance))
u
time.sleep(1)
time.sleep(1)
Sensor Class
------------
...
...
Documentation/pycardium/stdlib.rst
View file @
0a00d50c
MicroPython Standard Library
============================
Pycardium contains some modules from the MicroPython standard library. These
are:
Pycardium contains some modules from the MicroPython standard library.
Some modules below use a standard Python name, but prefixed with “u”,
e.g. ujson instead of json. This is to signify that such a module is a
micro-library, i.e. implements only a subset of CPython module
functionality. Please refer to the official `MicroPython docs`_ for an
explanation why.
All u-name modules can also be imported using their non-u-name. E.g.
``import utime`` and import ``import time`` will both work.
.. _MicroPython docs: http://docs.micropython.org/en/latest/library/index.html#python-standard-libraries-and-micro-libraries
.. py:module:: framebuf
...
...
Documentation/pycardium/utime.rst
View file @
0a00d50c
...
...
@@ -8,6 +8,9 @@ CPython but wouldn't fit anywhere else in our implementation. Most
prominently, this is the :py:func:`utime.alarm` function for setting an RTC
alarm.
Like all other u-name modules, ``utime`` can also imported using the standard
``import time`` statement.
.. |time| replace:: ``time``
.. _time: https://docs.python.org/3/library/time.html
...
...
@@ -135,13 +138,13 @@ alarm.
.. code-block:: python
import
u
time
import time
def minute_timer(x):
current =
u
time.time()
current = time.time()
print("Current: " + str(current))
alarm = (current // 60 + 1) * 60
u
time.alarm(alarm, minute_timer)
time.alarm(alarm, minute_timer)
minute_timer(None)
...
...
@@ -150,13 +153,13 @@ alarm.
.. code-block:: python
import interrupt,
u
time
import interrupt, time
def 5_second_timer(x):
current =
u
time.time()
current = time.time()
print("Current: " + str(current))
alarm = (current // 10) * 10 + 5
u
time.alarm(alarm)
time.alarm(alarm)
# This time, we need to register and enable the callback manually
interrupt.set_callback(interrupt.RTC_ALARM, 5_second_timer)
...
...
Documentation/pycardium/ws2812.rst
View file @
0a00d50c
...
...
@@ -19,7 +19,7 @@ The ``ws2812`` module controls LEDs of the WS2812 type. Just as the ``leds`` mod
.. code-block:: python
import color,
u
time, ws2812, gpio
import color, time, ws2812, gpio
i = 0
while True:
...
...
@@ -28,6 +28,6 @@ The ``ws2812`` module controls LEDs of the WS2812 type. Just as the ``leds`` mod
col3 = color.from_hsv((i + 40) % 360, 1.0, 0.1)
ws2812.set_all(gpio.WRISTBAND_2, [col1, col2, col3])
i += 1
u
time.sleep_ms(10)
time.sleep_ms(10)
.. versionadded:: 1.10
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment