Merge remote-tracking branch 'origin/main' into refine-stubs

This commit is contained in:
Jeff Epler 2021-07-08 19:05:26 -05:00
commit 3191357807
362 changed files with 9053 additions and 2528 deletions

View File

@ -1,3 +1,6 @@
# tools/gen-cpydiff.py: Fix formatting of doc strings for new Black.
0f78c36c5aa458a954eed39a46942209107a553e
# tests/run-tests.py: Reformat with Black.
2a38d7103672580882fb621a5b76e8d26805d593

View File

@ -1,54 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: 'bug'
assignees: ''
---
<!-- Thanks! for testing out CircuitPython. Now that you have got a problem...
you can file a bug report for it. Feel free to modify the below format to better
suit your issue. :) -->
**Firmware**
<!-- Include the version of CircuitPython you're running. You can see it in the
`boot_out.txt` file, as well as in the REPL. -->
```python
Adafruit CircuitPython 6.2.0-beta.2 on 2021-03-01; Raspberry Pi Pico with rp2040
```
**Code/REPL**
<!-- Include your code that reproduces the bug here. Try to distill down to the
minimum possible to reproduce. -->
```python
import busio, bitbangio
i2c = bitbangio.I2C(board.GP1, board.GP0)
```
**Behavior**
<!-- What happens when you run the code above? Include any error messages. -->
```python
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TimeoutError: Clock stretch too long
```
**Description**
<!-- Optionally, describe the issue in more detail. Here are some examples: -->
- Error while using i2c...
- Only happens when...
- might be related to #4291...
**Additional Info**
<!-- Optionally, add any other information like hardware connection, scope output etc.
If you have already done some debugging, mention it here. -->

63
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@ -0,0 +1,63 @@
name: 🐞 Bug Report
description: Create a bug report to help us improve
labels:
- bug
body:
- type: markdown
attributes:
value: >-
Thanks! for testing out CircuitPython. Now that you have encountered a
bug... you can file a report for it.
- type: textarea
id: firmware
attributes:
label: CircuitPython version
description: >-
Include the version of CircuitPython you're running. You can see it in
the `boot_out.txt` file, as well as in the `REPL`.
placeholder: Adafruit CircuitPython 6.2.0 on 2021-03-01; Raspberry Pi Pico with rp2040
render: python
validations:
required: true
- type: textarea
id: code
attributes:
label: Code/REPL
description: This is automatically rendered as Python, so no need for backticks.
placeholder: |
import busio, bitbangio
i2c = bitbangio.I2C(board.GP1, board.GP0)
render: python
validations:
required: true
- type: textarea
id: behavior
attributes:
label: Behavior
description: What happens when you run the code above? Include error messages (if any).
placeholder: |
```python
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TimeoutError: Clock stretch too long
```
On-board led pulses red.
validations:
required: true
- type: textarea
id: description
attributes:
label: Description
description: Optionally, describe the bug in more detail.
placeholder: |
- Error while using i2c...
- Only happens when...
- might be related to #4291...
- type: textarea
id: more-info
attributes:
label: Additional information
description: >-
Optionally, add any other information like hardware connection, scope
output etc. If you have already done some debugging, mention it here.
placeholder: Removing [this](url) line resolves the issue.

View File

@ -1,7 +1,7 @@
contact_links:
- name: Adafruit Forum
- name: 🔗 Adafruit Forum
url: https://forums.adafruit.com/
about: Official Adafruit technical support forum. Good for getting help on getting a project working.
- name: Adafruit Discord
- name: 🔗 Adafruit Discord
url: https://adafru.it/discord
about: Unofficial chat with many helpful folks and normally prompt replies.

View File

@ -1,5 +1,5 @@
---
name: Feature request
name: 🚀 Feature Request
about: Suggest an idea for this project
title: ''
labels: 'enhancement'
@ -7,5 +7,5 @@ assignees: ''
---
<!-- We are always adding new features and enhancements to CircuitPython 🚀
<!-- We keep adding new features and enhancements to CircuitPython 🚀
and would love ❤ to see what new challenge you have got for us... 🙂 -->

View File

@ -132,8 +132,9 @@ jobs:
TWINE_USERNAME: ${{ secrets.pypi_username }}
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: |
echo "Uploading dev release to PyPi"
twine upload circuitpython-stubs/dist/*
# setup.py sdist was run by 'make stubs'
if [ -z "$TWINE_USERNAME" ] || echo "Uploading dev release to PyPi"
if [ -z "$TWINE_USERNAME" ] || twine upload circuitpython-stubs/dist/*
mpy-cross-mac:
runs-on: macos-10.15

1
.gitmodules vendored
View File

@ -153,6 +153,7 @@
[submodule "ports/esp32s2/esp-idf"]
path = ports/esp32s2/esp-idf
url = https://github.com/adafruit/esp-idf.git
branch = circuitpython-v4.3
[submodule "ports/esp32s2/certificates/nina-fw"]
path = ports/esp32s2/certificates/nina-fw
url = https://github.com/adafruit/nina-fw.git

View File

@ -417,7 +417,6 @@ texinfo_documents = [
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {"cpython": ('https://docs.python.org/3/', None),
"bus_device": ('https://circuitpython.readthedocs.io/projects/busdevice/en/latest/', None),
"register": ('https://circuitpython.readthedocs.io/projects/register/en/latest/', None)}
# Adapted from sphinxcontrib-redirects

View File

@ -118,7 +118,8 @@ STATIC void add_generic_services(bleio_adapter_obj_t *adapter) {
SECURITY_MODE_NO_ACCESS,
248, // max length, from Bluetooth spec
false, // not fixed length
&generic_name_bufinfo
&generic_name_bufinfo,
NULL
);
uint16_t zero_16 = 0;
@ -140,7 +141,8 @@ STATIC void add_generic_services(bleio_adapter_obj_t *adapter) {
SECURITY_MODE_NO_ACCESS,
2, // max length, from Bluetooth spec
true, // fixed length
&zero_16_value
&zero_16_value,
NULL
);
// Generic Attribute Service setup.
@ -176,7 +178,8 @@ STATIC void add_generic_services(bleio_adapter_obj_t *adapter) {
SECURITY_MODE_NO_ACCESS,
4, // max length, from Bluetooth spec
true, // fixed length
&zero_32_value
&zero_32_value,
NULL
);
}
@ -645,7 +648,11 @@ STATIC void check_data_fit(size_t data_len, bool connectable) {
// return true;
// }
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) {
uint32_t _common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self,
bool connectable, bool anonymous, uint32_t timeout, float interval,
const uint8_t *advertising_data, uint16_t advertising_data_len,
const uint8_t *scan_response_data, uint16_t scan_response_data_len,
mp_int_t tx_power, const bleio_address_obj_t *directed_to) {
check_enabled(self);
if (self->now_advertising) {
@ -769,7 +776,11 @@ uint32_t _common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self,
return 0;
}
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) {
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, const bleio_address_obj_t *directed_to) {
check_enabled(self);
// interval value has already been validated.
@ -803,7 +814,7 @@ void common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self, bool
advertising_data_bufinfo->len,
scan_response_data_bufinfo->buf,
scan_response_data_bufinfo->len,
tx_power);
tx_power, directed_to);
if (result) {
mp_raise_bleio_BluetoothError(translate("Already advertising"));

View File

@ -41,7 +41,7 @@
#define CCCD_INDICATE 0x2
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) {
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) {
self->service = service;
self->uuid = uuid;
self->decl_handle = BLE_GATT_HANDLE_INVALID;
@ -66,7 +66,7 @@ void common_hal_bleio_characteristic_construct(bleio_characteristic_obj_t *self,
if (service->is_remote) {
self->handle = handle;
} else {
common_hal_bleio_service_add_characteristic(self->service, self, initial_value_bufinfo);
common_hal_bleio_service_add_characteristic(self->service, self, initial_value_bufinfo, user_description);
}
}

View File

@ -148,7 +148,8 @@ mp_int_t common_hal_bleio_packet_buffer_readinto(bleio_packet_buffer_obj_t *self
return ret;
}
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) {
mp_int_t common_hal_bleio_packet_buffer_write(bleio_packet_buffer_obj_t *self,
const uint8_t *data, size_t len, uint8_t *header, size_t header_len) {
if (self->outgoing[0] == NULL) {
mp_raise_bleio_BluetoothError(translate("Writes not supported on Characteristic"));
}

View File

@ -84,7 +84,8 @@ bool common_hal_bleio_service_get_is_secondary(bleio_service_obj_t *self) {
void common_hal_bleio_service_add_characteristic(bleio_service_obj_t *self,
bleio_characteristic_obj_t *characteristic,
mp_buffer_info_t *initial_value_bufinfo) {
mp_buffer_info_t *initial_value_bufinfo,
const char *user_description) {
if (self->handle != common_hal_bleio_adapter_obj.last_added_service_handle) {
mp_raise_bleio_BluetoothError(

View File

@ -36,7 +36,7 @@
#include "shared-bindings/_bleio/Descriptor.h"
#include "shared-bindings/_bleio/Service.h"
#include "shared-bindings/_bleio/UUID.h"
#include "supervisor/shared/bluetooth.h"
#include "supervisor/shared/bluetooth/bluetooth.h"
// UUID shared by all cccd's.
bleio_uuid_obj_t cccd_uuid;

View File

@ -182,10 +182,6 @@ Exceptions
.. exception:: OSError
|see_cpython| :py:class:`cpython:OSError`. CircuitPython doesn't implement the ``errno``
attribute, instead use the standard way to access exception arguments:
``exc.args[0]``.
.. exception:: RuntimeError
.. exception:: ReloadException

View File

@ -214,6 +214,14 @@ TCP stream connections
This is a coroutine.
.. method:: Stream.readinto(buf)
Read up to n bytes into *buf* with n being equal to the length of *buf*.
Return the number of bytes read into *buf*.
This is a coroutine, and a MicroPython extension.
.. method:: Stream.readline()
Read a line and return it.

View File

@ -247,7 +247,7 @@ Module contents
.. data:: VOID
``VOID`` is an alias for ``UINT8``, and is provided to conviniently define
``VOID`` is an alias for ``UINT8``, and is provided to conveniently define
C's void pointers: ``(uctypes.PTR, uctypes.VOID)``.
.. data:: PTR

View File

@ -8,9 +8,11 @@
|see_cpython_module| :mod:`cpython:heapq`.
This module implements the heap queue algorithm.
This module implements the
`min heap queue algorithm <https://en.wikipedia.org/wiki/Heap_%28data_structure%29>`_.
A heap queue is simply a list that has its elements stored in a certain way.
A heap queue is essentially a list that has its elements stored in such a way
that the first item of the list is always the smallest.
Functions
---------
@ -21,8 +23,10 @@ Functions
.. function:: heappop(heap)
Pop the first item from the ``heap``, and return it. Raises IndexError if
heap is empty.
Pop the first item from the ``heap``, and return it. Raise ``IndexError`` if
``heap`` is empty.
The returned item will be the smallest item in the ``heap``.
.. function:: heapify(x)

View File

@ -89,11 +89,11 @@ Methods
``callee-owned tuples``. This function provides efficient, allocation-free
way to poll on streams.
If *flags* is 1, one-shot behavior for events is employed: streams for
If *flags* is 1, one-shot behaviour for events is employed: streams for
which events happened will have their event masks automatically reset
(equivalent to ``poll.modify(obj, 0)``), so new events for such a stream
won't be processed until new mask is set with `poll.modify()`. This
behavior is useful for asynchronous I/O schedulers.
behaviour is useful for asynchronous I/O schedulers.
.. admonition:: Difference to CPython
:class: attention

View File

@ -31,12 +31,19 @@
#if MICROPY_PY_UASYNCIO
#define TASK_STATE_RUNNING_NOT_WAITED_ON (mp_const_true)
#define TASK_STATE_DONE_NOT_WAITED_ON (mp_const_none)
#define TASK_STATE_DONE_WAS_WAITED_ON (mp_const_false)
#define TASK_IS_DONE(task) ( \
(task)->state == TASK_STATE_DONE_NOT_WAITED_ON \
|| (task)->state == TASK_STATE_DONE_WAS_WAITED_ON)
typedef struct _mp_obj_task_t {
mp_pairheap_t pairheap;
mp_obj_t coro;
mp_obj_t data;
mp_obj_t waiting;
mp_obj_t state;
mp_obj_t ph_key;
} mp_obj_task_t;
@ -146,9 +153,6 @@ STATIC const mp_obj_type_t task_queue_type = {
/******************************************************************************/
// Task class
// For efficiency, the task object is stored to the coro entry when the task is done.
#define TASK_IS_DONE(task) ((task)->coro == MP_OBJ_FROM_PTR(task))
// This is the core uasyncio context with cur_task, _task_queue and CancelledError.
STATIC mp_obj_t uasyncio_context = MP_OBJ_NULL;
@ -159,7 +163,7 @@ STATIC mp_obj_t task_make_new(const mp_obj_type_t *type, size_t n_args, const mp
mp_pairheap_init_node(task_lt, &self->pairheap);
self->coro = args[0];
self->data = mp_const_none;
self->waiting = mp_const_none;
self->state = TASK_STATE_RUNNING_NOT_WAITED_ON;
self->ph_key = MP_OBJ_NEW_SMALL_INT(0);
if (n_args == 2) {
uasyncio_context = args[1];
@ -218,24 +222,6 @@ STATIC mp_obj_t task_cancel(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(task_cancel_obj, task_cancel);
STATIC mp_obj_t task_throw(mp_obj_t self_in, mp_obj_t value_in) {
// This task raised an exception which was uncaught; handle that now.
mp_obj_task_t *self = MP_OBJ_TO_PTR(self_in);
// Set the data because it was cleared by the main scheduling loop.
self->data = value_in;
if (self->waiting == mp_const_none) {
// Nothing await'ed on the task so call the exception handler.
mp_obj_t _exc_context = mp_obj_dict_get(uasyncio_context, MP_OBJ_NEW_QSTR(MP_QSTR__exc_context));
mp_obj_dict_store(_exc_context, MP_OBJ_NEW_QSTR(MP_QSTR_exception), value_in);
mp_obj_dict_store(_exc_context, MP_OBJ_NEW_QSTR(MP_QSTR_future), self_in);
mp_obj_t Loop = mp_obj_dict_get(uasyncio_context, MP_OBJ_NEW_QSTR(MP_QSTR_Loop));
mp_obj_t call_exception_handler = mp_load_attr(Loop, MP_QSTR_call_exception_handler);
mp_call_function_1(call_exception_handler, _exc_context);
}
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(task_throw_obj, task_throw);
STATIC void task_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
mp_obj_task_t *self = MP_OBJ_TO_PTR(self_in);
if (dest[0] == MP_OBJ_NULL) {
@ -244,32 +230,24 @@ STATIC void task_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
dest[0] = self->coro;
} else if (attr == MP_QSTR_data) {
dest[0] = self->data;
} else if (attr == MP_QSTR_waiting) {
if (self->waiting != mp_const_none && self->waiting != mp_const_false) {
dest[0] = self->waiting;
}
} else if (attr == MP_QSTR_state) {
dest[0] = self->state;
} else if (attr == MP_QSTR_done) {
dest[0] = MP_OBJ_FROM_PTR(&task_done_obj);
dest[1] = self_in;
} else if (attr == MP_QSTR_cancel) {
dest[0] = MP_OBJ_FROM_PTR(&task_cancel_obj);
dest[1] = self_in;
} else if (attr == MP_QSTR_throw) {
dest[0] = MP_OBJ_FROM_PTR(&task_throw_obj);
dest[1] = self_in;
} else if (attr == MP_QSTR_ph_key) {
dest[0] = self->ph_key;
}
} else if (dest[1] != MP_OBJ_NULL) {
// Store
if (attr == MP_QSTR_coro) {
self->coro = dest[1];
dest[0] = MP_OBJ_NULL;
} else if (attr == MP_QSTR_data) {
if (attr == MP_QSTR_data) {
self->data = dest[1];
dest[0] = MP_OBJ_NULL;
} else if (attr == MP_QSTR_waiting) {
self->waiting = dest[1];
} else if (attr == MP_QSTR_state) {
self->state = dest[1];
dest[0] = MP_OBJ_NULL;
}
}
@ -278,15 +256,12 @@ STATIC void task_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
STATIC mp_obj_t task_getiter(mp_obj_t self_in, mp_obj_iter_buf_t *iter_buf) {
(void)iter_buf;
mp_obj_task_t *self = MP_OBJ_TO_PTR(self_in);
if (self->waiting == mp_const_none) {
// The is the first access of the "waiting" entry.
if (TASK_IS_DONE(self)) {
// Signal that the completed-task has been await'ed on.
self->waiting = mp_const_false;
} else {
// Lazily allocate the waiting queue.
self->waiting = task_queue_make_new(&task_queue_type, 0, 0, NULL);
}
if (TASK_IS_DONE(self)) {
// Signal that the completed-task has been await'ed on.
self->state = TASK_STATE_DONE_WAS_WAITED_ON;
} else if (self->state == TASK_STATE_RUNNING_NOT_WAITED_ON) {
// Allocate the waiting queue.
self->state = task_queue_make_new(&task_queue_type, 0, 0, NULL);
}
return self_in;
}
@ -299,7 +274,7 @@ STATIC mp_obj_t task_iternext(mp_obj_t self_in) {
} else {
// Put calling task on waiting queue.
mp_obj_t cur_task = mp_obj_dict_get(uasyncio_context, MP_OBJ_NEW_QSTR(MP_QSTR_cur_task));
mp_obj_t args[2] = { self->waiting, cur_task };
mp_obj_t args[2] = { self->state, cur_task };
task_queue_push_sorted(2, args);
// Set calling task's data to this task that it waits on, to double-link it.
((mp_obj_task_t *)MP_OBJ_TO_PTR(cur_task))->data = self_in;

View File

@ -15,38 +15,10 @@
#if MICROPY_PY_UCTYPES
/// \module uctypes - Access data structures in memory
///
/// The module allows to define layout of raw data structure (using terms
/// of C language), and then access memory buffers using this definition.
/// The module also provides convenience functions to access memory buffers
/// contained in Python objects or wrap memory buffers in Python objects.
/// \constant UINT8_1 - uint8_t value type
/// \class struct - C-like structure
///
/// Encapsulalation of in-memory data structure. This class doesn't define
/// any methods, only attribute access (for structure fields) and
/// indexing (for pointer and array fields).
///
/// Usage:
///
/// # Define layout of a structure with 2 fields
/// # 0 and 4 are byte offsets of fields from the beginning of struct
/// # they are logically ORed with field type
/// FOO_STRUCT = {"a": 0 | uctypes.UINT32, "b": 4 | uctypes.UINT8}
///
/// # Example memory buffer to access (contained in bytes object)
/// buf = b"\x64\0\0\0\0x14"
///
/// # Create structure object referring to address of
/// # the data in the buffer above
/// s = uctypes.struct(FOO_STRUCT, uctypes.addressof(buf))
///
/// # Access fields
/// print(s.a, s.b)
/// # Result:
/// # 100, 20
// The uctypes module allows defining the layout of a raw data structure (using
// terms of the C language), and then access memory buffers using this definition.
// The module also provides convenience functions to access memory buffers
// contained in Python objects or wrap memory buffers in Python objects.
#define LAYOUT_LITTLE_ENDIAN (0)
#define LAYOUT_BIG_ENDIAN (1)
@ -56,6 +28,7 @@
#define BITF_LEN_BITS 5
#define BITF_OFF_BITS 5
#define OFFSET_BITS 17
#define LEN_BITS (OFFSET_BITS + BITF_OFF_BITS)
#if VAL_TYPE_BITS + BITF_LEN_BITS + BITF_OFF_BITS + OFFSET_BITS != 31
#error Invalid encoding field length
#endif
@ -172,7 +145,7 @@ STATIC mp_uint_t uctypes_struct_agg_size(mp_obj_tuple_t *t, int layout_type, mp_
mp_uint_t item_s;
if (t->len == 2) {
// Elements of array are scalar
item_s = GET_SCALAR_SIZE(val_type);
item_s = uctypes_struct_scalar_size(val_type);
if (item_s > *max_field_size) {
*max_field_size = item_s;
}
@ -400,10 +373,8 @@ STATIC mp_obj_t uctypes_struct_attr_op(mp_obj_t self_in, qstr attr, mp_obj_t set
mp_int_t offset = MP_OBJ_SMALL_INT_VALUE(deref);
mp_uint_t val_type = GET_TYPE(offset, VAL_TYPE_BITS);
offset &= VALUE_MASK(VAL_TYPE_BITS);
// printf("scalar type=%d offset=%x\n", val_type, offset);
if (val_type <= INT64 || val_type == FLOAT32 || val_type == FLOAT64) {
// printf("size=%d\n", GET_SCALAR_SIZE(val_type));
if (self->flags == LAYOUT_NATIVE) {
if (set_val == MP_OBJ_NULL) {
return get_aligned(val_type, self->addr + offset, 0);
@ -420,9 +391,9 @@ STATIC mp_obj_t uctypes_struct_attr_op(mp_obj_t self_in, qstr attr, mp_obj_t set
}
}
} else if (val_type >= BFUINT8 && val_type <= BFINT32) {
uint bit_offset = (offset >> 17) & 31;
uint bit_len = (offset >> 22) & 31;
offset &= (1 << 17) - 1;
uint bit_offset = (offset >> OFFSET_BITS) & 31;
uint bit_len = (offset >> LEN_BITS) & 31;
offset &= (1 << OFFSET_BITS) - 1;
mp_uint_t val;
if (self->flags == LAYOUT_NATIVE) {
val = get_aligned_basic(val_type & 6, self->addr + offset);
@ -470,7 +441,6 @@ STATIC mp_obj_t uctypes_struct_attr_op(mp_obj_t self_in, qstr attr, mp_obj_t set
mp_int_t offset = MP_OBJ_SMALL_INT_VALUE(sub->items[0]);
mp_uint_t agg_type = GET_TYPE(offset, AGG_TYPE_BITS);
offset &= VALUE_MASK(AGG_TYPE_BITS);
// printf("agg type=%d offset=%x\n", agg_type, offset);
switch (agg_type) {
case STRUCT: {
@ -495,7 +465,6 @@ STATIC mp_obj_t uctypes_struct_attr_op(mp_obj_t self_in, qstr attr, mp_obj_t set
o->desc = MP_OBJ_FROM_PTR(sub);
o->addr = self->addr + offset;
o->flags = self->flags;
// printf("PTR/ARR base addr=%p\n", o->addr);
return MP_OBJ_FROM_PTR(o);
}
}
@ -553,7 +522,7 @@ STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t base_in, mp_obj_t index_in, mp_ob
return value; // just !MP_OBJ_NULL
}
} else {
byte *p = self->addr + GET_SCALAR_SIZE(val_type) * index;
byte *p = self->addr + uctypes_struct_scalar_size(val_type) * index;
if (value == MP_OBJ_SENTINEL) {
return get_unaligned(val_type, p, self->flags);
} else {
@ -628,9 +597,8 @@ STATIC mp_int_t uctypes_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo,
return 0;
}
/// \function addressof()
/// Return address of object's data (applies to object providing buffer
/// interface).
// addressof()
// Return address of object's data (applies to objects providing the buffer interface).
STATIC mp_obj_t uctypes_struct_addressof(mp_obj_t buf) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_READ);
@ -638,25 +606,20 @@ STATIC mp_obj_t uctypes_struct_addressof(mp_obj_t buf) {
}
MP_DEFINE_CONST_FUN_OBJ_1(uctypes_struct_addressof_obj, uctypes_struct_addressof);
/// \function bytearray_at()
/// Capture memory at given address of given size as bytearray. Memory is
/// captured by reference (and thus memory pointed by bytearray may change
/// or become invalid at later time). Use bytes_at() to capture by value.
// bytearray_at()
// Capture memory at given address of given size as bytearray.
STATIC mp_obj_t uctypes_struct_bytearray_at(mp_obj_t ptr, mp_obj_t size) {
return mp_obj_new_bytearray_by_ref(mp_obj_int_get_truncated(size), (void *)(uintptr_t)mp_obj_int_get_truncated(ptr));
}
MP_DEFINE_CONST_FUN_OBJ_2(uctypes_struct_bytearray_at_obj, uctypes_struct_bytearray_at);
/// \function bytes_at()
/// Capture memory at given address of given size as bytes. Memory is
/// captured by value, i.e. copied. Use bytearray_at() to capture by reference
/// ("zero copy").
// bytes_at()
// Capture memory at given address of given size as bytes.
STATIC mp_obj_t uctypes_struct_bytes_at(mp_obj_t ptr, mp_obj_t size) {
return mp_obj_new_bytes((void *)(uintptr_t)mp_obj_int_get_truncated(ptr), mp_obj_int_get_truncated(size));
}
MP_DEFINE_CONST_FUN_OBJ_2(uctypes_struct_bytes_at_obj, uctypes_struct_bytes_at);
STATIC const mp_obj_type_t uctypes_struct_type = {
{ &mp_type_type },
.name = MP_QSTR_struct,
@ -676,81 +639,63 @@ STATIC const mp_rom_map_elem_t mp_module_uctypes_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_bytes_at), MP_ROM_PTR(&uctypes_struct_bytes_at_obj) },
{ MP_ROM_QSTR(MP_QSTR_bytearray_at), MP_ROM_PTR(&uctypes_struct_bytearray_at_obj) },
/// \moduleref uctypes
/// \constant NATIVE - Native structure layout - native endianness,
/// platform-specific field alignment
{ MP_ROM_QSTR(MP_QSTR_NATIVE), MP_ROM_INT(LAYOUT_NATIVE) },
/// \constant LITTLE_ENDIAN - Little-endian structure layout, tightly packed
/// (no alignment constraints)
{ MP_ROM_QSTR(MP_QSTR_LITTLE_ENDIAN), MP_ROM_INT(LAYOUT_LITTLE_ENDIAN) },
/// \constant BIG_ENDIAN - Big-endian structure layout, tightly packed
/// (no alignment constraints)
{ MP_ROM_QSTR(MP_QSTR_BIG_ENDIAN), MP_ROM_INT(LAYOUT_BIG_ENDIAN) },
/// \constant VOID - void value type, may be used only as pointer target type.
{ MP_ROM_QSTR(MP_QSTR_VOID), MP_ROM_INT(TYPE2SMALLINT(UINT8, VAL_TYPE_BITS)) },
/// \constant UINT8 - uint8_t value type
{ MP_ROM_QSTR(MP_QSTR_UINT8), MP_ROM_INT(TYPE2SMALLINT(UINT8, 4)) },
/// \constant INT8 - int8_t value type
{ MP_ROM_QSTR(MP_QSTR_INT8), MP_ROM_INT(TYPE2SMALLINT(INT8, 4)) },
/// \constant UINT16 - uint16_t value type
{ MP_ROM_QSTR(MP_QSTR_UINT16), MP_ROM_INT(TYPE2SMALLINT(UINT16, 4)) },
/// \constant INT16 - int16_t value type
{ MP_ROM_QSTR(MP_QSTR_INT16), MP_ROM_INT(TYPE2SMALLINT(INT16, 4)) },
/// \constant UINT32 - uint32_t value type
{ MP_ROM_QSTR(MP_QSTR_UINT32), MP_ROM_INT(TYPE2SMALLINT(UINT32, 4)) },
/// \constant INT32 - int32_t value type
{ MP_ROM_QSTR(MP_QSTR_INT32), MP_ROM_INT(TYPE2SMALLINT(INT32, 4)) },
/// \constant UINT64 - uint64_t value type
{ MP_ROM_QSTR(MP_QSTR_UINT64), MP_ROM_INT(TYPE2SMALLINT(UINT64, 4)) },
/// \constant INT64 - int64_t value type
{ MP_ROM_QSTR(MP_QSTR_INT64), MP_ROM_INT(TYPE2SMALLINT(INT64, 4)) },
{ MP_ROM_QSTR(MP_QSTR_UINT8), MP_ROM_INT(TYPE2SMALLINT(UINT8, VAL_TYPE_BITS)) },
{ MP_ROM_QSTR(MP_QSTR_INT8), MP_ROM_INT(TYPE2SMALLINT(INT8, VAL_TYPE_BITS)) },
{ MP_ROM_QSTR(MP_QSTR_UINT16), MP_ROM_INT(TYPE2SMALLINT(UINT16, VAL_TYPE_BITS)) },
{ MP_ROM_QSTR(MP_QSTR_INT16), MP_ROM_INT(TYPE2SMALLINT(INT16, VAL_TYPE_BITS)) },
{ MP_ROM_QSTR(MP_QSTR_UINT32), MP_ROM_INT(TYPE2SMALLINT(UINT32, VAL_TYPE_BITS)) },
{ MP_ROM_QSTR(MP_QSTR_INT32), MP_ROM_INT(TYPE2SMALLINT(INT32, VAL_TYPE_BITS)) },
{ MP_ROM_QSTR(MP_QSTR_UINT64), MP_ROM_INT(TYPE2SMALLINT(UINT64, VAL_TYPE_BITS)) },
{ MP_ROM_QSTR(MP_QSTR_INT64), MP_ROM_INT(TYPE2SMALLINT(INT64, VAL_TYPE_BITS)) },
{ MP_ROM_QSTR(MP_QSTR_BFUINT8), MP_ROM_INT(TYPE2SMALLINT(BFUINT8, 4)) },
{ MP_ROM_QSTR(MP_QSTR_BFINT8), MP_ROM_INT(TYPE2SMALLINT(BFINT8, 4)) },
{ MP_ROM_QSTR(MP_QSTR_BFUINT16), MP_ROM_INT(TYPE2SMALLINT(BFUINT16, 4)) },
{ MP_ROM_QSTR(MP_QSTR_BFINT16), MP_ROM_INT(TYPE2SMALLINT(BFINT16, 4)) },
{ MP_ROM_QSTR(MP_QSTR_BFUINT32), MP_ROM_INT(TYPE2SMALLINT(BFUINT32, 4)) },
{ MP_ROM_QSTR(MP_QSTR_BFINT32), MP_ROM_INT(TYPE2SMALLINT(BFINT32, 4)) },
{ MP_ROM_QSTR(MP_QSTR_BFUINT8), MP_ROM_INT(TYPE2SMALLINT(BFUINT8, VAL_TYPE_BITS)) },
{ MP_ROM_QSTR(MP_QSTR_BFINT8), MP_ROM_INT(TYPE2SMALLINT(BFINT8, VAL_TYPE_BITS)) },
{ MP_ROM_QSTR(MP_QSTR_BFUINT16), MP_ROM_INT(TYPE2SMALLINT(BFUINT16, VAL_TYPE_BITS)) },
{ MP_ROM_QSTR(MP_QSTR_BFINT16), MP_ROM_INT(TYPE2SMALLINT(BFINT16, VAL_TYPE_BITS)) },
{ MP_ROM_QSTR(MP_QSTR_BFUINT32), MP_ROM_INT(TYPE2SMALLINT(BFUINT32, VAL_TYPE_BITS)) },
{ MP_ROM_QSTR(MP_QSTR_BFINT32), MP_ROM_INT(TYPE2SMALLINT(BFINT32, VAL_TYPE_BITS)) },
{ MP_ROM_QSTR(MP_QSTR_BF_POS), MP_ROM_INT(17) },
{ MP_ROM_QSTR(MP_QSTR_BF_LEN), MP_ROM_INT(22) },
{ MP_ROM_QSTR(MP_QSTR_BF_POS), MP_ROM_INT(OFFSET_BITS) },
{ MP_ROM_QSTR(MP_QSTR_BF_LEN), MP_ROM_INT(LEN_BITS) },
#if MICROPY_PY_BUILTINS_FLOAT
{ MP_ROM_QSTR(MP_QSTR_FLOAT32), MP_ROM_INT(TYPE2SMALLINT(FLOAT32, 4)) },
{ MP_ROM_QSTR(MP_QSTR_FLOAT64), MP_ROM_INT(TYPE2SMALLINT(FLOAT64, 4)) },
{ MP_ROM_QSTR(MP_QSTR_FLOAT32), MP_ROM_INT(TYPE2SMALLINT(FLOAT32, VAL_TYPE_BITS)) },
{ MP_ROM_QSTR(MP_QSTR_FLOAT64), MP_ROM_INT(TYPE2SMALLINT(FLOAT64, VAL_TYPE_BITS)) },
#endif
#if MICROPY_PY_UCTYPES_NATIVE_C_TYPES
// C native type aliases. These depend on GCC-compatible predefined
// preprocessor macros.
#if __SIZEOF_SHORT__ == 2
{ MP_ROM_QSTR(MP_QSTR_SHORT), MP_ROM_INT(TYPE2SMALLINT(INT16, 4)) },
{ MP_ROM_QSTR(MP_QSTR_USHORT), MP_ROM_INT(TYPE2SMALLINT(UINT16, 4)) },
{ MP_ROM_QSTR(MP_QSTR_SHORT), MP_ROM_INT(TYPE2SMALLINT(INT16, VAL_TYPE_BITS)) },
{ MP_ROM_QSTR(MP_QSTR_USHORT), MP_ROM_INT(TYPE2SMALLINT(UINT16, VAL_TYPE_BITS)) },
#endif
#if __SIZEOF_INT__ == 4
{ MP_ROM_QSTR(MP_QSTR_INT), MP_ROM_INT(TYPE2SMALLINT(INT32, 4)) },
{ MP_ROM_QSTR(MP_QSTR_UINT), MP_ROM_INT(TYPE2SMALLINT(UINT32, 4)) },
{ MP_ROM_QSTR(MP_QSTR_INT), MP_ROM_INT(TYPE2SMALLINT(INT32, VAL_TYPE_BITS)) },
{ MP_ROM_QSTR(MP_QSTR_UINT), MP_ROM_INT(TYPE2SMALLINT(UINT32, VAL_TYPE_BITS)) },
#endif
#if __SIZEOF_LONG__ == 4
{ MP_ROM_QSTR(MP_QSTR_LONG), MP_ROM_INT(TYPE2SMALLINT(INT32, 4)) },
{ MP_ROM_QSTR(MP_QSTR_ULONG), MP_ROM_INT(TYPE2SMALLINT(UINT32, 4)) },
{ MP_ROM_QSTR(MP_QSTR_LONG), MP_ROM_INT(TYPE2SMALLINT(INT32, VAL_TYPE_BITS)) },
{ MP_ROM_QSTR(MP_QSTR_ULONG), MP_ROM_INT(TYPE2SMALLINT(UINT32, VAL_TYPE_BITS)) },
#elif __SIZEOF_LONG__ == 8
{ MP_ROM_QSTR(MP_QSTR_LONG), MP_ROM_INT(TYPE2SMALLINT(INT64, 4)) },
{ MP_ROM_QSTR(MP_QSTR_ULONG), MP_ROM_INT(TYPE2SMALLINT(UINT64, 4)) },
{ MP_ROM_QSTR(MP_QSTR_LONG), MP_ROM_INT(TYPE2SMALLINT(INT64, VAL_TYPE_BITS)) },
{ MP_ROM_QSTR(MP_QSTR_ULONG), MP_ROM_INT(TYPE2SMALLINT(UINT64, VAL_TYPE_BITS)) },
#endif
#if __SIZEOF_LONG_LONG__ == 8
{ MP_ROM_QSTR(MP_QSTR_LONGLONG), MP_ROM_INT(TYPE2SMALLINT(INT64, 4)) },
{ MP_ROM_QSTR(MP_QSTR_ULONGLONG), MP_ROM_INT(TYPE2SMALLINT(UINT64, 4)) },
{ MP_ROM_QSTR(MP_QSTR_LONGLONG), MP_ROM_INT(TYPE2SMALLINT(INT64, VAL_TYPE_BITS)) },
{ MP_ROM_QSTR(MP_QSTR_ULONGLONG), MP_ROM_INT(TYPE2SMALLINT(UINT64, VAL_TYPE_BITS)) },
#endif
#endif // MICROPY_PY_UCTYPES_NATIVE_C_TYPES
{ MP_ROM_QSTR(MP_QSTR_PTR), MP_ROM_INT(TYPE2SMALLINT(PTR, AGG_TYPE_BITS)) },
{ MP_ROM_QSTR(MP_QSTR_ARRAY), MP_ROM_INT(TYPE2SMALLINT(ARRAY, AGG_TYPE_BITS)) },
};
STATIC MP_DEFINE_CONST_DICT(mp_module_uctypes_globals, mp_module_uctypes_globals_table);
const mp_obj_module_t mp_module_uctypes = {

View File

@ -42,9 +42,16 @@
typedef struct _mp_obj_hash_t {
mp_obj_base_t base;
char state[0];
bool final; // if set, update and digest raise an exception
uintptr_t state[0]; // must be aligned to a machine word
} mp_obj_hash_t;
static void uhashlib_ensure_not_final(mp_obj_hash_t *self) {
if (self->final) {
mp_raise_ValueError(MP_ERROR_TEXT("hash is final"));
}
}
#if MICROPY_PY_UHASHLIB_SHA256
STATIC mp_obj_t uhashlib_sha256_update(mp_obj_t self_in, mp_obj_t arg);
@ -60,6 +67,7 @@ STATIC mp_obj_t uhashlib_sha256_make_new(const mp_obj_type_t *type, size_t n_arg
mp_arg_check_num(n_args, n_kw, 0, 1, false);
mp_obj_hash_t *o = m_new_obj_var(mp_obj_hash_t, char, sizeof(mbedtls_sha256_context));
o->base.type = type;
o->final = false;
mbedtls_sha256_init((mbedtls_sha256_context *)&o->state);
mbedtls_sha256_starts_ret((mbedtls_sha256_context *)&o->state, 0);
if (n_args == 1) {
@ -70,6 +78,7 @@ STATIC mp_obj_t uhashlib_sha256_make_new(const mp_obj_type_t *type, size_t n_arg
STATIC mp_obj_t uhashlib_sha256_update(mp_obj_t self_in, mp_obj_t arg) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
uhashlib_ensure_not_final(self);
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(arg, &bufinfo, MP_BUFFER_READ);
mbedtls_sha256_update_ret((mbedtls_sha256_context *)&self->state, bufinfo.buf, bufinfo.len);
@ -78,6 +87,8 @@ STATIC mp_obj_t uhashlib_sha256_update(mp_obj_t self_in, mp_obj_t arg) {
STATIC mp_obj_t uhashlib_sha256_digest(mp_obj_t self_in) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
uhashlib_ensure_not_final(self);
self->final = true;
vstr_t vstr;
vstr_init_len(&vstr, 32);
mbedtls_sha256_finish_ret((mbedtls_sha256_context *)&self->state, (unsigned char *)vstr.buf);
@ -102,6 +113,7 @@ STATIC mp_obj_t uhashlib_sha256_make_new(const mp_obj_type_t *type, size_t n_arg
mp_arg_check_num(n_args, kw_args, 0, 1, false);
mp_obj_hash_t *o = m_new_obj_var(mp_obj_hash_t, char, sizeof(CRYAL_SHA256_CTX));
o->base.type = type;
o->final = false;
sha256_init((CRYAL_SHA256_CTX *)o->state);
if (n_args == 1) {
uhashlib_sha256_update(MP_OBJ_FROM_PTR(o), args[0]);
@ -112,6 +124,7 @@ STATIC mp_obj_t uhashlib_sha256_make_new(const mp_obj_type_t *type, size_t n_arg
STATIC mp_obj_t uhashlib_sha256_update(mp_obj_t self_in, mp_obj_t arg) {
check_not_unicode(arg);
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
uhashlib_ensure_not_final(self);
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(arg, &bufinfo, MP_BUFFER_READ);
sha256_update((CRYAL_SHA256_CTX *)self->state, bufinfo.buf, bufinfo.len);
@ -120,6 +133,8 @@ STATIC mp_obj_t uhashlib_sha256_update(mp_obj_t self_in, mp_obj_t arg) {
STATIC mp_obj_t uhashlib_sha256_digest(mp_obj_t self_in) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
uhashlib_ensure_not_final(self);
self->final = true;
vstr_t vstr;
vstr_init_len(&vstr, SHA256_BLOCK_SIZE);
sha256_final((CRYAL_SHA256_CTX *)self->state, (byte *)vstr.buf);
@ -153,6 +168,7 @@ STATIC mp_obj_t uhashlib_sha1_make_new(const mp_obj_type_t *type, size_t n_args,
mp_arg_check_num(n_args, kw_args, 0, 1, false);
mp_obj_hash_t *o = m_new_obj_var(mp_obj_hash_t, char, sizeof(SHA1_CTX));
o->base.type = type;
o->final = false;
SHA1_Init((SHA1_CTX *)o->state);
if (n_args == 1) {
uhashlib_sha1_update(MP_OBJ_FROM_PTR(o), args[0]);
@ -163,6 +179,7 @@ STATIC mp_obj_t uhashlib_sha1_make_new(const mp_obj_type_t *type, size_t n_args,
STATIC mp_obj_t uhashlib_sha1_update(mp_obj_t self_in, mp_obj_t arg) {
check_not_unicode(arg);
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
uhashlib_ensure_not_final(self);
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(arg, &bufinfo, MP_BUFFER_READ);
SHA1_Update((SHA1_CTX *)self->state, bufinfo.buf, bufinfo.len);
@ -171,6 +188,8 @@ STATIC mp_obj_t uhashlib_sha1_update(mp_obj_t self_in, mp_obj_t arg) {
STATIC mp_obj_t uhashlib_sha1_digest(mp_obj_t self_in) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
uhashlib_ensure_not_final(self);
self->final = true;
vstr_t vstr;
vstr_init_len(&vstr, SHA1_SIZE);
SHA1_Final((byte *)vstr.buf, (SHA1_CTX *)self->state);
@ -190,6 +209,7 @@ STATIC mp_obj_t uhashlib_sha1_make_new(const mp_obj_type_t *type, size_t n_args,
mp_arg_check_num(n_args, n_kw, 0, 1, false);
mp_obj_hash_t *o = m_new_obj_var(mp_obj_hash_t, char, sizeof(mbedtls_sha1_context));
o->base.type = type;
o->final = false;
mbedtls_sha1_init((mbedtls_sha1_context *)o->state);
mbedtls_sha1_starts_ret((mbedtls_sha1_context *)o->state);
if (n_args == 1) {
@ -200,6 +220,7 @@ STATIC mp_obj_t uhashlib_sha1_make_new(const mp_obj_type_t *type, size_t n_args,
STATIC mp_obj_t uhashlib_sha1_update(mp_obj_t self_in, mp_obj_t arg) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
uhashlib_ensure_not_final(self);
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(arg, &bufinfo, MP_BUFFER_READ);
mbedtls_sha1_update_ret((mbedtls_sha1_context *)self->state, bufinfo.buf, bufinfo.len);
@ -208,6 +229,8 @@ STATIC mp_obj_t uhashlib_sha1_update(mp_obj_t self_in, mp_obj_t arg) {
STATIC mp_obj_t uhashlib_sha1_digest(mp_obj_t self_in) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
uhashlib_ensure_not_final(self);
self->final = true;
vstr_t vstr;
vstr_init_len(&vstr, 20);
mbedtls_sha1_finish_ret((mbedtls_sha1_context *)self->state, (byte *)vstr.buf);
@ -241,6 +264,7 @@ STATIC mp_obj_t uhashlib_md5_make_new(const mp_obj_type_t *type, size_t n_args,
mp_arg_check_num(n_args, n_kw, 0, 1, false);
mp_obj_hash_t *o = m_new_obj_var(mp_obj_hash_t, char, sizeof(MD5_CTX));
o->base.type = type;
o->final = false;
MD5_Init((MD5_CTX *)o->state);
if (n_args == 1) {
uhashlib_md5_update(MP_OBJ_FROM_PTR(o), args[0]);
@ -250,6 +274,7 @@ STATIC mp_obj_t uhashlib_md5_make_new(const mp_obj_type_t *type, size_t n_args,
STATIC mp_obj_t uhashlib_md5_update(mp_obj_t self_in, mp_obj_t arg) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
uhashlib_ensure_not_final(self);
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(arg, &bufinfo, MP_BUFFER_READ);
MD5_Update((MD5_CTX *)self->state, bufinfo.buf, bufinfo.len);
@ -258,6 +283,8 @@ STATIC mp_obj_t uhashlib_md5_update(mp_obj_t self_in, mp_obj_t arg) {
STATIC mp_obj_t uhashlib_md5_digest(mp_obj_t self_in) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
uhashlib_ensure_not_final(self);
self->final = true;
vstr_t vstr;
vstr_init_len(&vstr, MD5_SIZE);
MD5_Final((byte *)vstr.buf, (MD5_CTX *)self->state);
@ -277,6 +304,7 @@ STATIC mp_obj_t uhashlib_md5_make_new(const mp_obj_type_t *type, size_t n_args,
mp_arg_check_num(n_args, n_kw, 0, 1, false);
mp_obj_hash_t *o = m_new_obj_var(mp_obj_hash_t, char, sizeof(mbedtls_md5_context));
o->base.type = type;
o->final = false;
mbedtls_md5_init((mbedtls_md5_context *)o->state);
mbedtls_md5_starts_ret((mbedtls_md5_context *)o->state);
if (n_args == 1) {
@ -287,6 +315,7 @@ STATIC mp_obj_t uhashlib_md5_make_new(const mp_obj_type_t *type, size_t n_args,
STATIC mp_obj_t uhashlib_md5_update(mp_obj_t self_in, mp_obj_t arg) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
uhashlib_ensure_not_final(self);
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(arg, &bufinfo, MP_BUFFER_READ);
mbedtls_md5_update_ret((mbedtls_md5_context *)self->state, bufinfo.buf, bufinfo.len);
@ -295,6 +324,8 @@ STATIC mp_obj_t uhashlib_md5_update(mp_obj_t self_in, mp_obj_t arg) {
STATIC mp_obj_t uhashlib_md5_digest(mp_obj_t self_in) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
uhashlib_ensure_not_final(self);
self->final = true;
vstr_t vstr;
vstr_init_len(&vstr, 16);
mbedtls_md5_finish_ret((mbedtls_md5_context *)self->state, (byte *)vstr.buf);

View File

@ -66,8 +66,11 @@ STATIC uint32_t yasmarang_randbelow(uint32_t n) {
STATIC mp_obj_t mod_urandom_getrandbits(mp_obj_t num_in) {
int n = mp_obj_get_int(num_in);
if (n > 32 || n == 0) {
mp_raise_ValueError(NULL);
if (n > 32 || n < 0) {
mp_raise_ValueError(MP_ERROR_TEXT("bits must be 32 or less"));
}
if (n == 0) {
return MP_OBJ_NEW_SMALL_INT(0);
}
uint32_t mask = ~0;
// Beware of C undefined behavior when shifting by >= than bit size

View File

@ -20,10 +20,6 @@
// Flags for poll()
#define FLAG_ONESHOT (1)
/// \module select - Provides select function to wait for events on a stream
///
/// This module provides the select function.
typedef struct _poll_obj_t {
mp_obj_t obj;
mp_uint_t (*ioctl)(mp_obj_t obj, mp_uint_t request, uintptr_t arg, int *errcode);
@ -91,7 +87,7 @@ STATIC mp_uint_t poll_map_poll(mp_map_t *poll_map, size_t *rwx_num) {
return n_ready;
}
/// \function select(rlist, wlist, xlist[, timeout])
// select(rlist, wlist, xlist[, timeout])
STATIC mp_obj_t select_select(size_t n_args, const mp_obj_t *args) {
// get array data from tuple/list arguments
size_t rwx_len[3];
@ -158,8 +154,6 @@ STATIC mp_obj_t select_select(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_select_select_obj, 3, 4, select_select);
/// \class Poll - poll class
typedef struct _mp_obj_poll_t {
mp_obj_base_t base;
mp_map_t poll_map;
@ -170,7 +164,7 @@ typedef struct _mp_obj_poll_t {
mp_obj_t ret_tuple;
} mp_obj_poll_t;
/// \method register(obj[, eventmask])
// register(obj[, eventmask])
STATIC mp_obj_t poll_register(size_t n_args, const mp_obj_t *args) {
mp_obj_poll_t *self = MP_OBJ_TO_PTR(args[0]);
mp_uint_t flags;
@ -184,7 +178,7 @@ STATIC mp_obj_t poll_register(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(poll_register_obj, 2, 3, poll_register);
/// \method unregister(obj)
// unregister(obj)
STATIC mp_obj_t poll_unregister(mp_obj_t self_in, mp_obj_t obj_in) {
mp_obj_poll_t *self = MP_OBJ_TO_PTR(self_in);
mp_map_lookup(&self->poll_map, mp_obj_id(obj_in), MP_MAP_LOOKUP_REMOVE_IF_FOUND);
@ -193,7 +187,7 @@ STATIC mp_obj_t poll_unregister(mp_obj_t self_in, mp_obj_t obj_in) {
}
MP_DEFINE_CONST_FUN_OBJ_2(poll_unregister_obj, poll_unregister);
/// \method modify(obj, eventmask)
// modify(obj, eventmask)
STATIC mp_obj_t poll_modify(mp_obj_t self_in, mp_obj_t obj_in, mp_obj_t eventmask_in) {
mp_obj_poll_t *self = MP_OBJ_TO_PTR(self_in);
mp_map_elem_t *elem = mp_map_lookup(&self->poll_map, mp_obj_id(obj_in), MP_MAP_LOOKUP);
@ -328,7 +322,7 @@ STATIC const mp_obj_type_t mp_type_poll = {
.locals_dict = (void *)&poll_locals_dict,
};
/// \function poll()
// poll()
STATIC mp_obj_t select_poll(void) {
mp_obj_poll_t *poll = m_new_obj(mp_obj_poll_t);
poll->base.type = &mp_type_poll;

View File

@ -175,6 +175,10 @@ def run_until_complete(main_task=None):
if not exc:
t.coro.send(None)
else:
# If the task is finished and on the run queue and gets here, then it
# had an exception and was not await'ed on. Throwing into it now will
# raise StopIteration and the code below will catch this and run the
# call_exception_handler function.
t.data = None
t.coro.throw(exc)
except excs_all as er:
@ -185,22 +189,32 @@ def run_until_complete(main_task=None):
if isinstance(er, StopIteration):
return er.value
raise er
# Schedule any other tasks waiting on the completion of this task
waiting = False
if hasattr(t, "waiting"):
while t.waiting.peek():
_task_queue.push_head(t.waiting.pop_head())
waiting = True
t.waiting = None # Free waiting queue head
if not waiting and not isinstance(er, excs_stop):
# An exception ended this detached task, so queue it for later
# execution to handle the uncaught exception if no other task retrieves
# the exception in the meantime (this is handled by Task.throw).
_task_queue.push_head(t)
# Indicate task is done by setting coro to the task object itself
t.coro = t
# Save return value of coro to pass up to caller
t.data = er
if t.state:
# Task was running but is now finished.
waiting = False
if t.state is True:
# "None" indicates that the task is complete and not await'ed on (yet).
t.state = None
else:
# Schedule any other tasks waiting on the completion of this task.
while t.state.peek():
_task_queue.push_head(t.state.pop_head())
waiting = True
# "False" indicates that the task is complete and has been await'ed on.
t.state = False
if not waiting and not isinstance(er, excs_stop):
# An exception ended this detached task, so queue it for later
# execution to handle the uncaught exception if no other task retrieves
# the exception in the meantime (this is handled by Task.throw).
_task_queue.push_head(t)
# Save return value of coro to pass up to caller.
t.data = er
elif t.state is None:
# Task is already finished and nothing await'ed on the task,
# so call the exception handler.
_exc_context["exception"] = exc
_exc_context["future"] = t
Loop.call_exception_handler(_exc_context)
# Create a new task from a coroutine and run it until it finishes

View File

@ -30,6 +30,10 @@ class Stream:
yield core._io_queue.queue_read(self.s)
return self.s.read(n)
async def readinto(self, buf):
yield core._io_queue.queue_read(self.s)
return self.s.readinto(buf)
async def readexactly(self, n):
r = b""
while n:
@ -82,7 +86,7 @@ async def open_connection(host, port):
try:
s.connect(ai[-1])
except OSError as er:
if er.args[0] != EINPROGRESS:
if er.errno != EINPROGRESS:
raise er
yield core._io_queue.queue_write(s)
return ss, ss
@ -112,7 +116,6 @@ class Server:
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind(ai[-1])
s.listen(backlog)
self.task = core.cur_task
# Accept incoming connections
while True:
try:
@ -135,7 +138,7 @@ class Server:
# TODO could use an accept-callback on socket read activity instead of creating a task
async def start_server(cb, host, port, backlog=5):
s = Server()
core.create_task(s._serve(cb, host, port, backlog))
s.task = core.create_task(s._serve(cb, host, port, backlog))
return s

View File

@ -123,6 +123,7 @@ class Task:
def __init__(self, coro, globals=None):
self.coro = coro # Coroutine of this Task
self.data = None # General data for queue it is waiting on
self.state = True # None, False, True or a TaskQueue instance
self.ph_key = 0 # Pairing heap
self.ph_child = None # Paring heap
self.ph_child_last = None # Paring heap
@ -130,30 +131,30 @@ class Task:
self.ph_rightmost_parent = None # Paring heap
def __iter__(self):
if self.coro is self:
# Signal that the completed-task has been await'ed on.
self.waiting = None
elif not hasattr(self, "waiting"):
# Lazily allocated head of linked list of Tasks waiting on completion of this task.
self.waiting = TaskQueue()
if not self.state:
# Task finished, signal that is has been await'ed on.
self.state = False
elif self.state is True:
# Allocated head of linked list of Tasks waiting on completion of this task.
self.state = TaskQueue()
return self
def __next__(self):
if self.coro is self:
if not self.state:
# Task finished, raise return value to caller so it can continue.
raise self.data
else:
# Put calling task on waiting queue.
self.waiting.push_head(core.cur_task)
self.state.push_head(core.cur_task)
# Set calling task's data to this task that it waits on, to double-link it.
core.cur_task.data = self
def done(self):
return self.coro is self
return not self.state
def cancel(self):
# Check if task is already finished.
if self.coro is self:
if not self.state:
return False
# Can't cancel self (not supported yet).
if self is core.cur_task:
@ -172,13 +173,3 @@ class Task:
core._task_queue.push_head(self)
self.data = core.CancelledError
return True
def throw(self, value):
# This task raised an exception which was uncaught; handle that now.
# Set the data because it was cleared by the main scheduling loop.
self.data = value
if not hasattr(self, "waiting"):
# Nothing await'ed on the task so call the exception handler.
core._exc_context["exception"] = value
core._exc_context["future"] = self
core.Loop.call_exception_handler(core._exc_context)

View File

@ -264,7 +264,7 @@ STATIC mp_obj_t fat_vfs_mkdir(mp_obj_t vfs_in, mp_obj_t path_o) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_mkdir_obj, fat_vfs_mkdir);
/// Change current directory.
// Change current directory.
STATIC mp_obj_t fat_vfs_chdir(mp_obj_t vfs_in, mp_obj_t path_in) {
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(vfs_in);
const char *path;
@ -280,7 +280,7 @@ STATIC mp_obj_t fat_vfs_chdir(mp_obj_t vfs_in, mp_obj_t path_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_chdir_obj, fat_vfs_chdir);
/// Get the current directory.
// Get the current directory.
STATIC mp_obj_t fat_vfs_getcwd(mp_obj_t vfs_in) {
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(vfs_in);
char buf[MICROPY_ALLOC_PATH_MAX + 1];
@ -292,8 +292,7 @@ STATIC mp_obj_t fat_vfs_getcwd(mp_obj_t vfs_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_getcwd_obj, fat_vfs_getcwd);
/// \function stat(path)
/// Get the status of a file or directory.
// Get the status of a file or directory.
STATIC mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) {
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(vfs_in);
const char *path = mp_obj_str_get_str(path_in);

@ -1 +1 @@
Subproject commit 40d8a03b4569d566faa62fcb0f798178118f2954
Subproject commit b014aa045d9014b86a4ae583f452c6b8282a61b9

View File

@ -622,8 +622,8 @@ friendly_repl_reset:
// If the GC is locked at this point there is no way out except a reset,
// so force the GC to be unlocked to help the user debug what went wrong.
if (MP_STATE_MEM(gc_lock_depth) != 0) {
MP_STATE_MEM(gc_lock_depth) = 0;
if (MP_STATE_THREAD(gc_lock_depth) != 0) {
MP_STATE_THREAD(gc_lock_depth) = 0;
}
vstr_reset(&line);

View File

@ -47,9 +47,8 @@ extern pyexec_mode_kind_t pyexec_mode_kind;
extern int pyexec_system_exit;
#define PYEXEC_FORCED_EXIT (0x100)
#define PYEXEC_SWITCH_MODE (0x200)
#define PYEXEC_EXCEPTION (0x400)
#define PYEXEC_DEEP_SLEEP (0x800)
#define PYEXEC_EXCEPTION (0x200)
#define PYEXEC_DEEP_SLEEP (0x400)
int pyexec_raw_repl(void);
int pyexec_friendly_repl(void);

132
lib/utils/semihosting.c Normal file
View File

@ -0,0 +1,132 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2018 Ayke van Laethem
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "semihosting.h"
// Resources:
// http://embed.rs/articles/2016/semi-hosting-rust/
// https://wiki.dlang.org/Minimal_semihosted_ARM_Cortex-M_%22Hello_World%22
// https://github.com/arduino/OpenOCD/blob/master/src/target/arm_semihosting.c
#define SYS_OPEN 0x01
#define SYS_WRITEC 0x03
#define SYS_WRITE 0x05
#define SYS_READC 0x07
// Constants:
#define OPEN_MODE_READ (0) // mode "r"
#define OPEN_MODE_WRITE (4) // mode "w"
#ifndef __thumb__
#error Semihosting is only implemented for ARM microcontrollers.
#endif
static int mp_semihosting_stdout;
static uint32_t mp_semihosting_call(uint32_t num, const void *arg) {
// A semihosting call works as follows, similar to a SVCall:
// * the call is invoked by a special breakpoint: 0xAB
// * the command is placed in r0
// * a pointer to the arguments is placed in r1
// * the return value is placed in r0
// Note that because it uses the breakpoint instruction, applications
// will hang if they're not connected to a debugger. And they'll be
// stuck in a breakpoint if semihosting is not specifically enabled in
// the debugger.
// Also note that semihosting is extremely slow (sometimes >100ms per
// call).
register uint32_t num_reg __asm__ ("r0") = num;
register const void *args_reg __asm__ ("r1") = arg;
__asm__ __volatile__ (
"bkpt 0xAB\n" // invoke semihosting call
: "+r" (num_reg) // call number and result
: "r" (args_reg) // arguments
: "memory"); // make sure args aren't optimized away
return num_reg; // r0, which became the result
}
static int mp_semihosting_open_console(uint32_t mode) {
struct {
char *name;
uint32_t mode;
uint32_t name_len;
} args = {
.name = ":tt", // magic path to console
.mode = mode, // e.g. "r", "w" (see OPEN_MODE_* constants)
.name_len = 3, // strlen(":tt")
};
return mp_semihosting_call(SYS_OPEN, &args);
}
void mp_semihosting_init() {
mp_semihosting_stdout = mp_semihosting_open_console(OPEN_MODE_WRITE);
}
int mp_semihosting_rx_char() {
return mp_semihosting_call(SYS_READC, NULL);
}
static void mp_semihosting_tx_char(char c) {
mp_semihosting_call(SYS_WRITEC, &c);
}
uint32_t mp_semihosting_tx_strn(const char *str, size_t len) {
if (len == 0) {
return 0; // nothing to do
}
if (len == 1) {
mp_semihosting_tx_char(*str); // maybe faster?
return 0;
}
struct {
uint32_t fd;
const char *str;
uint32_t len;
} args = {
.fd = mp_semihosting_stdout,
.str = str,
.len = len,
};
return mp_semihosting_call(SYS_WRITE, &args);
}
uint32_t mp_semihosting_tx_strn_cooked(const char *str, size_t len) {
// Write chunks of data until (excluding) the first '\n' character,
// insert a '\r' character, and then continue with the next chunk
// (starting with '\n').
// Doing byte-by-byte writes would be easier to implement but is far
// too slow.
size_t start = 0;
for (size_t i = 0; i < len; i++) {
if (str[i] == '\n') {
mp_semihosting_tx_strn(str + start, i - start);
mp_semihosting_tx_char('\r');
start = i;
}
}
return mp_semihosting_tx_strn(str + start, len - start);
}

View File

@ -54,6 +54,10 @@ msgstr " File \"%q\", baris %d"
msgid " is of type %q\n"
msgstr ""
#: main.c
msgid " not found.\n"
msgstr ""
#: main.c
msgid " output:\n"
msgstr "output:\n"
@ -90,10 +94,22 @@ msgstr "%q indeks di luar batas"
msgid "%q indices must be integers, not %s"
msgstr "indeks %q harus bilangan bulat, bukan %s"
#: py/argcheck.c
msgid "%q length must be %q"
msgstr ""
#: shared-bindings/vectorio/Polygon.c
msgid "%q list must be a list"
msgstr "daftar %q harus berupa daftar"
#: py/argcheck.c
msgid "%q must <= %d"
msgstr ""
#: py/argcheck.c
msgid "%q must be %d-%d"
msgstr ""
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
@ -102,7 +118,11 @@ msgstr ""
msgid "%q must be 1-255"
msgstr ""
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: py/argcheck.c
msgid "%q must be >= %d"
msgstr ""
#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr "%q harus >= 0"
@ -118,6 +138,10 @@ msgstr "%q harus >= 1"
msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr ""
#: py/argcheck.c
msgid "%q must be a string"
msgstr ""
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr "%q harus berupa tuple dengan panjang 2"
@ -126,6 +150,10 @@ msgstr "%q harus berupa tuple dengan panjang 2"
msgid "%q must be between %d and %d"
msgstr ""
#: py/argcheck.c
msgid "%q must of type %q"
msgstr ""
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#: shared-bindings/canio/Match.c
msgid "%q out of range"
@ -575,10 +603,6 @@ msgstr ""
msgid "Buffer must be at least length 1"
msgstr "Penyangga harus memiliki panjang setidaknya 1"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Buffer too large and unable to allocate"
msgstr "Buffer terlalu besar dan tidak dapat dialokasikan"
#: shared-bindings/_bleio/PacketBuffer.c
#, c-format
msgid "Buffer too short by %d bytes"
@ -862,6 +886,10 @@ msgstr ""
msgid "Data chunk must follow fmt chunk"
msgstr "Potongan data harus mengikuti fmt chunk"
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data not supported with directed advertising"
msgstr ""
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data too large for advertisement packet"
msgstr "Data terlalu besar untuk paket advertisment"
@ -1658,7 +1686,6 @@ msgstr ""
msgid "Not a valid IP string"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1704,6 +1731,10 @@ msgstr ""
"Hanya format Windows, mendukung BMP tidak dikompresi: ukuran header yang "
"diberikan adalah %d"
#: shared-bindings/_bleio/Adapter.c
msgid "Only connectable advertisements can be directed"
msgstr ""
#: ports/stm/common-hal/alarm/pin/PinAlarm.c
msgid "Only edge detection is available on this hardware"
msgstr ""
@ -1727,6 +1758,7 @@ msgstr ""
#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c
#: ports/nrf/common-hal/alarm/time/TimeAlarm.c
#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c
#: ports/stm/common-hal/alarm/time/TimeAlarm.c
msgid "Only one alarm.time alarm can be set."
msgstr ""
@ -2031,6 +2063,10 @@ msgstr "Kesalahan Init SPI"
msgid "SPI Re-initialization error"
msgstr "Kesalahan Inisialisasi ulang SPI"
#: ports/esp32s2/common-hal/busio/SPI.c
msgid "SPI configuration failed"
msgstr ""
#: ports/raspberrypi/common-hal/busio/SPI.c
msgid "SPI peripheral in use"
msgstr ""
@ -2069,6 +2105,7 @@ msgstr ""
msgid "Size not supported"
msgstr ""
#: ports/raspberrypi/common-hal/alarm/SleepMemory.c
#: ports/stm/common-hal/alarm/SleepMemory.c
msgid "Sleep Memory not available"
msgstr ""
@ -2213,6 +2250,7 @@ msgstr "Terlalu banyak tampilan"
msgid "Total data to write is larger than %q"
msgstr ""
#: ports/raspberrypi/common-hal/alarm/touch/TouchAlarm.c
#: ports/stm/common-hal/alarm/touch/TouchAlarm.c
msgid "Touch alarms not available"
msgstr ""
@ -2514,7 +2552,7 @@ msgstr "Argumen argsort harus berupa ndarray"
msgid "argsort is not implemented for flattened arrays"
msgstr ""
#: py/runtime.c
#: py/runtime.c shared-bindings/supervisor/__init__.c
msgid "argument has wrong type"
msgstr "argumen memiliki tipe yang salah"
@ -2589,6 +2627,10 @@ msgstr "typecode buruk"
msgid "binary op %q not implemented"
msgstr ""
#: extmod/modurandom.c
msgid "bits must be 32 or less"
msgstr ""
#: shared-bindings/busio/UART.c
msgid "bits must be in range 5 to 9"
msgstr ""
@ -3200,6 +3242,10 @@ msgstr ""
msgid "graphic must be 2048 bytes long"
msgstr ""
#: extmod/moduhashlib.c
msgid "hash is final"
msgstr ""
#: extmod/moduheapq.c
msgid "heap must be a list"
msgstr "heap harus berupa sebuah list"
@ -4412,6 +4458,9 @@ msgstr "zi harus berjenis float"
msgid "zi must be of shape (n_section, 2)"
msgstr ""
#~ msgid "Buffer too large and unable to allocate"
#~ msgstr "Buffer terlalu besar dan tidak dapat dialokasikan"
#~ msgid ""
#~ "CircuitPython is in safe mode because you pressed the reset button during "
#~ "boot. Press again to exit safe mode.\n"

View File

@ -47,6 +47,10 @@ msgstr ""
msgid " is of type %q\n"
msgstr ""
#: main.c
msgid " not found.\n"
msgstr ""
#: main.c
msgid " output:\n"
msgstr ""
@ -83,10 +87,22 @@ msgstr ""
msgid "%q indices must be integers, not %s"
msgstr ""
#: py/argcheck.c
msgid "%q length must be %q"
msgstr ""
#: shared-bindings/vectorio/Polygon.c
msgid "%q list must be a list"
msgstr ""
#: py/argcheck.c
msgid "%q must <= %d"
msgstr ""
#: py/argcheck.c
msgid "%q must be %d-%d"
msgstr ""
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
@ -95,7 +111,11 @@ msgstr ""
msgid "%q must be 1-255"
msgstr ""
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: py/argcheck.c
msgid "%q must be >= %d"
msgstr ""
#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr ""
@ -111,6 +131,10 @@ msgstr ""
msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr ""
#: py/argcheck.c
msgid "%q must be a string"
msgstr ""
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr ""
@ -119,6 +143,10 @@ msgstr ""
msgid "%q must be between %d and %d"
msgstr ""
#: py/argcheck.c
msgid "%q must of type %q"
msgstr ""
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#: shared-bindings/canio/Match.c
msgid "%q out of range"
@ -566,10 +594,6 @@ msgstr ""
msgid "Buffer must be at least length 1"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Buffer too large and unable to allocate"
msgstr ""
#: shared-bindings/_bleio/PacketBuffer.c
#, c-format
msgid "Buffer too short by %d bytes"
@ -844,6 +868,10 @@ msgstr ""
msgid "Data chunk must follow fmt chunk"
msgstr ""
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data not supported with directed advertising"
msgstr ""
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data too large for advertisement packet"
msgstr ""
@ -1638,7 +1666,6 @@ msgstr ""
msgid "Not a valid IP string"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1681,6 +1708,10 @@ msgid ""
"Only Windows format, uncompressed BMP supported: given header size is %d"
msgstr ""
#: shared-bindings/_bleio/Adapter.c
msgid "Only connectable advertisements can be directed"
msgstr ""
#: ports/stm/common-hal/alarm/pin/PinAlarm.c
msgid "Only edge detection is available on this hardware"
msgstr ""
@ -1702,6 +1733,7 @@ msgstr ""
#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c
#: ports/nrf/common-hal/alarm/time/TimeAlarm.c
#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c
#: ports/stm/common-hal/alarm/time/TimeAlarm.c
msgid "Only one alarm.time alarm can be set."
msgstr ""
@ -1997,6 +2029,10 @@ msgstr ""
msgid "SPI Re-initialization error"
msgstr ""
#: ports/esp32s2/common-hal/busio/SPI.c
msgid "SPI configuration failed"
msgstr ""
#: ports/raspberrypi/common-hal/busio/SPI.c
msgid "SPI peripheral in use"
msgstr ""
@ -2035,6 +2071,7 @@ msgstr ""
msgid "Size not supported"
msgstr ""
#: ports/raspberrypi/common-hal/alarm/SleepMemory.c
#: ports/stm/common-hal/alarm/SleepMemory.c
msgid "Sleep Memory not available"
msgstr ""
@ -2179,6 +2216,7 @@ msgstr ""
msgid "Total data to write is larger than %q"
msgstr ""
#: ports/raspberrypi/common-hal/alarm/touch/TouchAlarm.c
#: ports/stm/common-hal/alarm/touch/TouchAlarm.c
msgid "Touch alarms not available"
msgstr ""
@ -2472,7 +2510,7 @@ msgstr ""
msgid "argsort is not implemented for flattened arrays"
msgstr ""
#: py/runtime.c
#: py/runtime.c shared-bindings/supervisor/__init__.c
msgid "argument has wrong type"
msgstr ""
@ -2547,6 +2585,10 @@ msgstr ""
msgid "binary op %q not implemented"
msgstr ""
#: extmod/modurandom.c
msgid "bits must be 32 or less"
msgstr ""
#: shared-bindings/busio/UART.c
msgid "bits must be in range 5 to 9"
msgstr ""
@ -3158,6 +3200,10 @@ msgstr ""
msgid "graphic must be 2048 bytes long"
msgstr ""
#: extmod/moduhashlib.c
msgid "hash is final"
msgstr ""
#: extmod/moduheapq.c
msgid "heap must be a list"
msgstr ""

View File

@ -50,6 +50,10 @@ msgstr " Soubor \"%q\", řádek %d"
msgid " is of type %q\n"
msgstr ""
#: main.c
msgid " not found.\n"
msgstr ""
#: main.c
msgid " output:\n"
msgstr " výstup:\n"
@ -86,10 +90,22 @@ msgstr "Index %q je mimo rozsah"
msgid "%q indices must be integers, not %s"
msgstr "Indexy %q musí být celá čísla, nikoli %s"
#: py/argcheck.c
msgid "%q length must be %q"
msgstr ""
#: shared-bindings/vectorio/Polygon.c
msgid "%q list must be a list"
msgstr "Seznam %q musí být seznam"
#: py/argcheck.c
msgid "%q must <= %d"
msgstr ""
#: py/argcheck.c
msgid "%q must be %d-%d"
msgstr ""
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
@ -98,7 +114,11 @@ msgstr ""
msgid "%q must be 1-255"
msgstr ""
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: py/argcheck.c
msgid "%q must be >= %d"
msgstr ""
#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr "%q musí být >= 0"
@ -114,6 +134,10 @@ msgstr "%q musí být > = 1"
msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr ""
#: py/argcheck.c
msgid "%q must be a string"
msgstr ""
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr "%q musí být n-tice délky 2"
@ -122,6 +146,10 @@ msgstr "%q musí být n-tice délky 2"
msgid "%q must be between %d and %d"
msgstr ""
#: py/argcheck.c
msgid "%q must of type %q"
msgstr ""
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#: shared-bindings/canio/Match.c
msgid "%q out of range"
@ -569,10 +597,6 @@ msgstr ""
msgid "Buffer must be at least length 1"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Buffer too large and unable to allocate"
msgstr ""
#: shared-bindings/_bleio/PacketBuffer.c
#, c-format
msgid "Buffer too short by %d bytes"
@ -847,6 +871,10 @@ msgstr ""
msgid "Data chunk must follow fmt chunk"
msgstr ""
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data not supported with directed advertising"
msgstr ""
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data too large for advertisement packet"
msgstr ""
@ -1641,7 +1669,6 @@ msgstr ""
msgid "Not a valid IP string"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1684,6 +1711,10 @@ msgid ""
"Only Windows format, uncompressed BMP supported: given header size is %d"
msgstr ""
#: shared-bindings/_bleio/Adapter.c
msgid "Only connectable advertisements can be directed"
msgstr ""
#: ports/stm/common-hal/alarm/pin/PinAlarm.c
msgid "Only edge detection is available on this hardware"
msgstr ""
@ -1705,6 +1736,7 @@ msgstr ""
#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c
#: ports/nrf/common-hal/alarm/time/TimeAlarm.c
#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c
#: ports/stm/common-hal/alarm/time/TimeAlarm.c
msgid "Only one alarm.time alarm can be set."
msgstr ""
@ -2000,6 +2032,10 @@ msgstr ""
msgid "SPI Re-initialization error"
msgstr ""
#: ports/esp32s2/common-hal/busio/SPI.c
msgid "SPI configuration failed"
msgstr ""
#: ports/raspberrypi/common-hal/busio/SPI.c
msgid "SPI peripheral in use"
msgstr ""
@ -2038,6 +2074,7 @@ msgstr ""
msgid "Size not supported"
msgstr ""
#: ports/raspberrypi/common-hal/alarm/SleepMemory.c
#: ports/stm/common-hal/alarm/SleepMemory.c
msgid "Sleep Memory not available"
msgstr ""
@ -2182,6 +2219,7 @@ msgstr ""
msgid "Total data to write is larger than %q"
msgstr ""
#: ports/raspberrypi/common-hal/alarm/touch/TouchAlarm.c
#: ports/stm/common-hal/alarm/touch/TouchAlarm.c
msgid "Touch alarms not available"
msgstr ""
@ -2475,7 +2513,7 @@ msgstr ""
msgid "argsort is not implemented for flattened arrays"
msgstr ""
#: py/runtime.c
#: py/runtime.c shared-bindings/supervisor/__init__.c
msgid "argument has wrong type"
msgstr ""
@ -2550,6 +2588,10 @@ msgstr ""
msgid "binary op %q not implemented"
msgstr ""
#: extmod/modurandom.c
msgid "bits must be 32 or less"
msgstr ""
#: shared-bindings/busio/UART.c
msgid "bits must be in range 5 to 9"
msgstr ""
@ -3161,6 +3203,10 @@ msgstr ""
msgid "graphic must be 2048 bytes long"
msgstr ""
#: extmod/moduhashlib.c
msgid "hash is final"
msgstr ""
#: extmod/moduheapq.c
msgid "heap must be a list"
msgstr ""

View File

@ -53,6 +53,10 @@ msgstr " Datei \"%q\", Zeile %d"
msgid " is of type %q\n"
msgstr " ist vom Type %q\n"
#: main.c
msgid " not found.\n"
msgstr ""
#: main.c
msgid " output:\n"
msgstr " Ausgabe:\n"
@ -91,10 +95,22 @@ msgstr "Der Index %q befindet sich außerhalb des Bereiches"
msgid "%q indices must be integers, not %s"
msgstr "%q Indizes müssen Integer sein, nicht %s"
#: py/argcheck.c
msgid "%q length must be %q"
msgstr ""
#: shared-bindings/vectorio/Polygon.c
msgid "%q list must be a list"
msgstr "%q Liste muss eine Liste sein"
#: py/argcheck.c
msgid "%q must <= %d"
msgstr ""
#: py/argcheck.c
msgid "%q must be %d-%d"
msgstr ""
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr "%q muss 0-255 sein"
@ -103,7 +119,11 @@ msgstr "%q muss 0-255 sein"
msgid "%q must be 1-255"
msgstr "%q muss 1-255 sein"
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: py/argcheck.c
msgid "%q must be >= %d"
msgstr ""
#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr "%q muss >= 0 sein"
@ -119,6 +139,10 @@ msgstr "%q muss >= 1 sein"
msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr "%q muss None oder zwischen 1 und len(report_descriptor)-1 sein"
#: py/argcheck.c
msgid "%q must be a string"
msgstr ""
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr "%q muss ein Tupel der Länge 2 sein"
@ -127,6 +151,10 @@ msgstr "%q muss ein Tupel der Länge 2 sein"
msgid "%q must be between %d and %d"
msgstr ""
#: py/argcheck.c
msgid "%q must of type %q"
msgstr ""
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#: shared-bindings/canio/Match.c
msgid "%q out of range"
@ -577,10 +605,6 @@ msgstr "Der Puffer muss ein vielfaches von 512 bytes sein"
msgid "Buffer must be at least length 1"
msgstr "Der Puffer muss eine Mindestenslänge von 1 haben"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Buffer too large and unable to allocate"
msgstr "Puffer zu groß und kann nicht reserviert werden"
#: shared-bindings/_bleio/PacketBuffer.c
#, c-format
msgid "Buffer too short by %d bytes"
@ -859,6 +883,10 @@ msgstr "Data 0 Pin muss Byte aligned sein."
msgid "Data chunk must follow fmt chunk"
msgstr "Dem fmt Block muss ein Datenblock folgen"
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data not supported with directed advertising"
msgstr ""
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data too large for advertisement packet"
msgstr "Zu vielen Daten für das advertisement packet"
@ -1659,7 +1687,6 @@ msgstr ""
msgid "Not a valid IP string"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1706,6 +1733,10 @@ msgstr ""
"Nur Windows-Format, unkomprimiertes BMP unterstützt: die gegebene Header-"
"Größe ist %d"
#: shared-bindings/_bleio/Adapter.c
msgid "Only connectable advertisements can be directed"
msgstr ""
#: ports/stm/common-hal/alarm/pin/PinAlarm.c
msgid "Only edge detection is available on this hardware"
msgstr ""
@ -1729,6 +1760,7 @@ msgstr ""
#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c
#: ports/nrf/common-hal/alarm/time/TimeAlarm.c
#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c
#: ports/stm/common-hal/alarm/time/TimeAlarm.c
msgid "Only one alarm.time alarm can be set."
msgstr ""
@ -2029,6 +2061,10 @@ msgstr "SPI-Init-Fehler"
msgid "SPI Re-initialization error"
msgstr "SPI-Neuinitialisierungsfehler"
#: ports/esp32s2/common-hal/busio/SPI.c
msgid "SPI configuration failed"
msgstr ""
#: ports/raspberrypi/common-hal/busio/SPI.c
msgid "SPI peripheral in use"
msgstr ""
@ -2067,6 +2103,7 @@ msgstr ""
msgid "Size not supported"
msgstr ""
#: ports/raspberrypi/common-hal/alarm/SleepMemory.c
#: ports/stm/common-hal/alarm/SleepMemory.c
msgid "Sleep Memory not available"
msgstr ""
@ -2214,6 +2251,7 @@ msgstr "Zu viele displays"
msgid "Total data to write is larger than %q"
msgstr ""
#: ports/raspberrypi/common-hal/alarm/touch/TouchAlarm.c
#: ports/stm/common-hal/alarm/touch/TouchAlarm.c
msgid "Touch alarms not available"
msgstr ""
@ -2520,7 +2558,7 @@ msgstr "Das Argument argsort muss ein ndarray sein"
msgid "argsort is not implemented for flattened arrays"
msgstr ""
#: py/runtime.c
#: py/runtime.c shared-bindings/supervisor/__init__.c
msgid "argument has wrong type"
msgstr "Argument hat falschen Typ"
@ -2595,6 +2633,10 @@ msgstr "Falscher Typcode"
msgid "binary op %q not implemented"
msgstr "Der binäre Operator %q ist nicht implementiert"
#: extmod/modurandom.c
msgid "bits must be 32 or less"
msgstr ""
#: shared-bindings/busio/UART.c
msgid "bits must be in range 5 to 9"
msgstr ""
@ -3220,6 +3262,10 @@ msgstr ""
msgid "graphic must be 2048 bytes long"
msgstr "graphic muss 2048 Byte lang sein"
#: extmod/moduhashlib.c
msgid "hash is final"
msgstr ""
#: extmod/moduheapq.c
msgid "heap must be a list"
msgstr "heap muss eine Liste sein"
@ -4448,6 +4494,9 @@ msgstr ""
msgid "zi must be of shape (n_section, 2)"
msgstr ""
#~ msgid "Buffer too large and unable to allocate"
#~ msgstr "Puffer zu groß und kann nicht reserviert werden"
#~ msgid "wrong operand type"
#~ msgstr "falscher Operandentyp"

View File

@ -47,6 +47,10 @@ msgstr ""
msgid " is of type %q\n"
msgstr ""
#: main.c
msgid " not found.\n"
msgstr ""
#: main.c
msgid " output:\n"
msgstr ""
@ -83,10 +87,22 @@ msgstr ""
msgid "%q indices must be integers, not %s"
msgstr ""
#: py/argcheck.c
msgid "%q length must be %q"
msgstr ""
#: shared-bindings/vectorio/Polygon.c
msgid "%q list must be a list"
msgstr ""
#: py/argcheck.c
msgid "%q must <= %d"
msgstr ""
#: py/argcheck.c
msgid "%q must be %d-%d"
msgstr ""
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
@ -95,7 +111,11 @@ msgstr ""
msgid "%q must be 1-255"
msgstr ""
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: py/argcheck.c
msgid "%q must be >= %d"
msgstr ""
#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr ""
@ -111,6 +131,10 @@ msgstr ""
msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr ""
#: py/argcheck.c
msgid "%q must be a string"
msgstr ""
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr ""
@ -119,6 +143,10 @@ msgstr ""
msgid "%q must be between %d and %d"
msgstr ""
#: py/argcheck.c
msgid "%q must of type %q"
msgstr ""
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#: shared-bindings/canio/Match.c
msgid "%q out of range"
@ -566,10 +594,6 @@ msgstr ""
msgid "Buffer must be at least length 1"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Buffer too large and unable to allocate"
msgstr ""
#: shared-bindings/_bleio/PacketBuffer.c
#, c-format
msgid "Buffer too short by %d bytes"
@ -844,6 +868,10 @@ msgstr ""
msgid "Data chunk must follow fmt chunk"
msgstr ""
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data not supported with directed advertising"
msgstr ""
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data too large for advertisement packet"
msgstr ""
@ -1638,7 +1666,6 @@ msgstr ""
msgid "Not a valid IP string"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1681,6 +1708,10 @@ msgid ""
"Only Windows format, uncompressed BMP supported: given header size is %d"
msgstr ""
#: shared-bindings/_bleio/Adapter.c
msgid "Only connectable advertisements can be directed"
msgstr ""
#: ports/stm/common-hal/alarm/pin/PinAlarm.c
msgid "Only edge detection is available on this hardware"
msgstr ""
@ -1702,6 +1733,7 @@ msgstr ""
#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c
#: ports/nrf/common-hal/alarm/time/TimeAlarm.c
#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c
#: ports/stm/common-hal/alarm/time/TimeAlarm.c
msgid "Only one alarm.time alarm can be set."
msgstr ""
@ -1997,6 +2029,10 @@ msgstr ""
msgid "SPI Re-initialization error"
msgstr ""
#: ports/esp32s2/common-hal/busio/SPI.c
msgid "SPI configuration failed"
msgstr ""
#: ports/raspberrypi/common-hal/busio/SPI.c
msgid "SPI peripheral in use"
msgstr ""
@ -2035,6 +2071,7 @@ msgstr ""
msgid "Size not supported"
msgstr ""
#: ports/raspberrypi/common-hal/alarm/SleepMemory.c
#: ports/stm/common-hal/alarm/SleepMemory.c
msgid "Sleep Memory not available"
msgstr ""
@ -2179,6 +2216,7 @@ msgstr ""
msgid "Total data to write is larger than %q"
msgstr ""
#: ports/raspberrypi/common-hal/alarm/touch/TouchAlarm.c
#: ports/stm/common-hal/alarm/touch/TouchAlarm.c
msgid "Touch alarms not available"
msgstr ""
@ -2472,7 +2510,7 @@ msgstr ""
msgid "argsort is not implemented for flattened arrays"
msgstr ""
#: py/runtime.c
#: py/runtime.c shared-bindings/supervisor/__init__.c
msgid "argument has wrong type"
msgstr ""
@ -2547,6 +2585,10 @@ msgstr ""
msgid "binary op %q not implemented"
msgstr ""
#: extmod/modurandom.c
msgid "bits must be 32 or less"
msgstr ""
#: shared-bindings/busio/UART.c
msgid "bits must be in range 5 to 9"
msgstr ""
@ -3158,6 +3200,10 @@ msgstr ""
msgid "graphic must be 2048 bytes long"
msgstr ""
#: extmod/moduhashlib.c
msgid "hash is final"
msgstr ""
#: extmod/moduheapq.c
msgid "heap must be a list"
msgstr ""

View File

@ -55,6 +55,10 @@ msgstr " File \"%q\", line %d"
msgid " is of type %q\n"
msgstr " is of type %q\n"
#: main.c
msgid " not found.\n"
msgstr ""
#: main.c
msgid " output:\n"
msgstr " output:\n"
@ -92,10 +96,22 @@ msgstr "%q index out of range"
msgid "%q indices must be integers, not %s"
msgstr ""
#: py/argcheck.c
msgid "%q length must be %q"
msgstr ""
#: shared-bindings/vectorio/Polygon.c
msgid "%q list must be a list"
msgstr "%q list must be a list"
#: py/argcheck.c
msgid "%q must <= %d"
msgstr ""
#: py/argcheck.c
msgid "%q must be %d-%d"
msgstr ""
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
@ -104,7 +120,11 @@ msgstr ""
msgid "%q must be 1-255"
msgstr ""
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: py/argcheck.c
msgid "%q must be >= %d"
msgstr ""
#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr "%q must be >= 0"
@ -120,6 +140,10 @@ msgstr "%q must be >= 1"
msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr ""
#: py/argcheck.c
msgid "%q must be a string"
msgstr ""
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr "%q must be a tuple of length 2"
@ -128,6 +152,10 @@ msgstr "%q must be a tuple of length 2"
msgid "%q must be between %d and %d"
msgstr ""
#: py/argcheck.c
msgid "%q must of type %q"
msgstr ""
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#: shared-bindings/canio/Match.c
msgid "%q out of range"
@ -577,10 +605,6 @@ msgstr "Buffer must be a multiple of 512 bytes"
msgid "Buffer must be at least length 1"
msgstr "Buffer must be at least length 1"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Buffer too large and unable to allocate"
msgstr "Buffer too large and unable to allocate"
#: shared-bindings/_bleio/PacketBuffer.c
#, c-format
msgid "Buffer too short by %d bytes"
@ -857,6 +881,10 @@ msgstr "Data 0 pin must be byte aligned."
msgid "Data chunk must follow fmt chunk"
msgstr "Data chunk must follow fmt chunk"
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data not supported with directed advertising"
msgstr ""
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data too large for advertisement packet"
msgstr "Data too large for advertisement packet"
@ -1653,7 +1681,6 @@ msgstr ""
msgid "Not a valid IP string"
msgstr "Not a valid IP string"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1698,6 +1725,10 @@ msgid ""
msgstr ""
"Only Windows format, uncompressed BMP supported: given header size is %d"
#: shared-bindings/_bleio/Adapter.c
msgid "Only connectable advertisements can be directed"
msgstr ""
#: ports/stm/common-hal/alarm/pin/PinAlarm.c
msgid "Only edge detection is available on this hardware"
msgstr ""
@ -1721,6 +1752,7 @@ msgstr "Only one TouchAlarm can be set in deep sleep."
#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c
#: ports/nrf/common-hal/alarm/time/TimeAlarm.c
#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c
#: ports/stm/common-hal/alarm/time/TimeAlarm.c
msgid "Only one alarm.time alarm can be set."
msgstr "Only one alarm.time alarm can be set."
@ -2025,6 +2057,10 @@ msgstr "SPI init error"
msgid "SPI Re-initialization error"
msgstr "SPI reinitialisation error"
#: ports/esp32s2/common-hal/busio/SPI.c
msgid "SPI configuration failed"
msgstr ""
#: ports/raspberrypi/common-hal/busio/SPI.c
msgid "SPI peripheral in use"
msgstr "SPI peripheral in use"
@ -2063,6 +2099,7 @@ msgstr "Side set pin count must be between 1 and 5"
msgid "Size not supported"
msgstr "Size not supported"
#: ports/raspberrypi/common-hal/alarm/SleepMemory.c
#: ports/stm/common-hal/alarm/SleepMemory.c
msgid "Sleep Memory not available"
msgstr ""
@ -2207,6 +2244,7 @@ msgstr "Too many displays"
msgid "Total data to write is larger than %q"
msgstr ""
#: ports/raspberrypi/common-hal/alarm/touch/TouchAlarm.c
#: ports/stm/common-hal/alarm/touch/TouchAlarm.c
msgid "Touch alarms not available"
msgstr ""
@ -2507,7 +2545,7 @@ msgstr "argsort argument must be an ndarray"
msgid "argsort is not implemented for flattened arrays"
msgstr "argsort is not implemented for flattened arrays"
#: py/runtime.c
#: py/runtime.c shared-bindings/supervisor/__init__.c
msgid "argument has wrong type"
msgstr "argument has wrong type"
@ -2582,6 +2620,10 @@ msgstr "bad typecode"
msgid "binary op %q not implemented"
msgstr "binary op %q not implemented"
#: extmod/modurandom.c
msgid "bits must be 32 or less"
msgstr ""
#: shared-bindings/busio/UART.c
msgid "bits must be in range 5 to 9"
msgstr "bits must be in range 5 to 9"
@ -3196,6 +3238,10 @@ msgstr ""
msgid "graphic must be 2048 bytes long"
msgstr "graphic must be 2048 bytes long"
#: extmod/moduhashlib.c
msgid "hash is final"
msgstr ""
#: extmod/moduheapq.c
msgid "heap must be a list"
msgstr "heap must be a list"
@ -4410,6 +4456,9 @@ msgstr "zi must be of float type"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi must be of shape (n_section, 2)"
#~ msgid "Buffer too large and unable to allocate"
#~ msgstr "Buffer too large and unable to allocate"
#~ msgid "interp is defined for 1D arrays of equal length"
#~ msgstr "interp is defined for 1D arrays of equal length"

View File

@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
"PO-Revision-Date: 2021-06-13 04:32+0000\n"
"PO-Revision-Date: 2021-06-27 12:33+0000\n"
"Last-Translator: Alvaro Figueroa <alvaro@greencore.co.cr>\n"
"Language-Team: \n"
"Language: es\n"
@ -16,7 +16,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.7-dev\n"
"X-Generator: Weblate 4.7.1-dev\n"
#: main.c
msgid ""
@ -56,6 +56,10 @@ msgstr " Archivo \"%q\", línea %d"
msgid " is of type %q\n"
msgstr " es de tipo %q\n"
#: main.c
msgid " not found.\n"
msgstr " no encontrado.\n"
#: main.c
msgid " output:\n"
msgstr " salida:\n"
@ -94,10 +98,22 @@ msgstr "%q indice fuera de rango"
msgid "%q indices must be integers, not %s"
msgstr "%q indices deben ser enteros, no %s"
#: py/argcheck.c
msgid "%q length must be %q"
msgstr "el tamaño de %q debe ser %q"
#: shared-bindings/vectorio/Polygon.c
msgid "%q list must be a list"
msgstr "%q lista debe ser una lista"
#: py/argcheck.c
msgid "%q must <= %d"
msgstr "%q debe ser <= %d"
#: py/argcheck.c
msgid "%q must be %d-%d"
msgstr "%q debe ser %d-%d"
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr "%q debe ser de 0-255"
@ -106,7 +122,11 @@ msgstr "%q debe ser de 0-255"
msgid "%q must be 1-255"
msgstr "%q debe estar entre 1-255"
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: py/argcheck.c
msgid "%q must be >= %d"
msgstr "%q debe ser >= %d"
#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr "%q debe ser >= 0"
@ -122,13 +142,21 @@ msgstr "%q debe ser >= 1"
msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr "%q debe ser None o entre 1 y len(report_descriptor)-1"
#: py/argcheck.c
msgid "%q must be a string"
msgstr "%q debe ser una cadena"
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr "%q debe ser una tupla de longitud 2"
#: ports/esp32s2/common-hal/imagecapture/ParallelImageCapture.c
msgid "%q must be between %d and %d"
msgstr ""
msgstr "%q debe estar entre %d y %d"
#: py/argcheck.c
msgid "%q must of type %q"
msgstr "%q debe ser de tipo %q"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#: shared-bindings/canio/Match.c
@ -582,10 +610,6 @@ msgstr "Búfer deber ser un múltiplo de 512 bytes"
msgid "Buffer must be at least length 1"
msgstr "Buffer debe ser de longitud 1 como minimo"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Buffer too large and unable to allocate"
msgstr "Buffer demasiado grande e incapaz de asignar"
#: shared-bindings/_bleio/PacketBuffer.c
#, c-format
msgid "Buffer too short by %d bytes"
@ -866,6 +890,10 @@ msgstr "El pin de datos 0 debe ser alineado a byte."
msgid "Data chunk must follow fmt chunk"
msgstr "Trozo de datos debe seguir fmt chunk"
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data not supported with directed advertising"
msgstr "Datos sin capacidad de anuncio dirigido"
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data too large for advertisement packet"
msgstr "Data es muy grande para el paquete de anuncio"
@ -1320,7 +1348,7 @@ msgstr "data_count inválido %d"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "Invalid data_pins[%d]"
msgstr ""
msgstr "Inválidos los data_pins[%d]"
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Invalid direction."
@ -1675,7 +1703,6 @@ msgstr "El firmware del sistema Nordic no tiene memoria"
msgid "Not a valid IP string"
msgstr "No es una cadena de IP válida"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1722,6 +1749,10 @@ msgstr ""
"Solo formato de Windows, sin comprimir BMP soportado: tamaño de encabezado "
"dado es %d"
#: shared-bindings/_bleio/Adapter.c
msgid "Only connectable advertisements can be directed"
msgstr "Solo se puede dirigir a los anuncios conectables"
#: ports/stm/common-hal/alarm/pin/PinAlarm.c
msgid "Only edge detection is available on this hardware"
msgstr "Este hardware solo tiene capacidad para detección de borde"
@ -1745,6 +1776,7 @@ msgstr "Solamente una TouchAlarm puede ser configurada durante deep sleep."
#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c
#: ports/nrf/common-hal/alarm/time/TimeAlarm.c
#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c
#: ports/stm/common-hal/alarm/time/TimeAlarm.c
msgid "Only one alarm.time alarm can be set."
msgstr "Solamente una alarm.time puede ser configurada."
@ -2053,6 +2085,10 @@ msgstr "Error de inicio de SPI"
msgid "SPI Re-initialization error"
msgstr "Error de reinicialización de SPI"
#: ports/esp32s2/common-hal/busio/SPI.c
msgid "SPI configuration failed"
msgstr "Configuración de SPI fallida"
#: ports/raspberrypi/common-hal/busio/SPI.c
msgid "SPI peripheral in use"
msgstr "Periférico SPI en uso"
@ -2091,6 +2127,7 @@ msgstr "El conteo de pines de Side set debe estar entre 1 y 5"
msgid "Size not supported"
msgstr "Sin capacidades para el tamaño"
#: ports/raspberrypi/common-hal/alarm/SleepMemory.c
#: ports/stm/common-hal/alarm/SleepMemory.c
msgid "Sleep Memory not available"
msgstr "Memoria de sueño no disponible"
@ -2245,6 +2282,7 @@ msgstr "Muchos displays"
msgid "Total data to write is larger than %q"
msgstr "La cantidad total de datos es mas grande que %q"
#: ports/raspberrypi/common-hal/alarm/touch/TouchAlarm.c
#: ports/stm/common-hal/alarm/touch/TouchAlarm.c
msgid "Touch alarms not available"
msgstr "Alarmas táctiles no disponibles"
@ -2551,7 +2589,7 @@ msgstr "El argumento para argsort debe ser un ndarray"
msgid "argsort is not implemented for flattened arrays"
msgstr "El argot no está implementado para arrays aplanados"
#: py/runtime.c
#: py/runtime.c shared-bindings/supervisor/__init__.c
msgid "argument has wrong type"
msgstr "el argumento tiene un tipo erroneo"
@ -2626,6 +2664,10 @@ msgstr "typecode erroneo"
msgid "binary op %q not implemented"
msgstr "operacion binaria %q no implementada"
#: extmod/modurandom.c
msgid "bits must be 32 or less"
msgstr "los bits deben ser 32 o menos"
#: shared-bindings/busio/UART.c
msgid "bits must be in range 5 to 9"
msgstr "los bits deben estar en el rango de 5 a 9"
@ -3244,6 +3286,10 @@ msgstr "el generador genero StopIteration"
msgid "graphic must be 2048 bytes long"
msgstr "graphic debe ser 2048 bytes de largo"
#: extmod/moduhashlib.c
msgid "hash is final"
msgstr "el hash es final"
#: extmod/moduheapq.c
msgid "heap must be a list"
msgstr "heap debe ser una lista"
@ -4465,6 +4511,12 @@ msgstr "zi debe ser de tipo flotante"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi debe ser una forma (n_section,2)"
#~ msgid "%q must store bytes"
#~ msgstr "%q debe almacenar bytes"
#~ msgid "Buffer too large and unable to allocate"
#~ msgstr "Buffer demasiado grande e incapaz de asignar"
#~ msgid "interp is defined for 1D arrays of equal length"
#~ msgstr "interp está definido para arreglos de 1D del mismo tamaño"

View File

@ -46,6 +46,10 @@ msgstr " File \"%q\", line %d"
msgid " is of type %q\n"
msgstr ""
#: main.c
msgid " not found.\n"
msgstr ""
#: main.c
msgid " output:\n"
msgstr " output:\n"
@ -82,10 +86,22 @@ msgstr "%q indeks wala sa sakop"
msgid "%q indices must be integers, not %s"
msgstr "%q indeks ay dapat integers, hindi %s"
#: py/argcheck.c
msgid "%q length must be %q"
msgstr ""
#: shared-bindings/vectorio/Polygon.c
msgid "%q list must be a list"
msgstr ""
#: py/argcheck.c
msgid "%q must <= %d"
msgstr ""
#: py/argcheck.c
msgid "%q must be %d-%d"
msgstr ""
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
@ -94,7 +110,11 @@ msgstr ""
msgid "%q must be 1-255"
msgstr ""
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: py/argcheck.c
msgid "%q must be >= %d"
msgstr ""
#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr ""
@ -111,6 +131,10 @@ msgstr "aarehas na haba dapat ang buffer slices"
msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr ""
#: py/argcheck.c
msgid "%q must be a string"
msgstr ""
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr ""
@ -119,6 +143,10 @@ msgstr ""
msgid "%q must be between %d and %d"
msgstr ""
#: py/argcheck.c
msgid "%q must of type %q"
msgstr ""
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#: shared-bindings/canio/Match.c
msgid "%q out of range"
@ -571,10 +599,6 @@ msgstr ""
msgid "Buffer must be at least length 1"
msgstr "Buffer dapat ay hindi baba sa 1 na haba"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Buffer too large and unable to allocate"
msgstr ""
#: shared-bindings/_bleio/PacketBuffer.c
#, c-format
msgid "Buffer too short by %d bytes"
@ -853,6 +877,10 @@ msgstr ""
msgid "Data chunk must follow fmt chunk"
msgstr "Dapat sunurin ng Data chunk ang fmt chunk"
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data not supported with directed advertising"
msgstr ""
#: ports/nrf/common-hal/_bleio/Adapter.c
#, fuzzy
msgid "Data too large for advertisement packet"
@ -1653,7 +1681,6 @@ msgstr ""
msgid "Not a valid IP string"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
#, fuzzy
@ -1699,6 +1726,10 @@ msgid ""
"Only Windows format, uncompressed BMP supported: given header size is %d"
msgstr ""
#: shared-bindings/_bleio/Adapter.c
msgid "Only connectable advertisements can be directed"
msgstr ""
#: ports/stm/common-hal/alarm/pin/PinAlarm.c
msgid "Only edge detection is available on this hardware"
msgstr ""
@ -1720,6 +1751,7 @@ msgstr ""
#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c
#: ports/nrf/common-hal/alarm/time/TimeAlarm.c
#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c
#: ports/stm/common-hal/alarm/time/TimeAlarm.c
msgid "Only one alarm.time alarm can be set."
msgstr ""
@ -2017,6 +2049,10 @@ msgstr ""
msgid "SPI Re-initialization error"
msgstr ""
#: ports/esp32s2/common-hal/busio/SPI.c
msgid "SPI configuration failed"
msgstr ""
#: ports/raspberrypi/common-hal/busio/SPI.c
msgid "SPI peripheral in use"
msgstr ""
@ -2055,6 +2091,7 @@ msgstr ""
msgid "Size not supported"
msgstr ""
#: ports/raspberrypi/common-hal/alarm/SleepMemory.c
#: ports/stm/common-hal/alarm/SleepMemory.c
msgid "Sleep Memory not available"
msgstr ""
@ -2199,6 +2236,7 @@ msgstr ""
msgid "Total data to write is larger than %q"
msgstr ""
#: ports/raspberrypi/common-hal/alarm/touch/TouchAlarm.c
#: ports/stm/common-hal/alarm/touch/TouchAlarm.c
msgid "Touch alarms not available"
msgstr ""
@ -2500,7 +2538,7 @@ msgstr ""
msgid "argsort is not implemented for flattened arrays"
msgstr ""
#: py/runtime.c
#: py/runtime.c shared-bindings/supervisor/__init__.c
msgid "argument has wrong type"
msgstr "may maling type ang argument"
@ -2575,6 +2613,10 @@ msgstr "masamang typecode"
msgid "binary op %q not implemented"
msgstr "binary op %q hindi implemented"
#: extmod/modurandom.c
msgid "bits must be 32 or less"
msgstr ""
#: shared-bindings/busio/UART.c
msgid "bits must be in range 5 to 9"
msgstr ""
@ -3199,6 +3241,10 @@ msgstr ""
msgid "graphic must be 2048 bytes long"
msgstr "graphic ay dapat 2048 bytes ang haba"
#: extmod/moduhashlib.c
msgid "hash is final"
msgstr ""
#: extmod/moduheapq.c
msgid "heap must be a list"
msgstr "list dapat ang heap"

View File

@ -56,6 +56,10 @@ msgstr " Fichier \"%q\", ligne %d"
msgid " is of type %q\n"
msgstr " est de type %q\n"
#: main.c
msgid " not found.\n"
msgstr ""
#: main.c
msgid " output:\n"
msgstr " sortie :\n"
@ -94,10 +98,22 @@ msgstr "index %q hors de portée"
msgid "%q indices must be integers, not %s"
msgstr "les indices %q doivent être des entiers, pas %s"
#: py/argcheck.c
msgid "%q length must be %q"
msgstr ""
#: shared-bindings/vectorio/Polygon.c
msgid "%q list must be a list"
msgstr "La liste %q doit être une liste"
#: py/argcheck.c
msgid "%q must <= %d"
msgstr ""
#: py/argcheck.c
msgid "%q must be %d-%d"
msgstr ""
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
@ -106,7 +122,11 @@ msgstr ""
msgid "%q must be 1-255"
msgstr "%q doit être compris entre 1 et 255"
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: py/argcheck.c
msgid "%q must be >= %d"
msgstr ""
#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr "%q doit être >= 0"
@ -122,6 +142,10 @@ msgstr "%q doit être >= 1"
msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr ""
#: py/argcheck.c
msgid "%q must be a string"
msgstr ""
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr "%q doit être un tuple de longueur 2"
@ -130,6 +154,10 @@ msgstr "%q doit être un tuple de longueur 2"
msgid "%q must be between %d and %d"
msgstr ""
#: py/argcheck.c
msgid "%q must of type %q"
msgstr ""
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#: shared-bindings/canio/Match.c
msgid "%q out of range"
@ -583,10 +611,6 @@ msgstr "La mémoire tampon doit être un multiple de 512"
msgid "Buffer must be at least length 1"
msgstr "Le tampon doit être de longueur au moins 1"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Buffer too large and unable to allocate"
msgstr "Tampon trop volumineux et impossible à allouer"
#: shared-bindings/_bleio/PacketBuffer.c
#, c-format
msgid "Buffer too short by %d bytes"
@ -872,6 +896,10 @@ msgstr "La broche Data 0 doit être aligné sur l'octet."
msgid "Data chunk must follow fmt chunk"
msgstr "Un bloc de données doit suivre un bloc fmt"
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data not supported with directed advertising"
msgstr ""
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data too large for advertisement packet"
msgstr "Données trop volumineuses pour un paquet d'avertissement"
@ -1683,7 +1711,6 @@ msgstr "Logiciel systême Nordic hors de mémoire"
msgid "Not a valid IP string"
msgstr "Chaîne IP non valide"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1730,6 +1757,10 @@ msgstr ""
"Seulement le format BMP Windows, non compressé est supporté : la taille de "
"l'entête fournie est %d"
#: shared-bindings/_bleio/Adapter.c
msgid "Only connectable advertisements can be directed"
msgstr ""
#: ports/stm/common-hal/alarm/pin/PinAlarm.c
msgid "Only edge detection is available on this hardware"
msgstr ""
@ -1753,6 +1784,7 @@ msgstr "Seulement une TouchAlarm peu être réglée en someil profond."
#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c
#: ports/nrf/common-hal/alarm/time/TimeAlarm.c
#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c
#: ports/stm/common-hal/alarm/time/TimeAlarm.c
msgid "Only one alarm.time alarm can be set."
msgstr "Seulement une alarme alarm.time peut être réglée."
@ -2062,6 +2094,10 @@ msgstr "Erreur d'initialisation SPI"
msgid "SPI Re-initialization error"
msgstr "Erreur de réinitialisation SPI"
#: ports/esp32s2/common-hal/busio/SPI.c
msgid "SPI configuration failed"
msgstr ""
#: ports/raspberrypi/common-hal/busio/SPI.c
msgid "SPI peripheral in use"
msgstr "Périphérique SPI utilisé"
@ -2100,6 +2136,7 @@ msgstr "Nombre de broches Side configurées doit être entre 1 et 5"
msgid "Size not supported"
msgstr "Taille n'est pas supportée"
#: ports/raspberrypi/common-hal/alarm/SleepMemory.c
#: ports/stm/common-hal/alarm/SleepMemory.c
msgid "Sleep Memory not available"
msgstr ""
@ -2245,6 +2282,7 @@ msgstr "Trop d'affichages"
msgid "Total data to write is larger than %q"
msgstr "Quantité de données à écrire est plus que %q"
#: ports/raspberrypi/common-hal/alarm/touch/TouchAlarm.c
#: ports/stm/common-hal/alarm/touch/TouchAlarm.c
msgid "Touch alarms not available"
msgstr ""
@ -2553,7 +2591,7 @@ msgstr "Le paramêtre argsort doit être un ndarray"
msgid "argsort is not implemented for flattened arrays"
msgstr "argsort n'est pas mis en œuvre pour les matrices aplatis"
#: py/runtime.c
#: py/runtime.c shared-bindings/supervisor/__init__.c
msgid "argument has wrong type"
msgstr "l'argument est d'un mauvais type"
@ -2628,6 +2666,10 @@ msgstr "mauvais code type"
msgid "binary op %q not implemented"
msgstr "opération binaire '%q' non implémentée"
#: extmod/modurandom.c
msgid "bits must be 32 or less"
msgstr ""
#: shared-bindings/busio/UART.c
msgid "bits must be in range 5 to 9"
msgstr "les bits doivent être compris entre 5 et 9"
@ -3252,6 +3294,10 @@ msgstr "générateur (generator) à surlevé StopIteration"
msgid "graphic must be 2048 bytes long"
msgstr "graphic doit être long de 2048 octets"
#: extmod/moduhashlib.c
msgid "hash is final"
msgstr ""
#: extmod/moduheapq.c
msgid "heap must be a list"
msgstr "le tas doit être une liste"
@ -4476,6 +4522,9 @@ msgstr "zi doit être de type float"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi doit être de forme (n_section, 2)"
#~ msgid "Buffer too large and unable to allocate"
#~ msgstr "Tampon trop volumineux et impossible à allouer"
#~ msgid "interp is defined for 1D arrays of equal length"
#~ msgstr "interp est défini pour les matrices 1D de longueur égale"

View File

@ -47,6 +47,10 @@ msgstr ""
msgid " is of type %q\n"
msgstr ""
#: main.c
msgid " not found.\n"
msgstr ""
#: main.c
msgid " output:\n"
msgstr ""
@ -83,10 +87,22 @@ msgstr ""
msgid "%q indices must be integers, not %s"
msgstr ""
#: py/argcheck.c
msgid "%q length must be %q"
msgstr ""
#: shared-bindings/vectorio/Polygon.c
msgid "%q list must be a list"
msgstr ""
#: py/argcheck.c
msgid "%q must <= %d"
msgstr ""
#: py/argcheck.c
msgid "%q must be %d-%d"
msgstr ""
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
@ -95,7 +111,11 @@ msgstr ""
msgid "%q must be 1-255"
msgstr ""
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: py/argcheck.c
msgid "%q must be >= %d"
msgstr ""
#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr ""
@ -111,6 +131,10 @@ msgstr ""
msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr ""
#: py/argcheck.c
msgid "%q must be a string"
msgstr ""
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr ""
@ -119,6 +143,10 @@ msgstr ""
msgid "%q must be between %d and %d"
msgstr ""
#: py/argcheck.c
msgid "%q must of type %q"
msgstr ""
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#: shared-bindings/canio/Match.c
msgid "%q out of range"
@ -566,10 +594,6 @@ msgstr ""
msgid "Buffer must be at least length 1"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Buffer too large and unable to allocate"
msgstr ""
#: shared-bindings/_bleio/PacketBuffer.c
#, c-format
msgid "Buffer too short by %d bytes"
@ -844,6 +868,10 @@ msgstr ""
msgid "Data chunk must follow fmt chunk"
msgstr ""
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data not supported with directed advertising"
msgstr ""
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data too large for advertisement packet"
msgstr ""
@ -1638,7 +1666,6 @@ msgstr ""
msgid "Not a valid IP string"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1681,6 +1708,10 @@ msgid ""
"Only Windows format, uncompressed BMP supported: given header size is %d"
msgstr ""
#: shared-bindings/_bleio/Adapter.c
msgid "Only connectable advertisements can be directed"
msgstr ""
#: ports/stm/common-hal/alarm/pin/PinAlarm.c
msgid "Only edge detection is available on this hardware"
msgstr ""
@ -1702,6 +1733,7 @@ msgstr ""
#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c
#: ports/nrf/common-hal/alarm/time/TimeAlarm.c
#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c
#: ports/stm/common-hal/alarm/time/TimeAlarm.c
msgid "Only one alarm.time alarm can be set."
msgstr ""
@ -1997,6 +2029,10 @@ msgstr ""
msgid "SPI Re-initialization error"
msgstr ""
#: ports/esp32s2/common-hal/busio/SPI.c
msgid "SPI configuration failed"
msgstr ""
#: ports/raspberrypi/common-hal/busio/SPI.c
msgid "SPI peripheral in use"
msgstr ""
@ -2035,6 +2071,7 @@ msgstr ""
msgid "Size not supported"
msgstr ""
#: ports/raspberrypi/common-hal/alarm/SleepMemory.c
#: ports/stm/common-hal/alarm/SleepMemory.c
msgid "Sleep Memory not available"
msgstr ""
@ -2179,6 +2216,7 @@ msgstr ""
msgid "Total data to write is larger than %q"
msgstr ""
#: ports/raspberrypi/common-hal/alarm/touch/TouchAlarm.c
#: ports/stm/common-hal/alarm/touch/TouchAlarm.c
msgid "Touch alarms not available"
msgstr ""
@ -2472,7 +2510,7 @@ msgstr ""
msgid "argsort is not implemented for flattened arrays"
msgstr ""
#: py/runtime.c
#: py/runtime.c shared-bindings/supervisor/__init__.c
msgid "argument has wrong type"
msgstr ""
@ -2547,6 +2585,10 @@ msgstr ""
msgid "binary op %q not implemented"
msgstr ""
#: extmod/modurandom.c
msgid "bits must be 32 or less"
msgstr ""
#: shared-bindings/busio/UART.c
msgid "bits must be in range 5 to 9"
msgstr ""
@ -3158,6 +3200,10 @@ msgstr ""
msgid "graphic must be 2048 bytes long"
msgstr ""
#: extmod/moduhashlib.c
msgid "hash is final"
msgstr ""
#: extmod/moduheapq.c
msgid "heap must be a list"
msgstr ""

View File

@ -55,6 +55,10 @@ msgstr " File \"%q\", riga %d"
msgid " is of type %q\n"
msgstr " è di tipo %q\n"
#: main.c
msgid " not found.\n"
msgstr ""
#: main.c
msgid " output:\n"
msgstr " output:\n"
@ -92,10 +96,22 @@ msgstr "indice %q fuori intervallo"
msgid "%q indices must be integers, not %s"
msgstr "gli indici %q devono essere interi, non %s"
#: py/argcheck.c
msgid "%q length must be %q"
msgstr ""
#: shared-bindings/vectorio/Polygon.c
msgid "%q list must be a list"
msgstr "lista %q deve essere una lista"
#: py/argcheck.c
msgid "%q must <= %d"
msgstr ""
#: py/argcheck.c
msgid "%q must be %d-%d"
msgstr ""
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
@ -104,7 +120,11 @@ msgstr ""
msgid "%q must be 1-255"
msgstr ""
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: py/argcheck.c
msgid "%q must be >= %d"
msgstr ""
#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr "%q deve essere >= 0"
@ -121,6 +141,10 @@ msgstr "slice del buffer devono essere della stessa lunghezza"
msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr ""
#: py/argcheck.c
msgid "%q must be a string"
msgstr ""
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr "%q deve essere una tupla di lunghezza 2"
@ -129,6 +153,10 @@ msgstr "%q deve essere una tupla di lunghezza 2"
msgid "%q must be between %d and %d"
msgstr ""
#: py/argcheck.c
msgid "%q must of type %q"
msgstr ""
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#: shared-bindings/canio/Match.c
msgid "%q out of range"
@ -581,10 +609,6 @@ msgstr "Il buffer deve essere un multiplo di 512 bytes"
msgid "Buffer must be at least length 1"
msgstr "Il buffer deve essere lungo almeno 1"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Buffer too large and unable to allocate"
msgstr "Buffer troppo grande ed impossibile allocare"
#: shared-bindings/_bleio/PacketBuffer.c
#, c-format
msgid "Buffer too short by %d bytes"
@ -863,6 +887,10 @@ msgstr ""
msgid "Data chunk must follow fmt chunk"
msgstr ""
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data not supported with directed advertising"
msgstr ""
#: ports/nrf/common-hal/_bleio/Adapter.c
#, fuzzy
msgid "Data too large for advertisement packet"
@ -1666,7 +1694,6 @@ msgstr ""
msgid "Not a valid IP string"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
#, fuzzy
@ -1713,6 +1740,10 @@ msgid ""
"Only Windows format, uncompressed BMP supported: given header size is %d"
msgstr ""
#: shared-bindings/_bleio/Adapter.c
msgid "Only connectable advertisements can be directed"
msgstr ""
#: ports/stm/common-hal/alarm/pin/PinAlarm.c
msgid "Only edge detection is available on this hardware"
msgstr ""
@ -1734,6 +1765,7 @@ msgstr ""
#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c
#: ports/nrf/common-hal/alarm/time/TimeAlarm.c
#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c
#: ports/stm/common-hal/alarm/time/TimeAlarm.c
msgid "Only one alarm.time alarm can be set."
msgstr ""
@ -2036,6 +2068,10 @@ msgstr ""
msgid "SPI Re-initialization error"
msgstr ""
#: ports/esp32s2/common-hal/busio/SPI.c
msgid "SPI configuration failed"
msgstr ""
#: ports/raspberrypi/common-hal/busio/SPI.c
msgid "SPI peripheral in use"
msgstr ""
@ -2076,6 +2112,7 @@ msgstr ""
msgid "Size not supported"
msgstr ""
#: ports/raspberrypi/common-hal/alarm/SleepMemory.c
#: ports/stm/common-hal/alarm/SleepMemory.c
msgid "Sleep Memory not available"
msgstr ""
@ -2220,6 +2257,7 @@ msgstr "Troppi schermi"
msgid "Total data to write is larger than %q"
msgstr ""
#: ports/raspberrypi/common-hal/alarm/touch/TouchAlarm.c
#: ports/stm/common-hal/alarm/touch/TouchAlarm.c
msgid "Touch alarms not available"
msgstr ""
@ -2515,7 +2553,7 @@ msgstr ""
msgid "argsort is not implemented for flattened arrays"
msgstr ""
#: py/runtime.c
#: py/runtime.c shared-bindings/supervisor/__init__.c
msgid "argument has wrong type"
msgstr "il tipo dell'argomento è errato"
@ -2590,6 +2628,10 @@ msgstr ""
msgid "binary op %q not implemented"
msgstr "operazione binaria %q non implementata"
#: extmod/modurandom.c
msgid "bits must be 32 or less"
msgstr ""
#: shared-bindings/busio/UART.c
msgid "bits must be in range 5 to 9"
msgstr ""
@ -3212,6 +3254,10 @@ msgstr ""
msgid "graphic must be 2048 bytes long"
msgstr "graphic deve essere lunga 2048 byte"
#: extmod/moduhashlib.c
msgid "hash is final"
msgstr ""
#: extmod/moduheapq.c
msgid "heap must be a list"
msgstr "l'heap deve essere una lista"
@ -4441,6 +4487,9 @@ msgstr ""
msgid "zi must be of shape (n_section, 2)"
msgstr ""
#~ msgid "Buffer too large and unable to allocate"
#~ msgstr "Buffer troppo grande ed impossibile allocare"
#~ msgid "USB Busy"
#~ msgstr "USB occupata"

View File

@ -52,6 +52,10 @@ msgstr " ファイル \"%q\", 行 %d"
msgid " is of type %q\n"
msgstr ""
#: main.c
msgid " not found.\n"
msgstr ""
#: main.c
msgid " output:\n"
msgstr " 出力:\n"
@ -88,10 +92,22 @@ msgstr "%q インデックスは範囲外"
msgid "%q indices must be integers, not %s"
msgstr ""
#: py/argcheck.c
msgid "%q length must be %q"
msgstr ""
#: shared-bindings/vectorio/Polygon.c
msgid "%q list must be a list"
msgstr "%q リストはリストでなければなりません"
#: py/argcheck.c
msgid "%q must <= %d"
msgstr ""
#: py/argcheck.c
msgid "%q must be %d-%d"
msgstr ""
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
@ -100,7 +116,11 @@ msgstr ""
msgid "%q must be 1-255"
msgstr ""
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: py/argcheck.c
msgid "%q must be >= %d"
msgstr ""
#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr "%qは0以上でなければなりません"
@ -116,6 +136,10 @@ msgstr "%qは1以上でなければなりません"
msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr ""
#: py/argcheck.c
msgid "%q must be a string"
msgstr ""
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr "%qは長さ2のタプルでなければなりません"
@ -124,6 +148,10 @@ msgstr "%qは長さ2のタプルでなければなりません"
msgid "%q must be between %d and %d"
msgstr ""
#: py/argcheck.c
msgid "%q must of type %q"
msgstr ""
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#: shared-bindings/canio/Match.c
msgid "%q out of range"
@ -573,10 +601,6 @@ msgstr "バッファは512の倍数でなければなりません"
msgid "Buffer must be at least length 1"
msgstr "バッファ長は少なくとも1以上でなければなりません"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Buffer too large and unable to allocate"
msgstr "バッファが大きすぎて確保できません"
#: shared-bindings/_bleio/PacketBuffer.c
#, c-format
msgid "Buffer too short by %d bytes"
@ -853,6 +877,10 @@ msgstr ""
msgid "Data chunk must follow fmt chunk"
msgstr "fmtチャンクの後にdataチャンクが続かなければなりません"
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data not supported with directed advertising"
msgstr ""
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data too large for advertisement packet"
msgstr "データが、アドバタイズメントパケットには大きすぎます"
@ -1649,7 +1677,6 @@ msgstr ""
msgid "Not a valid IP string"
msgstr "不正なIP文字列です"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1694,6 +1721,10 @@ msgid ""
"Only Windows format, uncompressed BMP supported: given header size is %d"
msgstr ""
#: shared-bindings/_bleio/Adapter.c
msgid "Only connectable advertisements can be directed"
msgstr ""
#: ports/stm/common-hal/alarm/pin/PinAlarm.c
msgid "Only edge detection is available on this hardware"
msgstr ""
@ -1715,6 +1746,7 @@ msgstr ""
#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c
#: ports/nrf/common-hal/alarm/time/TimeAlarm.c
#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c
#: ports/stm/common-hal/alarm/time/TimeAlarm.c
msgid "Only one alarm.time alarm can be set."
msgstr ""
@ -2011,6 +2043,10 @@ msgstr "SPI初期化エラー"
msgid "SPI Re-initialization error"
msgstr "SPI再初期化エラー"
#: ports/esp32s2/common-hal/busio/SPI.c
msgid "SPI configuration failed"
msgstr ""
#: ports/raspberrypi/common-hal/busio/SPI.c
msgid "SPI peripheral in use"
msgstr ""
@ -2049,6 +2085,7 @@ msgstr ""
msgid "Size not supported"
msgstr "サイズは対応していません"
#: ports/raspberrypi/common-hal/alarm/SleepMemory.c
#: ports/stm/common-hal/alarm/SleepMemory.c
msgid "Sleep Memory not available"
msgstr ""
@ -2193,6 +2230,7 @@ msgstr ""
msgid "Total data to write is larger than %q"
msgstr ""
#: ports/raspberrypi/common-hal/alarm/touch/TouchAlarm.c
#: ports/stm/common-hal/alarm/touch/TouchAlarm.c
msgid "Touch alarms not available"
msgstr ""
@ -2487,7 +2525,7 @@ msgstr "argsortの引数はndarrayでなければなりません"
msgid "argsort is not implemented for flattened arrays"
msgstr ""
#: py/runtime.c
#: py/runtime.c shared-bindings/supervisor/__init__.c
msgid "argument has wrong type"
msgstr ""
@ -2562,6 +2600,10 @@ msgstr "不正なtypecode"
msgid "binary op %q not implemented"
msgstr ""
#: extmod/modurandom.c
msgid "bits must be 32 or less"
msgstr ""
#: shared-bindings/busio/UART.c
msgid "bits must be in range 5 to 9"
msgstr ""
@ -3177,6 +3219,10 @@ msgstr ""
msgid "graphic must be 2048 bytes long"
msgstr "graphicは2048バイトでなければなりません"
#: extmod/moduhashlib.c
msgid "hash is final"
msgstr ""
#: extmod/moduheapq.c
msgid "heap must be a list"
msgstr "heapにはリストが必要"
@ -4392,6 +4438,9 @@ msgstr "ziはfloat値でなければなりません"
msgid "zi must be of shape (n_section, 2)"
msgstr ""
#~ msgid "Buffer too large and unable to allocate"
#~ msgstr "バッファが大きすぎて確保できません"
#~ msgid ""
#~ "CircuitPython is in safe mode because you pressed the reset button during "
#~ "boot. Press again to exit safe mode.\n"

View File

@ -48,6 +48,10 @@ msgstr " 파일 \"%q\", 라인 %d"
msgid " is of type %q\n"
msgstr ""
#: main.c
msgid " not found.\n"
msgstr ""
#: main.c
msgid " output:\n"
msgstr " 산출:\n"
@ -84,10 +88,22 @@ msgstr "%q 인덱스 범위를 벗어났습니다"
msgid "%q indices must be integers, not %s"
msgstr "%q 인덱스는 %s 가 아닌 정수 여야합니다"
#: py/argcheck.c
msgid "%q length must be %q"
msgstr ""
#: shared-bindings/vectorio/Polygon.c
msgid "%q list must be a list"
msgstr ""
#: py/argcheck.c
msgid "%q must <= %d"
msgstr ""
#: py/argcheck.c
msgid "%q must be %d-%d"
msgstr ""
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
@ -96,7 +112,11 @@ msgstr ""
msgid "%q must be 1-255"
msgstr ""
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: py/argcheck.c
msgid "%q must be >= %d"
msgstr ""
#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr ""
@ -112,6 +132,10 @@ msgstr "%q 는 >=1이어야합니다"
msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr ""
#: py/argcheck.c
msgid "%q must be a string"
msgstr ""
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr ""
@ -120,6 +144,10 @@ msgstr ""
msgid "%q must be between %d and %d"
msgstr ""
#: py/argcheck.c
msgid "%q must of type %q"
msgstr ""
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#: shared-bindings/canio/Match.c
msgid "%q out of range"
@ -569,10 +597,6 @@ msgstr ""
msgid "Buffer must be at least length 1"
msgstr "잘못된 크기의 버퍼. >1 여야합니다"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Buffer too large and unable to allocate"
msgstr ""
#: shared-bindings/_bleio/PacketBuffer.c
#, c-format
msgid "Buffer too short by %d bytes"
@ -847,6 +871,10 @@ msgstr ""
msgid "Data chunk must follow fmt chunk"
msgstr ""
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data not supported with directed advertising"
msgstr ""
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data too large for advertisement packet"
msgstr "광고 (브로드 캐스트) 패킷에 대한 데이터가 너무 큽니다"
@ -1641,7 +1669,6 @@ msgstr ""
msgid "Not a valid IP string"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1684,6 +1711,10 @@ msgid ""
"Only Windows format, uncompressed BMP supported: given header size is %d"
msgstr ""
#: shared-bindings/_bleio/Adapter.c
msgid "Only connectable advertisements can be directed"
msgstr ""
#: ports/stm/common-hal/alarm/pin/PinAlarm.c
msgid "Only edge detection is available on this hardware"
msgstr ""
@ -1705,6 +1736,7 @@ msgstr ""
#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c
#: ports/nrf/common-hal/alarm/time/TimeAlarm.c
#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c
#: ports/stm/common-hal/alarm/time/TimeAlarm.c
msgid "Only one alarm.time alarm can be set."
msgstr ""
@ -2000,6 +2032,10 @@ msgstr ""
msgid "SPI Re-initialization error"
msgstr ""
#: ports/esp32s2/common-hal/busio/SPI.c
msgid "SPI configuration failed"
msgstr ""
#: ports/raspberrypi/common-hal/busio/SPI.c
msgid "SPI peripheral in use"
msgstr ""
@ -2038,6 +2074,7 @@ msgstr ""
msgid "Size not supported"
msgstr ""
#: ports/raspberrypi/common-hal/alarm/SleepMemory.c
#: ports/stm/common-hal/alarm/SleepMemory.c
msgid "Sleep Memory not available"
msgstr ""
@ -2182,6 +2219,7 @@ msgstr ""
msgid "Total data to write is larger than %q"
msgstr ""
#: ports/raspberrypi/common-hal/alarm/touch/TouchAlarm.c
#: ports/stm/common-hal/alarm/touch/TouchAlarm.c
msgid "Touch alarms not available"
msgstr ""
@ -2476,7 +2514,7 @@ msgstr ""
msgid "argsort is not implemented for flattened arrays"
msgstr ""
#: py/runtime.c
#: py/runtime.c shared-bindings/supervisor/__init__.c
msgid "argument has wrong type"
msgstr ""
@ -2551,6 +2589,10 @@ msgstr ""
msgid "binary op %q not implemented"
msgstr ""
#: extmod/modurandom.c
msgid "bits must be 32 or less"
msgstr ""
#: shared-bindings/busio/UART.c
msgid "bits must be in range 5 to 9"
msgstr ""
@ -3162,6 +3204,10 @@ msgstr ""
msgid "graphic must be 2048 bytes long"
msgstr ""
#: extmod/moduhashlib.c
msgid "hash is final"
msgstr ""
#: extmod/moduheapq.c
msgid "heap must be a list"
msgstr ""

View File

@ -50,6 +50,10 @@ msgstr " Bestand \"%q\", regel %d"
msgid " is of type %q\n"
msgstr ""
#: main.c
msgid " not found.\n"
msgstr ""
#: main.c
msgid " output:\n"
msgstr " uitvoer:\n"
@ -86,10 +90,22 @@ msgstr "%q index buiten bereik"
msgid "%q indices must be integers, not %s"
msgstr "%q indexen moeten integers zijn, niet %s"
#: py/argcheck.c
msgid "%q length must be %q"
msgstr ""
#: shared-bindings/vectorio/Polygon.c
msgid "%q list must be a list"
msgstr "%q lijst moet een lijst zijn"
#: py/argcheck.c
msgid "%q must <= %d"
msgstr ""
#: py/argcheck.c
msgid "%q must be %d-%d"
msgstr ""
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
@ -98,7 +114,11 @@ msgstr ""
msgid "%q must be 1-255"
msgstr ""
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: py/argcheck.c
msgid "%q must be >= %d"
msgstr ""
#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr "%q moet >= 0 zijn"
@ -114,6 +134,10 @@ msgstr "%q moet >= 1 zijn"
msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr ""
#: py/argcheck.c
msgid "%q must be a string"
msgstr ""
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr "%q moet een tuple van lengte 2 zijn"
@ -122,6 +146,10 @@ msgstr "%q moet een tuple van lengte 2 zijn"
msgid "%q must be between %d and %d"
msgstr ""
#: py/argcheck.c
msgid "%q must of type %q"
msgstr ""
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#: shared-bindings/canio/Match.c
msgid "%q out of range"
@ -571,10 +599,6 @@ msgstr "Buffer moet een veelvoud van 512 bytes zijn"
msgid "Buffer must be at least length 1"
msgstr "Buffer moet op zijn minst lengte 1 zijn"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Buffer too large and unable to allocate"
msgstr "Buffer is te groot en niet in staat te alloceren"
#: shared-bindings/_bleio/PacketBuffer.c
#, c-format
msgid "Buffer too short by %d bytes"
@ -853,6 +877,10 @@ msgstr ""
msgid "Data chunk must follow fmt chunk"
msgstr "Data chunk moet gevolgd worden door fmt chunk"
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data not supported with directed advertising"
msgstr ""
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data too large for advertisement packet"
msgstr "Data te groot voor advertisement pakket"
@ -1650,7 +1678,6 @@ msgstr ""
msgid "Not a valid IP string"
msgstr "Geen geldige IP string"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1697,6 +1724,10 @@ msgstr ""
"Alleen Windows formaat en ongecomprimeerd BMP ondersteund: gegeven header "
"grootte is %d"
#: shared-bindings/_bleio/Adapter.c
msgid "Only connectable advertisements can be directed"
msgstr ""
#: ports/stm/common-hal/alarm/pin/PinAlarm.c
msgid "Only edge detection is available on this hardware"
msgstr ""
@ -1720,6 +1751,7 @@ msgstr ""
#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c
#: ports/nrf/common-hal/alarm/time/TimeAlarm.c
#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c
#: ports/stm/common-hal/alarm/time/TimeAlarm.c
msgid "Only one alarm.time alarm can be set."
msgstr "Slechts één alarm.time alarm kan worden ingesteld."
@ -2027,6 +2059,10 @@ msgstr "SPI Init Fout"
msgid "SPI Re-initialization error"
msgstr "SPI Herinitialisatie Fout"
#: ports/esp32s2/common-hal/busio/SPI.c
msgid "SPI configuration failed"
msgstr ""
#: ports/raspberrypi/common-hal/busio/SPI.c
msgid "SPI peripheral in use"
msgstr ""
@ -2065,6 +2101,7 @@ msgstr ""
msgid "Size not supported"
msgstr "Afmeting niet ondersteund"
#: ports/raspberrypi/common-hal/alarm/SleepMemory.c
#: ports/stm/common-hal/alarm/SleepMemory.c
msgid "Sleep Memory not available"
msgstr ""
@ -2209,6 +2246,7 @@ msgstr "Teveel beeldschermen"
msgid "Total data to write is larger than %q"
msgstr ""
#: ports/raspberrypi/common-hal/alarm/touch/TouchAlarm.c
#: ports/stm/common-hal/alarm/touch/TouchAlarm.c
msgid "Touch alarms not available"
msgstr ""
@ -2513,7 +2551,7 @@ msgstr "argsort argument moet een ndarray zijn"
msgid "argsort is not implemented for flattened arrays"
msgstr "argsort wordt niet geïmplementeerd voor vlakke arrays"
#: py/runtime.c
#: py/runtime.c shared-bindings/supervisor/__init__.c
msgid "argument has wrong type"
msgstr "argument heeft onjuist type"
@ -2588,6 +2626,10 @@ msgstr "verkeerde typecode"
msgid "binary op %q not implemented"
msgstr "binaire op %q niet geïmplementeerd"
#: extmod/modurandom.c
msgid "bits must be 32 or less"
msgstr ""
#: shared-bindings/busio/UART.c
msgid "bits must be in range 5 to 9"
msgstr ""
@ -3204,6 +3246,10 @@ msgstr ""
msgid "graphic must be 2048 bytes long"
msgstr "graphic moet 2048 bytes lang zijn"
#: extmod/moduhashlib.c
msgid "hash is final"
msgstr ""
#: extmod/moduheapq.c
msgid "heap must be a list"
msgstr "heap moet een lijst zijn"
@ -4421,6 +4467,9 @@ msgstr "zi moet van type float zijn"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi moet vorm (n_section, 2) hebben"
#~ msgid "Buffer too large and unable to allocate"
#~ msgstr "Buffer is te groot en niet in staat te alloceren"
#~ msgid "interp is defined for 1D arrays of equal length"
#~ msgstr ""
#~ "interp is gedefinieerd voor eendimensionale arrays van gelijke lengte"

View File

@ -52,6 +52,10 @@ msgstr " Plik \"%q\", linia %d"
msgid " is of type %q\n"
msgstr ""
#: main.c
msgid " not found.\n"
msgstr ""
#: main.c
msgid " output:\n"
msgstr " wyjście:\n"
@ -88,10 +92,22 @@ msgstr "%q poza zakresem"
msgid "%q indices must be integers, not %s"
msgstr "%q indeks musi być liczbą całkowitą, a nie %s"
#: py/argcheck.c
msgid "%q length must be %q"
msgstr ""
#: shared-bindings/vectorio/Polygon.c
msgid "%q list must be a list"
msgstr ""
#: py/argcheck.c
msgid "%q must <= %d"
msgstr ""
#: py/argcheck.c
msgid "%q must be %d-%d"
msgstr ""
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
@ -100,7 +116,11 @@ msgstr ""
msgid "%q must be 1-255"
msgstr ""
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: py/argcheck.c
msgid "%q must be >= %d"
msgstr ""
#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr "%q musi być >= 0"
@ -116,6 +136,10 @@ msgstr "%q musi być >= 1"
msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr ""
#: py/argcheck.c
msgid "%q must be a string"
msgstr ""
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr "%q musi być krotką o długości 2"
@ -124,6 +148,10 @@ msgstr "%q musi być krotką o długości 2"
msgid "%q must be between %d and %d"
msgstr ""
#: py/argcheck.c
msgid "%q must of type %q"
msgstr ""
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#: shared-bindings/canio/Match.c
msgid "%q out of range"
@ -573,10 +601,6 @@ msgstr "Bufor musi być wielokrotnością 512 bajtów"
msgid "Buffer must be at least length 1"
msgstr "Bufor musi mieć długość 1 lub więcej"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Buffer too large and unable to allocate"
msgstr "Bufor jest zbyt duży i nie można go przydzielić"
#: shared-bindings/_bleio/PacketBuffer.c
#, c-format
msgid "Buffer too short by %d bytes"
@ -853,6 +877,10 @@ msgstr ""
msgid "Data chunk must follow fmt chunk"
msgstr "Fragment danych musi następować po fragmencie fmt"
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data not supported with directed advertising"
msgstr ""
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data too large for advertisement packet"
msgstr "Zbyt dużo danych pakietu rozgłoszeniowego"
@ -1649,7 +1677,6 @@ msgstr ""
msgid "Not a valid IP string"
msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1692,6 +1719,10 @@ msgid ""
"Only Windows format, uncompressed BMP supported: given header size is %d"
msgstr "Wspierane są tylko nieskompresowane pliki BMP: wielkość nagłówka %d"
#: shared-bindings/_bleio/Adapter.c
msgid "Only connectable advertisements can be directed"
msgstr ""
#: ports/stm/common-hal/alarm/pin/PinAlarm.c
msgid "Only edge detection is available on this hardware"
msgstr ""
@ -1713,6 +1744,7 @@ msgstr ""
#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c
#: ports/nrf/common-hal/alarm/time/TimeAlarm.c
#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c
#: ports/stm/common-hal/alarm/time/TimeAlarm.c
msgid "Only one alarm.time alarm can be set."
msgstr ""
@ -2008,6 +2040,10 @@ msgstr "Błąd inicjowania SPI"
msgid "SPI Re-initialization error"
msgstr "Błąd ponownej inicjalizacji SPI"
#: ports/esp32s2/common-hal/busio/SPI.c
msgid "SPI configuration failed"
msgstr ""
#: ports/raspberrypi/common-hal/busio/SPI.c
msgid "SPI peripheral in use"
msgstr ""
@ -2046,6 +2082,7 @@ msgstr ""
msgid "Size not supported"
msgstr ""
#: ports/raspberrypi/common-hal/alarm/SleepMemory.c
#: ports/stm/common-hal/alarm/SleepMemory.c
msgid "Sleep Memory not available"
msgstr ""
@ -2190,6 +2227,7 @@ msgstr "Zbyt wiele wyświetlaczy"
msgid "Total data to write is larger than %q"
msgstr ""
#: ports/raspberrypi/common-hal/alarm/touch/TouchAlarm.c
#: ports/stm/common-hal/alarm/touch/TouchAlarm.c
msgid "Touch alarms not available"
msgstr ""
@ -2489,7 +2527,7 @@ msgstr ""
msgid "argsort is not implemented for flattened arrays"
msgstr ""
#: py/runtime.c
#: py/runtime.c shared-bindings/supervisor/__init__.c
msgid "argument has wrong type"
msgstr "argument ma zły typ"
@ -2564,6 +2602,10 @@ msgstr "zły typecode"
msgid "binary op %q not implemented"
msgstr "brak dwu-argumentowego operatora %q"
#: extmod/modurandom.c
msgid "bits must be 32 or less"
msgstr ""
#: shared-bindings/busio/UART.c
msgid "bits must be in range 5 to 9"
msgstr ""
@ -3176,6 +3218,10 @@ msgstr ""
msgid "graphic must be 2048 bytes long"
msgstr "graphic musi mieć 2048 bajtów długości"
#: extmod/moduhashlib.c
msgid "hash is final"
msgstr ""
#: extmod/moduheapq.c
msgid "heap must be a list"
msgstr "heap musi być listą"
@ -4389,6 +4435,9 @@ msgstr ""
msgid "zi must be of shape (n_section, 2)"
msgstr ""
#~ msgid "Buffer too large and unable to allocate"
#~ msgstr "Bufor jest zbyt duży i nie można go przydzielić"
#~ msgid "wrong operand type"
#~ msgstr "zły typ operandu"

View File

@ -6,7 +6,7 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
"PO-Revision-Date: 2021-06-21 22:27+0000\n"
"PO-Revision-Date: 2021-06-30 17:19+0000\n"
"Last-Translator: Wellington Terumi Uemura <wellingtonuemura@gmail.com>\n"
"Language-Team: \n"
"Language: pt_BR\n"
@ -14,7 +14,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.7\n"
"X-Generator: Weblate 4.7.1-dev\n"
#: main.c
msgid ""
@ -54,6 +54,10 @@ msgstr " Arquivo \"%q\", linha %d"
msgid " is of type %q\n"
msgstr " é do tipo %q\n"
#: main.c
msgid " not found.\n"
msgstr " não encontrado.\n"
#: main.c
msgid " output:\n"
msgstr " saída:\n"
@ -92,10 +96,22 @@ msgstr "O índice %q está fora do intervalo"
msgid "%q indices must be integers, not %s"
msgstr "Os índices %q devem ser inteiros, e não %s"
#: py/argcheck.c
msgid "%q length must be %q"
msgstr "o comprimento %q deve ser %q"
#: shared-bindings/vectorio/Polygon.c
msgid "%q list must be a list"
msgstr "A lista %q deve ser uma lista"
#: py/argcheck.c
msgid "%q must <= %d"
msgstr "o %q deve ser <= %d"
#: py/argcheck.c
msgid "%q must be %d-%d"
msgstr "o %q deve ser %d-%d"
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr "%q deve ser entre 0-255"
@ -104,7 +120,11 @@ msgstr "%q deve ser entre 0-255"
msgid "%q must be 1-255"
msgstr "%q deve ser 1-255"
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: py/argcheck.c
msgid "%q must be >= %d"
msgstr "o %q deve ser >= %d"
#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr "%q deve ser >= 0"
@ -120,6 +140,10 @@ msgstr "%q deve ser >= 1"
msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr "%q deve ser None ou entre 1 e len(report_descriptor)-1"
#: py/argcheck.c
msgid "%q must be a string"
msgstr "%q deve ser uma string"
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr "%q deve ser uma tupla de comprimento 2"
@ -128,6 +152,10 @@ msgstr "%q deve ser uma tupla de comprimento 2"
msgid "%q must be between %d and %d"
msgstr "%q deve estar entre %d e %d"
#: py/argcheck.c
msgid "%q must of type %q"
msgstr "o %q deve ser do tipo %q"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#: shared-bindings/canio/Match.c
msgid "%q out of range"
@ -584,10 +612,6 @@ msgstr "O buffer deve ser um múltiplo de 512 bytes"
msgid "Buffer must be at least length 1"
msgstr "O comprimento do buffer deve ter pelo menos 1"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Buffer too large and unable to allocate"
msgstr "O buffer é muito grande e incapaz de alocar"
#: shared-bindings/_bleio/PacketBuffer.c
#, c-format
msgid "Buffer too short by %d bytes"
@ -869,6 +893,10 @@ msgstr "O pino de dados 0 deve ser alinhado por bytes."
msgid "Data chunk must follow fmt chunk"
msgstr "Pedaço de dados deve seguir o pedaço de cortes"
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data not supported with directed advertising"
msgstr "Os dados não são compatíveis com publicidade direcionada"
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data too large for advertisement packet"
msgstr "Os dados são grandes demais para o pacote de publicidade"
@ -1674,7 +1702,6 @@ msgstr "O firmware do sistema nórdico está sem memória"
msgid "Not a valid IP string"
msgstr "Não é uma sequência válida de IP"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1720,6 +1747,10 @@ msgstr ""
"O BMP descompactado é compatível apenas no formato Windows: o tamanho do "
"cabeçalho é %d"
#: shared-bindings/_bleio/Adapter.c
msgid "Only connectable advertisements can be directed"
msgstr "Somente anúncios conectáveis podem ser direcionados"
#: ports/stm/common-hal/alarm/pin/PinAlarm.c
msgid "Only edge detection is available on this hardware"
msgstr "Apenas a detecção de borda está disponível neste hardware"
@ -1743,6 +1774,7 @@ msgstr "Apenas um TouchAlarm pode ser colocado em deep sleep."
#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c
#: ports/nrf/common-hal/alarm/time/TimeAlarm.c
#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c
#: ports/stm/common-hal/alarm/time/TimeAlarm.c
msgid "Only one alarm.time alarm can be set."
msgstr "Apenas um alarme alarm.time pode ser definido."
@ -2054,6 +2086,10 @@ msgstr "Houve um erro na inicialização SPI"
msgid "SPI Re-initialization error"
msgstr "Houve um erro na reinicialização SPI"
#: ports/esp32s2/common-hal/busio/SPI.c
msgid "SPI configuration failed"
msgstr "A configuração SPI falhou"
#: ports/raspberrypi/common-hal/busio/SPI.c
msgid "SPI peripheral in use"
msgstr "O periférico SPI está em uso"
@ -2093,6 +2129,7 @@ msgstr ""
msgid "Size not supported"
msgstr "O tamanho não é suportado"
#: ports/raspberrypi/common-hal/alarm/SleepMemory.c
#: ports/stm/common-hal/alarm/SleepMemory.c
msgid "Sleep Memory not available"
msgstr "Sleep memory não está disponível"
@ -2248,6 +2285,7 @@ msgstr "Exibições demais"
msgid "Total data to write is larger than %q"
msgstr "O total dos dados que serão escritos é maior do que %q"
#: ports/raspberrypi/common-hal/alarm/touch/TouchAlarm.c
#: ports/stm/common-hal/alarm/touch/TouchAlarm.c
msgid "Touch alarms not available"
msgstr "Alarmes de toque não estão disponíveis"
@ -2556,7 +2594,7 @@ msgstr "O argumento argsort deve ser um ndarray"
msgid "argsort is not implemented for flattened arrays"
msgstr "argsort não é implementado para matrizes achatadas"
#: py/runtime.c
#: py/runtime.c shared-bindings/supervisor/__init__.c
msgid "argument has wrong type"
msgstr "argumento tem tipo errado"
@ -2631,6 +2669,10 @@ msgstr "typecode incorreto"
msgid "binary op %q not implemented"
msgstr "a operação binário %q não foi implementada"
#: extmod/modurandom.c
msgid "bits must be 32 or less"
msgstr "bits deve ser 32 ou menos"
#: shared-bindings/busio/UART.c
msgid "bits must be in range 5 to 9"
msgstr "os bits devem estar na faixa entre 5 a 9"
@ -3251,6 +3293,10 @@ msgstr "gerador StopIteration elevado"
msgid "graphic must be 2048 bytes long"
msgstr "o gráfico deve ter 2048 bytes de comprimento"
#: extmod/moduhashlib.c
msgid "hash is final"
msgstr "o hash é final"
#: extmod/moduheapq.c
msgid "heap must be a list"
msgstr "a área de alocação dinâmica de variáveis (heap) deve ser uma lista"
@ -4475,6 +4521,12 @@ msgstr "zi deve ser de um tipo float"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi deve estar na forma (n_section, 2)"
#~ msgid "%q must store bytes"
#~ msgstr "o %q deve armazenar bytes"
#~ msgid "Buffer too large and unable to allocate"
#~ msgstr "O buffer é muito grande e incapaz de alocar"
#~ msgid "interp is defined for 1D arrays of equal length"
#~ msgstr "o interp é definido para matrizes 1D de igual comprimento"

View File

@ -6,7 +6,7 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
"PO-Revision-Date: 2021-06-21 13:39+0000\n"
"PO-Revision-Date: 2021-06-27 12:33+0000\n"
"Last-Translator: Jonny Bergdahl <jonny@bergdahl.it>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: sv\n"
@ -14,7 +14,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.7\n"
"X-Generator: Weblate 4.7.1-dev\n"
#: main.c
msgid ""
@ -54,6 +54,10 @@ msgstr " Fil \"%q\", rad %d"
msgid " is of type %q\n"
msgstr " är av typen %q\n"
#: main.c
msgid " not found.\n"
msgstr " hittades inte.\n"
#: main.c
msgid " output:\n"
msgstr " utdata:\n"
@ -91,10 +95,22 @@ msgstr "Index %q ligger utanför intervallet"
msgid "%q indices must be integers, not %s"
msgstr "Indexet %q måste vara ett heltal, inte %s"
#: py/argcheck.c
msgid "%q length must be %q"
msgstr "längden på %q måste vara %q"
#: shared-bindings/vectorio/Polygon.c
msgid "%q list must be a list"
msgstr "%q-listan måste vara en lista"
#: py/argcheck.c
msgid "%q must <= %d"
msgstr "%q måste vara <=%d"
#: py/argcheck.c
msgid "%q must be %d-%d"
msgstr "%q måste vara %d-%d"
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr "%q måste vara 0-255"
@ -103,7 +119,11 @@ msgstr "%q måste vara 0-255"
msgid "%q must be 1-255"
msgstr "%q måste vara 1-255"
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: py/argcheck.c
msgid "%q must be >= %d"
msgstr "%q måste vara >= %d"
#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr "%q måste vara >= 0"
@ -119,6 +139,10 @@ msgstr "%q måste vara >= 1"
msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr "%q måste vara None eller mellan 1 och len(report_descriptor)-1"
#: py/argcheck.c
msgid "%q must be a string"
msgstr "%q måste vara en sträng"
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr "%q måste vara en tuple av längd 2"
@ -127,6 +151,10 @@ msgstr "%q måste vara en tuple av längd 2"
msgid "%q must be between %d and %d"
msgstr "%q måste vara mellan %d och %d"
#: py/argcheck.c
msgid "%q must of type %q"
msgstr "%q måste av typen %q"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#: shared-bindings/canio/Match.c
msgid "%q out of range"
@ -576,10 +604,6 @@ msgstr "Bufferten måste vara en multipel av 512 byte"
msgid "Buffer must be at least length 1"
msgstr "Bufferten måste ha minst längd 1"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Buffer too large and unable to allocate"
msgstr "Bufferten är för stor och kan inte allokeras"
#: shared-bindings/_bleio/PacketBuffer.c
#, c-format
msgid "Buffer too short by %d bytes"
@ -859,6 +883,10 @@ msgstr "Datapinne 0 måste vara byte-justerad."
msgid "Data chunk must follow fmt chunk"
msgstr "Datasegmentet måste följa fmt-segmentet"
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data not supported with directed advertising"
msgstr "Data stöds inte med riktad annonsering"
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data too large for advertisement packet"
msgstr "Data för stor för annonseringspaket"
@ -1658,7 +1686,6 @@ msgstr "Nordic systemfirmware fick slut på minne"
msgid "Not a valid IP string"
msgstr "Inte en giltig IP-sträng"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1704,6 +1731,10 @@ msgid ""
msgstr ""
"Endast Windows-format, okomprimerad BMP stöds: given headerstorlek är %d"
#: shared-bindings/_bleio/Adapter.c
msgid "Only connectable advertisements can be directed"
msgstr "Endast anslutningsbara annonseringar kan dirigeras"
#: ports/stm/common-hal/alarm/pin/PinAlarm.c
msgid "Only edge detection is available on this hardware"
msgstr "Endast kantdetektering är tillgänglig för denna hårdvara"
@ -1727,6 +1758,7 @@ msgstr "Endast ett TouchAlarm kan ställas in för djupsömn."
#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c
#: ports/nrf/common-hal/alarm/time/TimeAlarm.c
#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c
#: ports/stm/common-hal/alarm/time/TimeAlarm.c
msgid "Only one alarm.time alarm can be set."
msgstr "Endast ett alarm.time kan ställas in."
@ -2033,6 +2065,10 @@ msgstr "SPI Init-fel"
msgid "SPI Re-initialization error"
msgstr "SPI reinitialiseringsfel"
#: ports/esp32s2/common-hal/busio/SPI.c
msgid "SPI configuration failed"
msgstr "SPI-konfigurationen misslyckades"
#: ports/raspberrypi/common-hal/busio/SPI.c
msgid "SPI peripheral in use"
msgstr "SPI-enhet används redan"
@ -2071,6 +2107,7 @@ msgstr "Sido-setets antal pinnar måste vara mellan 1 och 5"
msgid "Size not supported"
msgstr "Storleken stöds inte"
#: ports/raspberrypi/common-hal/alarm/SleepMemory.c
#: ports/stm/common-hal/alarm/SleepMemory.c
msgid "Sleep Memory not available"
msgstr "Sömnminne inte tillgängligt"
@ -2223,6 +2260,7 @@ msgstr "För många displayer"
msgid "Total data to write is larger than %q"
msgstr "Totala data att skriva är större än %q"
#: ports/raspberrypi/common-hal/alarm/touch/TouchAlarm.c
#: ports/stm/common-hal/alarm/touch/TouchAlarm.c
msgid "Touch alarms not available"
msgstr "Touchalarm är inte tillgängligt"
@ -2526,7 +2564,7 @@ msgstr "argumentet argsort måste vara en ndarray"
msgid "argsort is not implemented for flattened arrays"
msgstr "argsort är inte implementerad för tillplattade matriser"
#: py/runtime.c
#: py/runtime.c shared-bindings/supervisor/__init__.c
msgid "argument has wrong type"
msgstr "argumentet har fel typ"
@ -2601,6 +2639,10 @@ msgstr "Ogiltig typkod"
msgid "binary op %q not implemented"
msgstr "binär op %q är inte implementerad"
#: extmod/modurandom.c
msgid "bits must be 32 or less"
msgstr "bits måste vara 32 eller färre"
#: shared-bindings/busio/UART.c
msgid "bits must be in range 5 to 9"
msgstr "bits måste mellan 5 och 9"
@ -3217,6 +3259,10 @@ msgstr "generator kastade StopIteration"
msgid "graphic must be 2048 bytes long"
msgstr "graphic måste vara 2048 byte lång"
#: extmod/moduhashlib.c
msgid "hash is final"
msgstr "hash är slutgiltig"
#: extmod/moduheapq.c
msgid "heap must be a list"
msgstr "heap måste vara en lista"
@ -4434,6 +4480,12 @@ msgstr "zi måste vara av typ float"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi måste vara i formen (n_section, 2)"
#~ msgid "%q must store bytes"
#~ msgstr "%q måste lagra bytes"
#~ msgid "Buffer too large and unable to allocate"
#~ msgstr "Bufferten är för stor och kan inte allokeras"
#~ msgid "interp is defined for 1D arrays of equal length"
#~ msgstr "interp är definierad för 1D-matriser med samma längd"

View File

@ -7,7 +7,7 @@ msgstr ""
"Project-Id-Version: circuitpython-cn\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
"PO-Revision-Date: 2021-06-19 20:18+0000\n"
"PO-Revision-Date: 2021-07-06 16:32+0000\n"
"Last-Translator: hexthat <hexthat@gmail.com>\n"
"Language-Team: Chinese Hanyu Pinyin\n"
"Language: zh_Latn_pinyin\n"
@ -15,7 +15,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 4.7\n"
"X-Generator: Weblate 4.8-dev\n"
#: main.c
msgid ""
@ -55,6 +55,10 @@ msgstr " Wénjiàn \"%q\", dì %d xíng"
msgid " is of type %q\n"
msgstr " shì %q lèi xíng\n"
#: main.c
msgid " not found.\n"
msgstr " wèi zhǎo dào.\n"
#: main.c
msgid " output:\n"
msgstr " shūchū:\n"
@ -93,10 +97,22 @@ msgstr "%q suǒyǐn chāochū fànwéi"
msgid "%q indices must be integers, not %s"
msgstr "%q suǒyǐn bìxū shì zhěngshù, ér bùshì %s"
#: py/argcheck.c
msgid "%q length must be %q"
msgstr "%q cháng dù bì xū wéi %q"
#: shared-bindings/vectorio/Polygon.c
msgid "%q list must be a list"
msgstr "%q lièbiǎo bìxū shì lièbiǎo"
#: py/argcheck.c
msgid "%q must <= %d"
msgstr "%q bì xū <= %d"
#: py/argcheck.c
msgid "%q must be %d-%d"
msgstr "%q bì xū wéi %d-%d"
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr "%q bì xū wéi 0-255"
@ -105,7 +121,11 @@ msgstr "%q bì xū wéi 0-255"
msgid "%q must be 1-255"
msgstr "%q bì xū wéi 1-255"
#: shared-bindings/memorymonitor/AllocationAlarm.c
#: py/argcheck.c
msgid "%q must be >= %d"
msgstr "%q bì xū >= %d"
#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c
msgid "%q must be >= 0"
msgstr "%q Bìxū > = 0"
@ -121,13 +141,21 @@ msgstr "%q bìxū dàyú huò děngyú 1"
msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr "%q bì xū wéi wú huò zài 1 hé len(report_descriptor)-1 zhī jiān"
#: py/argcheck.c
msgid "%q must be a string"
msgstr "%q bì xū shì yí gè zì fú chuàn"
#: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2"
msgstr "%q bìxū shì chángdù wèi 2 de yuán zǔ"
#: ports/esp32s2/common-hal/imagecapture/ParallelImageCapture.c
msgid "%q must be between %d and %d"
msgstr ""
msgstr "%q bì xū zài %d hé %d zhī jiān"
#: py/argcheck.c
msgid "%q must of type %q"
msgstr "%q bì xū lèi xíng %q"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#: shared-bindings/canio/Match.c
@ -506,7 +534,7 @@ msgstr "Bǐtè shízhōng hé dānzì xuǎnzé bìxū gòngxiǎng shízhōng dā
#: shared-bindings/rgbmatrix/RGBMatrix.c
#, c-format
msgid "Bit depth must be from 1 to 6 inclusive, not %d"
msgstr "wèi shēn dù bì xū bāo hán 1 dào 6 ér bù shì %d"
msgstr "wèi shēn dù bì xū bāo hán 1 dào 6, ér bù shì %d"
#: shared-bindings/audiobusio/PDMIn.c
msgid "Bit depth must be multiple of 8."
@ -578,14 +606,10 @@ msgstr "Huǎn chōng qū bì xū shì 512 zì jié de bèi shù"
msgid "Buffer must be at least length 1"
msgstr "Huǎnchōng qū bìxū zhìshǎo chángdù 1"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Buffer too large and unable to allocate"
msgstr "Huǎn chōng qū tài dà wú fǎ fēn pèi"
#: shared-bindings/_bleio/PacketBuffer.c
#, c-format
msgid "Buffer too short by %d bytes"
msgstr "Huǎn chōng qū tài duǎn àn %d zì jié"
msgstr "Huǎn chōng qū tài duǎn , àn %d zì jié"
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
#: ports/esp32s2/common-hal/displayio/ParallelBus.c
@ -858,6 +882,10 @@ msgstr "shù jù 0 yǐn jiǎo bì xū àn zì jié duì qí."
msgid "Data chunk must follow fmt chunk"
msgstr "Shùjù kuài bìxū zūnxún fmt qū kuài"
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data not supported with directed advertising"
msgstr "bù zhī chí dìng xiàng guǎng gào de shù jù"
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Data too large for advertisement packet"
msgstr "Guǎnggào bāo de shùjù tài dà"
@ -1309,7 +1337,7 @@ msgstr "wú xiào data_count %d"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "Invalid data_pins[%d]"
msgstr ""
msgstr "wú xiào data_pins[%d]"
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Invalid direction."
@ -1661,7 +1689,6 @@ msgstr "běi ōu xì tǒng gù jiàn chū nèi cún"
msgid "Not a valid IP string"
msgstr "Wúxiào de IP zìfú chuàn"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "Not connected"
@ -1707,6 +1734,10 @@ msgstr ""
"Jǐn zhīchí Windows géshì, zhīchí wèi yāsuō de BMP: Gěi dìng de biāo tóu "
"dàxiǎo wèi %d"
#: shared-bindings/_bleio/Adapter.c
msgid "Only connectable advertisements can be directed"
msgstr "zhǐ yǒu kě lián jiē de guǎng gào cái néng bèi yǐn dǎo"
#: ports/stm/common-hal/alarm/pin/PinAlarm.c
msgid "Only edge detection is available on this hardware"
msgstr "cǐ yìng jiàn shàng jǐn tí gòng biān yuán jiǎn cè"
@ -1730,6 +1761,7 @@ msgstr "zhǐ yǒu yí gè chù mō bì kě yǐ shè zhì zài shēn dù shuì mi
#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c
#: ports/nrf/common-hal/alarm/time/TimeAlarm.c
#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c
#: ports/stm/common-hal/alarm/time/TimeAlarm.c
msgid "Only one alarm.time alarm can be set."
msgstr "zhǐ néng shè zhì yí gè bào jǐng."
@ -2032,6 +2064,10 @@ msgstr "SPI chūshǐhuà cuòwù"
msgid "SPI Re-initialization error"
msgstr "SPI chóngxīn chūshǐhuà cuòwù"
#: ports/esp32s2/common-hal/busio/SPI.c
msgid "SPI configuration failed"
msgstr "SPI pèi zhì shī bài"
#: ports/raspberrypi/common-hal/busio/SPI.c
msgid "SPI peripheral in use"
msgstr "SPI wài shè zhèng zài shǐ yòng zhōng"
@ -2070,6 +2106,7 @@ msgstr "cè miàn shè zhì yǐn jiǎo shù bì xū jiè yú 1 hé 5 zhī jiān"
msgid "Size not supported"
msgstr "bù zhī chí dà xiǎo"
#: ports/raspberrypi/common-hal/alarm/SleepMemory.c
#: ports/stm/common-hal/alarm/SleepMemory.c
msgid "Sleep Memory not available"
msgstr "shuì mián jì yì bù kě yòng"
@ -2135,7 +2172,7 @@ msgid ""
"Increase the stack size if you know how. If not:"
msgstr ""
"diàn lù dàn duī bèi sǔn huài, yīn wéi duī zhàn tài xiǎo.\n"
"rú guǒ nín zhī dào rú hé zēng jiā duī zhàn dà xiǎo. rú guǒ méi yǒu"
"rú guǒ nín zhī dào rú hé zēng jiā duī zhàn dà xiǎo. rú guǒ méi yǒu:"
#: supervisor/shared/safe_mode.c
msgid ""
@ -2221,6 +2258,7 @@ msgstr "Xiǎnshì tài duō"
msgid "Total data to write is larger than %q"
msgstr "yào biān xiě de zǒng shù jù dà yú %q"
#: ports/raspberrypi/common-hal/alarm/touch/TouchAlarm.c
#: ports/stm/common-hal/alarm/touch/TouchAlarm.c
msgid "Touch alarms not available"
msgstr "bù kě yòng chù mō bào jǐng qì"
@ -2316,7 +2354,7 @@ msgstr "Wúfǎ xiě rù nvm."
#: shared-bindings/alarm/SleepMemory.c
msgid "Unable to write to sleep_memory."
msgstr "wú fǎ xiě rù sleep_memory"
msgstr "wú fǎ xiě rù sleep_memory."
#: ports/nrf/common-hal/_bleio/UUID.c
msgid "Unexpected nrfx uuid type"
@ -2525,7 +2563,7 @@ msgstr "argsort cānshù bìxū shì ndarray"
msgid "argsort is not implemented for flattened arrays"
msgstr "wèi wéi pīn hé shù zǔ shí xiàn argsort"
#: py/runtime.c
#: py/runtime.c shared-bindings/supervisor/__init__.c
msgid "argument has wrong type"
msgstr "cānshù lèixíng cuòwù"
@ -2600,6 +2638,10 @@ msgstr "cuòwù de dàimǎ lèixíng"
msgid "binary op %q not implemented"
msgstr "èrjìnzhì bǎn qián bǎn %q wèi zhíxíng"
#: extmod/modurandom.c
msgid "bits must be 32 or less"
msgstr "wèi bì xū shì 32 huò gèng shǎo"
#: shared-bindings/busio/UART.c
msgid "bits must be in range 5 to 9"
msgstr "wèi bì xū zài fàn wéi nèi 5 zhì 9"
@ -3217,6 +3259,10 @@ msgstr "fā diàn jī tí chū tíng zhǐ"
msgid "graphic must be 2048 bytes long"
msgstr "túxíng bìxū wèi 2048 zì jié"
#: extmod/moduhashlib.c
msgid "hash is final"
msgstr "hā xī shì zuì zhōng de"
#: extmod/moduheapq.c
msgid "heap must be a list"
msgstr "duī bìxū shì yīgè lièbiǎo"
@ -3368,7 +3414,7 @@ msgstr "wúxiào de cānshù"
#: shared-bindings/bitmaptools/__init__.c
#, c-format
msgid "invalid bits_per_pixel %d, must be, 1, 4, 8, 16, 24, or 32"
msgstr "wú xiào bits_per_pixel %d bì xū shì, 1, 4, 8, 16, 24, huò 32"
msgstr "wú xiào bits_per_pixel %d, bì xū shì, 1, 4, 8, 16, 24, huò 32"
#: shared-bindings/bitmaptools/__init__.c
#, c-format
@ -3827,7 +3873,7 @@ msgstr "chāo gāo zhuǎnhuàn zhǎng zhěng shùzì shí"
#: py/modstruct.c
#, c-format
msgid "pack expected %d items for packing (got %d)"
msgstr "bāo zhuāng yù qī de %d bāo zhuāng xiàng mù dé dào %d)"
msgstr "bāo zhuāng yù qī de %d bāo zhuāng xiàng mù (dé dào %d)"
#: shared-bindings/_stage/Layer.c shared-bindings/_stage/Text.c
msgid "palette must be 32 bytes long"
@ -4431,6 +4477,12 @@ msgstr "zi bìxū wèi fú diǎn xíng"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)"
#~ msgid "%q must store bytes"
#~ msgstr "%q bì xū cún chǔ zì jié"
#~ msgid "Buffer too large and unable to allocate"
#~ msgstr "Huǎn chōng qū tài dà , wú fǎ fēn pèi"
#~ msgid "interp is defined for 1D arrays of equal length"
#~ msgstr "interp shì wèi děng zhǎng de 1D shùzǔ dìngyì de"

109
main.c
View File

@ -71,7 +71,7 @@
#if CIRCUITPY_BLEIO
#include "shared-bindings/_bleio/__init__.h"
#include "supervisor/shared/bluetooth.h"
#include "supervisor/shared/bluetooth/bluetooth.h"
#endif
#if CIRCUITPY_BOARD
@ -86,6 +86,10 @@
#include "shared-module/displayio/__init__.h"
#endif
#if CIRCUITPY_KEYPAD
#include "shared-module/keypad/__init__.h"
#endif
#if CIRCUITPY_MEMORYMONITOR
#include "shared-module/memorymonitor/__init__.h"
#endif
@ -230,9 +234,11 @@ STATIC void cleanup_after_vm(supervisor_allocation* heap) {
#if CIRCUITPY_DISPLAYIO
reset_displays();
#endif
#if CIRCUITPY_MEMORYMONITOR
memorymonitor_reset();
#endif
filesystem_flush();
stop_mp();
free_memory(heap);
@ -242,6 +248,10 @@ STATIC void cleanup_after_vm(supervisor_allocation* heap) {
common_hal_canio_reset();
#endif
#if CIRCUITPY_KEYPAD
keypad_reset();
#endif
// reset_board_busses() first because it may release pins from the never_reset state, so that
// reset_port() can reset them.
#if CIRCUITPY_BOARD
@ -280,7 +290,12 @@ STATIC bool run_code_py(safe_mode_t safe_mode) {
result.exception_type = NULL;
result.exception_line = 0;
bool skip_repl;
bool skip_wait = false;
bool found_main = false;
uint8_t next_code_options = 0;
// Collects stickiness bits that apply in the current situation.
uint8_t next_code_stickiness_situation = SUPERVISOR_NEXT_CODE_OPT_NEWLY_SET;
if (safe_mode == NO_SAFE_MODE) {
static const char * const supported_filenames[] = STRING_LIST(
@ -302,25 +317,71 @@ STATIC bool run_code_py(safe_mode_t safe_mode) {
usb_setup_with_vm();
#endif
// This is where the user's python code is actually executed:
found_main = maybe_run_list(supported_filenames, &result);
// If that didn't work, double check the extensions
#if CIRCUITPY_FULL_BUILD
if (!found_main){
found_main = maybe_run_list(double_extension_filenames, &result);
if (found_main) {
serial_write_compressed(translate("WARNING: Your code filename has two extensions\n"));
// Check if a different run file has been allocated
if (next_code_allocation) {
((next_code_info_t*)next_code_allocation->ptr)->options &= ~SUPERVISOR_NEXT_CODE_OPT_NEWLY_SET;
next_code_options = ((next_code_info_t*)next_code_allocation->ptr)->options;
if (((next_code_info_t*)next_code_allocation->ptr)->filename[0] != '\0') {
const char* next_list[] = {((next_code_info_t*)next_code_allocation->ptr)->filename, ""};
// This is where the user's python code is actually executed:
found_main = maybe_run_list(next_list, &result);
if (!found_main) {
serial_write(((next_code_info_t*)next_code_allocation->ptr)->filename);
serial_write_compressed(translate(" not found.\n"));
}
}
}
#else
(void) found_main;
#endif
// Otherwise, default to the standard list of filenames
if (!found_main) {
// This is where the user's python code is actually executed:
found_main = maybe_run_list(supported_filenames, &result);
// If that didn't work, double check the extensions
#if CIRCUITPY_FULL_BUILD
if (!found_main){
found_main = maybe_run_list(double_extension_filenames, &result);
if (found_main) {
serial_write_compressed(translate("WARNING: Your code filename has two extensions\n"));
}
}
#else
(void) found_main;
#endif
}
// Finished executing python code. Cleanup includes a board reset.
cleanup_after_vm(heap);
// If a new next code file was set, that is a reason to keep it (obviously). Stuff this into
// the options because it can be treated like any other reason-for-stickiness bit. The
// source is different though: it comes from the options that will apply to the next run,
// while the rest of next_code_options is what applied to this run.
if (next_code_allocation != NULL && (((next_code_info_t*)next_code_allocation->ptr)->options & SUPERVISOR_NEXT_CODE_OPT_NEWLY_SET)) {
next_code_options |= SUPERVISOR_NEXT_CODE_OPT_NEWLY_SET;
}
if (reload_requested) {
next_code_stickiness_situation |= SUPERVISOR_NEXT_CODE_OPT_STICKY_ON_RELOAD;
}
else if (result.return_code == 0) {
next_code_stickiness_situation |= SUPERVISOR_NEXT_CODE_OPT_STICKY_ON_SUCCESS;
if (next_code_options & SUPERVISOR_NEXT_CODE_OPT_RELOAD_ON_SUCCESS) {
skip_repl = true;
skip_wait = true;
}
}
else {
next_code_stickiness_situation |= SUPERVISOR_NEXT_CODE_OPT_STICKY_ON_ERROR;
// Deep sleep cannot be skipped
// TODO: settings in deep sleep should persist, using a new sleep memory API
if (next_code_options & SUPERVISOR_NEXT_CODE_OPT_RELOAD_ON_ERROR
&& !(result.return_code & PYEXEC_DEEP_SLEEP)) {
skip_repl = true;
skip_wait = true;
}
}
if (result.return_code & PYEXEC_FORCED_EXIT) {
return reload_requested;
skip_repl = reload_requested;
skip_wait = true;
}
if (reload_requested && result.return_code == PYEXEC_EXCEPTION) {
@ -368,12 +429,17 @@ STATIC bool run_code_py(safe_mode_t safe_mode) {
#if CIRCUITPY_ALARM
bool fake_sleeping = false;
#endif
bool skip_repl = false;
while (true) {
while (!skip_wait) {
RUN_BACKGROUND_TASKS;
// If a reload was requested by the supervisor or autoreload, return
if (reload_requested) {
next_code_stickiness_situation |= SUPERVISOR_NEXT_CODE_OPT_STICKY_ON_RELOAD;
// Should the STICKY_ON_SUCCESS and STICKY_ON_ERROR bits be cleared in
// next_code_stickiness_situation? I can see arguments either way, but I'm deciding
// "no" for now, mainly because it's a bit less code. At this point, we have both a
// success or error and a reload, so let's have both of the respective options take
// effect (in OR combination).
reload_requested = false;
skip_repl = true;
break;
@ -508,6 +574,13 @@ STATIC bool run_code_py(safe_mode_t safe_mode) {
port_idle_until_interrupt();
}
}
// free code allocation if unused
if ((next_code_options & next_code_stickiness_situation) == 0) {
free_memory(next_code_allocation);
next_code_allocation = NULL;
}
// Done waiting, start the board back up.
#if CIRCUITPY_STATUS_LED
if (led_active) {
@ -521,6 +594,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode) {
board_init();
}
#endif
return skip_repl;
}
@ -686,6 +760,11 @@ int __attribute__((used)) main(void) {
stack_init();
#if CIRCUITPY_BLEIO
// Early init so that a reset press can cause BLE public advertising.
supervisor_bluetooth_init();
#endif
// Create a new filesystem only if we're not in a safe mode.
// A power brownout here could make it appear as if there's
// no SPI flash filesystem, and we might erase the existing one.

View File

@ -131,7 +131,7 @@ void audio_dma_load_next_block(audio_dma_t *dma) {
uint8_t *buffer;
uint32_t buffer_length;
audioio_get_buffer_result_t get_buffer_result =
audiosample_get_buffer(dma->sample, dma->single_channel, dma->audio_channel,
audiosample_get_buffer(dma->sample, dma->single_channel_output, dma->audio_channel,
&buffer, &buffer_length);
DmacDescriptor *descriptor = dma->second_descriptor;
@ -155,7 +155,7 @@ void audio_dma_load_next_block(audio_dma_t *dma) {
descriptor->SRCADDR.reg = ((uint32_t)output_buffer) + output_buffer_length;
if (get_buffer_result == GET_BUFFER_DONE) {
if (dma->loop) {
audiosample_reset_buffer(dma->sample, dma->single_channel, dma->audio_channel);
audiosample_reset_buffer(dma->sample, dma->single_channel_output, dma->audio_channel);
} else {
descriptor->DESCADDR.reg = 0;
}
@ -183,7 +183,7 @@ static void setup_audio_descriptor(DmacDescriptor *descriptor, uint8_t beat_size
audio_dma_result audio_dma_setup_playback(audio_dma_t *dma,
mp_obj_t sample,
bool loop,
bool single_channel,
bool single_channel_output,
uint8_t audio_channel,
bool output_signed,
uint32_t output_register_address,
@ -195,7 +195,7 @@ audio_dma_result audio_dma_setup_playback(audio_dma_t *dma,
dma->sample = sample;
dma->loop = loop;
dma->single_channel = single_channel;
dma->single_channel_output = single_channel_output;
dma->audio_channel = audio_channel;
dma->dma_channel = dma_channel;
dma->signed_to_unsigned = false;
@ -203,12 +203,12 @@ audio_dma_result audio_dma_setup_playback(audio_dma_t *dma,
dma->second_descriptor = NULL;
dma->spacing = 1;
dma->first_descriptor_free = true;
audiosample_reset_buffer(sample, single_channel, audio_channel);
audiosample_reset_buffer(sample, single_channel_output, audio_channel);
bool single_buffer;
bool samples_signed;
uint32_t max_buffer_length;
audiosample_get_buffer_structure(sample, single_channel, &single_buffer, &samples_signed,
audiosample_get_buffer_structure(sample, single_channel_output, &single_buffer, &samples_signed,
&max_buffer_length, &dma->spacing);
uint8_t output_spacing = dma->spacing;
if (output_signed != samples_signed) {
@ -254,12 +254,12 @@ audio_dma_result audio_dma_setup_playback(audio_dma_t *dma,
} else {
dma->beat_size = 1;
dma->bytes_per_sample = 1;
if (single_channel) {
if (single_channel_output) {
output_register_address += 1;
}
}
// Transfer both channels at once.
if (!single_channel && audiosample_channel_count(sample) == 2) {
if (!single_channel_output && audiosample_channel_count(sample) == 2) {
dma->beat_size *= 2;
}

View File

@ -42,7 +42,7 @@ typedef struct {
uint8_t beat_size;
uint8_t spacing;
bool loop;
bool single_channel;
bool single_channel_output;
bool signed_to_unsigned;
bool unsigned_to_signed;
bool first_buffer_free;
@ -72,16 +72,16 @@ void dma_free_channel(uint8_t channel);
// This sets everything up but doesn't start the timer.
// Sample is the python object for the sample to play.
// loop is true if we should loop the sample.
// single_channel is true if we only output a single channel. When false, all channels will be
// single_channel_output is true if we only output a single channel. When false, all channels will be
// output.
// audio_channel is the index of the channel to dma. single_channel must be false in this case.
// audio_channel is the index of the channel to dma. single_channel_output must be false in this case.
// output_signed is true if the dma'd data should be signed. False and it will be unsigned.
// output_register_address is the address to copy data to.
// dma_trigger_source is the DMA trigger source which cause another copy
audio_dma_result audio_dma_setup_playback(audio_dma_t *dma,
mp_obj_t sample,
bool loop,
bool single_channel,
bool single_channel_output,
uint8_t audio_channel,
bool output_signed,
uint32_t output_register_address,

View File

@ -14,6 +14,7 @@ LONGINT_IMPL = NONE
CIRCUITPY_BUSDEVICE = 1
CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_KEYPAD = 0
# Include these Python libraries in firmware.
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground

View File

@ -11,6 +11,7 @@ EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C"
# Turn off features and optimizations for displayio build to make room for additional frozen libs.
LONGINT_IMPL = NONE
CIRCUITPY_KEYPAD = 0
CIRCUITPY_PIXELBUF = 0
CIRCUITPY_ROTARYIO = 0
CIRCUITPY_RTC = 0

View File

@ -12,7 +12,6 @@ LONGINT_IMPL = NONE
# To keep the build small
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_GAMEPAD = 0
# Include these Python libraries in firmware.
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH

View File

@ -15,6 +15,7 @@ CIRCUITPY_AUDIOMP3 = 0
CIRCUITPY_BLEIO_HCI = 0
CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_FRAMEBUFFERIO = 0
CIRCUITPY_KEYPAD = 0
CIRCUITPY_MSGPACK = 0
CIRCUITPY_PS2IO = 0
CIRCUITPY_RGBMATRIX = 0

View File

@ -6,6 +6,8 @@ USB_MANUFACTURER = "Electronic Cats"
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
CIRCUITPY_PWMIO = 0
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0

View File

@ -30,14 +30,17 @@ CIRCUIPTY_USB_CDC = 0
CIRCUITPY_USB_HID = 0
CIRCUITPY_USB_MIDI = 0
CIRCUITPY_VECTORIO = 0
CIRCUITPY_GAMEPAD = 0
CIRCUITPY_PWMIO = 0
CIRCUITPY_ANALOGIO = 1
CIRCUITPY_AUDIOMIXER = 1
CIRCUITPY_AUDIOIO = 1
CIRCUITPY_SYNTHIO = 1
CIRCUITPY_DISPLAYIO = 1
CIRCUITPY_GAMEPAD = 1
CIRCUITPY_MATH = 1
CIRCUITPY_STAGE = 1
CIRCUITPY_KEYPAD = 1
FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pewpew_m4
CIRCUITPY_DISPLAY_FONT = $(TOP)/ports/atmel-samd/boards/ugame10/brutalist-6.bdf

View File

@ -16,8 +16,8 @@ CIRCUITPY_DRIVE_LABEL = "PYCUBED"
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_BITMAPTOOLS = 0
CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_KEYPAD = 0
CIRCUITPY_FRAMEBUFFERIO = 0
CIRCUITPY_GAMEPAD = 0
CIRCUITPY_RGBMATRIX = 0
CIRCUITPY_PS2IO = 0

View File

@ -17,7 +17,7 @@ CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_BITMAPTOOLS = 0
CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_FRAMEBUFFERIO = 0
CIRCUITPY_GAMEPAD = 0
CIRCUITPY_KEYPAD = 0
CIRCUITPY_RGBMATRIX = 0
CIRCUITPY_PS2IO = 0

View File

@ -89,8 +89,8 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
// I2S
{ MP_OBJ_NEW_QSTR(MP_QSTR_I2S_LRCLK), MP_ROM_PTR(&pin_PA20) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_I2S_SDIN), MP_ROM_PTR(&pin_PA21) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_I2S_SDOUT), MP_ROM_PTR(&pin_PA22) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_I2S_SDOUT), MP_ROM_PTR(&pin_PA21) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_I2S_SDIN), MP_ROM_PTR(&pin_PA22) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_I2S_BCLK), MP_ROM_PTR(&pin_PB16) },
// RTL8720D

View File

@ -11,4 +11,6 @@ SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = AT25SF161
LONGINT_IMPL = MPZ
CIRCUITPY_KEYPAD = 0
CIRCUITPY_BITBANG_APA102 = 1

View File

@ -22,7 +22,6 @@ CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_BLEIO = 0
CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_GAMEPAD = 0
CIRCUITPY_I2CPERIPHERAL = 0
CIRCUITPY_TOUCHIO = 0
CIRCUITPY_RGBMATRIX = 0

View File

@ -21,7 +21,6 @@ CIRCUITPY_BITMAPTOOLS = 0
CIRCUITPY_BLEIO_HCI = 0
CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_FRAMEBUFFERIO = 0
CIRCUITPY_GAMEPAD = 0
CIRCUITPY_I2CPERIPHERAL = 0
CIRCUITPY_TOUCHIO = 0
CIRCUITPY_RGBMATRIX = 0

View File

@ -50,6 +50,7 @@ CIRCUITPY_FRAMEBUFFERIO ?= 0
CIRCUITPY_FREQUENCYIO ?= 0
CIRCUITPY_I2CPERIPHERAL ?= 0
CIRCUITPY_JSON ?= 0
CIRCUITPY_KEYPAD ?= 0
CIRCUITPY_MSGPACK ?= 0
CIRCUITPY_RE ?= 0
CIRCUITPY_SDCARDIO ?= 0

View File

@ -38,8 +38,10 @@ PORT ?= /dev/tty.SLAB_USBtoUART
BUILD ?= build-$(BOARD)
include ../../py/mkenv.mk
# Board-specific
include boards/$(BOARD)/mpconfigboard.mk
# Port-specific
include mpconfigport.mk
@ -64,51 +66,52 @@ CROSS_COMPILE = xtensa-esp32s2-elf-
#######################################
INC += -I.
INC += -I../..
INC += -I$(BUILD)
INC += -I$(BUILD)/genhdr
INC += -I./boards
INC += -I./boards/$(BOARD)
INC += -I./peripherals
INC += -I../..
INC += -I../../lib/mp-readline
INC += -I../../lib/tinyusb/src
INC += -I../../supervisor/shared/usb
INC += -I$(BUILD)
INC += -I$(BUILD)/genhdr
INC += -I$(BUILD)/esp-idf/config
INC += -isystem esp-idf
INC += -isystem esp-idf/components/app_update/include
INC += -isystem esp-idf/components/bootloader_support/include
INC += -isystem esp-idf/components/driver/esp32s2/include
INC += -isystem esp-idf/components/driver/include
INC += -isystem esp-idf/components/freertos/include/freertos
INC += -isystem esp-idf/components/freertos/xtensa/include
INC += -isystem esp-idf/components/esp32s2/include
INC += -isystem esp-idf/components/xtensa/esp32s2/include
INC += -isystem esp-idf/components/esp_common/include
INC += -isystem esp-idf/components/esp_event/include
INC += -isystem esp-idf/components/esp_hw_support/include
INC += -isystem esp-idf/components/esp_netif/include
INC += -isystem esp-idf/components/esp_pm/include
INC += -isystem esp-idf/components/esp_ringbuf/include
INC += -isystem esp-idf/components/esp_rom/include
INC += -isystem esp-idf/components/esp_wifi/include
INC += -isystem esp-idf/components/xtensa/include
INC += -isystem esp-idf/components/esp_system/include
INC += -isystem esp-idf/components/esp_timer/include
INC += -isystem esp-idf/components/mbedtls/mbedtls/include
INC += -isystem esp-idf/components/mbedtls/port/include/
INC += -isystem esp-idf/components/newlib/platform_include
INC += -isystem esp-idf/components/esp_wifi/include
INC += -isystem esp-idf/components/freertos/include
INC += -isystem esp-idf/components/freertos/include/freertos
INC += -isystem esp-idf/components/freertos/port/xtensa/include
INC += -isystem esp-idf/components/hal/include
INC += -isystem esp-idf/components/hal/esp32s2/include
INC += -isystem esp-idf/components/heap/include
INC += -isystem esp-idf/components/log/include/
INC += -isystem esp-idf/components/lwip/lwip/src/include
INC += -isystem esp-idf/components/lwip/port/esp32/include
INC += -isystem esp-idf/components/lwip/include/apps/sntp
INC += -isystem esp-idf/components/hal/include
INC += -isystem esp-idf/components/hal/esp32s2/include
INC += -isystem esp-idf/components/log/include/
INC += -isystem esp-idf/components/driver/esp32s2/include
INC += -isystem esp-idf/components/soc/include
INC += -isystem esp-idf/components/soc/src/esp32s2/include
INC += -isystem esp-idf/components/soc/soc/include
INC += -isystem esp-idf/components/soc/soc/esp32s2/include
INC += -isystem esp-idf/components/heap/include
INC += -isystem esp-idf/components/esp_system/include
INC += -isystem esp-idf/components/spi_flash/include
INC += -isystem esp-idf/components/mbedtls/mbedtls/include
INC += -isystem esp-idf/components/mbedtls/port/include/
INC += -isystem esp-idf/components/newlib/platform_include
INC += -isystem esp-idf/components/nvs_flash/include
INC += -isystem esp-idf/components/app_update/include
INC += -isystem esp-idf/components/bootloader_support/include
INC += -I$(BUILD)/esp-idf/config
INC += -isystem esp-idf/components/soc/include
INC += -isystem esp-idf/components/soc/esp32s2/include
INC += -isystem esp-idf/components/spi_flash/include
INC += -isystem esp-idf/components/xtensa/esp32s2/include
INC += -isystem esp-idf/components/xtensa/include
CFLAGS += -DHAVE_CONFIG_H \
-DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" \
@ -136,28 +139,29 @@ CFLAGS += $(OPTIMIZATION_FLAGS)
CFLAGS += $(INC) -Werror -Wall -mlongcalls -std=gnu11 -Wl,--gc-sections $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT)
LDFLAGS = $(CFLAGS) -Wl,-nostdlib -Wl,-Map=$@.map -Wl,-cref -Wl,--undefined=uxTopUsedPriority
LDFLAGS = $(CFLAGS) -Wl,-nostdlib -Wl,-Map=$@.map -Wl,-cref -Wl,--undefined=uxTopUsedPriority
LDFLAGS += -L$(BUILD)/esp-idf/esp-idf/esp32s2 \
-Tesp32s2_out.ld \
-L$(BUILD)/esp-idf/esp-idf/esp32s2/ld \
-Tesp32s2.project.ld \
-Lesp-idf/components/esp32s2/ld \
-Tesp32s2.peripherals.ld \
-Lesp-idf/components/esp_rom/esp32s2/ld \
-Tesp32s2.rom.ld \
-Tesp32s2.rom.libgcc.ld \
-Tesp32s2.rom.newlib-data.ld \
-Tesp32s2.rom.newlib-funcs.ld \
-Tesp32s2.rom.spiflash.ld
-L$(BUILD)/esp-idf/esp-idf/esp32s2/ld \
-Lesp-idf/components/esp32s2/ld \
-Lesp-idf/components/esp_rom/esp32s2/ld \
-Tesp32s2_out.ld \
-Tesp32s2.project.ld \
-Tesp32s2.peripherals.ld \
-Tesp32s2.rom.ld \
-Tesp32s2.rom.api.ld \
-Tesp32s2.rom.libgcc.ld \
-Tesp32s2.rom.newlib-data.ld \
-Tesp32s2.rom.newlib-funcs.ld \
-Tesp32s2.rom.spiflash.ld
LDFLAGS += -Wl,-Bstatic \
-Wl,--no-warn-mismatch \
-Wl,--build-id=none \
-fno-rtti
LIBS := -lgcc -lc -lstdc++
#
LDFLAGS += -Wl,-Bstatic \
-Wl,--no-warn-mismatch \
-Wl,--build-id=none \
-fno-rtti
# Use toolchain libm if we're not using our own.
ifndef INTERNAL_LIBM
LIBS += -lm
@ -272,11 +276,7 @@ menuconfig: $(BUILD)/esp-idf/config
# qstr builds include headers so we need to make sure they are up to date
$(HEADER_BUILD)/qstr.split: | $(BUILD)/esp-idf/config/sdkconfig.h
ESP_IDF_COMPONENTS_LINK = freertos log esp_system esp_adc_cal esp32s2 bootloader_support pthread esp_timer vfs spi_flash app_update esp_common esp32s2 heap newlib driver xtensa soc esp_ringbuf esp_wifi esp_event wpa_supplicant mbedtls efuse nvs_flash esp_netif lwip esp-tls
ESP_IDF_COMPONENTS_INCLUDE = driver freertos log soc
INC += $(foreach component, $(ESP_IDF_COMPONENTS_INCLUDE), -isystem esp-idf/components/$(component)/include)
ESP_IDF_COMPONENTS_LINK = app_update bootloader_support driver efuse esp32s2 esp_adc_cal esp_common esp_event esp_hw_support esp_netif esp_pm esp_ringbuf esp_rom esp_system esp_timer esp-tls esp_wifi freertos hal heap log lwip mbedtls newlib nvs_flash pthread soc spi_flash vfs wpa_supplicant xtensa
ESP_IDF_COMPONENTS_EXPANDED = $(foreach component, $(ESP_IDF_COMPONENTS_LINK), $(BUILD)/esp-idf/esp-idf/$(component)/lib$(component).a)
ESP_IDF_WIFI_COMPONENTS_EXPANDED = $(foreach component, $(ESP_IDF_WIFI_COMPONENTS_LINK), $(BUILD)/esp-idf/esp-idf/$(component)/lib$(component).a)
@ -284,11 +284,11 @@ ESP_IDF_WIFI_COMPONENTS_EXPANDED = $(foreach component, $(ESP_IDF_WIFI_COMPONENT
MBEDTLS_COMPONENTS_LINK = crypto tls x509
MBEDTLS_COMPONENTS_LINK_EXPANDED = $(foreach component, $(MBEDTLS_COMPONENTS_LINK), $(BUILD)/esp-idf/esp-idf/mbedtls/mbedtls/library/libmbed$(component).a)
BINARY_BLOBS = esp-idf/components/xtensa/esp32s2/libhal.a
BINARY_BLOBS = esp-idf/components/xtensa/esp32s2/libxt_hal.a
BINARY_WIFI_BLOBS = libcoexist.a libcore.a libespnow.a libmesh.a libnet80211.a libpp.a librtc.a libsmartconfig.a libphy.a
BINARY_BLOBS += $(addprefix esp-idf/components/esp_wifi/lib/esp32s2/, $(BINARY_WIFI_BLOBS))
ESP_IDF_COMPONENTS_EXPANDED += $(BUILD)/esp-idf/esp-idf/soc/soc/esp32s2/libsoc_esp32s2.a
ESP_IDF_COMPONENTS_EXPANDED += esp-idf/components/xtensa/esp32s2/libxt_hal.a
ESP_AUTOGEN_LD = $(BUILD)/esp-idf/esp-idf/esp32s2/esp32s2_out.ld $(BUILD)/esp-idf/esp-idf/esp32s2/ld/esp32s2.project.ld
FLASH_FLAGS = --flash_mode $(CIRCUITPY_ESP_FLASH_MODE) --flash_freq $(CIRCUITPY_ESP_FLASH_FREQ) --flash_size $(CIRCUITPY_ESP_FLASH_SIZE)
@ -301,24 +301,42 @@ all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2
esp-idf-stamp: $(BUILD)/esp-idf/config/sdkconfig.h
$(Q)ninja -C $(BUILD)/esp-idf \
bootloader/bootloader.bin \
esp-idf/app_update/libapp_update.a \
esp-idf/bootloader_support/libbootloader_support.a \
esp-idf/esp-tls/libesp-tls.a \
esp-idf/driver/libdriver.a \
esp-idf/efuse/libefuse.a \
esp-idf/esp32s2/libesp32s2.a \
esp-idf/esp32s2/ld/esp32s2.project.ld \
esp-idf/esp_adc_cal/libesp_adc_cal.a \
esp-idf/esp_common/libesp_common.a \
esp-idf/esp_event/libesp_event.a \
esp-idf/esp_hw_support/libesp_hw_support.a \
esp-idf/esp_netif/libesp_netif.a \
esp-idf/esp_pm/libesp_pm.a \
esp-idf/esp_ringbuf/libesp_ringbuf.a \
esp-idf/esp_rom/libesp_rom.a \
esp-idf/esp_system/libesp_system.a \
esp-idf/esp_timer/libesp_timer.a \
esp-idf/esp-tls/libesp-tls.a \
esp-idf/esp_wifi/libesp_wifi.a \
esp-idf/lwip/liblwip.a \
esp-idf/nvs_flash/libnvs_flash.a \
esp-idf/wpa_supplicant/libwpa_supplicant.a \
esp-idf/mbedtls/libmbedtls.a \
esp-idf/freertos/libfreertos.a \
esp-idf/hal/libhal.a \
esp-idf/heap/libheap.a \
esp-idf/log/liblog.a \
esp-idf/lwip/liblwip.a \
esp-idf/mbedtls/libmbedtls.a \
esp-idf/newlib/libnewlib.a \
esp-idf/nvs_flash/libnvs_flash.a \
esp-idf/pthread/libpthread.a \
esp-idf/soc/libsoc.a \
esp-idf/spi_flash/libspi_flash.a \
esp-idf/vfs/libvfs.a \
esp-idf/wpa_supplicant/libwpa_supplicant.a \
esp-idf/xtensa/libxtensa.a
$(BUILD)/firmware.elf: $(OBJ) | esp-idf-stamp
$(STEPECHO) "LINK $@"
$(Q)$(CC) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(ESP_IDF_COMPONENTS_EXPANDED) $(BINARY_BLOBS) $(MBEDTLS_COMPONENTS_LINK_EXPANDED) build-$(BOARD)/esp-idf/esp-idf/newlib/libnewlib.a -Wl,--end-group -u newlib_include_pthread_impl -Wl,--start-group $(LIBS) -Wl,--end-group build-$(BOARD)/esp-idf/esp-idf/pthread/libpthread.a -u __cxx_fatal_exception
$(Q)$(CC) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(ESP_IDF_COMPONENTS_EXPANDED) $(BINARY_BLOBS) $(MBEDTLS_COMPONENTS_LINK_EXPANDED) $(BUILD)/esp-idf/esp-idf/newlib/libnewlib.a -Wl,--end-group -u newlib_include_pthread_impl -Wl,--start-group $(LIBS) -Wl,--end-group $(BUILD)/esp-idf/esp-idf/pthread/libpthread.a -u __cxx_fatal_exception
$(BUILD)/circuitpython-firmware.bin: $(BUILD)/firmware.elf | tools/build_memory_info.py
$(STEPECHO) "Create $@"

View File

@ -1,12 +1,3 @@
# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE is not set
# CONFIG_COMPILER_OPTIMIZATION_SIZE is not set
# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT is not set
# TWAI configuration
#
# CONFIG_TWAI_ISR_IN_IRAM is not set
# end of TWAI configuration
#
CONFIG_ESP32S2_SPIRAM_SUPPORT=y
#
@ -27,7 +18,6 @@ CONFIG_DEFAULT_PSRAM_CS_IO=26
# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set
# CONFIG_SPIRAM_RODATA is not set
# CONFIG_SPIRAM_USE_AHB_DBUS3 is not set
# CONFIG_SPIRAM_SPEED_80M is not set
CONFIG_SPIRAM_SPEED_40M=y
# CONFIG_SPIRAM_SPEED_26M is not set
@ -41,16 +31,3 @@ CONFIG_SPIRAM_USE_MEMMAP=y
CONFIG_SPIRAM_MEMTEST=y
# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set
# end of SPI RAM config
# CONFIG_ESP_CONSOLE_UART_NONE is not set
CONFIG_ESP_CONSOLE_UART_TX_GPIO=43
CONFIG_ESP_CONSOLE_UART_RX_GPIO=44
CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER=y
CONFIG_LWIP_TCP_HIGH_SPEED_RETRANSMISSION=y
CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG=y
# CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE is not set
CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED=y
# CONFIG_OPTIMIZATION_ASSERTIONS_SILENT is not set
# CONFIG_CONSOLE_UART_NONE is not set
CONFIG_CONSOLE_UART_TX_GPIO=43
CONFIG_CONSOLE_UART_RX_GPIO=44

View File

@ -44,7 +44,7 @@
#include "esp_sleep.h"
#include "components/soc/soc/esp32s2/include/soc/rtc_cntl_reg.h"
#include "components/soc/esp32s2/include/soc/rtc_cntl_reg.h"
#include "components/driver/include/driver/uart.h"
// Singleton instance of SleepMemory.

View File

@ -27,16 +27,16 @@
#include "py/runtime.h"
#include "shared-bindings/alarm/pin/PinAlarm.h"
#include "shared-bindings/microcontroller/__init__.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "supervisor/esp_port.h"
#include "shared-bindings/alarm/pin/PinAlarm.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/microcontroller/__init__.h"
#include "components/driver/include/driver/rtc_io.h"
#include "components/esp32s2/include/esp_sleep.h"
#include "components/freertos/include/freertos/FreeRTOS.h"
#include "components/soc/src/esp32s2/include/hal/gpio_ll.h"
#include "components/esp_system/include/esp_sleep.h"
#include "components/hal/esp32s2/include/hal/gpio_ll.h"
#include "components/xtensa/include/esp_debug_helpers.h"
#include "components/freertos/include/freertos/FreeRTOS.h"
void common_hal_alarm_pin_pinalarm_construct(alarm_pin_pinalarm_obj_t *self, const mcu_pin_obj_t *pin, bool value, bool edge, bool pull) {
if (edge) {

View File

@ -29,7 +29,7 @@
#include "common-hal/microcontroller/Pin.h"
#include "components/soc/include/hal/adc_types.h"
#include "components/hal/include/hal/adc_types.h"
#include "FreeRTOS.h"
#include "freertos/semphr.h"
#include "py/obj.h"

View File

@ -88,8 +88,8 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
}
#endif
if (xSemaphoreCreateMutexStatic(&self->semaphore) != &self->semaphore) {
self->xSemaphore = xSemaphoreCreateMutexStatic(&self->xSemaphoreBuffer);
if (self->xSemaphore == NULL) {
mp_raise_RuntimeError(translate("Unable to create lock"));
}
self->sda_pin = sda;
@ -168,7 +168,7 @@ bool common_hal_busio_i2c_try_lock(busio_i2c_obj_t *self) {
if (self->has_lock) {
return false;
}
self->has_lock = xSemaphoreTake(&self->semaphore, 0) == pdTRUE;
self->has_lock = xSemaphoreTake(self->xSemaphore, 0) == pdTRUE;
return self->has_lock;
}
@ -177,7 +177,7 @@ bool common_hal_busio_i2c_has_lock(busio_i2c_obj_t *self) {
}
void common_hal_busio_i2c_unlock(busio_i2c_obj_t *self) {
xSemaphoreGive(&self->semaphore);
xSemaphoreGive(self->xSemaphore);
self->has_lock = false;
}

View File

@ -29,7 +29,7 @@
#include "common-hal/microcontroller/Pin.h"
#include "components/soc/include/hal/i2c_types.h"
#include "components/hal/include/hal/i2c_types.h"
#include "FreeRTOS.h"
#include "freertos/semphr.h"
#include "py/obj.h"
@ -39,7 +39,8 @@ typedef struct {
const mcu_pin_obj_t *scl_pin;
const mcu_pin_obj_t *sda_pin;
i2c_port_t i2c_num;
StaticSemaphore_t semaphore;
SemaphoreHandle_t xSemaphore;
StaticSemaphore_t xSemaphoreBuffer;
bool has_lock;
} busio_i2c_obj_t;

View File

@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
* Copyright (c) 2016 Scott Shawcroft
* Copyright (c) 2021 microDev
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -24,282 +24,147 @@
* THE SOFTWARE.
*/
#include "shared-bindings/busio/SPI.h"
#include "py/mperrno.h"
#include "py/runtime.h"
#include <string.h>
#include "shared-bindings/microcontroller/Pin.h"
#include "py/runtime.h"
#include "shared-bindings/busio/SPI.h"
#include "driver/spi_common_internal.h"
#define SPI_MAX_DMA_BITS (SPI_MAX_DMA_LEN * 8)
static bool spi_never_reset[SOC_SPI_PERIPH_NUM];
static spi_device_handle_t spi_handle[SOC_SPI_PERIPH_NUM];
// Store one lock handle per device so that we can free it.
static spi_bus_lock_dev_handle_t lock_dev_handle[SOC_SPI_PERIPH_NUM];
static intr_handle_t intr_handle[SOC_SPI_PERIPH_NUM];
static bool spi_bus_is_free(spi_host_device_t host_id) {
return spi_bus_get_attr(host_id) == NULL;
}
void spi_reset(void) {
for (spi_host_device_t host_id = SPI2_HOST; host_id < SOC_SPI_PERIPH_NUM; host_id++) {
if (spi_never_reset[host_id]) {
continue;
}
bool in_use = false;
if (lock_dev_handle[host_id] != NULL) {
spi_bus_lock_unregister_dev(lock_dev_handle[host_id]);
lock_dev_handle[host_id] = NULL;
in_use = true;
}
if (intr_handle[host_id] != NULL) {
esp_intr_free(intr_handle[host_id]);
intr_handle[host_id] = NULL;
in_use = true;
}
if (in_use) {
if (!spi_bus_is_free(host_id)) {
spi_bus_remove_device(spi_handle[host_id]);
spi_bus_free(host_id);
}
}
}
// This is copied in from the ESP-IDF because it is static.
// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
static bool bus_uses_iomux_pins(spi_host_device_t host, const spi_bus_config_t *bus_config) {
if (bus_config->sclk_io_num >= 0 &&
bus_config->sclk_io_num != spi_periph_signal[host].spiclk_iomux_pin) {
return false;
static void set_spi_config(busio_spi_obj_t *self,
uint32_t baudrate, uint8_t polarity, uint8_t phase, uint8_t bits) {
const spi_device_interface_config_t device_config = {
.clock_speed_hz = baudrate,
.mode = phase | (polarity << 1),
.spics_io_num = -1, // No CS pin
.queue_size = 1,
.pre_cb = NULL
};
esp_err_t result = spi_bus_add_device(self->host_id, &device_config, &spi_handle[self->host_id]);
if (result != ESP_OK) {
mp_raise_RuntimeError(translate("SPI configuration failed"));
}
if (bus_config->quadwp_io_num >= 0 &&
bus_config->quadwp_io_num != spi_periph_signal[host].spiwp_iomux_pin) {
return false;
}
if (bus_config->quadhd_io_num >= 0 &&
bus_config->quadhd_io_num != spi_periph_signal[host].spihd_iomux_pin) {
return false;
}
if (bus_config->mosi_io_num >= 0 &&
bus_config->mosi_io_num != spi_periph_signal[host].spid_iomux_pin) {
return false;
}
if (bus_config->miso_io_num >= 0 &&
bus_config->miso_io_num != spi_periph_signal[host].spiq_iomux_pin) {
return false;
}
return true;
}
// End copied code.
static bool spi_bus_is_free(spi_host_device_t host_id) {
return spi_bus_get_attr(host_id) == NULL;
}
static void spi_interrupt_handler(void *arg) {
// busio_spi_obj_t *self = arg;
}
// The interrupt may get invoked by the bus lock.
static void spi_bus_intr_enable(void *self) {
esp_intr_enable(((busio_spi_obj_t *)self)->interrupt);
}
// The interrupt is always disabled by the ISR itself, not exposed
static void spi_bus_intr_disable(void *self) {
esp_intr_disable(((busio_spi_obj_t *)self)->interrupt);
self->baudrate = baudrate;
self->polarity = polarity;
self->phase = phase;
self->bits = bits;
}
void common_hal_busio_spi_construct(busio_spi_obj_t *self,
const mcu_pin_obj_t *clock, const mcu_pin_obj_t *mosi,
const mcu_pin_obj_t *miso) {
spi_bus_config_t bus_config;
bus_config.mosi_io_num = mosi != NULL ? mosi->number : -1;
bus_config.miso_io_num = miso != NULL ? miso->number : -1;
bus_config.sclk_io_num = clock != NULL ? clock->number : -1;
bus_config.quadwp_io_num = -1;
bus_config.quadhd_io_num = -1;
bus_config.max_transfer_sz = 0; // Uses the default
bus_config.flags = SPICOMMON_BUSFLAG_MASTER | SPICOMMON_BUSFLAG_SCLK |
(mosi != NULL ? SPICOMMON_BUSFLAG_MOSI : 0) |
(miso != NULL ? SPICOMMON_BUSFLAG_MISO : 0);
bus_config.intr_flags = 0;
const spi_bus_config_t bus_config = {
.mosi_io_num = mosi != NULL ? mosi->number : -1,
.miso_io_num = miso != NULL ? miso->number : -1,
.sclk_io_num = clock != NULL ? clock->number : -1,
.quadwp_io_num = -1,
.quadhd_io_num = -1,
};
// RAM and Flash is often on SPI1 and is unsupported by the IDF so use it as
// a flag value.
spi_host_device_t host_id = SPI1_HOST;
self->connected_through_gpio = true;
// Try and save SPI2 for pins that are on the IOMUX
if (bus_uses_iomux_pins(SPI2_HOST, &bus_config) && spi_bus_is_free(SPI2_HOST)) {
host_id = SPI2_HOST;
self->connected_through_gpio = false;
} else if (spi_bus_is_free(SPI3_HOST)) {
host_id = SPI3_HOST;
} else if (spi_bus_is_free(SPI2_HOST)) {
host_id = SPI2_HOST;
for (spi_host_device_t host_id = SPI2_HOST; host_id < SOC_SPI_PERIPH_NUM; host_id++) {
if (spi_bus_is_free(host_id)) {
self->host_id = host_id;
}
}
if (host_id == SPI1_HOST) {
if (self->host_id == 0) {
mp_raise_ValueError(translate("All SPI peripherals are in use"));
}
esp_err_t result = spi_bus_initialize(host_id, &bus_config, host_id /* dma channel */);
esp_err_t result = spi_bus_initialize(self->host_id, &bus_config, self->host_id /* dma channel */);
if (result == ESP_ERR_NO_MEM) {
mp_raise_msg(&mp_type_MemoryError, translate("ESP-IDF memory allocation failed"));
} else if (result == ESP_ERR_INVALID_ARG) {
mp_raise_ValueError(translate("Invalid pins"));
}
// After this point, we need to deinit to free IDF memory so fill out self's pins.
self->clock_pin = clock;
self->MOSI_pin = mosi;
self->MISO_pin = miso;
self->host_id = host_id;
set_spi_config(self, 250000, 0, 0, 8);
spi_bus_lock_dev_config_t config = { .flags = 0 };
// The returned lock is stored in the bus lock but must be freed separately with
// spi_bus_lock_unregister_dev.
result = spi_bus_lock_register_dev(spi_bus_get_attr(host_id)->lock,
&config,
&self->lock);
if (result == ESP_ERR_NO_MEM) {
common_hal_busio_spi_deinit(self);
mp_raise_msg(&mp_type_MemoryError, translate("ESP-IDF memory allocation failed"));
self->MOSI = mosi;
self->MISO = miso;
self->clock = clock;
if (mosi != NULL) {
claim_pin(mosi);
}
lock_dev_handle[host_id] = self->lock;
result = esp_intr_alloc(spicommon_irqsource_for_host(host_id),
bus_config.intr_flags | ESP_INTR_FLAG_INTRDISABLED,
spi_interrupt_handler, self, &self->interrupt);
if (result == ESP_ERR_NO_MEM) {
common_hal_busio_spi_deinit(self);
mp_raise_msg(&mp_type_MemoryError, translate("ESP-IDF memory allocation failed"));
if (miso != NULL) {
claim_pin(miso);
}
intr_handle[host_id] = self->interrupt;
spi_bus_lock_set_bg_control(spi_bus_get_attr(host_id)->lock, spi_bus_intr_enable, spi_bus_intr_disable, self);
spi_hal_context_t *hal = &self->hal_context;
// spi_hal_init clears the given hal context so set everything after.
spi_hal_init(hal, host_id);
// We don't use native CS.
// hal->cs_setup = 0;
// hal->cs_hold = 0;
// hal->cs_pin_id = 0;
hal->sio = 0;
hal->half_duplex = 0;
// hal->tx_lsbfirst = 0;
// hal->rx_lsbfirst = 0;
hal->no_compensate = 1;
// Ignore CS bits
// We don't use cmd, addr or dummy bits.
// hal->cmd = 0;
// hal->cmd_bits = 0;
// hal->addr_bits = 0;
// hal->dummy_bits = 0;
// hal->addr = 0;
claim_pin(self->clock_pin);
if (self->MOSI_pin != NULL) {
claim_pin(self->MOSI_pin);
}
if (self->MISO_pin != NULL) {
claim_pin(self->MISO_pin);
}
hal->io_mode = SPI_LL_IO_MODE_NORMAL;
common_hal_busio_spi_configure(self, 250000, 0, 0, 8);
claim_pin(clock);
}
void common_hal_busio_spi_never_reset(busio_spi_obj_t *self) {
spi_never_reset[self->host_id] = true;
common_hal_never_reset_pin(self->clock_pin);
if (self->MOSI_pin != NULL) {
common_hal_never_reset_pin(self->MOSI_pin);
common_hal_never_reset_pin(self->clock);
if (self->MOSI != NULL) {
common_hal_never_reset_pin(self->MOSI);
}
if (self->MISO_pin != NULL) {
common_hal_never_reset_pin(self->MISO_pin);
if (self->MISO != NULL) {
common_hal_never_reset_pin(self->MISO);
}
}
bool common_hal_busio_spi_deinited(busio_spi_obj_t *self) {
return self->clock_pin == NULL;
return self->clock == NULL;
}
void common_hal_busio_spi_deinit(busio_spi_obj_t *self) {
if (common_hal_busio_spi_deinited(self)) {
return;
}
spi_never_reset[self->host_id] = false;
if (self->lock != NULL) {
spi_bus_lock_unregister_dev(self->lock);
lock_dev_handle[self->host_id] = NULL;
}
if (self->interrupt != NULL) {
esp_intr_free(self->interrupt);
intr_handle[self->host_id] = NULL;
}
spi_bus_remove_device(spi_handle[self->host_id]);
spi_bus_free(self->host_id);
common_hal_reset_pin(self->clock_pin);
common_hal_reset_pin(self->MOSI_pin);
common_hal_reset_pin(self->MISO_pin);
self->clock_pin = NULL;
self->MISO_pin = NULL;
self->MOSI_pin = NULL;
common_hal_reset_pin(self->MOSI);
common_hal_reset_pin(self->MISO);
common_hal_reset_pin(self->clock);
self->clock = NULL;
}
bool common_hal_busio_spi_configure(busio_spi_obj_t *self,
uint32_t baudrate, uint8_t polarity, uint8_t phase, uint8_t bits) {
if (baudrate == self->target_frequency &&
if (baudrate == self->baudrate &&
polarity == self->polarity &&
phase == self->phase &&
bits == self->bits) {
return true;
}
self->hal_context.mode = polarity << 1 | phase;
self->polarity = polarity;
self->phase = phase;
self->bits = bits;
self->target_frequency = baudrate;
self->hal_context.timing_conf = &self->timing_conf;
esp_err_t result = spi_hal_get_clock_conf(&self->hal_context,
self->target_frequency,
128 /* duty_cycle */,
self->connected_through_gpio,
0 /* input_delay_ns */,
&self->real_frequency,
&self->timing_conf);
if (result != ESP_OK) {
return false;
}
spi_hal_setup_device(&self->hal_context);
spi_bus_remove_device(spi_handle[self->host_id]);
set_spi_config(self, baudrate, polarity, phase, bits);
return true;
}
bool common_hal_busio_spi_try_lock(busio_spi_obj_t *self) {
// If our lock has already been taken then return false because someone else
// may already grabbed it in our call stack.
if (self->has_lock) {
return false;
bool grabbed_lock = false;
if (!self->has_lock) {
grabbed_lock = true;
self->has_lock = true;
}
// Wait to grab the lock from another task.
esp_err_t result = spi_bus_lock_acquire_start(self->lock, portMAX_DELAY);
self->has_lock = result == ESP_OK;
return self->has_lock;
return grabbed_lock;
}
bool common_hal_busio_spi_has_lock(busio_spi_obj_t *self) {
@ -307,13 +172,12 @@ bool common_hal_busio_spi_has_lock(busio_spi_obj_t *self) {
}
void common_hal_busio_spi_unlock(busio_spi_obj_t *self) {
spi_bus_lock_acquire_end(self->lock);
self->has_lock = false;
}
bool common_hal_busio_spi_write(busio_spi_obj_t *self,
const uint8_t *data, size_t len) {
if (self->MOSI_pin == NULL) {
if (self->MOSI == NULL) {
mp_raise_ValueError(translate("No MOSI Pin"));
}
return common_hal_busio_spi_transfer(self, data, NULL, len);
@ -321,11 +185,10 @@ bool common_hal_busio_spi_write(busio_spi_obj_t *self,
bool common_hal_busio_spi_read(busio_spi_obj_t *self,
uint8_t *data, size_t len, uint8_t write_value) {
if (self->MISO_pin == NULL) {
if (self->MISO == NULL) {
mp_raise_ValueError(translate("No MISO Pin"));
}
if (self->MOSI_pin == NULL) {
if (self->MOSI == NULL) {
return common_hal_busio_spi_transfer(self, NULL, data, len);
} else {
memset(data, write_value, len);
@ -333,86 +196,73 @@ bool common_hal_busio_spi_read(busio_spi_obj_t *self,
}
}
bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, const uint8_t *data_out, uint8_t *data_in, size_t len) {
bool common_hal_busio_spi_transfer(busio_spi_obj_t *self,
const uint8_t *data_out, uint8_t *data_in, size_t len) {
if (len == 0) {
return true;
}
// Other than the read special case, stop transfers that don't have a pin/array match
if (!self->MOSI_pin && (data_out != data_in)) {
if (!self->MOSI && (data_out != data_in)) {
mp_raise_ValueError(translate("No MOSI Pin"));
}
if (!self->MISO_pin && data_in) {
if (!self->MISO && data_in) {
mp_raise_ValueError(translate("No MISO Pin"));
}
spi_hal_context_t *hal = &self->hal_context;
hal->send_buffer = NULL;
hal->rcv_buffer = NULL;
// Reset timing_conf in case we've moved since the last time we used it.
hal->timing_conf = &self->timing_conf;
lldesc_t tx_dma __attribute__((aligned(16)));
lldesc_t rx_dma __attribute__((aligned(16)));
hal->dmadesc_tx = &tx_dma;
hal->dmadesc_rx = &rx_dma;
hal->dmadesc_n = 1;
spi_transaction_t transaction = { 0 };
size_t burst_length;
// If both of the incoming pointers are DMA capable then use DMA. Otherwise, do
// bursts the size of the SPI data buffer without DMA.
if ((data_out == NULL || esp_ptr_dma_capable(data_out)) &&
(data_in == NULL || esp_ptr_dma_capable(data_out))) {
hal->dma_enabled = 1;
burst_length = LLDESC_MAX_NUM_PER_DESC;
} else {
hal->dma_enabled = 0;
burst_length = sizeof(hal->hw->data_buf);
// When switching to non-DMA, we need to make sure DMA is off. Otherwise,
// the S2 will transmit zeroes instead of our data.
hal->hw->dma_out_link.dma_tx_ena = 0;
hal->hw->dma_out_link.stop = 1;
}
// Round to nearest whole set of bits
int bits_to_send = len * 8 / self->bits * self->bits;
// This rounds up.
size_t burst_count = (len + burst_length - 1) / burst_length;
for (size_t i = 0; i < burst_count; i++) {
size_t offset = burst_length * i;
size_t this_length = len - offset;
if (this_length > burst_length) {
this_length = burst_length;
}
hal->tx_bitlen = this_length * self->bits;
hal->rx_bitlen = this_length * self->bits;
if (len <= 4) {
if (data_out != NULL) {
hal->send_buffer = (uint8_t *)data_out + offset;
}
if (data_in != NULL) {
hal->rcv_buffer = data_in + offset;
memcpy(&transaction.tx_data, data_out, len);
}
spi_hal_setup_trans(hal);
spi_hal_prepare_data(hal);
spi_hal_user_start(hal);
// TODO: Switch to waiting on a lock that is given by an interrupt.
while (!spi_hal_usr_is_done(hal)) {
transaction.flags = SPI_TRANS_USE_TXDATA | SPI_TRANS_USE_RXDATA;
transaction.length = bits_to_send;
spi_device_transmit(spi_handle[self->host_id], &transaction);
if (data_in != NULL) {
memcpy(data_in, &transaction.rx_data, len);
}
} else {
int offset = 0;
int bits_remaining = bits_to_send;
while (bits_remaining && !mp_hal_is_interrupted()) {
memset(&transaction, 0, sizeof(transaction));
transaction.length =
bits_remaining > SPI_MAX_DMA_BITS ? SPI_MAX_DMA_BITS : bits_remaining;
if (data_out != NULL) {
transaction.tx_buffer = data_out + offset;
}
if (data_in != NULL) {
transaction.rx_buffer = data_in + offset;
}
spi_device_transmit(spi_handle[self->host_id], &transaction);
bits_remaining -= transaction.length;
// doesn't need ceil(); loop ends when bits_remaining is 0
offset += transaction.length / 8;
RUN_BACKGROUND_TASKS;
}
spi_hal_fetch_result(hal);
}
hal->dmadesc_tx = NULL;
hal->dmadesc_rx = NULL;
hal->dmadesc_n = 0;
return true;
}
uint32_t common_hal_busio_spi_get_frequency(busio_spi_obj_t *self) {
return self->real_frequency;
}
uint8_t common_hal_busio_spi_get_phase(busio_spi_obj_t *self) {
return self->phase;
return self->baudrate;
}
uint8_t common_hal_busio_spi_get_polarity(busio_spi_obj_t *self) {
return self->polarity;
}
uint8_t common_hal_busio_spi_get_phase(busio_spi_obj_t *self) {
return self->phase;
}

View File

@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
* Copyright (c) 2016 Scott Shawcroft
* Copyright (c) 2021 microDev
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -27,30 +27,24 @@
#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_BUSIO_SPI_H
#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_BUSIO_SPI_H
#include "common-hal/microcontroller/Pin.h"
#include "components/driver/include/driver/spi_common_internal.h"
#include "components/soc/include/hal/spi_hal.h"
#include "components/soc/include/hal/spi_types.h"
#include "py/obj.h"
#include "driver/spi_master.h"
#include "shared-bindings/microcontroller/Pin.h"
typedef struct {
mp_obj_base_t base;
const mcu_pin_obj_t *clock_pin;
const mcu_pin_obj_t *MOSI_pin;
const mcu_pin_obj_t *MISO_pin;
const mcu_pin_obj_t* MOSI;
const mcu_pin_obj_t* MISO;
const mcu_pin_obj_t* clock;
spi_host_device_t host_id;
spi_bus_lock_dev_handle_t lock;
spi_hal_context_t hal_context;
spi_hal_timing_conf_t timing_conf;
intr_handle_t interrupt;
uint32_t target_frequency;
int32_t real_frequency;
uint8_t polarity;
uint8_t phase;
uint8_t bits;
uint8_t phase;
uint8_t polarity;
uint32_t baudrate;
bool has_lock;
bool connected_through_gpio;
} busio_spi_obj_t;
void spi_reset(void);

View File

@ -29,7 +29,7 @@
#include "common-hal/microcontroller/Pin.h"
#include "components/soc/include/hal/uart_types.h"
#include "components/hal/include/hal/uart_types.h"
#include "py/obj.h"
typedef struct {

View File

@ -30,7 +30,7 @@
#include "components/driver/include/driver/gpio.h"
#include "components/soc/include/hal/gpio_hal.h"
#include "components/hal/include/hal/gpio_hal.h"
void common_hal_digitalio_digitalinout_never_reset(
digitalio_digitalinout_obj_t *self) {

View File

@ -38,10 +38,7 @@ static esp_ota_handle_t update_handle = 0;
static const char *TAG = "dualbank";
void dualbank_reset(void) {
// should use `abort` instead of `end`
// but not in idf v4.2
// esp_ota_abort(update_handle);
if (esp_ota_end(update_handle) == ESP_OK) {
if (esp_ota_abort(update_handle) == ESP_OK) {
update_handle = 0;
update_partition = NULL;
}

View File

@ -31,7 +31,7 @@
#include "py/mphal.h"
#include "components/driver/include/driver/gpio.h"
#include "components/soc/include/hal/gpio_hal.h"
#include "components/hal/include/hal/gpio_hal.h"
STATIC uint32_t never_reset_pins[2];
STATIC uint32_t in_use[2];

View File

@ -28,7 +28,7 @@
#include "py/obj.h"
#include "py/runtime.h"
#include "components/soc/soc/include/soc/rtc_periph.h"
#include "components/soc/include/soc/rtc_periph.h"
#include "shared-bindings/rtc/RTC.h"
void common_hal_rtc_get_time(timeutils_struct_time_t *tm) {

@ -1 +1 @@
Subproject commit f30a865fd1a44d880b909b84112f74741412c2ce
Subproject commit d97b6863badec4643bf8d1d1058a65d723572882

View File

@ -18,6 +18,7 @@ CIRCUITPY_AUDIOBUSIO = 1
CIRCUITPY_AUDIOBUSIO_PDMIN = 0
CIRCUITPY_AUDIOBUSIO_I2SOUT = 1
CIRCUITPY_AUDIOIO = 0
CIRCUITPY_AUDIOMIXER = 1
CIRCUITPY_CANIO = 1
CIRCUITPY_COUNTIO = 1
CIRCUITPY_DUALBANK = 1

View File

@ -35,9 +35,9 @@
#include "esp32s2_peripherals_config.h"
#include "esp-idf/config/sdkconfig.h"
#include "components/soc/include/hal/gpio_types.h"
#include "components/soc/include/hal/adc_types.h"
#include "components/soc/include/hal/touch_sensor_types.h"
#include "components/hal/include/hal/gpio_types.h"
#include "components/hal/include/hal/adc_types.h"
#include "components/hal/include/hal/touch_sensor_types.h"
typedef struct {
PIN_PREFIX_FIELDS

View File

@ -24,8 +24,6 @@
* THE SOFTWARE.
*/
#include "components/soc/include/hal/gpio_types.h"
// above include fixes build error in idf@v4.2
#include "peripherals/touch.h"
static bool touch_inited = false;

View File

@ -59,8 +59,8 @@
#include "components/esp_rom/include/esp32s2/rom/ets_sys.h"
#include "components/heap/include/esp_heap_caps.h"
#include "components/xtensa/include/esp_debug_helpers.h"
#include "components/soc/soc/esp32s2/include/soc/cache_memory.h"
#include "components/soc/soc/esp32s2/include/soc/rtc_cntl_reg.h"
#include "components/soc/esp32s2/include/soc/cache_memory.h"
#include "components/soc/esp32s2/include/soc/rtc_cntl_reg.h"
#if CIRCUITPY_AUDIOBUSIO
#include "common-hal/audiobusio/__init__.h"

View File

@ -31,11 +31,11 @@
#include "lib/utils/interrupt_char.h"
#include "lib/mp-readline/readline.h"
#include "components/soc/soc/esp32s2/include/soc/usb_periph.h"
#include "components/driver/include/driver/periph_ctrl.h"
#include "components/driver/include/driver/gpio.h"
#include "components/driver/include/driver/periph_ctrl.h"
#include "components/esp_rom/include/esp32s2/rom/gpio.h"
#include "components/soc/src/esp32s2/include/hal/gpio_ll.h"
#include "components/hal/esp32s2/include/hal/gpio_ll.h"
#include "components/soc/esp32s2/include/soc/usb_periph.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
@ -120,7 +120,7 @@ void tud_cdc_rx_wanted_cb(uint8_t itf, char wanted_char) {
// Compare mp_interrupt_char with wanted_char and ignore if not matched
if (mp_interrupt_char == wanted_char) {
tud_cdc_read_flush(); // flush read fifo
mp_keyboard_interrupt();
mp_sched_keyboard_interrupt();
// CircuitPython's VM is run in a separate FreeRTOS task from TinyUSB.
// So, we must notify the other task when a CTRL-C is received.
xTaskNotifyGive(circuitpython_task);

View File

@ -41,11 +41,6 @@
#include "common-hal/audiopwmio/PWMAudioOut.h"
#endif
#if CIRCUITPY_BLEIO
#include "supervisor/shared/bluetooth.h"
#include "common-hal/_bleio/bonding.h"
#endif
void port_start_background_task(void) {
}
void port_finish_background_task(void) {

View File

@ -38,9 +38,6 @@
#include "py/misc.h"
#include "py/mpstate.h"
#include "supervisor/shared/bluetooth.h"
#include "supervisor/bluetooth.h"
nrf_nvic_state_t nrf_nvic_state = { 0 };
// Flag indicating progress of internal flash operation.
@ -56,6 +53,14 @@ void ble_drv_reset() {
}
void ble_drv_add_event_handler_entry(ble_drv_evt_handler_entry_t *entry, ble_drv_evt_handler_t func, void *param) {
ble_drv_evt_handler_entry_t *it = MP_STATE_VM(ble_drv_evt_handler_entries);
while (it != NULL) {
// If event handler and its corresponding param are already on the list, don't add again.
if ((it->func == func) && (it->param == param)) {
return;
}
it = it->next;
}
entry->next = MP_STATE_VM(ble_drv_evt_handler_entries);
entry->param = param;
entry->func = func;
@ -85,6 +90,8 @@ void ble_drv_remove_event_handler(ble_drv_evt_handler_t func, void *param) {
if ((it->func == func) && (it->param == param)) {
// Splice out the matching handler.
*prev = it->next;
// Clear next of the removed node so it's clearly not in a list.
it->next = NULL;
return;
}
prev = &(it->next);
@ -138,21 +145,26 @@ void SD_EVT_IRQHandler(void) {
ble_evt_t *event = (ble_evt_t *)m_ble_evt_buf;
#if CIRCUITPY_VERBOSE_BLE
mp_printf(&mp_plat_print, "BLE event: 0x%04x\n", event->header.evt_id);
#endif
if (supervisor_bluetooth_hook(event)) {
continue;
size_t eid = event->header.evt_id;
if (eid != 0x1d) {
if (BLE_GAP_EVT_BASE <= eid && eid <= BLE_GAP_EVT_LAST) {
mp_printf(&mp_plat_print, "BLE GAP event: %d\n", eid - BLE_GAP_EVT_BASE);
} else {
mp_printf(&mp_plat_print, "BLE event: 0x%04x\n", event->header.evt_id);
}
}
#endif
ble_drv_evt_handler_entry_t *it = MP_STATE_VM(ble_drv_evt_handler_entries);
bool done = false;
while (it != NULL) {
#if CIRCUITPY_VERBOSE_BLE
// mp_printf(&mp_plat_print, " calling handler: 0x%08lx, param: 0x%08lx\n", it->func-1, it->param);
// mp_printf(&mp_plat_print, " calling handler: 0x%08lx, param: 0x%08lx\n", it->func - 1, it->param);
#endif
// Capture next before calling the function in case it removes itself from the list.
ble_drv_evt_handler_entry_t *next = it->next;
done = it->func(event, it->param) || done;
it = it->next;
it = next;
}
#if CIRCUITPY_VERBOSE_BLE
if (event->header.evt_id == BLE_GATTS_EVT_WRITE) {

View File

@ -1,191 +0,0 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
* Copyright (c) 2018 Artur Pacholec
* Copyright (c) 2017 Glenn Ruben Bakke
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <string.h>
#include "ble.h"
#include "ble_uart.h"
#include "ringbuffer.h"
#include "py/mphal.h"
#include "py/runtime.h"
#include "lib/utils/interrupt_char.h"
#include "shared-bindings/_bleio/Adapter.h"
#include "shared-bindings/_bleio/Characteristic.h"
#include "shared-bindings/_bleio/Device.h"
#include "shared-bindings/_bleio/Service.h"
#include "shared-bindings/_bleio/UUID.h"
#if CIRCUITPY_CONSOLE_BLE
static const char default_name[] = "CP-REPL"; // max 8 chars or uuid won't fit in adv data
static const char NUS_UUID[] = "6e400001-b5a3-f393-e0a9-e50e24dcca9e";
#define NUS_RX_UUID 0x0002
#define NUS_TX_UUID 0x0003
#define BUFFER_SIZE 128
ringBuffer_typedef(uint8_t, ringbuffer_t);
static bleio_device_obj_t m_device;
static bleio_service_obj_t *m_nus;
static bleio_characteristic_obj_t *m_tx_chara;
static bleio_characteristic_obj_t *m_rx_chara;
static volatile bool m_cccd_enabled;
static uint8_t m_rx_ring_buffer_data[BUFFER_SIZE];
static ringbuffer_t m_rx_ring_buffer = {
.size = sizeof(m_rx_ring_buffer_data) + 1,
.elems = m_rx_ring_buffer_data,
};
STATIC void on_ble_evt(ble_evt_t *ble_evt, void *param) {
switch (ble_evt->header.evt_id) {
case BLE_GAP_EVT_DISCONNECTED: {
mp_obj_t device_obj = MP_OBJ_FROM_PTR(&m_device);
mp_call_function_0(mp_load_attr(device_obj, qstr_from_str("start_advertising")));
break;
}
case BLE_GATTS_EVT_WRITE: {
ble_gatts_evt_write_t *write = &ble_evt->evt.gatts_evt.params.write;
if (write->handle == m_tx_chara->cccd_handle) {
m_cccd_enabled = true;
} else if (write->handle == m_rx_chara->handle) {
for (size_t i = 0; i < write->len; ++i) {
#if MICROPY_KBD_EXCEPTION
if (write->data[i] == mp_interrupt_char) {
mp_keyboard_interrupt();
} else
#endif
{
bufferWrite(&m_rx_ring_buffer, write->data[i]);
}
}
}
}
}
}
void ble_uart_init(void) {
mp_obj_t device_obj = MP_OBJ_FROM_PTR(&m_device);
m_device.base.type = &bleio_device_type;
m_device.service_list = mp_obj_new_list(0, NULL);
m_device.notif_handler = mp_const_none;
m_device.conn_handler = mp_const_none;
m_device.conn_handle = 0xFFFF;
m_device.is_peripheral = true;
m_device.name = mp_obj_new_str(default_name, strlen(default_name), false);
common_hal_bleio_adapter_get_address(&m_device.address);
mp_obj_t nus_uuid_str = mp_obj_new_str(NUS_UUID, strlen(NUS_UUID), false);
mp_obj_t nus_uuid_obj = bleio_uuid_type.make_new(&bleio_uuid_type, 1, 0, &nus_uuid_str);
mp_obj_t nus_obj = bleio_service_type.make_new(&bleio_service_type, 1, 0, &nus_uuid_obj);
m_nus = MP_OBJ_TO_PTR(nus_obj);
mp_call_function_1(mp_load_attr(device_obj, qstr_from_str("add_service")), nus_obj);
mp_obj_t tx_uuid_int = mp_obj_new_int(NUS_TX_UUID);
mp_obj_t tx_uuid_obj = bleio_uuid_type.make_new(&bleio_uuid_type, 1, 0, &tx_uuid_int);
mp_obj_t tx_obj = bleio_characteristic_type.make_new(&bleio_characteristic_type, 1, 0, &tx_uuid_obj);
m_tx_chara = MP_OBJ_TO_PTR(tx_obj);
m_tx_chara->uuid->type = UUID_TYPE_128BIT;
m_tx_chara->uuid->uuid_vs_idx = m_nus->uuid->uuid_vs_idx;
m_tx_chara->props.notify = true;
mp_call_function_1(mp_load_attr(nus_obj, qstr_from_str("add_characteristic")), tx_obj);
mp_obj_t rx_uuid_int = mp_obj_new_int(NUS_RX_UUID);
mp_obj_t rx_uuid_obj = bleio_uuid_type.make_new(&bleio_uuid_type, 1, 0, &rx_uuid_int);
mp_obj_t rx_obj = bleio_characteristic_type.make_new(&bleio_characteristic_type, 1, 0, &rx_uuid_obj);
m_rx_chara = MP_OBJ_TO_PTR(rx_obj);
m_rx_chara->uuid->type = UUID_TYPE_128BIT;
m_rx_chara->uuid->uuid_vs_idx = m_nus->uuid->uuid_vs_idx;
m_rx_chara->props.write = true;
m_rx_chara->props.write_wo_resp = true;
mp_call_function_1(mp_load_attr(nus_obj, qstr_from_str("add_characteristic")), rx_obj);
mp_call_function_0(mp_load_attr(device_obj, qstr_from_str("start_advertising")));
ble_drv_add_event_handler(on_ble_evt, &m_device);
m_cccd_enabled = false;
while (!m_cccd_enabled) {
RUN_BACKGROUND_TASKS;
}
}
bool ble_uart_connected(void) {
return m_device.conn_handle != BLE_CONN_HANDLE_INVALID;
}
char ble_uart_rx_chr(void) {
while (isBufferEmpty(&m_rx_ring_buffer)) {
RUN_BACKGROUND_TASKS;
}
uint8_t byte;
bufferRead(&m_rx_ring_buffer, byte);
return (int)byte;
}
bool ble_uart_stdin_any(void) {
return !isBufferEmpty(&m_rx_ring_buffer);
}
void ble_uart_stdout_tx_str(const char *text) {
mp_hal_stdout_tx_strn(text, strlen(text));
}
int mp_hal_stdin_rx_chr(void) {
return ble_uart_rx_chr();
}
void mp_hal_stdout_tx_strn(const char *str, size_t len) {
size_t send_len;
while (len > 0) {
if (len >= BLE_GATT_ATT_MTU_DEFAULT - 3) {
send_len = (BLE_GATT_ATT_MTU_DEFAULT - 3);
} else {
send_len = len;
}
mp_buffer_info_t bufinfo = {
.buf = (uint8_t *)str,
.len = send_len,
};
common_hal_bleio_characteristic_write_value(m_tx_chara, &bufinfo);
len -= send_len;
str += send_len;
}
}
#endif // CIRCUITPY_CONSOLE_BLE

View File

@ -1,99 +0,0 @@
/* The MIT License (MIT)
*
* Copyright (c) 2013 Philip Thrasher
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* Philip Thrasher's Crazy Awesome Ring Buffer Macros!
*
* Below you will find some naughty macros for easy owning and manipulating
* generic ring buffers. Yes, they are slightly evil in readability, but they
* are really fast, and they work great.
*
* Example usage:
*
* #include <stdio.h>
*
* // So we can use this in any method, this gives us a typedef
* // named 'intBuffer'.
* ringBuffer_typedef(int, intBuffer);
*
* int main() {
* // Declare vars.
* intBuffer myBuffer;
*
* bufferInit(myBuffer,1024,int);
*
* // We must have the pointer. All of the macros deal with the pointer.
* // (except for init.)
* intBuffer* myBuffer_ptr;
* myBuffer_ptr = &myBuffer;
*
* // Write two values.
* bufferWrite(myBuffer_ptr,37);
* bufferWrite(myBuffer_ptr,72);
*
* // Read a value into a local variable.
* int first;
* bufferRead(myBuffer_ptr,first);
* assert(first == 37); // true
*
* int second;
* bufferRead(myBuffer_ptr,second);
* assert(second == 72); // true
*
* return 0;
* }
*
*/
#ifndef _ringbuffer_h
#define _ringbuffer_h
#define ringBuffer_typedef(T, NAME) \
typedef struct { \
int size; \
volatile int start; \
volatile int end; \
T *elems; \
} NAME
#define bufferInit(BUF, S, T) \
BUF.size = S + 1; \
BUF.start = 0; \
BUF.end = 0; \
BUF.elems = (T *)calloc(BUF.size, sizeof(T))
#define bufferDestroy(BUF) free((BUF)->elems)
#define nextStartIndex(BUF) (((BUF)->start + 1) % (BUF)->size)
#define nextEndIndex(BUF) (((BUF)->end + 1) % (BUF)->size)
#define isBufferEmpty(BUF) ((BUF)->end == (BUF)->start)
#define isBufferFull(BUF) (nextEndIndex(BUF) == (BUF)->start)
#define bufferWrite(BUF, ELEM) \
(BUF)->elems[(BUF)->end] = ELEM; \
(BUF)->end = ((BUF)->end + 1) % (BUF)->size; \
if (isBufferEmpty(BUF)) { \
(BUF)->start = nextStartIndex(BUF); \
}
#define bufferRead(BUF, ELEM) \
ELEM = (BUF)->elems[(BUF)->start]; \
(BUF)->start = nextStartIndex(BUF);
#endif

View File

@ -18,6 +18,7 @@ CIRCUITPY_FRAMEBUFFERIO = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_I2CPERIPHERAL = 0
CIRCUITPY_JSON = 0
CIRCUITPY_KEYPAD = 0
CIRCUITPY_MSGPACK = 0
CIRCUITPY_NEOPIXEL_WRITE = 0
CIRCUITPY_NVM = 0
@ -26,6 +27,7 @@ CIRCUITPY_RE = 0
CIRCUITPY_RGBMATRIX = 0
CIRCUITPY_SDCARDIO = 0
CIRCUITPY_ULAB = 0
CIRCUITPY_USB_MIDI = 0
MICROPY_PY_ASYNC_AWAIT = 0

View File

@ -20,7 +20,7 @@ CIRCUITPY_COUNTIO = 0
CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_ERRNO = 0
CIRCUITPY_FRAMEBUFFERIO = 0
CIRCUITPY_GAMEPAD = 0
CIRCUITPY_KEYPAD = 0
CIRCUITPY_MSGPACK = 0
CIRCUITPY_NEOPIXEL_WRITE = 0
CIRCUITPY_NVM = 0
@ -43,3 +43,5 @@ CIRCUITPY_WATCHDOG = 1
# Override optimization to keep binary small
OPTIMIZATION_FLAGS = -Os
SUPEROPT_VM = 0
SUPEROPT_GC = 0

View File

@ -40,6 +40,7 @@
#include "py/gc.h"
#include "py/objstr.h"
#include "py/runtime.h"
#include "supervisor/shared/bluetooth/bluetooth.h"
#include "supervisor/shared/safe_mode.h"
#include "supervisor/shared/tick.h"
#include "supervisor/usb.h"
@ -174,6 +175,16 @@ STATIC uint32_t ble_stack_enable(void) {
return err_code;
}
// Make sure service changed characteristic is on. This lets us prompt a peer to re-discover
// portions of our attribute table.
memset(&ble_conf, 0, sizeof(ble_conf));
ble_conf.gatts_cfg.service_changed.service_changed = 1;
err_code = sd_ble_cfg_set(BLE_GATTS_CFG_SERVICE_CHANGED, &ble_conf, sd_ram_end);
if (err_code != NRF_SUCCESS) {
return err_code;
}
// Increase the GATT Server attribute size to accomodate both the CircuitPython built-in service
// and anything the user does.
memset(&ble_conf, 0, sizeof(ble_conf));
@ -231,6 +242,9 @@ STATIC bool adapter_on_ble_evt(ble_evt_t *ble_evt, void *self_in) {
// For debugging.
// mp_printf(&mp_plat_print, "Adapter event: 0x%04x\n", ble_evt->header.evt_id);
// Always queue a background run after a BLE event.
background_callback_add_core(&self->background_callback);
switch (ble_evt->header.evt_id) {
case BLE_GAP_EVT_CONNECTED: {
// Find an empty connection. One must always be available because the SD has the same
@ -299,10 +313,6 @@ STATIC bool adapter_on_ble_evt(ble_evt_t *ble_evt, void *self_in) {
break;
}
case BLE_GAP_EVT_ADV_SET_TERMINATED:
self->current_advertising_data = NULL;
break;
default:
// For debugging.
// mp_printf(&mp_plat_print, "Unhandled adapter event: 0x%04x\n", ble_evt->header.evt_id);
@ -333,6 +343,11 @@ STATIC void bleio_adapter_reset_name(bleio_adapter_obj_t *self) {
common_hal_bleio_adapter_set_name(self, (char *)default_ble_name);
}
static void bluetooth_adapter_background(void *data) {
supervisor_bluetooth_background();
bleio_background();
}
void common_hal_bleio_adapter_set_enabled(bleio_adapter_obj_t *self, bool enabled) {
const bool is_enabled = common_hal_bleio_adapter_get_enabled(self);
@ -341,7 +356,7 @@ void common_hal_bleio_adapter_set_enabled(bleio_adapter_obj_t *self, bool enable
return;
}
uint32_t err_code;
uint32_t err_code = NRF_SUCCESS;
if (enabled) {
// The SD takes over the POWER module and will fail if the module is already in use.
// Occurs when USB is initialized previously
@ -365,11 +380,19 @@ void common_hal_bleio_adapter_set_enabled(bleio_adapter_obj_t *self, bool enable
bleio_connection_internal_t *connection = &bleio_connections[i];
// Reset connection.
bleio_connection_clear(connection);
ble_drv_remove_event_handler(connection_on_ble_evt, connection);
connection->conn_handle = BLE_CONN_HANDLE_INVALID;
}
self->background_callback.fun = bluetooth_adapter_background;
self->background_callback.data = self;
bleio_adapter_reset_name(self);
ble_drv_add_event_handler_entry(&self->handler_entry, adapter_on_ble_evt, self);
ble_drv_add_event_handler_entry(&self->connection_handler_entry, adapter_on_ble_evt, self);
bluetooth_adapter_background(self);
} else {
ble_drv_remove_event_handler(adapter_on_ble_evt, self);
if (self->current_advertising_data != NULL) {
common_hal_bleio_adapter_stop_advertising(self);
}
ble_drv_reset();
self->scan_results = NULL;
self->current_advertising_data = NULL;
@ -428,6 +451,22 @@ void common_hal_bleio_adapter_set_name(bleio_adapter_obj_t *self, const char *na
sd_ble_gap_device_name_set(&sec, (const uint8_t *)name, strlen(name));
}
STATIC uint32_t _update_identities(bool is_central) {
const ble_gap_id_key_t *keys[BLE_GAP_DEVICE_IDENTITIES_MAX_COUNT];
// TODO: Make sure we don't store more than BLE_GAP_DEVICE_IDENTITIES_MAX_COUNT identities of
// each type. Right now, we'll silently ignore those keys.
size_t len = bonding_load_identities(is_central, keys, BLE_GAP_DEVICE_IDENTITIES_MAX_COUNT);
uint32_t status = NRF_SUCCESS;
if (len > 0) {
status = sd_ble_gap_device_identities_set(
keys,
NULL, // Don't set local IRK because we use our device IRK for private addresses.
len
);
}
return status;
};
STATIC bool scan_on_ble_evt(ble_evt_t *ble_evt, void *scan_results_in) {
bleio_scanresults_obj_t *scan_results = (bleio_scanresults_obj_t *)scan_results_in;
@ -476,6 +515,11 @@ mp_obj_t common_hal_bleio_adapter_start_scan(bleio_adapter_obj_t *self, uint8_t
sd_data->len = max_packet_size;
sd_data->p_data = raw_data + sizeof(ble_data_t);
// Update the identities of peripheral peers so they can use a private
// resolvable address in their advertisements.
check_nrf_error(_update_identities(true));
ble_drv_add_event_handler(scan_on_ble_evt, self->scan_results);
uint32_t nrf_timeout = SEC_TO_UNITS(timeout, UNIT_10_MS) + 0.5f;
@ -500,9 +544,8 @@ mp_obj_t common_hal_bleio_adapter_start_scan(bleio_adapter_obj_t *self, uint8_t
.scan_phys = BLE_GAP_PHY_1MBPS,
.active = active
};
uint32_t err_code;
vm_used_ble = true;
err_code = sd_ble_gap_scan_start(&scan_params, sd_data);
uint32_t err_code = sd_ble_gap_scan_start(&scan_params, sd_data);
if (err_code != NRF_SUCCESS) {
ble_drv_remove_event_handler(scan_on_ble_evt, self->scan_results);
@ -514,6 +557,9 @@ mp_obj_t common_hal_bleio_adapter_start_scan(bleio_adapter_obj_t *self, uint8_t
}
void common_hal_bleio_adapter_stop_scan(bleio_adapter_obj_t *self) {
if (self->scan_results == NULL) {
return;
}
sd_ble_gap_scan_stop();
shared_module_bleio_scanresults_set_done(self->scan_results, true);
ble_drv_remove_event_handler(scan_on_ble_evt, self->scan_results);
@ -548,14 +594,16 @@ STATIC bool connect_on_ble_evt(ble_evt_t *ble_evt, void *info_in) {
return true;
}
mp_obj_t common_hal_bleio_adapter_connect(bleio_adapter_obj_t *self, bleio_address_obj_t *address, mp_float_t timeout) {
ble_gap_addr_t addr;
addr.addr_type = address->type;
STATIC void _convert_address(const bleio_address_obj_t *address, ble_gap_addr_t *sd_address) {
sd_address->addr_type = address->type;
mp_buffer_info_t address_buf_info;
mp_get_buffer_raise(address->bytes, &address_buf_info, MP_BUFFER_READ);
memcpy(addr.addr, (uint8_t *)address_buf_info.buf, NUM_BLEIO_ADDRESS_BYTES);
memcpy(sd_address->addr, (uint8_t *)address_buf_info.buf, NUM_BLEIO_ADDRESS_BYTES);
}
mp_obj_t common_hal_bleio_adapter_connect(bleio_adapter_obj_t *self, bleio_address_obj_t *address, mp_float_t timeout) {
ble_gap_addr_t addr;
_convert_address(address, &addr);
ble_gap_scan_params_t scan_params = {
.interval = MSEC_TO_UNITS(100, UNIT_0_625_MS),
@ -576,7 +624,6 @@ mp_obj_t common_hal_bleio_adapter_connect(bleio_adapter_obj_t *self, bleio_addre
ble_drv_add_event_handler(connect_on_ble_evt, &event_info);
event_info.done = false;
vm_used_ble = true;
uint32_t err_code = sd_ble_gap_connect(&addr, &scan_params, &conn_params, BLE_CONN_CFG_TAG_CUSTOM);
if (err_code != NRF_SUCCESS) {
@ -594,6 +641,17 @@ mp_obj_t common_hal_bleio_adapter_connect(bleio_adapter_obj_t *self, bleio_addre
if (conn_handle == BLE_CONN_HANDLE_INVALID) {
mp_raise_bleio_BluetoothError(translate("Failed to connect: timeout"));
}
// If we have keys, then try and encrypt the connection.
const ble_gap_enc_key_t *encryption_key = bonding_load_peer_encryption_key(true, &addr);
pair_status_t pair_status = PAIR_NOT_PAIRED;
if (encryption_key != NULL) {
err_code = sd_ble_gap_encrypt(conn_handle, &encryption_key->master_id, &encryption_key->enc_info);
pair_status = PAIR_WAITING;
if (err_code != NRF_SUCCESS) {
pair_status = PAIR_NOT_PAIRED;
}
}
// Negotiate for better PHY, larger MTU and data lengths since we are the central. These are
// nice-to-haves so ignore any errors.
@ -610,6 +668,7 @@ mp_obj_t common_hal_bleio_adapter_connect(bleio_adapter_obj_t *self, bleio_addre
bleio_connection_internal_t *connection = &bleio_connections[i];
if (connection->conn_handle == conn_handle) {
connection->is_central = true;
connection->pair_status = pair_status;
return bleio_connection_new_from_internal(connection);
}
}
@ -634,9 +693,14 @@ STATIC bool advertising_on_ble_evt(ble_evt_t *ble_evt, void *self_in) {
bleio_adapter_obj_t *self = (bleio_adapter_obj_t *)self_in;
switch (ble_evt->header.evt_id) {
case BLE_GAP_EVT_CONNECTED: // Connecting also stops an advertisement.
// Set the tx_power for the connection higher than the advertisement.
sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_CONN, ble_evt->evt.gap_evt.conn_handle, 0);
common_hal_bleio_adapter_stop_advertising(self);
return false;
break;
case BLE_GAP_EVT_ADV_SET_TERMINATED:
common_hal_bleio_adapter_stop_advertising(self);
ble_drv_remove_event_handler(advertising_on_ble_evt, self_in);
break;
default:
@ -648,10 +712,11 @@ STATIC bool advertising_on_ble_evt(ble_evt_t *ble_evt, void *self_in) {
return true;
}
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) {
uint32_t _common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self,
bool connectable, bool anonymous, uint32_t timeout, float interval,
const uint8_t *advertising_data, uint16_t advertising_data_len,
const uint8_t *scan_response_data, uint16_t scan_response_data_len,
mp_int_t tx_power, const bleio_address_obj_t *directed_to) {
if (self->current_advertising_data != NULL && self->current_advertising_data == self->advertising_data) {
return NRF_ERROR_BUSY;
}
@ -667,6 +732,8 @@ uint32_t _common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self,
scan_response_data_len > BLE_GAP_ADV_SET_DATA_SIZE_MAX;
uint8_t adv_type;
ble_gap_addr_t *peer = NULL;
ble_gap_addr_t peer_address;
if (extended) {
if (connectable) {
adv_type = BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED;
@ -676,7 +743,17 @@ uint32_t _common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self,
adv_type = BLE_GAP_ADV_TYPE_EXTENDED_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED;
}
} else if (connectable) {
adv_type = BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED;
if (directed_to == NULL) {
adv_type = BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED;
} else if (interval <= 3.5 && timeout <= 1.3) {
adv_type = BLE_GAP_ADV_TYPE_CONNECTABLE_NONSCANNABLE_DIRECTED_HIGH_DUTY_CYCLE;
_convert_address(directed_to, &peer_address);
peer = &peer_address;
} else {
adv_type = BLE_GAP_ADV_TYPE_CONNECTABLE_NONSCANNABLE_DIRECTED;
_convert_address(directed_to, &peer_address);
peer = &peer_address;
}
} else if (scan_response_data_len > 0) {
adv_type = BLE_GAP_ADV_TYPE_NONCONNECTABLE_SCANNABLE_UNDIRECTED;
} else {
@ -714,26 +791,34 @@ uint32_t _common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self,
.duration = SEC_TO_UNITS(timeout, UNIT_10_MS),
.filter_policy = BLE_GAP_ADV_FP_ANY,
.primary_phy = BLE_GAP_PHY_1MBPS,
.p_peer_addr = peer,
};
const ble_gap_adv_data_t ble_gap_adv_data = {
.adv_data.p_data = advertising_data,
.adv_data.p_data = (uint8_t *)advertising_data,
.adv_data.len = advertising_data_len,
.scan_rsp_data.p_data = scan_response_data_len > 0 ? scan_response_data : NULL,
.scan_rsp_data.p_data = scan_response_data_len > 0 ? (uint8_t *)scan_response_data : NULL,
.scan_rsp_data.len = scan_response_data_len,
};
// Update the identities of central peers so they can use a private address
// in the scan and connection initiation.
err_code = _update_identities(false);
if (err_code != NRF_SUCCESS) {
return err_code;
}
err_code = sd_ble_gap_adv_set_configure(&adv_handle, &ble_gap_adv_data, &adv_params);
if (err_code != NRF_SUCCESS) {
return err_code;
}
ble_drv_add_event_handler(advertising_on_ble_evt, self);
ble_drv_add_event_handler_entry(&self->advertising_handler_entry, advertising_on_ble_evt, self);
err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, adv_handle, tx_power);
if (err_code != NRF_SUCCESS) {
return err_code;
}
vm_used_ble = true;
err_code = sd_ble_gap_adv_start(adv_handle, BLE_CONN_CFG_TAG_CUSTOM);
if (err_code != NRF_SUCCESS) {
return err_code;
@ -743,9 +828,16 @@ uint32_t _common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self,
}
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) {
if (self->current_advertising_data != NULL && self->current_advertising_data == self->advertising_data) {
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, const bleio_address_obj_t *directed_to) {
if (self->user_advertising) {
mp_raise_bleio_BluetoothError(translate("Already advertising."));
} else if (self->current_advertising_data != NULL) {
// If the user isn't advertising, then the background is. So, stop the
// background advertising so the user can.
common_hal_bleio_adapter_stop_advertising(self);
}
// interval value has already been validated.
@ -756,6 +848,11 @@ void common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self, bool
mp_raise_bleio_BluetoothError(translate("Extended advertisements with scan response not supported."));
}
if (advertising_data_bufinfo->len > 0 && directed_to != NULL) {
mp_raise_bleio_BluetoothError(translate("Data not supported with directed advertising"));
}
// Anonymous mode requires a timeout so that we don't continue to broadcast
// the same data while cycling the MAC address -- otherwise, what's the
// point of randomizing the MAC address?
@ -792,7 +889,9 @@ void common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self, bool
advertising_data_bufinfo->len,
self->scan_response_data,
scan_response_data_bufinfo->len,
tx_power));
tx_power,
directed_to));
self->user_advertising = true;
}
void common_hal_bleio_adapter_stop_advertising(bleio_adapter_obj_t *self) {
@ -800,9 +899,10 @@ void common_hal_bleio_adapter_stop_advertising(bleio_adapter_obj_t *self) {
return;
}
// TODO: Don't actually stop. Switch to advertising CircuitPython if we don't already have a connection.
const uint32_t err_code = sd_ble_gap_adv_stop(adv_handle);
ble_drv_remove_event_handler(advertising_on_ble_evt, self);
self->current_advertising_data = NULL;
self->user_advertising = false;
if ((err_code != NRF_SUCCESS) && (err_code != NRF_ERROR_INVALID_STATE)) {
check_nrf_error(err_code);
@ -847,6 +947,10 @@ void common_hal_bleio_adapter_erase_bonding(bleio_adapter_obj_t *self) {
bonding_erase_storage();
}
bool common_hal_bleio_adapter_is_bonded_to_central(bleio_adapter_obj_t *self) {
return bonding_peripheral_bond_count() > 0;
}
void bleio_adapter_gc_collect(bleio_adapter_obj_t *adapter) {
gc_collect_root((void **)adapter, sizeof(bleio_adapter_obj_t) / sizeof(size_t));
gc_collect_root((void **)bleio_connections, sizeof(bleio_connections) / sizeof(size_t));

View File

@ -35,6 +35,8 @@
#include "shared-bindings/_bleio/Connection.h"
#include "shared-bindings/_bleio/ScanResults.h"
#include "supervisor/background_callback.h"
#ifndef BLEIO_TOTAL_CONNECTION_COUNT
#define BLEIO_TOTAL_CONNECTION_COUNT 5
#endif
@ -43,13 +45,18 @@ extern bleio_connection_internal_t bleio_connections[BLEIO_TOTAL_CONNECTION_COUN
typedef struct {
mp_obj_base_t base;
// Pointer to buffers we maintain so that the data is long lived.
uint8_t *advertising_data;
uint8_t *scan_response_data;
uint8_t *current_advertising_data;
// Pointer to current data.
const uint8_t *current_advertising_data;
bleio_scanresults_obj_t *scan_results;
mp_obj_t name;
mp_obj_tuple_t *connection_objs;
ble_drv_evt_handler_entry_t handler_entry;
ble_drv_evt_handler_entry_t connection_handler_entry;
ble_drv_evt_handler_entry_t advertising_handler_entry;
background_callback_t background_callback;
bool user_advertising;
} bleio_adapter_obj_t;
void bleio_adapter_gc_collect(bleio_adapter_obj_t *adapter);

View File

@ -83,15 +83,37 @@ STATIC void characteristic_gatts_notify_indicate(uint16_t handle, uint16_t conn_
}
}
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) {
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) {
self->service = service;
self->uuid = uuid;
self->handle = BLE_GATT_HANDLE_INVALID;
self->props = props;
self->read_perm = read_perm;
self->write_perm = write_perm;
self->initial_value = mp_obj_new_bytes(initial_value_bufinfo->buf, initial_value_bufinfo->len);
self->descriptor_list = mp_obj_new_list(0, NULL);
self->initial_value_len = 0;
self->initial_value = NULL;
if (initial_value_bufinfo != NULL) {
// Copy the initial value if it's on the heap. Otherwise it's internal and we may not be able
// to allocate.
self->initial_value_len = initial_value_bufinfo->len;
if (gc_alloc_possible()) {
if (gc_nbytes(initial_value_bufinfo->buf) > 0) {
uint8_t *initial_value = m_malloc(self->initial_value_len, false);
memcpy(initial_value, initial_value_bufinfo->buf, self->initial_value_len);
self->initial_value = initial_value;
} else {
self->initial_value = initial_value_bufinfo->buf;
}
self->descriptor_list = mp_obj_new_list(0, NULL);
} else {
self->initial_value = initial_value_bufinfo->buf;
self->descriptor_list = NULL;
}
}
const mp_int_t max_length_max = fixed_length ? BLE_GATTS_FIX_ATTR_LEN_MAX : BLE_GATTS_VAR_ATTR_LEN_MAX;
if (max_length < 0 || max_length > max_length_max) {
@ -104,11 +126,14 @@ void common_hal_bleio_characteristic_construct(bleio_characteristic_obj_t *self,
if (service->is_remote) {
self->handle = handle;
} else {
common_hal_bleio_service_add_characteristic(self->service, self, initial_value_bufinfo);
common_hal_bleio_service_add_characteristic(self->service, self, initial_value_bufinfo, user_description);
}
}
mp_obj_tuple_t *common_hal_bleio_characteristic_get_descriptors(bleio_characteristic_obj_t *self) {
if (self->descriptor_list == NULL) {
return mp_const_empty_tuple;
}
return mp_obj_new_tuple(self->descriptor_list->len, self->descriptor_list->items);
}
@ -193,6 +218,11 @@ bleio_characteristic_properties_t common_hal_bleio_characteristic_get_properties
}
void common_hal_bleio_characteristic_add_descriptor(bleio_characteristic_obj_t *self, bleio_descriptor_obj_t *descriptor) {
if (self->descriptor_list == NULL) {
// This should only happen from internal use so we just fail silently instead of raising an
// exception.
return;
}
ble_uuid_t desc_uuid;
bleio_uuid_convert_to_nrf_ble_uuid(descriptor->uuid, &desc_uuid);

View File

@ -39,9 +39,9 @@ typedef struct _bleio_characteristic_obj {
// Will be MP_OBJ_NULL before being assigned to a Service.
bleio_service_obj_t *service;
bleio_uuid_obj_t *uuid;
mp_obj_t initial_value;
const uint8_t *initial_value;
uint16_t initial_value_len;
uint16_t max_length;
bool fixed_length;
uint16_t handle;
bleio_characteristic_properties_t props;
bleio_attribute_security_mode_t read_perm;
@ -50,6 +50,7 @@ typedef struct _bleio_characteristic_obj {
uint16_t user_desc_handle;
uint16_t cccd_handle;
uint16_t sccd_handle;
bool fixed_length;
} bleio_characteristic_obj_t;
#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_CHARACTERISTIC_H

View File

@ -80,20 +80,34 @@ STATIC bool characteristic_buffer_on_ble_evt(ble_evt_t *ble_evt, void *param) {
return true;
}
void _common_hal_bleio_characteristic_buffer_construct(bleio_characteristic_buffer_obj_t *self,
bleio_characteristic_obj_t *characteristic,
mp_float_t timeout,
uint8_t *buffer, size_t buffer_size,
void *static_handler_entry) {
self->characteristic = characteristic;
self->timeout_ms = timeout * 1000;
self->ringbuf.buf = (uint8_t *)buffer;
self->ringbuf.size = buffer_size;
self->ringbuf.iget = 0;
self->ringbuf.iput = 0;
if (static_handler_entry != NULL) {
ble_drv_add_event_handler_entry((ble_drv_evt_handler_entry_t *)static_handler_entry, characteristic_buffer_on_ble_evt, self);
} else {
ble_drv_add_event_handler(characteristic_buffer_on_ble_evt, self);
}
}
// Assumes that timeout and buffer_size have been validated before call.
void common_hal_bleio_characteristic_buffer_construct(bleio_characteristic_buffer_obj_t *self,
bleio_characteristic_obj_t *characteristic,
mp_float_t timeout,
size_t buffer_size) {
self->characteristic = characteristic;
self->timeout_ms = timeout * 1000;
// This is a macro.
// true means long-lived, so it won't be moved.
ringbuf_alloc(&self->ringbuf, buffer_size, true);
ble_drv_add_event_handler(characteristic_buffer_on_ble_evt, self);
uint8_t *buffer = m_malloc(buffer_size, true);
_common_hal_bleio_characteristic_buffer_construct(self, characteristic, timeout, buffer, buffer_size, NULL);
}
uint32_t common_hal_bleio_characteristic_buffer_read(bleio_characteristic_buffer_obj_t *self, uint8_t *data, size_t len, int *errcode) {

View File

@ -309,6 +309,9 @@ bool connection_on_ble_evt(ble_evt_t *ble_evt, void *self_in) {
} else {
if (bonding_load_cccd_info(self->is_central, self->conn_handle, self->ediv)) {
// Did an sd_ble_gatts_sys_attr_set() with the stored sys_attr values.
// Indicate ATTR table change because we may have reloaded since the peer last
// connected.
sd_ble_gatts_service_changed(self->conn_handle, 0xC, 0xFFFF);
} else {
// No matching bonding found, so use fresh system attributes.
sd_ble_gatts_sys_attr_set(self->conn_handle, NULL, 0, 0);
@ -351,6 +354,14 @@ void common_hal_bleio_connection_disconnect(bleio_connection_internal_t *self) {
}
void common_hal_bleio_connection_pair(bleio_connection_internal_t *self, bool bond) {
// We may already be trying to pair if we just reconnected to a peer we're
// bonded with.
while (self->pair_status == PAIR_WAITING && !mp_hal_is_interrupted()) {
RUN_BACKGROUND_TASKS;
}
if (self->pair_status == PAIR_PAIRED) {
return;
}
self->pair_status = PAIR_WAITING;
check_nrf_error(sd_ble_gap_authenticate(self->conn_handle, &pairing_sec_params));
@ -522,7 +533,8 @@ STATIC void on_char_discovery_rsp(ble_gattc_evt_char_disc_rsp_t *response, bleio
characteristic, m_char_discovery_service, gattc_char->handle_value, uuid,
props, SECURITY_MODE_OPEN, SECURITY_MODE_OPEN,
GATT_MAX_DATA_LENGTH, false, // max_length, fixed_length: values don't matter for gattc
mp_const_empty_bytes);
mp_const_empty_bytes,
NULL);
mp_obj_list_append(MP_OBJ_FROM_PTR(m_char_discovery_service->characteristic_list),
MP_OBJ_FROM_PTR(characteristic));

View File

@ -76,7 +76,7 @@ STATIC uint32_t queue_next_write(bleio_packet_buffer_obj_t *self) {
ble_gattc_write_params_t write_params = {
.write_op = self->write_type,
.handle = self->characteristic->handle,
.p_value = self->outgoing[self->pending_index],
.p_value = (const uint8_t *)self->outgoing[self->pending_index],
.len = self->pending_size,
};
@ -89,7 +89,7 @@ STATIC uint32_t queue_next_write(bleio_packet_buffer_obj_t *self) {
.type = self->write_type,
.offset = 0,
.p_len = &hvx_len,
.p_data = self->outgoing[self->pending_index],
.p_data = (const uint8_t *)self->outgoing[self->pending_index],
};
err_code = sd_ble_gatts_hvx(conn_handle, &hvx_params);
}
@ -173,6 +173,25 @@ STATIC bool packet_buffer_on_ble_server_evt(ble_evt_t *ble_evt, void *param) {
}
break;
}
case BLE_GAP_EVT_CONN_SEC_UPDATE: { // 0x1a
if (self->conn_handle != BLE_CONN_HANDLE_INVALID) {
break;
}
uint16_t conn_handle = ble_evt->evt.gatts_evt.conn_handle;
// Check to see if the bond restored the HVX state.
uint16_t cccd;
ble_gatts_value_t value;
value.len = sizeof(uint16_t);
value.offset = 0;
value.p_value = (uint8_t *)&cccd;
sd_ble_gatts_value_get(conn_handle, self->characteristic->cccd_handle, &value);
if (cccd & BLE_GATT_HVX_NOTIFICATION) {
self->conn_handle = conn_handle;
}
break;
}
case BLE_GAP_EVT_CONNECTED:
break;
case BLE_GAP_EVT_DISCONNECTED:
if (self->conn_handle == ble_evt->evt.gap_evt.conn_handle) {
self->conn_handle = BLE_CONN_HANDLE_INVALID;
@ -188,12 +207,16 @@ STATIC bool packet_buffer_on_ble_server_evt(ble_evt_t *ble_evt, void *param) {
return true;
}
void common_hal_bleio_packet_buffer_construct(
void _common_hal_bleio_packet_buffer_construct(
bleio_packet_buffer_obj_t *self, bleio_characteristic_obj_t *characteristic,
size_t buffer_size, size_t max_packet_size) {
uint32_t *incoming_buffer, size_t incoming_buffer_size,
uint32_t *outgoing_buffer1, uint32_t *outgoing_buffer2, size_t max_packet_size,
void *static_handler_entry) {
self->characteristic = characteristic;
self->client = self->characteristic->service->is_remote;
self->max_packet_size = max_packet_size;
bleio_characteristic_properties_t incoming = self->characteristic->props & (CHAR_PROP_WRITE_NO_RESPONSE | CHAR_PROP_WRITE);
bleio_characteristic_properties_t outgoing = self->characteristic->props & (CHAR_PROP_NOTIFY | CHAR_PROP_INDICATE);
@ -207,28 +230,25 @@ void common_hal_bleio_packet_buffer_construct(
self->conn_handle = BLE_CONN_HANDLE_INVALID;
}
// Cap the packet size to our implementation limits.
self->max_packet_size = MIN(max_packet_size, BLE_GATTS_VAR_ATTR_LEN_MAX - 3);
if (incoming) {
if (!ringbuf_alloc(&self->ringbuf, buffer_size * (sizeof(uint16_t) + self->max_packet_size), false)) {
mp_raise_ValueError(translate("Buffer too large and unable to allocate"));
}
self->ringbuf.buf = (uint8_t *)incoming_buffer;
self->ringbuf.size = incoming_buffer_size;
self->ringbuf.iget = 0;
self->ringbuf.iput = 0;
}
if (outgoing) {
self->packet_queued = false;
self->pending_index = 0;
self->pending_size = 0;
self->outgoing[0] = m_malloc(self->max_packet_size, false);
self->outgoing[1] = m_malloc(self->max_packet_size, false);
} else {
self->outgoing[0] = NULL;
self->outgoing[1] = NULL;
}
self->packet_queued = false;
self->pending_index = 0;
self->pending_size = 0;
self->outgoing[0] = outgoing_buffer1;
self->outgoing[1] = outgoing_buffer2;
if (self->client) {
ble_drv_add_event_handler(packet_buffer_on_ble_client_evt, self);
if (static_handler_entry != NULL) {
ble_drv_add_event_handler_entry((ble_drv_evt_handler_entry_t *)static_handler_entry, packet_buffer_on_ble_client_evt, self);
} else {
ble_drv_add_event_handler(packet_buffer_on_ble_client_evt, self);
}
if (incoming) {
// Prefer notify if both are available.
if (incoming & CHAR_PROP_NOTIFY) {
@ -245,7 +265,11 @@ void common_hal_bleio_packet_buffer_construct(
}
}
} else {
ble_drv_add_event_handler(packet_buffer_on_ble_server_evt, self);
if (static_handler_entry != NULL) {
ble_drv_add_event_handler_entry((ble_drv_evt_handler_entry_t *)static_handler_entry, packet_buffer_on_ble_server_evt, self);
} else {
ble_drv_add_event_handler(packet_buffer_on_ble_server_evt, self);
}
if (outgoing) {
self->write_type = BLE_GATT_HVX_INDICATION;
if (outgoing & CHAR_PROP_NOTIFY) {
@ -253,12 +277,44 @@ void common_hal_bleio_packet_buffer_construct(
}
}
}
}
void common_hal_bleio_packet_buffer_construct(
bleio_packet_buffer_obj_t *self, bleio_characteristic_obj_t *characteristic,
size_t buffer_size, size_t max_packet_size) {
// Cap the packet size to our implementation limits.
max_packet_size = MIN(max_packet_size, BLE_GATTS_VAR_ATTR_LEN_MAX - 3);
bleio_characteristic_properties_t incoming = characteristic->props & (CHAR_PROP_WRITE_NO_RESPONSE | CHAR_PROP_WRITE);
bleio_characteristic_properties_t outgoing = characteristic->props & (CHAR_PROP_NOTIFY | CHAR_PROP_INDICATE);
if (characteristic->service->is_remote) {
// Swap if we're the client.
bleio_characteristic_properties_t temp = incoming;
incoming = outgoing;
outgoing = temp;
}
size_t incoming_buffer_size = 0;
uint32_t *incoming_buffer = NULL;
if (incoming) {
incoming_buffer_size = buffer_size * (sizeof(uint16_t) + max_packet_size);
incoming_buffer = m_malloc(incoming_buffer_size, false);
}
uint32_t *outgoing1 = NULL;
uint32_t *outgoing2 = NULL;
if (outgoing) {
outgoing1 = m_malloc(max_packet_size, false);
outgoing2 = m_malloc(max_packet_size, false);
}
_common_hal_bleio_packet_buffer_construct(self, characteristic,
incoming_buffer, incoming_buffer_size,
outgoing1, outgoing2, max_packet_size,
NULL);
}
mp_int_t common_hal_bleio_packet_buffer_readinto(bleio_packet_buffer_obj_t *self, uint8_t *data, size_t len) {
if (self->conn_handle == BLE_CONN_HANDLE_INVALID) {
mp_raise_ConnectionError(translate("Not connected"));
}
if (ringbuf_num_filled(&self->ringbuf) < 2) {
return 0;
}
@ -291,7 +347,7 @@ mp_int_t common_hal_bleio_packet_buffer_readinto(bleio_packet_buffer_obj_t *self
return ret;
}
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) {
mp_int_t common_hal_bleio_packet_buffer_write(bleio_packet_buffer_obj_t *self, const uint8_t *data, size_t len, uint8_t *header, size_t header_len) {
if (self->outgoing[0] == NULL) {
mp_raise_bleio_BluetoothError(translate("Writes not supported on Characteristic"));
}
@ -330,14 +386,14 @@ mp_int_t common_hal_bleio_packet_buffer_write(bleio_packet_buffer_obj_t *self, u
uint8_t is_nested_critical_region;
sd_nvic_critical_region_enter(&is_nested_critical_region);
uint8_t *pending = self->outgoing[self->pending_index];
uint32_t *pending = self->outgoing[self->pending_index];
if (self->pending_size == 0) {
memcpy(pending, header, header_len);
self->pending_size += header_len;
num_bytes_written += header_len;
}
memcpy(pending + self->pending_size, data, len);
memcpy(((uint8_t *)pending) + self->pending_size, data, len);
self->pending_size += len;
num_bytes_written += len;
@ -425,6 +481,15 @@ mp_int_t common_hal_bleio_packet_buffer_get_outgoing_packet_length(bleio_packet_
return MIN(self->characteristic->max_length, self->max_packet_size);
}
void common_hal_bleio_packet_buffer_flush(bleio_packet_buffer_obj_t *self) {
while (self->pending_size != 0 &&
self->packet_queued &&
self->conn_handle != BLE_CONN_HANDLE_INVALID &&
!mp_hal_is_interrupted()) {
RUN_BACKGROUND_TASKS;
}
}
bool common_hal_bleio_packet_buffer_deinited(bleio_packet_buffer_obj_t *self) {
return self->characteristic == NULL;
}

View File

@ -39,7 +39,7 @@ typedef struct {
ringbuf_t ringbuf;
// Two outgoing buffers to alternate between. One will be queued for transmission by the SD and
// the other is waiting to be queued and can be extended.
uint8_t *outgoing[2];
uint32_t *outgoing[2];
volatile uint16_t pending_size;
// We remember the conn_handle so we can do a NOTIFY/INDICATE to a client.
// We can find out the conn_handle on a Characteristic write or a CCCD write (but not a read).

View File

@ -34,6 +34,19 @@
#include "shared-bindings/_bleio/Service.h"
#include "shared-bindings/_bleio/Adapter.h"
STATIC void _indicate_service_change(uint16_t start, uint16_t end) {
for (size_t i = 0; i < BLEIO_TOTAL_CONNECTION_COUNT; i++) {
bleio_connection_internal_t *connection = &bleio_connections[i];
uint16_t conn_handle = connection->conn_handle;
if (connection->conn_handle == BLE_CONN_HANDLE_INVALID) {
continue;
}
sd_ble_gatts_service_changed(conn_handle, start, end);
}
}
uint32_t _common_hal_bleio_service_construct(bleio_service_obj_t *self, bleio_uuid_obj_t *uuid, bool is_secondary, mp_obj_list_t *characteristic_list) {
self->handle = 0xFFFF;
self->uuid = uuid;
@ -50,9 +63,13 @@ uint32_t _common_hal_bleio_service_construct(bleio_service_obj_t *self, bleio_uu
service_type = BLE_GATTS_SRVC_TYPE_SECONDARY;
}
vm_used_ble = true;
uint32_t result = sd_ble_gatts_service_add(service_type, &nordic_uuid, &self->handle);
// Do a service changed indication to all connected peers.
if (result == NRF_SUCCESS) {
_indicate_service_change(self->handle, self->handle);
}
return sd_ble_gatts_service_add(service_type, &nordic_uuid, &self->handle);
return result;
}
void common_hal_bleio_service_construct(bleio_service_obj_t *self, bleio_uuid_obj_t *uuid, bool is_secondary) {
@ -85,9 +102,18 @@ bool common_hal_bleio_service_get_is_secondary(bleio_service_obj_t *self) {
return self->is_secondary;
}
STATIC void _expand_range(uint16_t new_value, uint16_t *start, uint16_t *end) {
if (new_value == 0) {
return;
}
*start = MIN(*start, new_value);
*end = MAX(*end, new_value);
}
void common_hal_bleio_service_add_characteristic(bleio_service_obj_t *self,
bleio_characteristic_obj_t *characteristic,
mp_buffer_info_t *initial_value_bufinfo) {
mp_buffer_info_t *initial_value_bufinfo,
const char *user_description) {
ble_gatts_char_md_t char_md = {
.char_props.broadcast = (characteristic->props & CHAR_PROP_BROADCAST) ? 1 : 0,
.char_props.read = (characteristic->props & CHAR_PROP_READ) ? 1 : 0,
@ -117,6 +143,18 @@ void common_hal_bleio_service_add_characteristic(bleio_service_obj_t *self,
char_md.p_cccd_md = &cccd_md;
}
ble_gatts_attr_md_t user_desc_md;
if (user_description != NULL && strlen(user_description) > 0) {
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&user_desc_md.read_perm);
// If the description is on the Python heap, then have the SD copy it. If not, assume it's
// static and will live for longer than the SD.
user_desc_md.vloc = gc_nbytes(user_description) > 0 ? BLE_GATTS_VLOC_STACK : BLE_GATTS_VLOC_USER;
char_md.p_user_desc_md = &user_desc_md;
char_md.p_char_user_desc = (const uint8_t *)user_description;
char_md.char_user_desc_max_size = strlen(user_description);
char_md.char_user_desc_size = strlen(user_description);
}
bleio_attribute_gatts_set_security_mode(&char_attr_md.read_perm, characteristic->read_perm);
bleio_attribute_gatts_set_security_mode(&char_attr_md.write_perm, characteristic->write_perm);
#if CIRCUITPY_VERBOSE_BLE
@ -124,14 +162,11 @@ void common_hal_bleio_service_add_characteristic(bleio_service_obj_t *self,
char_attr_md.rd_auth = true;
#endif
mp_buffer_info_t char_value_bufinfo;
mp_get_buffer_raise(characteristic->initial_value, &char_value_bufinfo, MP_BUFFER_READ);
ble_gatts_attr_t char_attr = {
.p_uuid = &char_uuid,
.p_attr_md = &char_attr_md,
.init_len = char_value_bufinfo.len,
.p_value = char_value_bufinfo.buf,
.init_len = characteristic->initial_value_len,
.p_value = (uint8_t *)characteristic->initial_value,
.init_offs = 0,
.max_len = characteristic->max_length,
};
@ -144,6 +179,15 @@ void common_hal_bleio_service_add_characteristic(bleio_service_obj_t *self,
characteristic->cccd_handle = char_handles.cccd_handle;
characteristic->sccd_handle = char_handles.sccd_handle;
characteristic->handle = char_handles.value_handle;
// Indicate that the attribute table has changed.
uint16_t start = char_handles.value_handle;
uint16_t end = char_handles.value_handle;
_expand_range(char_handles.cccd_handle, &start, &end);
_expand_range(char_handles.sccd_handle, &start, &end);
_expand_range(char_handles.user_desc_handle, &start, &end);
_indicate_service_change(start, end);
#if CIRCUITPY_VERBOSE_BLE
mp_printf(&mp_plat_print, "Char handle %x user %x cccd %x sccd %x\n", characteristic->handle, characteristic->user_desc_handle, characteristic->cccd_handle, characteristic->sccd_handle);
#endif

Some files were not shown because too many files have changed in this diff Show More