Skip to content

Commit 59fb3fb

Browse files
authored
Merge branch 'adafruit:main' into main
2 parents c884194 + b1371ce commit 59fb3fb

File tree

379 files changed

+8198
-2046
lines changed

Some content is hidden

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

379 files changed

+8198
-2046
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,3 +307,6 @@
307307
[submodule "frozen/circuitpython_picoed"]
308308
path = frozen/circuitpython_picoed
309309
url = https://github.com/elecfreaks/circuitpython_picoed.git
310+
[submodule "ports/espressif/esp32-camera"]
311+
path = ports/espressif/esp32-camera
312+
url = https://github.com/adafruit/esp32-camera/

LICENSE

Lines changed: 6 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
The MIT License (MIT)
1+
MIT License
22

3-
Copyright (c) 2013-2022 Damien P. George
3+
Copyright (c) 2013-2022 Damien P. George and others
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -9,77 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99
copies of the Software, and to permit persons to whom the Software is
1010
furnished to do so, subject to the following conditions:
1111

12-
The above copyright notice and this permission notice shall be included in
13-
all copies or substantial portions of the Software.
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
1414

1515
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1616
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1717
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21-
THE SOFTWARE.
22-
23-
--------------------------------------------------------------------------------
24-
25-
Unless specified otherwise (see below), the above license and copyright applies
26-
to all files in this repository.
27-
28-
Individual files may include additional copyright holders.
29-
30-
The various ports of MicroPython may include third-party software that is
31-
licensed under different terms. These licenses are summarised in the tree
32-
below, please refer to these files and directories for further license and
33-
copyright information. Note that (L)GPL-licensed code listed below is only
34-
used during the build process and is not part of the compiled source code.
35-
36-
/ (MIT)
37-
/drivers
38-
/cc3000 (BSD-3-clause)
39-
/cc3100 (BSD-3-clause)
40-
/wiznet5k (BSD-3-clause)
41-
/lib
42-
/asf4 (Apache-2.0)
43-
/axtls (BSD-3-clause)
44-
/config
45-
/scripts
46-
/config (GPL-2.0-or-later)
47-
/Rules.mak (GPL-2.0)
48-
/berkeley-db-1xx (BSD-4-clause)
49-
/btstack (See btstack/LICENSE)
50-
/cmsis (BSD-3-clause)
51-
/crypto-algorithms (NONE)
52-
/libhydrogen (ISC)
53-
/littlefs (BSD-3-clause)
54-
/lwip (BSD-3-clause)
55-
/mynewt-nimble (Apache-2.0)
56-
/nrfx (BSD-3-clause)
57-
/nxp_driver (BSD-3-Clause)
58-
/oofatfs (BSD-1-clause)
59-
/pico-sdk (BSD-3-clause)
60-
/re15 (BSD-3-clause)
61-
/stm32lib (BSD-3-clause)
62-
/tinytest (BSD-3-clause)
63-
/tinyusb (MIT)
64-
/uzlib (Zlib)
65-
/logo (uses OFL-1.1)
66-
/ports
67-
/cc3200
68-
/hal (BSD-3-clause)
69-
/simplelink (BSD-3-clause)
70-
/FreeRTOS (GPL-2.0 with FreeRTOS exception)
71-
/stm32
72-
/usbd*.c (MCD-ST Liberty SW License Agreement V2)
73-
/stm32_it.* (MIT + BSD-3-clause)
74-
/system_stm32*.c (MIT + BSD-3-clause)
75-
/boards
76-
/startup_stm32*.s (BSD-3-clause)
77-
/*/stm32*.h (BSD-3-clause)
78-
/usbdev (MCD-ST Liberty SW License Agreement V2)
79-
/usbhost (MCD-ST Liberty SW License Agreement V2)
80-
/teensy
81-
/core (PJRC.COM)
82-
/zephyr
83-
/src (Apache-2.0)
84-
/tools
85-
/dfu.py (LGPL-3.0-only)
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

LICENSE_MicroPython

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2013-2022 Damien P. George
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.
22+
23+
--------------------------------------------------------------------------------
24+
25+
Unless specified otherwise (see below), the above license and copyright applies
26+
to all files in this repository.
27+
28+
Individual files may include additional copyright holders.
29+
30+
The various ports of MicroPython may include third-party software that is
31+
licensed under different terms. These licenses are summarised in the tree
32+
below, please refer to these files and directories for further license and
33+
copyright information. Note that (L)GPL-licensed code listed below is only
34+
used during the build process and is not part of the compiled source code.
35+
36+
/ (MIT)
37+
/drivers
38+
/cc3000 (BSD-3-clause)
39+
/cc3100 (BSD-3-clause)
40+
/wiznet5k (BSD-3-clause)
41+
/lib
42+
/asf4 (Apache-2.0)
43+
/axtls (BSD-3-clause)
44+
/config
45+
/scripts
46+
/config (GPL-2.0-or-later)
47+
/Rules.mak (GPL-2.0)
48+
/berkeley-db-1xx (BSD-4-clause)
49+
/btstack (See btstack/LICENSE)
50+
/cmsis (BSD-3-clause)
51+
/crypto-algorithms (NONE)
52+
/libhydrogen (ISC)
53+
/littlefs (BSD-3-clause)
54+
/lwip (BSD-3-clause)
55+
/mynewt-nimble (Apache-2.0)
56+
/nrfx (BSD-3-clause)
57+
/nxp_driver (BSD-3-Clause)
58+
/oofatfs (BSD-1-clause)
59+
/pico-sdk (BSD-3-clause)
60+
/re15 (BSD-3-clause)
61+
/stm32lib (BSD-3-clause)
62+
/tinytest (BSD-3-clause)
63+
/tinyusb (MIT)
64+
/uzlib (Zlib)
65+
/logo (uses OFL-1.1)
66+
/ports
67+
/cc3200
68+
/hal (BSD-3-clause)
69+
/simplelink (BSD-3-clause)
70+
/FreeRTOS (GPL-2.0 with FreeRTOS exception)
71+
/stm32
72+
/usbd*.c (MCD-ST Liberty SW License Agreement V2)
73+
/stm32_it.* (MIT + BSD-3-clause)
74+
/system_stm32*.c (MIT + BSD-3-clause)
75+
/boards
76+
/startup_stm32*.s (BSD-3-clause)
77+
/*/stm32*.h (BSD-3-clause)
78+
/usbdev (MCD-ST Liberty SW License Agreement V2)
79+
/usbhost (MCD-ST Liberty SW License Agreement V2)
80+
/teensy
81+
/core (PJRC.COM)
82+
/zephyr
83+
/src (Apache-2.0)
84+
/tools
85+
/dfu.py (LGPL-3.0-only)

conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ def autoapi_prepare_jinja_env(jinja_env):
199199
"ports/cxd56/spresense-exported-sdk",
200200
"ports/espressif/certificates",
201201
"ports/espressif/esp-idf",
202+
"ports/espressif/esp32-camera",
202203
"ports/espressif/.idf_tools",
203204
"ports/espressif/peripherals",
204205
"ports/litex/hw",
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
MicroPython & CircuitPython license information
2-
===============================================
1+
# MicroPython & CircuitPython License
32

4-
The MIT License (MIT)
3+
MIT License
54

6-
Copyright (c) 2013-2017 Damien P. George, and others
5+
Copyright (c) 2013-2022 Damien P. George and others
76

87
Permission is hereby granted, free of charge, to any person obtaining a copy
98
of this software and associated documentation files (the "Software"), to deal
@@ -12,13 +11,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1211
copies of the Software, and to permit persons to whom the Software is
1312
furnished to do so, subject to the following conditions:
1413

15-
The above copyright notice and this permission notice shall be included in
16-
all copies or substantial portions of the Software.
14+
The above copyright notice and this permission notice shall be included in all
15+
copies or substantial portions of the Software.
1716

1817
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1918
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2019
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2120
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2221
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24-
THE SOFTWARE.
22+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
SOFTWARE.

docs/design_guide.rst

Lines changed: 70 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ statement will ensure hardware isn't enabled longer than needed.
141141
Verify your device
142142
--------------------------------------------------------------------------------
143143

144-
Whenever possible, make sure device you are talking to is the device you expect.
144+
Whenever possible, make sure the device you are talking to is the device you expect.
145145
If not, raise a RuntimeError. Beware that I2C addresses can be identical on
146146
different devices so read registers you know to make sure they match your
147147
expectation. Validating this upfront will help catch mistakes.
@@ -202,7 +202,7 @@ interchangeably with the CPython name. This is confusing. Instead, think up a
202202
new name that is related to the extra functionality you are adding.
203203

204204
For example, storage mounting and unmounting related functions were moved from
205-
``uos`` into a new `storage` module. Terminal related functions were moved into
205+
``uos`` into a new `storage` module. Terminal-related functions were moved into
206206
`multiterminal`. These names better match their functionality and do not
207207
conflict with CPython names. Make sure to check that you don't conflict with
208208
CPython libraries too. That way we can port the API to CPython in the future.
@@ -213,7 +213,7 @@ Example
213213
When adding extra functionality to CircuitPython to mimic what a normal
214214
operating system would do, either copy an existing CPython API (for example file
215215
writing) or create a separate module to achieve what you want. For example,
216-
mounting and unmount drives is not a part of CPython so it should be done in a
216+
mounting and unmounting drives is not a part of CPython so it should be done in a
217217
module, such as a new ``storage`` module, that is only available in CircuitPython.
218218
That way when someone moves the code to CPython they know what parts need to be
219219
adapted.
@@ -494,6 +494,45 @@ backticks ``:class:`~adafruit_motor.servo.Servo```. You must also add the refer
494494

495495
"adafruit_motor": ("https://circuitpython.readthedocs.io/projects/motor/en/latest/", None,),
496496

497+
Use ``adafruit_register`` when possible
498+
--------------------------------------------------------------------------------
499+
`Register <https://github.com/adafruit/Adafruit_CircuitPython_Register>`_ is
500+
a foundational library that manages packing and unpacking data from I2C device
501+
registers. There is also `Register SPI <https://github.com/adafruit/Adafruit_CircuitPython_Register_SPI>`_
502+
for SPI devices. When possible, use one of these libraries for unpacking and
503+
packing registers. This ensures the packing code is shared amongst all
504+
registers (even across drivers). Furthermore, it simplifies device definitions
505+
by making them declarative (only data.)
506+
507+
Values with non-consecutive bits in a register or that represent FIFO endpoints
508+
may not map well to existing register classes. In unique cases like these, it is
509+
ok to read and write the register directly.
510+
511+
*Do not* add all registers from a datasheet upfront. Instead, only add the ones
512+
necessary for the functionality the driver exposes. Adding them all will lead to
513+
unnecessary file size and API clutter. See `this video about outside-in design
514+
from @tannewt <https://www.youtube.com/watch?v=3QewiyfBQh8>`_.
515+
516+
I2C Example
517+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
518+
519+
.. code-block:: python
520+
521+
from adafruit_register import i2c_bit
522+
from adafruit_bus_device import i2c_device
523+
524+
class HelloWorldDevice:
525+
"""Device with two bits to control when the words 'hello' and 'world' are lit."""
526+
527+
hello = i2c_bit.RWBit(0x0, 0x0)
528+
"""Bit to indicate if hello is lit."""
529+
530+
world = i2c_bit.RWBit(0x1, 0x0)
531+
"""Bit to indicate if world is lit."""
532+
533+
def __init__(self, i2c, device_address=0x0):
534+
self.i2c_device = i2c_device.I2CDevice(i2c, device_address)
535+
497536
Use BusDevice
498537
--------------------------------------------------------------------------------
499538

@@ -668,8 +707,24 @@ when using ``const()``, keep in mind these general guide lines:
668707

669708
- Always use via an import, ex: ``from micropython import const``
670709
- Limit use to global (module level) variables only.
671-
- If user will not need access to variable, prefix name with a leading
672-
underscore, ex: ``_SOME_CONST``.
710+
- Only used when the user will not need access to variable and prefix name with
711+
a leading underscore, ex: ``_SOME_CONST``.
712+
713+
Example
714+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
715+
716+
.. code-block:: python
717+
718+
from adafruit_bus_device import i2c_device
719+
from micropython import const
720+
721+
_DEFAULT_I2C_ADDR = const(0x42)
722+
723+
class Widget:
724+
"""A generic widget."""
725+
726+
def __init__(self, i2c, address=_DEFAULT_I2C_ADDR):
727+
self.i2c_device = i2c_device.I2CDevice(i2c, address)
673728
674729
Libraries Examples
675730
------------------
@@ -751,6 +806,16 @@ properties.
751806
| ``sound_level`` | float | non-unit-specific sound level (monotonic but not actual decibels) |
752807
+-----------------------+-----------------------+-------------------------------------------------------------------------+
753808

809+
Driver constant naming
810+
--------------------------------------------------------------------------------
811+
812+
When adding variables for constant values for a driver. Do not include the
813+
device's name in the variable name. For example, in ``adafruit_fancy123.py``,
814+
variables should not start with ``FANCY123_``. Adding this prefix increases RAM
815+
usage and .mpy file size because variable names are preserved. User code should
816+
refer to these constants as ``adafruit_fancy123.HELLO_WORLD`` for clarity.
817+
``adafruit_fancy123.FANCY123_HELLO_WORLD`` would be overly verbose.
818+
754819
Adding native modules
755820
--------------------------------------------------------------------------------
756821

docs/environment.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ CIRCUITPY_BLE_NAME
3535
~~~~~~~~~~~~~~~~~~
3636
Default BLE name the board advertises as, including for the BLE workflow.
3737

38+
CIRCUITPY_RESERVED_PSRAM
39+
~~~~~~~~~~~~~~~~~~~~~~~~
40+
On boards with Espressif microcontrollers with PSRAM (also called SPIRAM), permanently reserve a portion of PSRAM for use by esp-idf.
41+
This storage is removed from the CircuitPython "heap" and is available for allocation by esp-idf routines in the core instead.
42+
Generally, only set this to a non-zero value when it is required by a specific core module.
43+
3844
CIRCUITPY_WEB_API_PASSWORD
3945
~~~~~~~~~~~~~~~~~~~~~~~~~~
4046
Password required to make modifications to the board from the Web Workflow.

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Full Table of Contents
4848
../CONTRIBUTING
4949
../BUILDING
5050
../CODE_OF_CONDUCT
51-
../license.rst
51+
../docs/LICENSE
5252
../WEBUSB_README
5353

5454
Indices and tables

docs/porting.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ as a natural "TODO" list. An example minimal build list is shown below:
7171
CIRCUITPY_SDCARDIO = 0
7272
CIRCUITPY_FRAMEBUFFERIO = 0
7373
CIRCUITPY_FREQUENCYIO = 0
74-
CIRCUITPY_I2CPERIPHERAL = 0
74+
CIRCUITPY_I2CTARGET = 0
7575
# Requires SPI, PulseIO (stub ok):
7676
CIRCUITPY_DISPLAYIO = 0
7777

docs/shared_bindings_matrix.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
"pybadge": ["edgebadge"],
4141
"pyportal": ["pyportal_pynt"],
4242
"gemma_m0": ["gemma_m0_pycon2018"],
43-
"pewpew10": ["pewpew13"],
4443
}
4544

4645
ALIASES_BRAND_NAMES = {
@@ -54,8 +53,6 @@
5453
"Adafruit PyPortal Pynt",
5554
"gemma_m0_pycon2018":
5655
"Adafruit Gemma M0 PyCon 2018",
57-
"pewpew13":
58-
"PewPew 13",
5956
}
6057

6158
ADDITIONAL_MODULES = {

0 commit comments

Comments
 (0)