Skip to content

Commit 3401449

Browse files
authored
Merge pull request adafruit#47 from adafruit/main
Update from adafruit main
2 parents d5768c5 + fcabbe9 commit 3401449

File tree

732 files changed

+16773
-22507
lines changed

Some content is hidden

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

732 files changed

+16773
-22507
lines changed

.github/workflows/build.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,13 @@ jobs:
178178
- "TG-Watch"
179179
- "adafruit_feather_rp2040"
180180
- "adafruit_itsybitsy_rp2040"
181+
- "adafruit_neokey_trinkey_m0"
182+
- "adafruit_proxlight_trinkey_m0"
181183
- "adafruit_qtpy_rp2040"
184+
- "adafruit_rotary_trinkey_m0"
185+
- "adafruit_slide_trinkey_m0"
182186
- "aloriumtech_evo_m51"
187+
- "aramcon2_badge"
183188
- "aramcon_badge_2019"
184189
- "arduino_mkr1300"
185190
- "arduino_mkrzero"
@@ -285,6 +290,8 @@ jobs:
285290
- "pewpew_m4"
286291
- "picoplanet"
287292
- "pimoroni_keybow2040"
293+
- "pimoroni_picolipo_16mb"
294+
- "pimoroni_picolipo_4mb"
288295
- "pimoroni_picosystem"
289296
- "pimoroni_tiny2040"
290297
- "pirkey_m0"
@@ -305,7 +312,6 @@ jobs:
305312
- "raspberry_pi_pico"
306313
- "raytac_mdbt50q-db-40"
307314
- "robohatmm1_m4"
308-
- "rotary_trinkey_m0"
309315
- "sam32"
310316
- "same54_xplained"
311317
- "seeeduino_wio_terminal"
@@ -317,6 +323,7 @@ jobs:
317323
- "simmel"
318324
- "snekboard"
319325
- "sparkfun_lumidrive"
326+
- "sparkfun_micromod_rp2040"
320327
- "sparkfun_nrf52840_micromod"
321328
- "sparkfun_nrf52840_mini"
322329
- "sparkfun_pro_micro_rp2040"
@@ -376,6 +383,8 @@ jobs:
376383
python3 --version
377384
- name: mpy-cross
378385
run: make -C mpy-cross -j2
386+
- name: Setup build failure matcher
387+
run: echo "::add-matcher::$GITHUB_WORKSPACE/.github/workflows/match-build-fail.json"
379388
- name: build
380389
run: python3 -u build_release_files.py
381390
working-directory: tools
@@ -425,6 +434,8 @@ jobs:
425434
python3 --version
426435
- name: mpy-cross
427436
run: make -C mpy-cross -j2
437+
- name: Setup build failure matcher
438+
run: echo "::add-matcher::$GITHUB_WORKSPACE/.github/workflows/match-build-fail.json"
428439
- name: build
429440
run: python3 -u build_release_files.py
430441
working-directory: tools
@@ -454,6 +465,7 @@ jobs:
454465
- "adafruit_magtag_2.9_grayscale"
455466
- "adafruit_metro_esp32s2"
456467
- "artisense_rd00"
468+
- "atmegazero_esp32s2"
457469
- "electroniccats_bastwifi"
458470
- "espressif_kaluga_1"
459471
- "espressif_saola_1_wroom"
@@ -486,7 +498,7 @@ jobs:
486498
id: idf-cache
487499
with:
488500
path: ${{ github.workspace }}/.idf_tools
489-
key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20210304
501+
key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20210422
490502
- name: Clone IDF submodules
491503
run: |
492504
(cd $IDF_PATH && git submodule update --init)
@@ -523,6 +535,8 @@ jobs:
523535
IDF_TOOLS_PATH: ${{ github.workspace }}/.idf_tools
524536
- name: mpy-cross
525537
run: make -C mpy-cross -j2
538+
- name: Setup build failure matcher
539+
run: echo "::add-matcher::$GITHUB_WORKSPACE/.github/workflows/match-build-fail.json"
526540
- name: build
527541
run: |
528542
source $IDF_PATH/export.sh
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"severity": "error",
5+
"pattern": [
6+
{
7+
"regexp": "^(Build .+ and \\x1b\\[31mfailed\\x1b\\[0m)$",
8+
"message": 1
9+
}
10+
],
11+
"owner": "build-failed"
12+
}
13+
]
14+
}

.gitmodules

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
url = https://github.com/adafruit/Adafruit_CircuitPython_Register.git
114114
[submodule "extmod/ulab"]
115115
path = extmod/ulab
116-
url = https://github.com/v923z/micropython-ulab
116+
url = https://github.com/adafruit/circuitpython-ulab
117117
[submodule "frozen/Adafruit_CircuitPython_ESP32SPI"]
118118
path = frozen/Adafruit_CircuitPython_ESP32SPI
119119
url = https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI
@@ -171,10 +171,16 @@
171171
[submodule "frozen/Adafruit_CircuitPython_LC709203F"]
172172
path = frozen/Adafruit_CircuitPython_LC709203F
173173
url = https://github.com/adafruit/Adafruit_CircuitPython_LC709203F
174+
[submodule "frozen/Adafruit_CircuitPython_SimpleMath"]
175+
path = frozen/Adafruit_CircuitPython_SimpleMath
176+
url = https://github.com/adafruit/Adafruit_CircuitPython_SimpleMath
174177
[submodule "ports/raspberrypi/sdk"]
175178
path = ports/raspberrypi/sdk
176179
url = https://github.com/adafruit/pico-sdk.git
177180
[submodule "data/nvm.toml"]
178181
path = data/nvm.toml
179182
url = https://github.com/adafruit/nvm.toml.git
180183
branch = main
184+
[submodule "frozen/Adafruit_CircuitPython_MIDI"]
185+
path = frozen/Adafruit_CircuitPython_MIDI
186+
url = https://github.com/adafruit/Adafruit_CircuitPython_MIDI

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2013, 2014 Damien P. George
3+
Copyright (c) 2013-2019 Damien P. George
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

conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,8 @@ def apply(self, **kwargs):
489489

490490
def setup(app):
491491
app.add_css_file("customstyle.css")
492+
app.add_css_file("filter.css")
493+
app.add_js_file("filter.js")
492494
app.add_config_value('redirects_file', 'redirects', 'env')
493495
app.connect('builder-inited', generate_redirects)
494496
app.add_transform(CoreModuleTransform)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -886,10 +886,10 @@ uint16_t bleio_adapter_add_attribute(bleio_adapter_obj_t *adapter, mp_obj_t *att
886886
uint16_t handle = (uint16_t)adapter->attributes->len;
887887
mp_obj_list_append(adapter->attributes, attribute);
888888

889-
if (MP_OBJ_IS_TYPE(attribute, &bleio_service_type)) {
889+
if (mp_obj_is_type(attribute, &bleio_service_type)) {
890890
adapter->last_added_service_handle = handle;
891891
}
892-
if (MP_OBJ_IS_TYPE(attribute, &bleio_characteristic_type)) {
892+
if (mp_obj_is_type(attribute, &bleio_characteristic_type)) {
893893
adapter->last_added_characteristic_handle = handle;
894894
}
895895

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@
3333

3434

3535
bleio_uuid_obj_t *bleio_attribute_get_uuid(mp_obj_t *attribute) {
36-
if (MP_OBJ_IS_TYPE(attribute, &bleio_characteristic_type)) {
36+
if (mp_obj_is_type(attribute, &bleio_characteristic_type)) {
3737
bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(attribute);
3838
return characteristic->uuid;
3939
}
40-
if (MP_OBJ_IS_TYPE(attribute, &bleio_descriptor_type)) {
40+
if (mp_obj_is_type(attribute, &bleio_descriptor_type)) {
4141
bleio_descriptor_obj_t *descriptor = MP_OBJ_TO_PTR(attribute);
4242
return descriptor->uuid;
4343
}
44-
if (MP_OBJ_IS_TYPE(attribute, &bleio_service_type)) {
44+
if (mp_obj_is_type(attribute, &bleio_service_type)) {
4545
bleio_service_obj_t *service = MP_OBJ_TO_PTR(attribute);
4646
return service->uuid;
4747
}

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ bleio_service_obj_t *common_hal_bleio_characteristic_get_service(bleio_character
7878
return self->service;
7979
}
8080

81+
size_t common_hal_bleio_characteristic_get_max_length(bleio_characteristic_obj_t *self) {
82+
return self->max_length;
83+
}
84+
8185
size_t common_hal_bleio_characteristic_get_value(bleio_characteristic_obj_t *self, uint8_t *buf, size_t len) {
8286
// Do GATT operations only if this characteristic has been added to a registered service.
8387
if (self->handle != BLE_GATT_HANDLE_INVALID) {
@@ -209,9 +213,9 @@ bool bleio_characteristic_set_local_value(bleio_characteristic_obj_t *self, mp_b
209213

210214
self->value = mp_obj_new_bytes(bufinfo->buf, bufinfo->len);
211215

212-
if (MP_OBJ_IS_TYPE(self->observer, &bleio_characteristic_buffer_type)) {
216+
if (mp_obj_is_type(self->observer, &bleio_characteristic_buffer_type)) {
213217
bleio_characteristic_buffer_update(MP_OBJ_FROM_PTR(self->observer), bufinfo);
214-
} else if (MP_OBJ_IS_TYPE(self->observer, &bleio_packet_buffer_type)) {
218+
} else if (mp_obj_is_type(self->observer, &bleio_packet_buffer_type)) {
215219
bleio_packet_buffer_update(MP_OBJ_FROM_PTR(self->observer), bufinfo);
216220
} else {
217221
return false;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ void common_hal_bleio_connection_set_connection_interval(bleio_connection_intern
644644
// mp_obj_t iterable = mp_getiter(service_uuids_whitelist, &iter_buf);
645645
// mp_obj_t uuid_obj;
646646
// while ((uuid_obj = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) {
647-
// if (!MP_OBJ_IS_TYPE(uuid_obj, &bleio_uuid_type)) {
647+
// if (!mp_obj_is_type(uuid_obj, &bleio_uuid_type)) {
648648
// mp_raise_TypeError(translate("non-UUID found in service_uuids_whitelist"));
649649
// }
650650
// bleio_uuid_obj_t *uuid = MP_OBJ_TO_PTR(uuid_obj);

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ void bleio_packet_buffer_update(bleio_packet_buffer_obj_t *self, mp_buffer_info_
8181

8282
void common_hal_bleio_packet_buffer_construct(
8383
bleio_packet_buffer_obj_t *self, bleio_characteristic_obj_t *characteristic,
84-
size_t buffer_size) {
84+
size_t buffer_size, size_t max_packet_size) {
8585

8686
self->characteristic = characteristic;
8787
self->client = self->characteristic->service->is_remote;
@@ -101,7 +101,7 @@ void common_hal_bleio_packet_buffer_construct(
101101
}
102102

103103
if (incoming) {
104-
if (!ringbuf_alloc(&self->ringbuf, buffer_size * (sizeof(uint16_t) + characteristic->max_length), false)) {
104+
if (!ringbuf_alloc(&self->ringbuf, buffer_size * (sizeof(uint16_t) + max_packet_size), false)) {
105105
mp_raise_ValueError(translate("Buffer too large and unable to allocate"));
106106
}
107107
}
@@ -110,12 +110,13 @@ void common_hal_bleio_packet_buffer_construct(
110110
self->packet_queued = false;
111111
self->pending_index = 0;
112112
self->pending_size = 0;
113-
self->outgoing[0] = m_malloc(characteristic->max_length, false);
114-
self->outgoing[1] = m_malloc(characteristic->max_length, false);
113+
self->outgoing[0] = m_malloc(max_packet_size, false);
114+
self->outgoing[1] = m_malloc(max_packet_size, false);
115115
} else {
116116
self->outgoing[0] = NULL;
117117
self->outgoing[1] = NULL;
118118
}
119+
self->max_packet_size = max_packet_size;
119120

120121
bleio_characteristic_set_observer(self->characteristic, self);
121122
}
@@ -243,15 +244,16 @@ mp_int_t common_hal_bleio_packet_buffer_get_outgoing_packet_length(bleio_packet_
243244
if (self->conn_handle != BLE_CONN_HANDLE_INVALID) {
244245
bleio_connection_internal_t *connection = bleio_conn_handle_to_connection(self->conn_handle);
245246
if (connection) {
246-
return MIN(common_hal_bleio_connection_get_max_packet_length(connection),
247-
self->characteristic->max_length);
247+
return MIN(MIN(common_hal_bleio_connection_get_max_packet_length(connection),
248+
self->max_packet_size),
249+
self->characteristic->max_length);
248250
}
249251
}
250252
// There's no current connection, so we don't know the MTU, and
251253
// we can't tell what the largest outgoing packet length would be.
252254
return -1;
253255
}
254-
return self->characteristic->max_length;
256+
return MIN(self->characteristic->max_length, self->max_packet_size);
255257
}
256258

257259
bool common_hal_bleio_packet_buffer_deinited(bleio_packet_buffer_obj_t *self) {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ typedef struct {
4242
// We remember the conn_handle so we can do a NOTIFY/INDICATE to a client.
4343
// We can find out the conn_handle on a Characteristic write or a CCCD write (but not a read).
4444
volatile uint16_t conn_handle;
45+
uint16_t max_packet_size;
4546
uint8_t pending_index;
4647
uint8_t write_type;
4748
bool client;

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ void att_remove_connection(uint16_t conn_handle, uint8_t reason) {
539539
.len = sizeof(zero),
540540
};
541541

542-
if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_descriptor_type)) {
542+
if (mp_obj_is_type(attribute_obj, &bleio_descriptor_type)) {
543543
bleio_descriptor_obj_t *descriptor = MP_OBJ_TO_PTR(attribute_obj);
544544
if (bleio_uuid_get_uuid16_or_unknown(descriptor->uuid) == BLE_UUID_CCCD) {
545545
common_hal_bleio_descriptor_set_value(descriptor, &zero_cccd_value);
@@ -800,7 +800,7 @@ STATIC void process_find_info_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
800800
// Fetch the uuid for the given attribute, which might be a characteristic or a descriptor.
801801
bleio_uuid_obj_t *uuid;
802802

803-
if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_characteristic_type)) {
803+
if (mp_obj_is_type(attribute_obj, &bleio_characteristic_type)) {
804804
bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(attribute_obj);
805805
if (characteristic->handle != handle) {
806806
// If the handles don't match, this is the characteristic definition attribute.
@@ -971,7 +971,7 @@ void process_read_group_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, ui
971971
}
972972

973973
mp_obj_t *attribute_obj = bleio_adapter_get_attribute(&common_hal_bleio_adapter_obj, handle);
974-
if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_service_type)) {
974+
if (mp_obj_is_type(attribute_obj, &bleio_service_type)) {
975975
bleio_service_obj_t *service = MP_OBJ_TO_PTR(attribute_obj);
976976

977977
// Is this a 16-bit or a 128-bit uuid? It must match in size with any previous attribute
@@ -1083,7 +1083,7 @@ STATIC void process_read_or_read_blob_req(uint16_t conn_handle, uint16_t mtu, ui
10831083
size_t rsp_length = sizeof(rsp_t);
10841084

10851085
mp_obj_t *attribute_obj = bleio_adapter_get_attribute(&common_hal_bleio_adapter_obj, handle);
1086-
if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_service_type)) {
1086+
if (mp_obj_is_type(attribute_obj, &bleio_service_type)) {
10871087
if (offset) {
10881088
send_error(conn_handle, BT_ATT_ERR_ATTRIBUTE_NOT_LONG, handle, BT_ATT_ERR_INVALID_PDU);
10891089
return;
@@ -1095,7 +1095,7 @@ STATIC void process_read_or_read_blob_req(uint16_t conn_handle, uint16_t mtu, ui
10951095
common_hal_bleio_uuid_pack_into(service->uuid, rsp->r.value);
10961096
rsp_length += sizeof_service_uuid;
10971097

1098-
} else if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_characteristic_type)) {
1098+
} else if (mp_obj_is_type(attribute_obj, &bleio_characteristic_type)) {
10991099
bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(attribute_obj);
11001100
if (characteristic->decl_handle == handle) {
11011101
// Read characteristic declaration. Return properties, value handle, and uuid.
@@ -1135,7 +1135,7 @@ STATIC void process_read_or_read_blob_req(uint16_t conn_handle, uint16_t mtu, ui
11351135
memcpy(rsp->r.value, bufinfo.buf + offset, value_length);
11361136
rsp_length += value_length;
11371137
}
1138-
} else if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_descriptor_type)) {
1138+
} else if (mp_obj_is_type(attribute_obj, &bleio_descriptor_type)) {
11391139
bleio_descriptor_obj_t *descriptor = MP_OBJ_TO_PTR(attribute_obj);
11401140

11411141
mp_buffer_info_t bufinfo;
@@ -1203,7 +1203,7 @@ STATIC void process_read_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
12031203
mp_obj_t *attribute_obj = bleio_adapter_get_attribute(&common_hal_bleio_adapter_obj, handle);
12041204

12051205
if (type_uuid == BLE_UUID_CHARACTERISTIC &&
1206-
MP_OBJ_IS_TYPE(attribute_obj, &bleio_characteristic_type)) {
1206+
mp_obj_is_type(attribute_obj, &bleio_characteristic_type)) {
12071207
// Request is for characteristic declarations.
12081208
bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(attribute_obj);
12091209

@@ -1250,7 +1250,7 @@ STATIC void process_read_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
12501250
rsp_length += data_length;
12511251
no_data = false;
12521252

1253-
} else if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_descriptor_type)) {
1253+
} else if (mp_obj_is_type(attribute_obj, &bleio_descriptor_type)) {
12541254
// See if request is for a descriptor value with a 16-bit UUID, such as the CCCD.
12551255
bleio_descriptor_obj_t *descriptor = MP_OBJ_TO_PTR(attribute_obj);
12561256
if (bleio_uuid_get_uuid16_or_unknown(descriptor->uuid) == type_uuid) {
@@ -1271,7 +1271,7 @@ STATIC void process_read_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
12711271
break;
12721272
}
12731273

1274-
} else if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_characteristic_type)) {
1274+
} else if (mp_obj_is_type(attribute_obj, &bleio_characteristic_type)) {
12751275
// See if request is for a characteristic value with a 16-bit UUID.
12761276
bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(attribute_obj);
12771277
if (bleio_uuid_get_uuid16_or_unknown(characteristic->uuid) == type_uuid) {
@@ -1359,7 +1359,7 @@ STATIC void process_write_req_or_cmd(uint16_t conn_handle, uint16_t mtu, uint8_t
13591359

13601360
mp_obj_t attribute_obj = bleio_adapter_get_attribute(&common_hal_bleio_adapter_obj, req->handle);
13611361

1362-
if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_characteristic_type)) {
1362+
if (mp_obj_is_type(attribute_obj, &bleio_characteristic_type)) {
13631363
bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(attribute_obj);
13641364

13651365
// Don't write the characteristic declaration.
@@ -1377,7 +1377,7 @@ STATIC void process_write_req_or_cmd(uint16_t conn_handle, uint16_t mtu, uint8_t
13771377
// Just change the local value. Don't fire off notifications, etc.
13781378
bleio_characteristic_set_local_value(characteristic, &bufinfo);
13791379

1380-
} else if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_descriptor_type)) {
1380+
} else if (mp_obj_is_type(attribute_obj, &bleio_descriptor_type)) {
13811381
bleio_descriptor_obj_t *descriptor = MP_OBJ_TO_PTR(attribute_obj);
13821382
// Only CCCD's are writable.
13831383
if (bleio_uuid_get_uuid16_or_unknown(descriptor->uuid) != BLE_UUID_CCCD) {
@@ -1427,7 +1427,7 @@ STATIC void process_prepare_write_req(uint16_t conn_handle, uint16_t mtu, uint8_
14271427

14281428
mp_obj_t *attribute = bleio_adapter_get_attribute(&common_hal_bleio_adapter_obj, handle);
14291429

1430-
if (!MP_OBJ_IS_TYPE(attribute, &bleio_characteristic_type)) {
1430+
if (!mp_obj_is_type(attribute, &bleio_characteristic_type)) {
14311431
send_error(conn_handle, BT_ATT_OP_PREPARE_WRITE_REQ, handle, BT_ATT_ERR_ATTRIBUTE_NOT_LONG);
14321432
return;
14331433
}

0 commit comments

Comments
 (0)