Skip to content

Commit 3191357

Browse files
committed
Merge remote-tracking branch 'origin/main' into refine-stubs
2 parents 9449a35 + e51d5e4 commit 3191357

File tree

362 files changed

+9047
-2522
lines changed

Some content is hidden

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

362 files changed

+9047
-2522
lines changed

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# tools/gen-cpydiff.py: Fix formatting of doc strings for new Black.
2+
0f78c36c5aa458a954eed39a46942209107a553e
3+
14
# tests/run-tests.py: Reformat with Black.
25
2a38d7103672580882fb621a5b76e8d26805d593
36

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 0 additions & 54 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: 🐞 Bug Report
2+
description: Create a bug report to help us improve
3+
labels:
4+
- bug
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: >-
9+
Thanks! for testing out CircuitPython. Now that you have encountered a
10+
bug... you can file a report for it.
11+
- type: textarea
12+
id: firmware
13+
attributes:
14+
label: CircuitPython version
15+
description: >-
16+
Include the version of CircuitPython you're running. You can see it in
17+
the `boot_out.txt` file, as well as in the `REPL`.
18+
placeholder: Adafruit CircuitPython 6.2.0 on 2021-03-01; Raspberry Pi Pico with rp2040
19+
render: python
20+
validations:
21+
required: true
22+
- type: textarea
23+
id: code
24+
attributes:
25+
label: Code/REPL
26+
description: This is automatically rendered as Python, so no need for backticks.
27+
placeholder: |
28+
import busio, bitbangio
29+
i2c = bitbangio.I2C(board.GP1, board.GP0)
30+
render: python
31+
validations:
32+
required: true
33+
- type: textarea
34+
id: behavior
35+
attributes:
36+
label: Behavior
37+
description: What happens when you run the code above? Include error messages (if any).
38+
placeholder: |
39+
```python
40+
Traceback (most recent call last):
41+
File "<stdin>", line 1, in <module>
42+
TimeoutError: Clock stretch too long
43+
```
44+
On-board led pulses red.
45+
validations:
46+
required: true
47+
- type: textarea
48+
id: description
49+
attributes:
50+
label: Description
51+
description: Optionally, describe the bug in more detail.
52+
placeholder: |
53+
- Error while using i2c...
54+
- Only happens when...
55+
- might be related to #4291...
56+
- type: textarea
57+
id: more-info
58+
attributes:
59+
label: Additional information
60+
description: >-
61+
Optionally, add any other information like hardware connection, scope
62+
output etc. If you have already done some debugging, mention it here.
63+
placeholder: Removing [this](url) line resolves the issue.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
contact_links:
2-
- name: Adafruit Forum
2+
- name: 🔗 Adafruit Forum
33
url: https://forums.adafruit.com/
44
about: Official Adafruit technical support forum. Good for getting help on getting a project working.
5-
- name: Adafruit Discord
5+
- name: 🔗 Adafruit Discord
66
url: https://adafru.it/discord
77
about: Unofficial chat with many helpful folks and normally prompt replies.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
name: Feature request
2+
name: 🚀 Feature Request
33
about: Suggest an idea for this project
44
title: ''
55
labels: 'enhancement'
66
assignees: ''
77

88
---
99

10-
<!-- We are always adding new features and enhancements to CircuitPython 🚀
10+
<!-- We keep adding new features and enhancements to CircuitPython 🚀
1111
and would love ❤ to see what new challenge you have got for us... 🙂 -->

.github/workflows/build.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,9 @@ jobs:
132132
TWINE_USERNAME: ${{ secrets.pypi_username }}
133133
TWINE_PASSWORD: ${{ secrets.pypi_password }}
134134
run: |
135-
echo "Uploading dev release to PyPi"
136-
twine upload circuitpython-stubs/dist/*
135+
# setup.py sdist was run by 'make stubs'
136+
if [ -z "$TWINE_USERNAME" ] || echo "Uploading dev release to PyPi"
137+
if [ -z "$TWINE_USERNAME" ] || twine upload circuitpython-stubs/dist/*
137138
138139
mpy-cross-mac:
139140
runs-on: macos-10.15

.gitmodules

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@
153153
[submodule "ports/esp32s2/esp-idf"]
154154
path = ports/esp32s2/esp-idf
155155
url = https://github.com/adafruit/esp-idf.git
156+
branch = circuitpython-v4.3
156157
[submodule "ports/esp32s2/certificates/nina-fw"]
157158
path = ports/esp32s2/certificates/nina-fw
158159
url = https://github.com/adafruit/nina-fw.git

conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,6 @@
417417

418418
# Example configuration for intersphinx: refer to the Python standard library.
419419
intersphinx_mapping = {"cpython": ('https://docs.python.org/3/', None),
420-
"bus_device": ('https://circuitpython.readthedocs.io/projects/busdevice/en/latest/', None),
421420
"register": ('https://circuitpython.readthedocs.io/projects/register/en/latest/', None)}
422421

423422
# Adapted from sphinxcontrib-redirects

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

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ STATIC void add_generic_services(bleio_adapter_obj_t *adapter) {
118118
SECURITY_MODE_NO_ACCESS,
119119
248, // max length, from Bluetooth spec
120120
false, // not fixed length
121-
&generic_name_bufinfo
121+
&generic_name_bufinfo,
122+
NULL
122123
);
123124

124125
uint16_t zero_16 = 0;
@@ -140,7 +141,8 @@ STATIC void add_generic_services(bleio_adapter_obj_t *adapter) {
140141
SECURITY_MODE_NO_ACCESS,
141142
2, // max length, from Bluetooth spec
142143
true, // fixed length
143-
&zero_16_value
144+
&zero_16_value,
145+
NULL
144146
);
145147

146148
// Generic Attribute Service setup.
@@ -176,7 +178,8 @@ STATIC void add_generic_services(bleio_adapter_obj_t *adapter) {
176178
SECURITY_MODE_NO_ACCESS,
177179
4, // max length, from Bluetooth spec
178180
true, // fixed length
179-
&zero_32_value
181+
&zero_32_value,
182+
NULL
180183
);
181184
}
182185

@@ -645,7 +648,11 @@ STATIC void check_data_fit(size_t data_len, bool connectable) {
645648
// return true;
646649
// }
647650

648-
uint32_t _common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self, bool connectable, bool anonymous, uint32_t timeout, float interval, uint8_t *advertising_data, uint16_t advertising_data_len, uint8_t *scan_response_data, uint16_t scan_response_data_len, mp_int_t tx_power) {
651+
uint32_t _common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self,
652+
bool connectable, bool anonymous, uint32_t timeout, float interval,
653+
const uint8_t *advertising_data, uint16_t advertising_data_len,
654+
const uint8_t *scan_response_data, uint16_t scan_response_data_len,
655+
mp_int_t tx_power, const bleio_address_obj_t *directed_to) {
649656
check_enabled(self);
650657

651658
if (self->now_advertising) {
@@ -769,7 +776,11 @@ uint32_t _common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self,
769776
return 0;
770777
}
771778

772-
void common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self, bool connectable, bool anonymous, uint32_t timeout, mp_float_t interval, mp_buffer_info_t *advertising_data_bufinfo, mp_buffer_info_t *scan_response_data_bufinfo, mp_int_t tx_power) {
779+
void common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self,
780+
bool connectable, bool anonymous, uint32_t timeout, mp_float_t interval,
781+
mp_buffer_info_t *advertising_data_bufinfo,
782+
mp_buffer_info_t *scan_response_data_bufinfo,
783+
mp_int_t tx_power, const bleio_address_obj_t *directed_to) {
773784
check_enabled(self);
774785

775786
// interval value has already been validated.
@@ -803,7 +814,7 @@ void common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self, bool
803814
advertising_data_bufinfo->len,
804815
scan_response_data_bufinfo->buf,
805816
scan_response_data_bufinfo->len,
806-
tx_power);
817+
tx_power, directed_to);
807818

808819
if (result) {
809820
mp_raise_bleio_BluetoothError(translate("Already advertising"));

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#define CCCD_INDICATE 0x2
4242

4343

44-
void common_hal_bleio_characteristic_construct(bleio_characteristic_obj_t *self, bleio_service_obj_t *service, uint16_t handle, bleio_uuid_obj_t *uuid, bleio_characteristic_properties_t props, bleio_attribute_security_mode_t read_perm, bleio_attribute_security_mode_t write_perm, mp_int_t max_length, bool fixed_length, mp_buffer_info_t *initial_value_bufinfo) {
44+
void common_hal_bleio_characteristic_construct(bleio_characteristic_obj_t *self, bleio_service_obj_t *service, uint16_t handle, bleio_uuid_obj_t *uuid, bleio_characteristic_properties_t props, bleio_attribute_security_mode_t read_perm, bleio_attribute_security_mode_t write_perm, mp_int_t max_length, bool fixed_length, mp_buffer_info_t *initial_value_bufinfo, const char *user_description) {
4545
self->service = service;
4646
self->uuid = uuid;
4747
self->decl_handle = BLE_GATT_HANDLE_INVALID;
@@ -66,7 +66,7 @@ void common_hal_bleio_characteristic_construct(bleio_characteristic_obj_t *self,
6666
if (service->is_remote) {
6767
self->handle = handle;
6868
} else {
69-
common_hal_bleio_service_add_characteristic(self->service, self, initial_value_bufinfo);
69+
common_hal_bleio_service_add_characteristic(self->service, self, initial_value_bufinfo, user_description);
7070
}
7171
}
7272

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ mp_int_t common_hal_bleio_packet_buffer_readinto(bleio_packet_buffer_obj_t *self
148148
return ret;
149149
}
150150

151-
mp_int_t common_hal_bleio_packet_buffer_write(bleio_packet_buffer_obj_t *self, uint8_t *data, size_t len, uint8_t *header, size_t header_len) {
151+
mp_int_t common_hal_bleio_packet_buffer_write(bleio_packet_buffer_obj_t *self,
152+
const uint8_t *data, size_t len, uint8_t *header, size_t header_len) {
152153
if (self->outgoing[0] == NULL) {
153154
mp_raise_bleio_BluetoothError(translate("Writes not supported on Characteristic"));
154155
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ bool common_hal_bleio_service_get_is_secondary(bleio_service_obj_t *self) {
8484

8585
void common_hal_bleio_service_add_characteristic(bleio_service_obj_t *self,
8686
bleio_characteristic_obj_t *characteristic,
87-
mp_buffer_info_t *initial_value_bufinfo) {
87+
mp_buffer_info_t *initial_value_bufinfo,
88+
const char *user_description) {
8889

8990
if (self->handle != common_hal_bleio_adapter_obj.last_added_service_handle) {
9091
mp_raise_bleio_BluetoothError(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include "shared-bindings/_bleio/Descriptor.h"
3737
#include "shared-bindings/_bleio/Service.h"
3838
#include "shared-bindings/_bleio/UUID.h"
39-
#include "supervisor/shared/bluetooth.h"
39+
#include "supervisor/shared/bluetooth/bluetooth.h"
4040

4141
// UUID shared by all cccd's.
4242
bleio_uuid_obj_t cccd_uuid;

docs/library/builtins.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,6 @@ Exceptions
182182

183183
.. exception:: OSError
184184

185-
|see_cpython| :py:class:`cpython:OSError`. CircuitPython doesn't implement the ``errno``
186-
attribute, instead use the standard way to access exception arguments:
187-
``exc.args[0]``.
188-
189185
.. exception:: RuntimeError
190186

191187
.. exception:: ReloadException

docs/library/uasyncio.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,14 @@ TCP stream connections
214214

215215
This is a coroutine.
216216

217+
.. method:: Stream.readinto(buf)
218+
219+
Read up to n bytes into *buf* with n being equal to the length of *buf*.
220+
221+
Return the number of bytes read into *buf*.
222+
223+
This is a coroutine, and a MicroPython extension.
224+
217225
.. method:: Stream.readline()
218226

219227
Read a line and return it.

docs/library/uctypes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ Module contents
247247

248248
.. data:: VOID
249249

250-
``VOID`` is an alias for ``UINT8``, and is provided to conviniently define
250+
``VOID`` is an alias for ``UINT8``, and is provided to conveniently define
251251
C's void pointers: ``(uctypes.PTR, uctypes.VOID)``.
252252

253253
.. data:: PTR

docs/library/uheapq.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88

99
|see_cpython_module| :mod:`cpython:heapq`.
1010

11-
This module implements the heap queue algorithm.
11+
This module implements the
12+
`min heap queue algorithm <https://en.wikipedia.org/wiki/Heap_%28data_structure%29>`_.
1213

13-
A heap queue is simply a list that has its elements stored in a certain way.
14+
A heap queue is essentially a list that has its elements stored in such a way
15+
that the first item of the list is always the smallest.
1416

1517
Functions
1618
---------
@@ -21,8 +23,10 @@ Functions
2123

2224
.. function:: heappop(heap)
2325

24-
Pop the first item from the ``heap``, and return it. Raises IndexError if
25-
heap is empty.
26+
Pop the first item from the ``heap``, and return it. Raise ``IndexError`` if
27+
``heap`` is empty.
28+
29+
The returned item will be the smallest item in the ``heap``.
2630

2731
.. function:: heapify(x)
2832

docs/library/uselect.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ Methods
8989
``callee-owned tuples``. This function provides efficient, allocation-free
9090
way to poll on streams.
9191

92-
If *flags* is 1, one-shot behavior for events is employed: streams for
92+
If *flags* is 1, one-shot behaviour for events is employed: streams for
9393
which events happened will have their event masks automatically reset
9494
(equivalent to ``poll.modify(obj, 0)``), so new events for such a stream
9595
won't be processed until new mask is set with `poll.modify()`. This
96-
behavior is useful for asynchronous I/O schedulers.
96+
behaviour is useful for asynchronous I/O schedulers.
9797

9898
.. admonition:: Difference to CPython
9999
:class: attention

0 commit comments

Comments
 (0)