Skip to content

Commit bd510cb

Browse files
authored
Merge branch 'main' into stm-alarm
2 parents 07b86fc + a2ae503 commit bd510cb

File tree

547 files changed

+50693
-8476
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

547 files changed

+50693
-8476
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*.bat text eol=crlf
1212

1313
# These are binary so should never be modified by git.
14+
*.a binary
1415
*.png binary
1516
*.jpg binary
1617
*.dxf binary

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ jobs:
209209
- "clue_nrf52840_express"
210210
- "cp32-m4"
211211
- "cp_sapling_m0"
212+
- "cp_sapling_m0_revb"
212213
- "cp_sapling_m0_spiflash"
213214
- "datalore_ip_m4"
214215
- "datum_distance"

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ dist/
2828
######################
2929
*.swp
3030

31-
# Build directory
31+
# Build directories
3232
######################
3333
build/
3434
bin/
3535
circuitpython-stubs/
36+
build-*/
3637

3738
# Test failure outputs
3839
######################

ACKNOWLEDGEMENTS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,6 @@ today. The names appear in order of pledging.
762762
1642 Udine
763763
1643 Simon Critchley
764764
1644 Sven Haiges, Germany
765-
1645 Yi Qing Sim
766765
1646 "silicium" ("silicium_one", if "silicium" is busy)
767766
1648 Andy O'Malia, @andyomalia
768767
1650 RedCamelApps.com

devices/ble_hci/common-hal/_bleio/PacketBuffer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ mp_int_t common_hal_bleio_packet_buffer_get_outgoing_packet_length(bleio_packet_
245245
bleio_connection_internal_t *connection = bleio_conn_handle_to_connection(self->conn_handle);
246246
if (connection) {
247247
return MIN(MIN(common_hal_bleio_connection_get_max_packet_length(connection),
248-
self->max_packet_size),
249-
self->characteristic->max_length);
248+
self->max_packet_size),
249+
self->characteristic->max_length);
250250
}
251251
}
252252
// There's no current connection, so we don't know the MTU, and

docs/design_guide.rst

Lines changed: 85 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,34 @@ Module description
238238
After the license comment::
239239

240240
"""
241-
`<module name>` - <Short description>
241+
`<module name>`
242242
=================================================
243-
<Longer description.>
243+
244+
<Longer description>
245+
246+
* Author(s):
247+
248+
Implementation Notes
249+
--------------------
250+
251+
252+
**Hardware:**
253+
254+
* Adafruit `Device Description
255+
<hyperlink>`_ (Product ID: <Product Number>)
256+
257+
**Software and Dependencies:**
258+
259+
* Adafruit CircuitPython firmware for the supported boards:
260+
https://circuitpython.org/downloads
261+
* Adafruit's Bus Device library:
262+
https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
263+
* Adafruit's Register library:
264+
https://github.com/adafruit/Adafruit_CircuitPython_Register
265+
244266
"""
245267

268+
246269
Class description
247270
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
248271

@@ -269,6 +292,58 @@ Renders as:
269292
:param ~busio.I2C i2c_bus: The I2C bus the DS3231 is connected to.
270293
:param int address: The I2C address of the device. Defaults to :const:`0x40`
271294

295+
296+
Documenting Parameters
297+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
298+
Although there are different ways to document class and functions definitions in Python,
299+
the following is the prevalent method of documenting parameters
300+
for CircuitPython libraries. When documenting class parameters you should use the
301+
following structure:
302+
303+
.. code-block:: sh
304+
305+
:param param_type param_name: Parameter_description
306+
307+
308+
param_type
309+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
310+
The type of the parameter. This could be among other `int`, `float`, `str` `bool`, etc.
311+
To document an object in the CircuitPython domain, you need to include a ``~`` before the
312+
definition as shown in the following example:
313+
314+
.. code-block:: sh
315+
316+
:param ~busio.I2C i2c_bus: The I2C bus the DS3231 is connected to.
317+
318+
319+
To include references to CircuitPython modules, cookiecutter creates an entry in the
320+
intersphinx_mapping section in the ``conf.py`` file located within the ``docs`` directory.
321+
To add different types outside CircuitPython you need to include them in the intersphinx_mapping::
322+
323+
324+
intersphinx_mapping = {
325+
"python": ("https://docs.python.org/3.4", None),
326+
"BusDevice":("https://circuitpython.readthedocs.io/projects/busdevice/en/latest/", None,),
327+
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
328+
}
329+
330+
The intersphinx_mapping above includes references to Python, BusDevice and CircuitPython
331+
Documentation
332+
333+
334+
param_name
335+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
336+
Parameter name used in the class or method definition
337+
338+
339+
Parameter_description
340+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
341+
Parameter description. When the parameter defaults to a particular value, it is good
342+
practice to include the default::
343+
344+
:param int pitch: Pitch value for the servo. Defaults to :const:`4500`
345+
346+
272347
Attributes
273348
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
274349

@@ -383,6 +458,14 @@ Renders as:
383458

384459
:param float degrees: Degrees to turn right
385460

461+
Documentation References to other Libraries
462+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
463+
When you need to make references to documentation in other libraries you should refer the class using single
464+
backticks ``:class:`~adafruit_motor.servo.Servo```. You must also add the reference in the ``conf.py`` file in the
465+
``intersphinx_mapping section`` by adding a new entry::
466+
467+
"adafruit_motor": ("https://circuitpython.readthedocs.io/projects/motor/en/latest/", None,),
468+
386469
Use BusDevice
387470
--------------------------------------------------------------------------------
388471

docs/library/array.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
:mod:`array` -- arrays of numeric data
2-
======================================
2+
=======================================
33

44
.. module:: array
55
:synopsis: efficient arrays of numeric data
@@ -13,7 +13,7 @@ floating-point support).
1313
Classes
1414
-------
1515

16-
.. class:: array.array(typecode, [iterable])
16+
.. class:: array(typecode, [iterable])
1717

1818
Create array with elements of given type. Initial contents of the
1919
array are given by an `iterable`. If it is not provided, an empty

docs/library/framebuf.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ For example::
2121
import framebuf
2222

2323
# FrameBuffer needs 2 bytes for every RGB565 pixel
24-
fbuf = FrameBuffer(bytearray(10 * 100 * 2), 10, 100, framebuf.RGB565)
24+
fbuf = framebuf.FrameBuffer(bytearray(10 * 100 * 2), 10, 100, framebuf.RGB565)
2525

2626
fbuf.fill(0)
2727
fbuf.text('MicroPython!', 0, 0, 0xffff)

docs/library/micropython.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,36 @@ Functions
9494
This function can be used to prevent the capturing of Ctrl-C on the
9595
incoming stream of characters that is usually used for the REPL, in case
9696
that stream is used for other purposes.
97+
98+
.. function:: schedule(func, arg)
99+
100+
Schedule the function *func* to be executed "very soon". The function
101+
is passed the value *arg* as its single argument. "Very soon" means that
102+
the MicroPython runtime will do its best to execute the function at the
103+
earliest possible time, given that it is also trying to be efficient, and
104+
that the following conditions hold:
105+
106+
- A scheduled function will never preempt another scheduled function.
107+
- Scheduled functions are always executed "between opcodes" which means
108+
that all fundamental Python operations (such as appending to a list)
109+
are guaranteed to be atomic.
110+
- A given port may define "critical regions" within which scheduled
111+
functions will never be executed. Functions may be scheduled within
112+
a critical region but they will not be executed until that region
113+
is exited. An example of a critical region is a preempting interrupt
114+
handler (an IRQ).
115+
116+
A use for this function is to schedule a callback from a preempting IRQ.
117+
Such an IRQ puts restrictions on the code that runs in the IRQ (for example
118+
the heap may be locked) and scheduling a function to call later will lift
119+
those restrictions.
120+
121+
Note: If `schedule()` is called from a preempting IRQ, when memory
122+
allocation is not allowed and the callback to be passed to `schedule()` is
123+
a bound method, passing this directly will fail. This is because creating a
124+
reference to a bound method causes memory allocation. A solution is to
125+
create a reference to the method in the class constructor and to pass that
126+
reference to `schedule()`.
127+
128+
There is a finite queue to hold the scheduled functions and `schedule()`
129+
will raise a `RuntimeError` if the queue is full.

docs/library/sys.rst

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,6 @@ Functions
1717
function raise as `SystemExit` exception. If an argument is given, its
1818
value given as an argument to `SystemExit`.
1919

20-
.. function:: print_exception(exc, file=sys.stdout)
21-
22-
Print exception with a traceback to a file-like object *file* (or
23-
`sys.stdout` by default).
24-
25-
.. admonition:: Difference to CPython
26-
:class: attention
27-
28-
This is simplified version of a function which appears in the
29-
``traceback`` module in CPython. Unlike ``traceback.print_exception()``,
30-
this function takes just exception value instead of exception type,
31-
exception value, and traceback object; *file* argument should be
32-
positional; further arguments are not supported.
33-
3420
Constants
3521
---------
3622

@@ -122,3 +108,9 @@ Constants
122108
.. data:: version_info
123109

124110
Python language version that this implementation conforms to, as a tuple of ints.
111+
112+
.. admonition:: Difference to CPython
113+
:class: attention
114+
115+
Only the first three version numbers (major, minor, micro) are supported and
116+
they can be referenced only by index, not by name.

0 commit comments

Comments
 (0)