merge upstream/main

This commit is contained in:
Kevin Matocha 2021-03-17 09:30:51 -05:00
commit ef91e1752c
1808 changed files with 32744 additions and 25881 deletions

View File

@ -43,8 +43,6 @@ jobs:
run: |
gcc --version
python3 --version
- name: Translations
run: make check-translate
- name: New boards check
run: python3 -u ci_new_boards_check.py
working-directory: tools

View File

@ -7,7 +7,6 @@ name: pre-commit
on:
pull_request:
push:
branches: [main]
jobs:
pre-commit:
@ -16,10 +15,13 @@ jobs:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
- name: Install deps
run: sudo apt-get update && sudo apt-get install -y gettext
run: |
sudo apt-add-repository -y -u ppa:pybricks/ppa
sudo apt-get install -y black gettext uncrustify
pip3 install polib
- name: Populate selected submodules
run: git submodule update --init extmod/ulab
- name: set PY
- name: Set PY
run: echo >>$GITHUB_ENV PY="$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')"
- uses: actions/cache@v2
with:

View File

@ -11,3 +11,16 @@ repos:
exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*|ports/esp32s2/esp-idf-config/.*|ports/esp32s2/boards/.*/sdkconfig)'
- id: trailing-whitespace
exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*)'
- repo: local
hooks:
- id: translations
name: Translations
entry: sh -c "if ! make check-translate; then make translate; fi"
types: [c]
pass_filenames: false
language: system
- id: formatting
name: Formatting
entry: python3 tools/codeformat.py
types_or: [c, python]
language: system

View File

@ -85,3 +85,23 @@ Example:
If your port/build includes `arm-none-eabi-gdb-py`, consider using it instead, as it can be used for better register
debugging with https://github.com/bnahill/PyCortexMDebug
# Code Quality Checks
We apply code quality checks using pre-commit. Install pre-commit once per system with
python3 -mpip install pre-commit
Activate it once per git clone with
pre-commit --install
Pre-commit also requires some additional programs to be installed through your package manager:
* Standard Unix tools such as make, find, etc
* The gettext package, any modern version
* uncrustify version 0.71 (0.72 is also tested)
Each time you create a git commit, the pre-commit quality checks will be run. You can also run them e.g., with `pre-commit run foo.c` or `pre-commit run --all` to run on all files whether modified or not.
Some pre-commit quality checks require your active attention to resolve, others (such as the formatting checks of uncrustify) are made automatically and must simply be incorporated into your code changes by committing them.

View File

@ -51,6 +51,10 @@ Specifically useful documentation when starting out:
- `CircuitPython Essentials <https://learn.adafruit.com/circuitpython-essentials>`__
- `Example Code <https://github.com/adafruit/Adafruit_Learning_System_Guides/tree/master/CircuitPython_Essentials>`__
Code Search
------------
GitHub doesn't currently support code search on forks. Therefore, CircuitPython doesn't have code search through GitHub because it is a fork of MicroPython. Luckily, `SourceGraph <https://sourcegraph.com/github.com/adafruit/circuitpython>`_ has free code search for public repos like CircuitPython. So, visit `sourcegraph.com/github.com/adafruit/circuitpython <https://sourcegraph.com/github.com/adafruit/circuitpython>`_ to search the CircuitPython codebase online.
Contributing
------------
@ -207,6 +211,7 @@ esp32s2 beta
litex alpha
mimxrt10xx alpha
nrf stable
raspberrypi beta
stm ``F4`` stable | ``others`` beta
unix alpha
================ ============================================================

View File

@ -51,7 +51,7 @@
#define MSEC_TO_UNITS(TIME, RESOLUTION) (((TIME) * 1000) / (RESOLUTION))
#define SEC_TO_UNITS(TIME, RESOLUTION) (((TIME) * 1000000) / (RESOLUTION))
#define UNITS_TO_SEC(TIME, RESOLUTION) (((TIME) * (RESOLUTION)) / 1000000)
#define UNITS_TO_SEC(TIME, RESOLUTION) (((TIME)*(RESOLUTION)) / 1000000)
// 0.625 msecs (625 usecs)
#define ADV_INTERVAL_UNIT_FLOAT_SECS (0.000625)
// Microseconds is the base unit. The macros above know that.
@ -63,7 +63,7 @@
// TODO make this settable from Python.
#define DEFAULT_TX_POWER 0 // 0 dBm
#define MAX_ANONYMOUS_ADV_TIMEOUT_SECS (60*15)
#define MAX_ANONYMOUS_ADV_TIMEOUT_SECS (60 * 15)
#define MAX_LIMITED_DISCOVERABLE_ADV_TIMEOUT_SECS (180)
#define BLE_MIN_CONN_INTERVAL MSEC_TO_UNITS(15, UNIT_0_625_MS)
@ -289,7 +289,7 @@ STATIC void bleio_adapter_hci_init(bleio_adapter_obj_t *self) {
// Get version information.
if (hci_read_local_version(&self->hci_version, &self->hci_revision, &self->lmp_version,
&self->manufacturer, &self->lmp_subversion) != HCI_OK) {
&self->manufacturer, &self->lmp_subversion) != HCI_OK) {
mp_raise_bleio_BluetoothError(translate("Could not read HCI version"));
}
// Get supported features.
@ -414,11 +414,11 @@ bool common_hal_bleio_adapter_set_address(bleio_adapter_obj_t *self, bleio_addre
return hci_le_set_random_address(bufinfo.buf) == HCI_OK;
}
mp_obj_str_t* common_hal_bleio_adapter_get_name(bleio_adapter_obj_t *self) {
mp_obj_str_t *common_hal_bleio_adapter_get_name(bleio_adapter_obj_t *self) {
return self->name;
}
void common_hal_bleio_adapter_set_name(bleio_adapter_obj_t *self, const char* name) {
void common_hal_bleio_adapter_set_name(bleio_adapter_obj_t *self, const char *name) {
self->name = mp_obj_new_str(name, strlen(name));
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(self->name, &bufinfo, MP_BUFFER_READ);
@ -459,7 +459,7 @@ void common_hal_bleio_adapter_set_name(bleio_adapter_obj_t *self, const char* na
// return true;
// }
mp_obj_t common_hal_bleio_adapter_start_scan(bleio_adapter_obj_t *self, uint8_t* prefixes, size_t prefix_length, bool extended, mp_int_t buffer_size, mp_float_t timeout, mp_float_t interval, mp_float_t window, mp_int_t minimum_rssi, bool active) {
mp_obj_t common_hal_bleio_adapter_start_scan(bleio_adapter_obj_t *self, uint8_t *prefixes, size_t prefix_length, bool extended, mp_int_t buffer_size, mp_float_t timeout, mp_float_t interval, mp_float_t window, mp_int_t minimum_rssi, bool active) {
// TODO
mp_raise_NotImplementedError(NULL);
check_enabled(self);
@ -704,7 +704,7 @@ uint32_t _common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self,
uint8_t handle[1] = { 0 };
uint16_t duration_10msec[1] = { timeout * 100 };
uint8_t max_ext_adv_evts[1] = { 0 };
uint8_t max_ext_adv_evts[1] = { 0 };
hci_check_error(
hci_le_set_extended_advertising_enable(
BT_HCI_LE_ADV_ENABLE,
@ -789,11 +789,11 @@ void common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self, bool
} else {
if (timeout > MAX_LIMITED_DISCOVERABLE_ADV_TIMEOUT_SECS) {
mp_raise_bleio_BluetoothError(translate("Timeout is too long: Maximum timeout length is %d seconds"),
MAX_LIMITED_DISCOVERABLE_ADV_TIMEOUT_SECS);
MAX_LIMITED_DISCOVERABLE_ADV_TIMEOUT_SECS);
}
}
const uint32_t result =_common_hal_bleio_adapter_start_advertising(
const uint32_t result = _common_hal_bleio_adapter_start_advertising(
self, connectable, anonymous, timeout, interval,
advertising_data_bufinfo->buf,
advertising_data_bufinfo->len,
@ -820,11 +820,11 @@ void common_hal_bleio_adapter_stop_advertising(bleio_adapter_obj_t *self) {
hci_check_error(result);
}
//TODO startup CircuitPython advertising again.
// TODO startup CircuitPython advertising again.
}
// Note that something stopped advertising, such as a connection happening.
//Don't ask the adapter to stop.
// Don't ask the adapter to stop.
void bleio_adapter_advertising_was_stopped(bleio_adapter_obj_t *self) {
self->now_advertising = false;
self->extended_advertising = false;
@ -876,14 +876,14 @@ void common_hal_bleio_adapter_erase_bonding(bleio_adapter_obj_t *self) {
mp_raise_NotImplementedError(NULL);
check_enabled(self);
//FIX bonding_erase_storage();
// FIX bonding_erase_storage();
}
uint16_t bleio_adapter_add_attribute(bleio_adapter_obj_t *adapter, mp_obj_t *attribute) {
check_enabled(adapter);
// The handle is the index of this attribute in the attributes list.
uint16_t handle = (uint16_t) adapter->attributes->len;
uint16_t handle = (uint16_t)adapter->attributes->len;
mp_obj_list_append(adapter->attributes, attribute);
if (MP_OBJ_IS_TYPE(attribute, &bleio_service_type)) {
@ -896,7 +896,7 @@ uint16_t bleio_adapter_add_attribute(bleio_adapter_obj_t *adapter, mp_obj_t *att
return handle;
}
mp_obj_t* bleio_adapter_get_attribute(bleio_adapter_obj_t *adapter, uint16_t handle) {
mp_obj_t *bleio_adapter_get_attribute(bleio_adapter_obj_t *adapter, uint16_t handle) {
check_enabled(adapter);
if (handle == 0 || handle >= adapter->attributes->len) {
@ -912,12 +912,12 @@ uint16_t bleio_adapter_max_attribute_handle(bleio_adapter_obj_t *adapter) {
}
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));
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));
}
void bleio_adapter_reset(bleio_adapter_obj_t* adapter) {
void bleio_adapter_reset(bleio_adapter_obj_t *adapter) {
if (!common_hal_bleio_adapter_get_enabled(adapter)) {
return;
@ -939,7 +939,7 @@ void bleio_adapter_reset(bleio_adapter_obj_t* adapter) {
}
void bleio_adapter_background(bleio_adapter_obj_t* adapter) {
void bleio_adapter_background(bleio_adapter_obj_t *adapter) {
if (!common_hal_bleio_adapter_get_enabled(adapter)) {
return;
}

View File

@ -49,7 +49,7 @@ typedef struct _bleio_adapter_obj_t {
bleio_scanresults_obj_t *scan_results;
mp_obj_t name;
mp_obj_tuple_t *connection_objs;
busio_uart_obj_t* hci_uart;
busio_uart_obj_t *hci_uart;
digitalio_digitalinout_obj_t *rts_digitalinout;
digitalio_digitalinout_obj_t *cts_digitalinout;
bool allocated; // True when in use.
@ -72,7 +72,7 @@ typedef struct _bleio_adapter_obj_t {
// Generic services characteristics.
bleio_characteristic_obj_t *device_name_characteristic;
bleio_characteristic_obj_t *appearance_characteristic;
bleio_characteristic_obj_t * service_changed_characteristic;
bleio_characteristic_obj_t *service_changed_characteristic;
uint16_t max_acl_buffer_len;
uint16_t max_acl_num_buffers;
@ -90,10 +90,10 @@ typedef struct _bleio_adapter_obj_t {
uint16_t bleio_adapter_add_attribute(bleio_adapter_obj_t *adapter, mp_obj_t *attribute);
void bleio_adapter_advertising_was_stopped(bleio_adapter_obj_t *self);
mp_obj_t* bleio_adapter_get_attribute(bleio_adapter_obj_t *adapter, uint16_t handle);
mp_obj_t *bleio_adapter_get_attribute(bleio_adapter_obj_t *adapter, uint16_t handle);
uint16_t bleio_adapter_max_attribute_handle(bleio_adapter_obj_t *adapter);
void bleio_adapter_background(bleio_adapter_obj_t* adapter);
void bleio_adapter_gc_collect(bleio_adapter_obj_t* adapter);
void bleio_adapter_reset(bleio_adapter_obj_t* adapter);
void bleio_adapter_background(bleio_adapter_obj_t *adapter);
void bleio_adapter_gc_collect(bleio_adapter_obj_t *adapter);
void bleio_adapter_reset(bleio_adapter_obj_t *adapter);
#endif // MICROPY_INCLUDED_BLE_HCI_COMMON_HAL_ADAPTER_H

View File

@ -78,16 +78,16 @@ bleio_service_obj_t *common_hal_bleio_characteristic_get_service(bleio_character
return self->service;
}
size_t common_hal_bleio_characteristic_get_value(bleio_characteristic_obj_t *self, uint8_t* buf, size_t len) {
size_t common_hal_bleio_characteristic_get_value(bleio_characteristic_obj_t *self, uint8_t *buf, size_t len) {
// Do GATT operations only if this characteristic has been added to a registered service.
if (self->handle != BLE_GATT_HANDLE_INVALID) {
//FIX uint16_t conn_handle = bleio_connection_get_conn_handle(self->service->connection);
// FIX uint16_t conn_handle = bleio_connection_get_conn_handle(self->service->connection);
if (common_hal_bleio_service_get_is_remote(self->service)) {
//FIX read remote chars
//uint8_t rsp[MAX(len, 512)];
//FIX improve att_read_req to write into our requested buffer.
// FIX read remote chars
// uint8_t rsp[MAX(len, 512)];
// FIX improve att_read_req to write into our requested buffer.
// return att_read_req(conn_handle, self->handle, rsp);
return 0; //FIX
return 0; // FIX
} else {
mp_buffer_info_t bufinfo;
if (!mp_get_buffer(self->value, &bufinfo, MP_BUFFER_READ)) {
@ -113,13 +113,13 @@ void common_hal_bleio_characteristic_set_value(bleio_characteristic_obj_t *self,
// Do GATT operations only if this characteristic has been added to a registered service.
if (self->handle != BLE_GATT_HANDLE_INVALID) {
if (common_hal_bleio_service_get_is_remote(self->service)) {
//FIX uint16_t conn_handle = bleio_connection_get_conn_handle(self->service->connection);
// FIX uint16_t conn_handle = bleio_connection_get_conn_handle(self->service->connection);
if (self->props & CHAR_PROP_WRITE) {
//FIX writing remote chars
//uint8_t rsp[sizeof(bt_att_error_rsp)];
//att_write_req(conn_handle, self->handle, bufinfo->buf, bufinfo->len, rsp);
// FIX writing remote chars
// uint8_t rsp[sizeof(bt_att_error_rsp)];
// att_write_req(conn_handle, self->handle, bufinfo->buf, bufinfo->len, rsp);
} else if (self->props & CHAR_PROP_WRITE_NO_RESPONSE) {
//att_write_cmd(conn_handle, self->handle, bufinfo->buff, bufinfo->len);
// att_write_cmd(conn_handle, self->handle, bufinfo->buff, bufinfo->len);
} else {
mp_raise_bleio_BluetoothError(translate("Characteristic not writable"));
}
@ -172,7 +172,7 @@ void common_hal_bleio_characteristic_add_descriptor(bleio_characteristic_obj_t *
self->service->end_handle = descriptor->handle;
mp_obj_list_append(MP_OBJ_FROM_PTR(self->descriptor_list),
MP_OBJ_FROM_PTR(descriptor));
MP_OBJ_FROM_PTR(descriptor));
}
void common_hal_bleio_characteristic_set_cccd(bleio_characteristic_obj_t *self, bool notify, bool indicate) {
@ -191,8 +191,8 @@ void common_hal_bleio_characteristic_set_cccd(bleio_characteristic_obj_t *self,
(notify ? CCCD_NOTIFY : 0) |
(indicate ? CCCD_INDICATE : 0);
//FIX do remote
(void) cccd_value;
// FIX do remote
(void)cccd_value;
// uint8_t rsp[sizeof(bt_att_error_rsp)];
// if (att_write_req(conn_handle, self->cccd->handle, &cccd_value, sizeof(cccd_value)) == 0) {
// mp_raise_bleio_BluetoothError(translate("Could not write CCCD"));

View File

@ -47,9 +47,9 @@ void bleio_characteristic_buffer_update(bleio_characteristic_buffer_obj_t *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) {
bleio_characteristic_obj_t *characteristic,
mp_float_t timeout,
size_t buffer_size) {
self->characteristic = characteristic;
self->timeout_ms = timeout * 1000;
@ -64,10 +64,10 @@ uint32_t common_hal_bleio_characteristic_buffer_read(bleio_characteristic_buffer
uint64_t start_ticks = supervisor_ticks_ms64();
// Wait for all bytes received or timeout
while ( (ringbuf_num_filled(&self->ringbuf) < len) && (supervisor_ticks_ms64() - start_ticks < self->timeout_ms) ) {
while ((ringbuf_num_filled(&self->ringbuf) < len) && (supervisor_ticks_ms64() - start_ticks < self->timeout_ms)) {
RUN_BACKGROUND_TASKS;
// Allow user to break out of a timeout with a KeyboardInterrupt.
if ( mp_hal_is_interrupted() ) {
if (mp_hal_is_interrupted()) {
return 0;
}
}
@ -97,8 +97,8 @@ void common_hal_bleio_characteristic_buffer_deinit(bleio_characteristic_buffer_o
bool common_hal_bleio_characteristic_buffer_connected(bleio_characteristic_buffer_obj_t *self) {
return self->characteristic != NULL &&
self->characteristic->service != NULL &&
(!self->characteristic->service->is_remote ||
(self->characteristic->service->connection != MP_OBJ_NULL &&
common_hal_bleio_connection_get_connected(self->characteristic->service->connection)));
self->characteristic->service != NULL &&
(!self->characteristic->service->is_remote ||
(self->characteristic->service->connection != MP_OBJ_NULL &&
common_hal_bleio_connection_get_connected(self->characteristic->service->connection)));
}

View File

@ -73,8 +73,8 @@
static volatile bool m_discovery_in_process;
static volatile bool m_discovery_successful;
//FIX static bleio_service_obj_t *m_char_discovery_service;
//FIX static bleio_characteristic_obj_t *m_desc_discovery_characteristic;
// FIX static bleio_service_obj_t *m_char_discovery_service;
// FIX static bleio_characteristic_obj_t *m_desc_discovery_characteristic;
// bool connection_on_ble_evt(ble_evt_t *ble_evt, void *self_in) {
// bleio_connection_internal_t *self = (bleio_connection_internal_t*)self_in;
@ -326,7 +326,7 @@ void bleio_connection_clear(bleio_connection_internal_t *self) {
self->conn_handle = BLE_CONN_HANDLE_INVALID;
self->pair_status = PAIR_NOT_PAIRED;
self->is_central = false;
//FIX bonding_clear_keys(&self->bonding_keys);
// FIX bonding_clear_keys(&self->bonding_keys);
}
bool common_hal_bleio_connection_get_paired(bleio_connection_obj_t *self) {
@ -350,7 +350,7 @@ void common_hal_bleio_connection_disconnect(bleio_connection_internal_t *self) {
void common_hal_bleio_connection_pair(bleio_connection_internal_t *self, bool bond) {
self->pair_status = PAIR_WAITING;
//FIX check_nrf_error(sd_ble_gap_authenticate(self->conn_handle, &pairing_sec_params));
// FIX check_nrf_error(sd_ble_gap_authenticate(self->conn_handle, &pairing_sec_params));
while (self->pair_status == PAIR_WAITING && !mp_hal_is_interrupted()) {
RUN_BACKGROUND_TASKS;
@ -358,14 +358,14 @@ void common_hal_bleio_connection_pair(bleio_connection_internal_t *self, bool bo
if (mp_hal_is_interrupted()) {
return;
}
//FIX check_sec_status(self->sec_status);
// FIX check_sec_status(self->sec_status);
}
mp_float_t common_hal_bleio_connection_get_connection_interval(bleio_connection_internal_t *self) {
while (self->conn_params_updating && !mp_hal_is_interrupted()) {
RUN_BACKGROUND_TASKS;
}
//FIX return 1.25f * self->conn_params.min_conn_interval;
// FIX return 1.25f * self->conn_params.min_conn_interval;
return 0.0f;
}
@ -729,14 +729,14 @@ void common_hal_bleio_connection_set_connection_interval(bleio_connection_intern
// }
mp_obj_tuple_t *common_hal_bleio_connection_discover_remote_services(bleio_connection_obj_t *self, mp_obj_t service_uuids_whitelist) {
//FIX discover_remote_services(self->connection, service_uuids_whitelist);
// FIX discover_remote_services(self->connection, service_uuids_whitelist);
bleio_connection_ensure_connected(self);
// Convert to a tuple and then clear the list so the callee will take ownership.
mp_obj_tuple_t *services_tuple =
mp_obj_new_tuple(self->connection->remote_service_list->len,
self->connection->remote_service_list->items);
mp_obj_list_clear(MP_OBJ_FROM_PTR(self->connection->remote_service_list));
return services_tuple;
mp_obj_tuple_t *services_tuple =
mp_obj_new_tuple(self->connection->remote_service_list->len,
self->connection->remote_service_list->items);
mp_obj_list_clear(MP_OBJ_FROM_PTR(self->connection->remote_service_list));
return services_tuple;
}
uint16_t bleio_connection_get_conn_handle(bleio_connection_obj_t *self) {
@ -746,7 +746,7 @@ uint16_t bleio_connection_get_conn_handle(bleio_connection_obj_t *self) {
return self->connection->conn_handle;
}
mp_obj_t bleio_connection_new_from_internal(bleio_connection_internal_t* internal) {
mp_obj_t bleio_connection_new_from_internal(bleio_connection_internal_t *internal) {
if (internal->connection_obj != mp_const_none) {
return internal->connection_obj;
}

View File

@ -60,7 +60,7 @@ typedef struct {
volatile pair_status_t pair_status;
uint8_t sec_status; // Internal security status.
mp_obj_t connection_obj;
//REMOVE ble_gap_conn_params_t conn_params;
// REMOVE ble_gap_conn_params_t conn_params;
volatile bool conn_params_updating;
uint16_t mtu;
// Request that CCCD values for this connection be saved, using sys_attr values.
@ -70,20 +70,20 @@ typedef struct {
// Time of setting do_bond_ccds: we delay a bit to consolidate multiple CCCD changes
// into one write. Time is currently in ticks_ms.
uint64_t do_bond_cccds_request_time;
//FIX from att.c
// FIX from att.c
uint8_t role;
bt_addr_le_t addr;
} bleio_connection_internal_t;
typedef struct {
mp_obj_base_t base;
bleio_connection_internal_t* connection;
bleio_connection_internal_t *connection;
// The HCI disconnect reason.
uint8_t disconnect_reason;
} bleio_connection_obj_t;
uint16_t bleio_connection_get_conn_handle(bleio_connection_obj_t *self);
mp_obj_t bleio_connection_new_from_internal(bleio_connection_internal_t* connection);
mp_obj_t bleio_connection_new_from_internal(bleio_connection_internal_t *connection);
bleio_connection_internal_t *bleio_conn_handle_to_connection(uint16_t conn_handle);
#endif // MICROPY_INCLUDED_BLE_HCI_COMMON_HAL_CONNECTION_H

View File

@ -44,7 +44,7 @@ void common_hal_bleio_descriptor_construct(bleio_descriptor_obj_t *self, bleio_c
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) {
mp_raise_ValueError_varg(translate("max_length must be 0-%d when fixed_length is %s"),
max_length_max, fixed_length ? "True" : "False");
max_length_max, fixed_length ? "True" : "False");
}
self->max_length = max_length;
self->fixed_length = fixed_length;
@ -60,14 +60,14 @@ bleio_characteristic_obj_t *common_hal_bleio_descriptor_get_characteristic(bleio
return self->characteristic;
}
size_t common_hal_bleio_descriptor_get_value(bleio_descriptor_obj_t *self, uint8_t* buf, size_t len) {
size_t common_hal_bleio_descriptor_get_value(bleio_descriptor_obj_t *self, uint8_t *buf, size_t len) {
// Do GATT operations only if this descriptor has been registered
if (self->handle != BLE_GATT_HANDLE_INVALID) {
if (common_hal_bleio_service_get_is_remote(self->characteristic->service)) {
//uint16_t conn_handle = bleio_connection_get_conn_handle(self->characteristic->service->connection);
//FIX have att_read_req fill in a buffer
//uint8_t rsp[MAX(len, 512)];
//return att_read_req(conn_handle, self->handle, rsp, len);
// uint16_t conn_handle = bleio_connection_get_conn_handle(self->characteristic->service->connection);
// FIX have att_read_req fill in a buffer
// uint8_t rsp[MAX(len, 512)];
// return att_read_req(conn_handle, self->handle, rsp, len);
return 0;
} else {
mp_buffer_info_t bufinfo;
@ -96,7 +96,7 @@ void common_hal_bleio_descriptor_set_value(bleio_descriptor_obj_t *self, mp_buff
// Do GATT operations only if this descriptor has been registered.
if (self->handle != BLE_GATT_HANDLE_INVALID) {
if (common_hal_bleio_service_get_is_remote(self->characteristic->service)) {
//FIX
// FIX
// uint16_t conn_handle = bleio_connection_get_conn_handle(self->service->connection);
// att_write_req(conn_handle, self->handle, bufinfo->buf, bufinfo->len, rsp);
} else {

View File

@ -47,7 +47,7 @@ typedef struct _bleio_descriptor_obj {
uint16_t handle;
bleio_attribute_security_mode_t read_perm;
bleio_attribute_security_mode_t write_perm;
struct _bleio_descriptor_obj* next;
struct _bleio_descriptor_obj *next;
} bleio_descriptor_obj_t;
#endif // MICROPY_INCLUDED_BLE_HCI_COMMON_HAL_DESCRIPTOR_H

View File

@ -45,13 +45,13 @@ STATIC void write_to_ringbuf(bleio_packet_buffer_obj_t *self, uint8_t *data, uin
// Make room for the new value by dropping the oldest packets first.
while (ringbuf_capacity(&self->ringbuf) - ringbuf_num_filled(&self->ringbuf) < len + sizeof(uint16_t)) {
uint16_t packet_length;
ringbuf_get_n(&self->ringbuf, (uint8_t*) &packet_length, sizeof(uint16_t));
ringbuf_get_n(&self->ringbuf, (uint8_t *)&packet_length, sizeof(uint16_t));
for (uint16_t i = 0; i < packet_length; i++) {
ringbuf_get(&self->ringbuf);
}
// set an overflow flag?
}
ringbuf_put_n(&self->ringbuf, (uint8_t*) &len, sizeof(uint16_t));
ringbuf_put_n(&self->ringbuf, (uint8_t *)&len, sizeof(uint16_t));
ringbuf_put_n(&self->ringbuf, data, len);
}
@ -80,8 +80,8 @@ void bleio_packet_buffer_update(bleio_packet_buffer_obj_t *self, mp_buffer_info_
}
void common_hal_bleio_packet_buffer_construct(
bleio_packet_buffer_obj_t *self, bleio_characteristic_obj_t *characteristic,
size_t buffer_size) {
bleio_packet_buffer_obj_t *self, bleio_characteristic_obj_t *characteristic,
size_t buffer_size) {
self->characteristic = characteristic;
self->client = self->characteristic->service->is_remote;
@ -128,7 +128,7 @@ mp_int_t common_hal_bleio_packet_buffer_readinto(bleio_packet_buffer_obj_t *self
// Copy received data.
// Get packet length, which is in first two bytes of packet.
uint16_t packet_length;
ringbuf_get_n(&self->ringbuf, (uint8_t*) &packet_length, sizeof(uint16_t));
ringbuf_get_n(&self->ringbuf, (uint8_t *)&packet_length, sizeof(uint16_t));
mp_int_t ret;
if (packet_length > len) {
@ -136,7 +136,7 @@ mp_int_t common_hal_bleio_packet_buffer_readinto(bleio_packet_buffer_obj_t *self
ret = len - packet_length;
// Discard the packet if it's too large. Don't fill data.
while (packet_length--) {
(void) ringbuf_get(&self->ringbuf);
(void)ringbuf_get(&self->ringbuf);
}
} else {
// Read as much as possible, but might be shorter than len.
@ -147,7 +147,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, 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"));
}
@ -174,7 +174,7 @@ mp_int_t common_hal_bleio_packet_buffer_write(bleio_packet_buffer_obj_t *self, u
size_t num_bytes_written = 0;
uint8_t* pending = self->outgoing[self->pending_index];
uint8_t *pending = self->outgoing[self->pending_index];
if (self->pending_size == 0) {
memcpy(pending, header, header_len);
@ -213,7 +213,7 @@ mp_int_t common_hal_bleio_packet_buffer_get_incoming_packet_length(bleio_packet_
bleio_connection_internal_t *connection = bleio_conn_handle_to_connection(self->conn_handle);
if (connection) {
return MIN(common_hal_bleio_connection_get_max_packet_length(connection),
self->characteristic->max_length);
self->characteristic->max_length);
}
}
// There's no current connection, so we don't know the MTU, and
@ -244,7 +244,7 @@ mp_int_t common_hal_bleio_packet_buffer_get_outgoing_packet_length(bleio_packet_
bleio_connection_internal_t *connection = bleio_conn_handle_to_connection(self->conn_handle);
if (connection) {
return MIN(common_hal_bleio_connection_get_max_packet_length(connection),
self->characteristic->max_length);
self->characteristic->max_length);
}
}
// There's no current connection, so we don't know the MTU, and

View File

@ -37,7 +37,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];
uint8_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

@ -32,7 +32,7 @@
#include "shared-bindings/_bleio/Service.h"
#include "shared-bindings/_bleio/Adapter.h"
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) {
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->uuid = uuid;
self->characteristic_list = characteristic_list;
self->is_remote = false;
@ -52,7 +52,7 @@ uint32_t _common_hal_bleio_service_construct(bleio_service_obj_t *self, bleio_uu
void common_hal_bleio_service_construct(bleio_service_obj_t *self, bleio_uuid_obj_t *uuid, bool is_secondary) {
if (_common_hal_bleio_service_construct(self, uuid, is_secondary,
mp_obj_new_list(0, NULL)) != 0) {
mp_obj_new_list(0, NULL)) != 0) {
mp_raise_RuntimeError(translate("Failed to add service"));
}
}
@ -83,8 +83,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) {
bleio_characteristic_obj_t *characteristic,
mp_buffer_info_t *initial_value_bufinfo) {
if (self->handle != common_hal_bleio_adapter_obj.last_added_service_handle) {
mp_raise_bleio_BluetoothError(

View File

@ -46,7 +46,7 @@ typedef struct bleio_service_obj {
// Range of attribute handles of this service.
uint16_t start_handle;
uint16_t end_handle;
struct bleio_service_obj* next;
struct bleio_service_obj *next;
} bleio_service_obj_t;
void bleio_service_from_connection(bleio_service_obj_t *self, mp_obj_t connection);

View File

@ -60,7 +60,7 @@ void common_hal_bleio_uuid_get_uuid128(bleio_uuid_obj_t *self, uint8_t uuid128[1
memcpy(uuid128, self->uuid128, 16);
}
void common_hal_bleio_uuid_pack_into(bleio_uuid_obj_t *self, uint8_t* buf) {
void common_hal_bleio_uuid_pack_into(bleio_uuid_obj_t *self, uint8_t *buf) {
if (self->size == 16) {
buf[0] = self->uuid16 & 0xff;
buf[1] = self->uuid16 >> 8;

View File

@ -33,17 +33,17 @@
// Types returned by attribute table lookups. These are UUIDs.
typedef enum {
BLE_UUID_UNKNOWN = 0x0000,
BLE_UUID_SERVICE_PRIMARY = 0x2800,
BLE_UUID_SERVICE_SECONDARY = 0x2801,
BLE_UUID_SERVICE_INCLUDE = 0x2802, // not yet implemented by us
BLE_UUID_CHARACTERISTIC = 0x2803,
BLE_UUID_CHAR_EXTENDED_PROPS = 0x2900, // not yet implemented by us
BLE_UUID_CHAR_USER_DESC = 0x2901, // not yet implemented by us
BLE_UUID_CCCD = 0x2902,
BLE_UUID_SCCD = 0x2903, // not yet implemented by us
BLE_UUID_CHAR_PRESENTATION_FMT = 0x2904, // not yet implemented by us
BLE_UUID_CHAR_AGGREGATE_FMT = 0x2905, // not yet implemented by us
BLE_UUID_UNKNOWN = 0x0000,
BLE_UUID_SERVICE_PRIMARY = 0x2800,
BLE_UUID_SERVICE_SECONDARY = 0x2801,
BLE_UUID_SERVICE_INCLUDE = 0x2802,// not yet implemented by us
BLE_UUID_CHARACTERISTIC = 0x2803,
BLE_UUID_CHAR_EXTENDED_PROPS = 0x2900,// not yet implemented by us
BLE_UUID_CHAR_USER_DESC = 0x2901,// not yet implemented by us
BLE_UUID_CCCD = 0x2902,
BLE_UUID_SCCD = 0x2903,// not yet implemented by us
BLE_UUID_CHAR_PRESENTATION_FMT = 0x2904, // not yet implemented by us
BLE_UUID_CHAR_AGGREGATE_FMT = 0x2905,// not yet implemented by us
} ble_standard_uuid;
typedef struct {

View File

@ -78,7 +78,7 @@ void bleio_reset() {
bleio_set_adapter(mp_const_none);
//FIX bonding_reset();
// FIX bonding_reset();
supervisor_start_bluetooth();
}

View File

@ -47,7 +47,7 @@ typedef struct {
// 20 bytes max (23 - 3).
#define GATT_MAX_DATA_LENGTH (BT_ATT_DEFAULT_LE_MTU - 3)
//FIX
// FIX
#define BLE_GATT_HANDLE_INVALID 0x0000
#define BLE_CONN_HANDLE_INVALID 0xFFFF
#define BLE_GATTS_FIX_ATTR_LEN_MAX (510) /**< Maximum length for fixed length Attribute Values. */

View File

@ -24,8 +24,8 @@
#include "att.h"
// Zephyr include files to define HCI communication values and structs.
//#include "hci_include/hci.h"
//#include "hci_include/hci_err.h"
// #include "hci_include/hci.h"
// #include "hci_include/hci_err.h"
#include "hci_include/l2cap_internal.h"
#include "py/obj.h"
@ -44,7 +44,7 @@ STATIC unsigned long timeout = 5000;
STATIC volatile bool confirm;
STATIC uint16_t long_write_handle = BLE_GATT_HANDLE_INVALID;
STATIC uint8_t* long_write_value = NULL;
STATIC uint8_t *long_write_value = NULL;
STATIC uint16_t long_write_value_length = 0;
// When we send a request, fill this struct with info about the expected response.
@ -52,7 +52,7 @@ STATIC uint16_t long_write_value_length = 0;
STATIC struct {
uint16_t conn_handle; // Expected handle.
uint8_t opcode; // Expected RSP opcode.
uint8_t* buffer; // Pointer to response packet
uint8_t *buffer; // Pointer to response packet
uint8_t length; // Length of response packet.
} expected_rsp;
@ -88,7 +88,7 @@ STATIC uint8_t bleio_properties_to_ble_spec_properties(uint8_t bleio_properties)
return ble_spec_properties;
}
//FIX not currently used; reenable when used.
// FIX not currently used; reenable when used.
#if 0
STATIC uint8_t ble_spec_properties_to_bleio_properties(uint8_t ble_spec_properties) {
uint8_t bleio_properties = 0;
@ -120,20 +120,19 @@ STATIC void send_error(uint16_t conn_handle, uint8_t opcode, uint16_t handle, ui
struct bt_att_hdr h;
struct bt_att_error_rsp r;
} rsp = { {
.code = BT_ATT_OP_ERROR_RSP,
}, {
.request = opcode,
}
};
.code = BT_ATT_OP_ERROR_RSP,
}, {
.request = opcode,
}};
hci_send_acl_pkt(conn_handle, BT_L2CAP_CID_ATT, sizeof(rsp), (uint8_t *) &rsp);
hci_send_acl_pkt(conn_handle, BT_L2CAP_CID_ATT, sizeof(rsp), (uint8_t *)&rsp);
}
STATIC void send_req(uint16_t conn_handle, size_t request_length, uint8_t* request_buffer) {
STATIC void send_req(uint16_t conn_handle, size_t request_length, uint8_t *request_buffer) {
hci_send_acl_pkt(conn_handle, BT_L2CAP_CID_ATT, request_length, request_buffer);
}
STATIC int send_req_wait_for_rsp(uint16_t conn_handle, size_t request_length, uint8_t* request_buffer, uint8_t response_buffer[]) {
STATIC int send_req_wait_for_rsp(uint16_t conn_handle, size_t request_length, uint8_t *request_buffer, uint8_t response_buffer[]) {
// We expect a particular kind of response after this request.
expected_rsp.conn_handle = conn_handle;
// The response opcode is the request opcode + 1.
@ -192,9 +191,9 @@ void bleio_att_reset(void) {
}
bool att_connect_to_address(bt_addr_le_t *addr) {
//FIX
// FIX
if (hci_le_create_conn(0x0060, 0x0030, 0x00, addr, 0x00,
0x0006, 0x000c, 0x0000, 0x00c8, 0x0004, 0x0006) != 0) {
0x0006, 0x000c, 0x0000, 0x00c8, 0x0004, 0x0006) != 0) {
return false;
}
@ -229,7 +228,7 @@ bool att_disconnect(uint16_t conn_handle) {
return !att_handle_is_connected(conn_handle);
}
//FIX
// FIX
// STATIC bool discover_services(uint16_t conn_handle, BLERemoteDevice* device, const char* serviceUuidFilter) {
// uint16_t reqStart_handle = 0x0001;
// uint16_t reqEnd_handle = 0xffff;
@ -406,7 +405,7 @@ bool att_disconnect(uint16_t conn_handle) {
// return true;
// }
bool att_discover_attributes(bt_addr_le_t *addr, const char* service_uuid_filter) {
bool att_discover_attributes(bt_addr_le_t *addr, const char *service_uuid_filter) {
uint16_t conn_handle = att_conn_handle(addr);
if (conn_handle == 0xffff) {
return false;
@ -418,7 +417,7 @@ bool att_discover_attributes(bt_addr_le_t *addr, const char* service_uuid_filter
}
// find the device entry for the peeer
//FIX BLERemoteDevice* device = NULL;
// FIX BLERemoteDevice* device = NULL;
for (size_t i = 0; i < BLEIO_TOTAL_CONNECTION_COUNT; i++) {
// if (bleio_connections[i].conn_handle == conn_handle) {
@ -454,7 +453,7 @@ bool att_discover_attributes(bt_addr_le_t *addr, const char* service_uuid_filter
}
// discover services
//FIX
// FIX
// if (!att_discover_services(conn_handle, device, service_uuid_filter)) {
// return false;
// }
@ -481,10 +480,10 @@ void att_set_timeout(unsigned long timeout_in) {
}
void att_add_connection(uint16_t handle, uint8_t role, bt_addr_le_t *peer_addr, uint16_t interval, uint16_t latency, uint16_t supervision_timeout, uint8_t master_clock_accuracy) {
(void) interval;
(void) latency;
(void) supervision_timeout;
(void) master_clock_accuracy;
(void)interval;
(void)latency;
(void)supervision_timeout;
(void)master_clock_accuracy;
int peer_index = -1;
@ -508,7 +507,7 @@ void att_add_connection(uint16_t handle, uint8_t role, bt_addr_le_t *peer_addr,
void att_remove_connection(uint16_t conn_handle, uint8_t reason) {
(void) reason;
(void)reason;
int peer_index = -1;
int peer_count = 0;
@ -580,7 +579,7 @@ bool att_is_connected(void) {
}
bool att_address_is_connected(bt_addr_le_t *addr) {
return (att_conn_handle(addr) != 0xffff);
return att_conn_handle(addr) != 0xffff;
}
bool att_handle_is_connected(uint16_t handle) {
@ -624,10 +623,10 @@ bool att_disconnect_all(void) {
bleio_connections[i].mtu = BT_ATT_DEFAULT_LE_MTU;
}
return (num_disconnects > 0);
return num_disconnects > 0;
}
bool att_notify(uint16_t handle, const uint8_t* value, int length) {
bool att_notify(uint16_t handle, const uint8_t *value, int length) {
int num_notifications = 0;
for (size_t i = 0; i < BLEIO_TOTAL_CONNECTION_COUNT; i++) {
@ -643,20 +642,21 @@ bool att_notify(uint16_t handle, const uint8_t* value, int length) {
size_t allowed_length = MIN((uint16_t)(bleio_connections[i].mtu - sizeof(notify_t)), (uint16_t)length);
uint8_t notify_bytes[sizeof(notify_t) + allowed_length];
notify_t *notify = (notify_t *) notify_bytes;
notify->hdr.code = BT_ATT_OP_NOTIFY;;
notify_t *notify = (notify_t *)notify_bytes;
notify->hdr.code = BT_ATT_OP_NOTIFY;
;
notify->ntf.handle = handle;
memcpy(notify->ntf.value, value, allowed_length);
hci_send_acl_pkt(bleio_connections[i].conn_handle, BT_L2CAP_CID_ATT,
sizeof(notify_bytes), notify_bytes);
sizeof(notify_bytes), notify_bytes);
num_notifications++;
}
return (num_notifications > 0);
return num_notifications > 0;
}
bool att_indicate(uint16_t handle, const uint8_t* value, int length) {
bool att_indicate(uint16_t handle, const uint8_t *value, int length) {
int num_indications = 0;
for (size_t i = 0; i < BLEIO_TOTAL_CONNECTION_COUNT; i++) {
@ -672,15 +672,16 @@ bool att_indicate(uint16_t handle, const uint8_t* value, int length) {
size_t allowed_length = MIN((uint16_t)(bleio_connections[i].mtu - sizeof(indicate_t)), (uint16_t)length);
uint8_t indicate_bytes[sizeof(indicate_t) + allowed_length];
indicate_t *indicate = (indicate_t *) indicate_bytes;
indicate->hdr.code = BT_ATT_OP_INDICATE;;
indicate_t *indicate = (indicate_t *)indicate_bytes;
indicate->hdr.code = BT_ATT_OP_INDICATE;
;
indicate->ind.handle = handle;
memcpy(indicate->ind.value, value, allowed_length);
confirm = false;
hci_send_acl_pkt(bleio_connections[i].conn_handle, BT_L2CAP_CID_ATT,
sizeof(indicate_bytes), indicate_bytes);
sizeof(indicate_bytes), indicate_bytes);
while (!confirm) {
// RUN_BACKGROUND_TASKS includes hci_poll_for_incoming_pkt();
@ -694,11 +695,11 @@ bool att_indicate(uint16_t handle, const uint8_t* value, int length) {
num_indications++;
}
return (num_indications > 0);
return num_indications > 0;
}
STATIC void process_error(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) {
struct bt_att_error_rsp *rsp = (struct bt_att_error_rsp *) data;
struct bt_att_error_rsp *rsp = (struct bt_att_error_rsp *)data;
if (dlen != sizeof(struct bt_att_error_rsp)) {
// Incorrect size; ignore.
@ -714,7 +715,7 @@ STATIC void process_error(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) {
}
STATIC void process_mtu_req(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) {
struct bt_att_exchange_mtu_req *req = (struct bt_att_exchange_mtu_req *) data;
struct bt_att_exchange_mtu_req *req = (struct bt_att_exchange_mtu_req *)data;
if (dlen != sizeof(struct bt_att_exchange_mtu_req)) {
send_error(conn_handle, BT_ATT_OP_MTU_REQ, BLE_GATT_HANDLE_INVALID, BT_ATT_ERR_INVALID_PDU);
@ -738,17 +739,16 @@ STATIC void process_mtu_req(uint16_t conn_handle, uint8_t dlen, uint8_t data[])
struct bt_att_hdr h;
struct bt_att_exchange_mtu_rsp r;
} rsp = { {
.code = BT_ATT_OP_MTU_RSP,
}, {
.mtu = mtu,
}
};
.code = BT_ATT_OP_MTU_RSP,
}, {
.mtu = mtu,
}};
hci_send_acl_pkt(conn_handle, BT_L2CAP_CID_ATT, sizeof(rsp), (uint8_t *) &rsp);
hci_send_acl_pkt(conn_handle, BT_L2CAP_CID_ATT, sizeof(rsp), (uint8_t *)&rsp);
}
STATIC void process_mtu_rsp(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) {
struct bt_att_exchange_mtu_rsp *rsp = (struct bt_att_exchange_mtu_rsp *) data;
struct bt_att_exchange_mtu_rsp *rsp = (struct bt_att_exchange_mtu_rsp *)data;
if (dlen != sizeof(struct bt_att_exchange_mtu_rsp)) {
return;
@ -765,7 +765,7 @@ STATIC void process_mtu_rsp(uint16_t conn_handle, uint8_t dlen, uint8_t data[])
}
STATIC void process_find_info_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, uint8_t data[]) {
struct bt_att_find_info_req *req = (struct bt_att_find_info_req *) data;
struct bt_att_find_info_req *req = (struct bt_att_find_info_req *)data;
if (dlen != sizeof(struct bt_att_find_info_req)) {
send_error(conn_handle, BT_ATT_OP_FIND_INFO_REQ, req->start_handle, BT_ATT_ERR_INVALID_PDU);
@ -778,7 +778,7 @@ STATIC void process_find_info_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
} rsp_t;
uint8_t rsp_bytes[mtu];
rsp_t *rsp = (rsp_t *) rsp_bytes;
rsp_t *rsp = (rsp_t *)rsp_bytes;
rsp->h.code = BT_ATT_OP_FIND_INFO_RSP;
// Keeps track of total length of the response.
@ -832,20 +832,20 @@ STATIC void process_find_info_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
}
if (sizeof_uuid == 2) {
struct bt_att_info_16 *info_16 = (struct bt_att_info_16 *) &rsp_bytes[rsp_length];
struct bt_att_info_16 *info_16 = (struct bt_att_info_16 *)&rsp_bytes[rsp_length];
info_16->handle = handle;
info_16->uuid = common_hal_bleio_uuid_get_uuid16(uuid);
rsp_length += sizeof(struct bt_att_info_16);
} else {
struct bt_att_info_128 *info_128 = (struct bt_att_info_128 *) &rsp_bytes[rsp_length];
struct bt_att_info_128 *info_128 = (struct bt_att_info_128 *)&rsp_bytes[rsp_length];
info_128->handle = handle;
common_hal_bleio_uuid_get_uuid128(uuid, info_128->uuid);
rsp_length += sizeof(struct bt_att_info_128);
}
no_data =false;
no_data = false;
} // end for
@ -861,14 +861,13 @@ int att_find_info_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_
struct bt_att_hdr h;
struct bt_att_find_info_req r;
} req = { {
.code = BT_ATT_OP_FIND_INFO_REQ,
}, {
.start_handle = start_handle,
.end_handle = end_handle,
}
};
.code = BT_ATT_OP_FIND_INFO_REQ,
}, {
.start_handle = start_handle,
.end_handle = end_handle,
}};
return send_req_wait_for_rsp(conn_handle, sizeof(req), (uint8_t *) &req, response_buffer);
return send_req_wait_for_rsp(conn_handle, sizeof(req), (uint8_t *)&req, response_buffer);
}
STATIC void process_find_info_rsp(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) {
@ -880,7 +879,7 @@ STATIC void process_find_info_rsp(uint16_t conn_handle, uint8_t dlen, uint8_t da
}
STATIC void process_find_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, uint8_t data[]) {
struct bt_att_find_type_req *req = (struct bt_att_find_type_req *) data;
struct bt_att_find_type_req *req = (struct bt_att_find_type_req *)data;
if (dlen < sizeof(struct bt_att_find_type_req)) {
send_error(conn_handle, BT_ATT_OP_FIND_TYPE_RSP, req->start_handle, BT_ATT_ERR_INVALID_PDU);
@ -893,7 +892,7 @@ STATIC void process_find_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
response[0] = BT_ATT_OP_FIND_TYPE_RSP;
response_length = 1;
//FIX
// FIX
// if (find_type_req->type == BLE_UUID_SERVICE_PRIMARY) {
// for (uint16_t i = (find_type_req->start_handle - 1); i < GATT.attributeCount() && i <= (find_type_req->end_handle - 1); i++) {
// BLELocalAttribute* attribute = GATT.attribute(i);
@ -926,7 +925,7 @@ STATIC void process_find_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
}
void process_read_group_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, uint8_t data[]) {
struct bt_att_read_group_req *req = (struct bt_att_read_group_req *) data;
struct bt_att_read_group_req *req = (struct bt_att_read_group_req *)data;
uint16_t type_uuid = req->uuid[0] | (req->uuid[1] << 8);
// We only support returning services for BT_ATT_OP_READ_GROUP_REQ, which is typically used
@ -944,7 +943,7 @@ void process_read_group_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, ui
} rsp_t;
uint8_t rsp_bytes[mtu];
rsp_t *rsp = (rsp_t *) rsp_bytes;
rsp_t *rsp = (rsp_t *)rsp_bytes;
rsp->h.code = BT_ATT_OP_READ_GROUP_RSP;
rsp->r.len = 0;
@ -991,7 +990,7 @@ void process_read_group_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, ui
// There may be multiple chunks in this transmission.
rsp->r.len = data_length;
struct bt_att_group_data *group_data = (struct bt_att_group_data *) &rsp_bytes[rsp_length];
struct bt_att_group_data *group_data = (struct bt_att_group_data *)&rsp_bytes[rsp_length];
group_data->start_handle = service->start_handle;
group_data->end_handle = service->end_handle;
@ -1017,7 +1016,7 @@ int att_read_group_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end
} req_t;
uint8_t req_bytes[sizeof(req_t) + sizeof(uuid)];
req_t *req = (req_t *) req_bytes;
req_t *req = (req_t *)req_bytes;
req->h.code = BT_ATT_OP_READ_GROUP_REQ;
req->r.start_handle = start_handle;
@ -1047,7 +1046,7 @@ STATIC void process_read_or_read_blob_req(uint16_t conn_handle, uint16_t mtu, ui
return;
}
struct bt_att_read_req *req = (struct bt_att_read_req *) data;
struct bt_att_read_req *req = (struct bt_att_read_req *)data;
handle = req->handle;
response_opcode = BT_ATT_OP_READ_RSP;
@ -1057,7 +1056,7 @@ STATIC void process_read_or_read_blob_req(uint16_t conn_handle, uint16_t mtu, ui
return;
}
struct bt_att_read_blob_req *req = (struct bt_att_read_blob_req *) data;
struct bt_att_read_blob_req *req = (struct bt_att_read_blob_req *)data;
handle = req->handle;
offset = req->offset;
response_opcode = BT_ATT_OP_READ_BLOB_RSP;
@ -1077,7 +1076,7 @@ STATIC void process_read_or_read_blob_req(uint16_t conn_handle, uint16_t mtu, ui
} rsp_t;
uint8_t rsp_bytes[mtu];
rsp_t *rsp = (rsp_t *) rsp_bytes;
rsp_t *rsp = (rsp_t *)rsp_bytes;
rsp->h.code = response_opcode;
// Keeps track of total length of the response.
@ -1105,7 +1104,7 @@ STATIC void process_read_or_read_blob_req(uint16_t conn_handle, uint16_t mtu, ui
return;
}
characteristic_declaration_t *char_decl = (characteristic_declaration_t *) rsp->r.value;
characteristic_declaration_t *char_decl = (characteristic_declaration_t *)rsp->r.value;
// Convert from the bleio properties bit values to the BLE spec properties bit values.
// They are not the same :(.
@ -1160,7 +1159,7 @@ STATIC void process_read_rsp(uint16_t conn_handle, uint8_t dlen, uint8_t data[])
}
STATIC void process_read_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, uint8_t data[]) {
struct bt_att_read_type_req *req = (struct bt_att_read_type_req *) data;
struct bt_att_read_type_req *req = (struct bt_att_read_type_req *)data;
uint16_t type_uuid = req->uuid[0] | (req->uuid[1] << 8);
if (dlen != sizeof(struct bt_att_read_type_req) + sizeof(type_uuid)) {
@ -1174,7 +1173,7 @@ STATIC void process_read_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
} rsp_t;
uint8_t rsp_bytes[mtu];
rsp_t *rsp = (rsp_t *) rsp_bytes;
rsp_t *rsp = (rsp_t *)rsp_bytes;
rsp->h.code = BT_ATT_OP_READ_TYPE_RSP;
rsp->r.len = 0;
@ -1233,11 +1232,11 @@ STATIC void process_read_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
// There may be multiple chunks in this transmission.
rsp->r.len = data_length;
struct bt_att_data *att_data = (struct bt_att_data *) &rsp_bytes[rsp_length];
struct bt_att_data *att_data = (struct bt_att_data *)&rsp_bytes[rsp_length];
att_data->handle = characteristic->decl_handle;
characteristic_declaration_t *char_decl = (characteristic_declaration_t *) att_data->value;
characteristic_declaration_t *char_decl = (characteristic_declaration_t *)att_data->value;
// Convert from the bleio properties bit values to the BLE spec properties bit values.
// They are not the same :(.
@ -1255,7 +1254,7 @@ STATIC void process_read_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
// See if request is for a descriptor value with a 16-bit UUID, such as the CCCD.
bleio_descriptor_obj_t *descriptor = MP_OBJ_TO_PTR(attribute_obj);
if (bleio_uuid_get_uuid16_or_unknown(descriptor->uuid) == type_uuid) {
struct bt_att_data *att_data = (struct bt_att_data *) &rsp_bytes[rsp_length];
struct bt_att_data *att_data = (struct bt_att_data *)&rsp_bytes[rsp_length];
att_data->handle = handle;
@ -1277,7 +1276,7 @@ STATIC void process_read_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(attribute_obj);
if (bleio_uuid_get_uuid16_or_unknown(characteristic->uuid) == type_uuid) {
struct bt_att_data *att_data = (struct bt_att_data *) &rsp_bytes[rsp_length];
struct bt_att_data *att_data = (struct bt_att_data *)&rsp_bytes[rsp_length];
att_data->handle = handle;
@ -1299,7 +1298,7 @@ STATIC void process_read_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
if (no_data) {
send_error(conn_handle, BT_ATT_OP_READ_TYPE_REQ,
req->start_handle, BT_ATT_ERR_ATTRIBUTE_NOT_FOUND);
req->start_handle, BT_ATT_ERR_ATTRIBUTE_NOT_FOUND);
} else {
hci_send_acl_pkt(conn_handle, BT_L2CAP_CID_ATT, rsp_length, rsp_bytes);
}
@ -1312,7 +1311,7 @@ int att_read_type_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_
} req_t;
uint8_t req_bytes[sizeof(req_t) + sizeof(type)];
req_t *req = (req_t *) req_bytes;
req_t *req = (req_t *)req_bytes;
req->h.code = BT_ATT_OP_READ_TYPE_REQ;
req->r.start_handle = start_handle;
@ -1334,7 +1333,7 @@ STATIC void process_read_type_rsp(uint16_t conn_handle, uint8_t dlen, uint8_t da
// Handles BT_ATT_OP_WRITE_REQ or BT_ATT_OP_WRITE_
STATIC void process_write_req_or_cmd(uint16_t conn_handle, uint16_t mtu, uint8_t op, uint8_t dlen, uint8_t data[]) {
// struct bt_att_write_cmd is identical, so don't bother to split code paths based on opcode.
struct bt_att_write_req *req = (struct bt_att_write_req *) data;
struct bt_att_write_req *req = (struct bt_att_write_req *)data;
bool with_response = (op == BT_ATT_OP_WRITE_REQ);
@ -1397,7 +1396,7 @@ STATIC void process_write_req_or_cmd(uint16_t conn_handle, uint16_t mtu, uint8_t
.code = BT_ATT_OP_WRITE_RSP,
};
hci_send_acl_pkt(conn_handle, BT_L2CAP_CID_ATT, sizeof(rsp), (uint8_t *) &rsp);
hci_send_acl_pkt(conn_handle, BT_L2CAP_CID_ATT, sizeof(rsp), (uint8_t *)&rsp);
}
}
@ -1410,7 +1409,7 @@ STATIC void process_write_rsp(uint16_t conn_handle, uint8_t dlen, uint8_t data[]
}
STATIC void process_prepare_write_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, uint8_t data[]) {
struct bt_att_prepare_write_req *req = (struct bt_att_prepare_write_req *) data;
struct bt_att_prepare_write_req *req = (struct bt_att_prepare_write_req *)data;
if (dlen < sizeof(struct bt_att_prepare_write_req)) {
send_error(conn_handle, BT_ATT_OP_PREPARE_WRITE_REQ, BLE_GATT_HANDLE_INVALID, BT_ATT_ERR_INVALID_PDU);
@ -1419,7 +1418,7 @@ STATIC void process_prepare_write_req(uint16_t conn_handle, uint16_t mtu, uint8_
uint16_t handle = req->handle;
uint16_t offset = req->offset;
(void) offset;
(void)offset;
if (handle > bleio_adapter_max_attribute_handle(&common_hal_bleio_adapter_obj)) {
send_error(conn_handle, BT_ATT_OP_PREPARE_WRITE_REQ, handle, BT_ATT_ERR_ATTRIBUTE_NOT_FOUND);
@ -1433,7 +1432,7 @@ STATIC void process_prepare_write_req(uint16_t conn_handle, uint16_t mtu, uint8_
return;
}
bleio_characteristic_obj_t* characteristic = MP_OBJ_TO_PTR(attribute);
bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(attribute);
if (handle != characteristic->handle) {
send_error(conn_handle, BT_ATT_OP_PREPARE_WRITE_REQ, handle, BT_ATT_ERR_ATTRIBUTE_NOT_LONG);
@ -1445,7 +1444,7 @@ STATIC void process_prepare_write_req(uint16_t conn_handle, uint16_t mtu, uint8_
return;
}
//FIX if (long_write_handle == BLE_GATT_HANDLE_INVALID)
// FIX if (long_write_handle == BLE_GATT_HANDLE_INVALID)
// int valueSize = characteristic->valueSize();
// long_write_value = (uint8_t*)realloc(long_write_value, valueSize);
@ -1480,7 +1479,7 @@ STATIC void process_prepare_write_req(uint16_t conn_handle, uint16_t mtu, uint8_
}
STATIC void process_exec_write_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, uint8_t data[]) {
struct bt_att_exec_write_req *req = (struct bt_att_exec_write_req *) data;
struct bt_att_exec_write_req *req = (struct bt_att_exec_write_req *)data;
if (dlen != sizeof(struct bt_att_exec_write_req)) {
send_error(conn_handle, BT_ATT_OP_EXEC_WRITE_REQ, BLE_GATT_HANDLE_INVALID, BT_ATT_ERR_INVALID_PDU);
@ -1488,11 +1487,11 @@ STATIC void process_exec_write_req(uint16_t conn_handle, uint16_t mtu, uint8_t d
}
if (long_write_handle && (req->flags & 0x01)) {
//FIX BLELocalCharacteristic* characteristic = (BLELocalCharacteristic*)GATT.attribute(long_write_handle - 1);
// FIX BLELocalCharacteristic* characteristic = (BLELocalCharacteristic*)GATT.attribute(long_write_handle - 1);
for (size_t i = 0; i < BLEIO_TOTAL_CONNECTION_COUNT; i++) {
if (bleio_connections[i].conn_handle == conn_handle) {
//FIX characteristic->writeValue(BLEDevice(bleio_connections[i].address_type, bleio_connections[i].address), long_write_value, long_write_value_length);
// FIX characteristic->writeValue(BLEDevice(bleio_connections[i].address_type, bleio_connections[i].address), long_write_value, long_write_value_length);
break;
}
}
@ -1516,16 +1515,16 @@ STATIC void process_notify_or_indicate(uint16_t conn_handle, uint8_t opcode, uin
}
// struct bt_att_notify and bt_att_indicate are identical.
//FIXunused struct bt_att_notify *req = (struct bt_att_notify *) data;
// FIXunused struct bt_att_notify *req = (struct bt_att_notify *) data;
//FIXunused uint8_t handle = req->handle;
// FIXunused uint8_t handle = req->handle;
for (size_t i = 0; i < BLEIO_TOTAL_CONNECTION_COUNT; i++) {
if (bleio_connections[i].conn_handle != conn_handle) {
continue;
}
//FIX BLERemoteDevice* device = bleio_connections[i].device;
// FIX BLERemoteDevice* device = bleio_connections[i].device;
// if (!device) {
// break;
@ -1562,9 +1561,9 @@ STATIC void process_notify_or_indicate(uint16_t conn_handle, uint8_t opcode, uin
}
STATIC void process_confirm(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) {
(void) conn_handle;
(void) dlen;
(void) data;
(void)conn_handle;
(void)dlen;
(void)data;
confirm = true;
}
@ -1574,7 +1573,7 @@ bool att_exchange_mtu(uint16_t conn_handle) {
struct bt_att_exchange_mtu_req req = {
.mtu = max_mtu,
};
return send_req_wait_for_rsp(conn_handle, sizeof(req), (uint8_t *) &req, response_buffer);
return send_req_wait_for_rsp(conn_handle, sizeof(req), (uint8_t *)&req, response_buffer);
}
int att_read_req(uint16_t conn_handle, uint16_t handle, uint8_t response_buffer[]) {
@ -1582,23 +1581,22 @@ int att_read_req(uint16_t conn_handle, uint16_t handle, uint8_t response_buffer[
struct bt_att_hdr h;
struct bt_att_read_req r;
} req = { {
.code = BT_ATT_OP_READ_REQ,
}, {
.handle = handle,
}
};
.code = BT_ATT_OP_READ_REQ,
}, {
.handle = handle,
}};
return send_req_wait_for_rsp(conn_handle, sizeof(req), (uint8_t *) &req, response_buffer);
return send_req_wait_for_rsp(conn_handle, sizeof(req), (uint8_t *)&req, response_buffer);
}
int att_write_req(uint16_t conn_handle, uint16_t handle, const uint8_t* data, uint8_t data_len, uint8_t response_buffer[]) {
int att_write_req(uint16_t conn_handle, uint16_t handle, const uint8_t *data, uint8_t data_len, uint8_t response_buffer[]) {
typedef struct __packed {
struct bt_att_hdr h;
struct bt_att_write_req r;
} req_t;
uint8_t req_bytes[sizeof(req_t) + data_len];
req_t *req = (req_t *) req_bytes;
req_t *req = (req_t *)req_bytes;
req->h.code = BT_ATT_OP_WRITE_REQ;
req->r.handle = handle;
memcpy(req->r.value, data, data_len);
@ -1606,14 +1604,14 @@ int att_write_req(uint16_t conn_handle, uint16_t handle, const uint8_t* data, ui
return send_req_wait_for_rsp(conn_handle, sizeof(req_bytes), req_bytes, response_buffer);
}
void att_write_cmd(uint16_t conn_handle, uint16_t handle, const uint8_t* data, uint8_t data_len) {
void att_write_cmd(uint16_t conn_handle, uint16_t handle, const uint8_t *data, uint8_t data_len) {
typedef struct __packed {
struct bt_att_hdr h;
struct bt_att_write_cmd r;
} cmd_t;
uint8_t cmd_bytes[sizeof(cmd_t) + data_len];
cmd_t *cmd = (cmd_t *) cmd_bytes;
cmd_t *cmd = (cmd_t *)cmd_bytes;
cmd->h.code = BT_ATT_OP_WRITE_CMD;
cmd->r.handle = handle;
memcpy(cmd->r.value, data, data_len);
@ -1715,7 +1713,7 @@ void att_process_data(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) {
}
}
//FIX Do we need all of these?
// FIX Do we need all of these?
void check_att_err(uint8_t err) {
const compressed_string_t *msg = NULL;
switch (err) {

View File

@ -32,19 +32,19 @@
void bleio_att_reset(void);
//FIX void att_set_event_handler(BLEDeviceEvent event, BLEDeviceEventHandler eventHandler);
// FIX void att_set_event_handler(BLEDeviceEvent event, BLEDeviceEventHandler eventHandler);
bool att_address_is_connected(bt_addr_le_t *addr);
bool att_connect_to_address(bt_addr_le_t *addr);
bool att_disconnect(uint16_t conn_handle);
bool att_disconnect_all(void);
bool att_discover_attributes(bt_addr_le_t *addr, const char* service_uuid_filter);
bool att_discover_attributes(bt_addr_le_t *addr, const char *service_uuid_filter);
bool att_exchange_mtu(uint16_t conn_handle);
bool att_handle_is_connected(uint16_t handle);
bool att_indicate(uint16_t handle, const uint8_t* value, int length);
bool att_indicate(uint16_t handle, const uint8_t *value, int length);
bool att_is_connected(void);
bool att_notify(uint16_t handle, const uint8_t* value, int length);
bool att_notify(uint16_t handle, const uint8_t *value, int length);
int att_read_req(uint16_t conn_handle, uint16_t handle, uint8_t response_buffer[]);
int att_write_req(uint16_t conn_handle, uint16_t handle, const uint8_t* data, uint8_t data_len, uint8_t response_buffer[]);
int att_write_req(uint16_t conn_handle, uint16_t handle, const uint8_t *data, uint8_t data_len, uint8_t response_buffer[]);
uint16_t att_conn_handle(bt_addr_le_t *addr);
uint16_t att_mtu(uint16_t handle);
void att_add_connection(uint16_t handle, uint8_t role, bt_addr_le_t *peer_addr, uint16_t interval, uint16_t latency, uint16_t supervision_timeout, uint8_t master_clock_accuracy);
@ -52,6 +52,6 @@ void att_process_data(uint16_t conn_handle, uint8_t dlen, uint8_t data[]);
void att_remove_connection(uint16_t conn_handle, uint8_t reason);
void att_set_max_mtu(uint16_t max_mtu);
void att_set_timeout(unsigned long timeout);
void att_write_cmd(uint16_t conn_handle, uint16_t handle, const uint8_t* data, uint8_t data_len);
void att_write_cmd(uint16_t conn_handle, uint16_t handle, const uint8_t *data, uint8_t data_len);
#endif // MICROPY_INCLUDED_DEVICES_BLE_HCI_COMMON_HAL_BLEIO_ATT_H

View File

@ -27,7 +27,7 @@
#include <string.h>
#include "py/mphal.h" //*****************************
#include "py/mphal.h" // *****************************
#include "supervisor/shared/tick.h"
#include "shared-bindings/_bleio/__init__.h"
#include "common-hal/_bleio/Adapter.h"
@ -63,8 +63,8 @@ typedef struct __attribute__ ((packed)) {
typedef struct __attribute__ ((packed)) {
uint8_t pkt_type;
uint16_t handle : 12;
uint8_t pb: 2; // Packet boundary flag: ACL_DATA_PB values.
uint8_t bc: 2; // Broadcast flag: always 0b00 for BLE.
uint8_t pb : 2; // Packet boundary flag: ACL_DATA_PB values.
uint8_t bc : 2; // Broadcast flag: always 0b00 for BLE.
uint16_t data_len; // length of data[] in this packet.
uint8_t data[];
} h4_hci_acl_pkt_t;
@ -89,7 +89,7 @@ typedef struct __attribute__ ((packed)) {
//////////////////////////////////////////////////////////////////////
// Static storage:
//FIX size
// FIX size
#define RX_BUFFER_SIZE (3 + 255)
#define ACL_DATA_BUFFER_SIZE (255)
@ -107,7 +107,7 @@ STATIC bool cmd_response_received;
STATIC uint16_t cmd_response_opcode;
STATIC uint8_t cmd_response_status;
STATIC size_t cmd_response_len;
STATIC uint8_t* cmd_response_data;
STATIC uint8_t *cmd_response_data;
STATIC volatile bool hci_poll_in_progress = false;
@ -119,7 +119,7 @@ STATIC volatile bool hci_poll_in_progress = false;
#endif // HCI_DEBUG
STATIC void process_acl_data_pkt(uint8_t pkt_len, uint8_t pkt_data[]) {
h4_hci_acl_pkt_t *pkt = (h4_hci_acl_pkt_t*) pkt_data;
h4_hci_acl_pkt_t *pkt = (h4_hci_acl_pkt_t *)pkt_data;
if (pkt->pb != ACL_DATA_PB_MIDDLE) {
// This is the start of a fragmented acl_data packet or is a full packet.
@ -132,7 +132,7 @@ STATIC void process_acl_data_pkt(uint8_t pkt_len, uint8_t pkt_data[]) {
acl_data_len += pkt->data_len;
}
acl_data_t *acl = (acl_data_t *) &acl_data_buffer;
acl_data_t *acl = (acl_data_t *)&acl_data_buffer;
if (acl_data_len != sizeof(acl) + acl->acl_data_len) {
// We don't have the full packet yet.
return;
@ -167,18 +167,17 @@ STATIC void process_num_comp_pkts(uint16_t handle, uint16_t num_pkts) {
}
}
STATIC void process_evt_pkt(size_t pkt_len, uint8_t pkt_data[])
{
h4_hci_evt_pkt_t *pkt = (h4_hci_evt_pkt_t*) pkt_data;
STATIC void process_evt_pkt(size_t pkt_len, uint8_t pkt_data[]) {
h4_hci_evt_pkt_t *pkt = (h4_hci_evt_pkt_t *)pkt_data;
switch (pkt->evt) {
case BT_HCI_EVT_DISCONN_COMPLETE: {
struct bt_hci_evt_disconn_complete *disconn_complete =
(struct bt_hci_evt_disconn_complete*) pkt->params;
(void) disconn_complete;
(struct bt_hci_evt_disconn_complete *)pkt->params;
(void)disconn_complete;
att_remove_connection(disconn_complete->handle, disconn_complete->reason);
//FIX L2CAPSignaling.removeConnection(disconn_complete->handle, disconn_complete->reason);
// FIX L2CAPSignaling.removeConnection(disconn_complete->handle, disconn_complete->reason);
break;
}
@ -188,7 +187,7 @@ STATIC void process_evt_pkt(size_t pkt_len, uint8_t pkt_data[])
struct bt_hci_evt_cc_status cc_status;
} __packed;
struct cmd_complete_with_status *evt = (struct cmd_complete_with_status *) pkt->params;
struct cmd_complete_with_status *evt = (struct cmd_complete_with_status *)pkt->params;
num_command_packets_allowed = evt->cmd_complete.ncmd;
@ -197,7 +196,7 @@ STATIC void process_evt_pkt(size_t pkt_len, uint8_t pkt_data[])
cmd_response_status = evt->cc_status.status;
// All the bytes following cmd_complete, -including- the status byte, which is
// included in all the _bt_hci_rp_* structs.
cmd_response_data = (uint8_t *) &evt->cc_status;
cmd_response_data = (uint8_t *)&evt->cc_status;
// Includes status byte.
cmd_response_len = pkt->param_len - sizeof_field(struct cmd_complete_with_status, cmd_complete);
@ -205,7 +204,7 @@ STATIC void process_evt_pkt(size_t pkt_len, uint8_t pkt_data[])
}
case BT_HCI_EVT_CMD_STATUS: {
struct bt_hci_evt_cmd_status *evt = (struct bt_hci_evt_cmd_status *) pkt->params;
struct bt_hci_evt_cmd_status *evt = (struct bt_hci_evt_cmd_status *)pkt->params;
num_command_packets_allowed = evt->ncmd;
@ -220,7 +219,7 @@ STATIC void process_evt_pkt(size_t pkt_len, uint8_t pkt_data[])
case BT_HCI_EVT_NUM_COMPLETED_PACKETS: {
struct bt_hci_evt_num_completed_packets *evt =
(struct bt_hci_evt_num_completed_packets *) pkt->params;
(struct bt_hci_evt_num_completed_packets *)pkt->params;
// Start at zero-th pair: (conn handle, num completed packets).
struct bt_hci_handle_count *handle_and_count = &(evt->h[0]);
@ -232,8 +231,8 @@ STATIC void process_evt_pkt(size_t pkt_len, uint8_t pkt_data[])
}
case BT_HCI_EVT_LE_META_EVENT: {
struct bt_hci_evt_le_meta_event *meta_evt = (struct bt_hci_evt_le_meta_event *) pkt->params;
uint8_t *le_evt = pkt->params + sizeof (struct bt_hci_evt_le_meta_event);
struct bt_hci_evt_le_meta_event *meta_evt = (struct bt_hci_evt_le_meta_event *)pkt->params;
uint8_t *le_evt = pkt->params + sizeof (struct bt_hci_evt_le_meta_event);
if (meta_evt->subevent == BT_HCI_EVT_LE_CONN_COMPLETE) {
// Advertising stops when connection occurs.
@ -243,7 +242,7 @@ STATIC void process_evt_pkt(size_t pkt_len, uint8_t pkt_data[])
bleio_adapter_advertising_was_stopped(&common_hal_bleio_adapter_obj);
struct bt_hci_evt_le_conn_complete *le_conn_complete =
(struct bt_hci_evt_le_conn_complete *) le_evt;
(struct bt_hci_evt_le_conn_complete *)le_evt;
if (le_conn_complete->status == BT_HCI_ERR_SUCCESS) {
att_add_connection(
@ -258,9 +257,9 @@ STATIC void process_evt_pkt(size_t pkt_len, uint8_t pkt_data[])
}
} else if (meta_evt->subevent == BT_HCI_EVT_LE_ADVERTISING_REPORT) {
struct bt_hci_evt_le_advertising_info *le_advertising_info =
(struct bt_hci_evt_le_advertising_info *) le_evt;
(struct bt_hci_evt_le_advertising_info *)le_evt;
if (le_advertising_info->evt_type == BT_HCI_ADV_DIRECT_IND) {
//FIX
// FIX
// last byte is RSSI
// GAP.handleLeAdvertisingReport(leAdvertisingReport->type,
// leAdvertisingReport->peerBdaddrType,
@ -275,9 +274,9 @@ STATIC void process_evt_pkt(size_t pkt_len, uint8_t pkt_data[])
}
default:
#if HCI_DEBUG
#if HCI_DEBUG
mp_printf(&mp_plat_print, "process_evt_pkt: Unknown event: %02x\n");
#endif
#endif
break;
}
}
@ -333,7 +332,7 @@ hci_result_t hci_poll_for_incoming_pkt(void) {
case H4_ACL:
if (rx_idx >= sizeof(h4_hci_acl_pkt_t)) {
const size_t total_len =
sizeof(h4_hci_acl_pkt_t) + ((h4_hci_acl_pkt_t *) rx_buffer)->data_len;
sizeof(h4_hci_acl_pkt_t) + ((h4_hci_acl_pkt_t *)rx_buffer)->data_len;
if (rx_idx == total_len) {
packet_is_complete = true;
}
@ -346,7 +345,7 @@ hci_result_t hci_poll_for_incoming_pkt(void) {
case H4_EVT:
if (rx_idx >= sizeof(h4_hci_evt_pkt_t)) {
const size_t total_len =
sizeof(h4_hci_evt_pkt_t) + ((h4_hci_evt_pkt_t *) rx_buffer)->param_len;
sizeof(h4_hci_evt_pkt_t) + ((h4_hci_evt_pkt_t *)rx_buffer)->param_len;
if (rx_idx == total_len) {
packet_is_complete = true;
}
@ -374,23 +373,23 @@ hci_result_t hci_poll_for_incoming_pkt(void) {
switch (rx_buffer[0]) {
case H4_ACL:
#if HCI_DEBUG
#if HCI_DEBUG
dump_acl_pkt(false, pkt_len, rx_buffer);
#endif
#endif
process_acl_data_pkt(pkt_len, rx_buffer);
break;
case H4_EVT:
#if HCI_DEBUG
#if HCI_DEBUG
dump_evt_pkt(false, pkt_len, rx_buffer);
#endif
#endif
process_evt_pkt(pkt_len, rx_buffer);
break;
default:
#if HCI_DEBUG
#if HCI_DEBUG
mp_printf(&mp_plat_print, "Unknown HCI packet type: %d\n", rx_buffer[0]);
#endif
#endif
break;
}
@ -425,21 +424,21 @@ STATIC hci_result_t write_pkt(uint8_t *buffer, size_t len) {
return HCI_OK;
}
STATIC hci_result_t send_command(uint16_t opcode, uint8_t params_len, void* params) {
STATIC hci_result_t send_command(uint16_t opcode, uint8_t params_len, void *params) {
uint8_t cmd_pkt_len = sizeof(h4_hci_cmd_pkt_t) + params_len;
uint8_t tx_buffer[cmd_pkt_len];
// cmd header is at the beginning of tx_buffer
h4_hci_cmd_pkt_t *cmd_pkt = (h4_hci_cmd_pkt_t *) tx_buffer;
h4_hci_cmd_pkt_t *cmd_pkt = (h4_hci_cmd_pkt_t *)tx_buffer;
cmd_pkt->pkt_type = H4_CMD;
cmd_pkt->opcode = opcode;
cmd_pkt->param_len = params_len;
memcpy(cmd_pkt->params, params, params_len);
#if HCI_DEBUG
dump_cmd_pkt(true, sizeof(tx_buffer), tx_buffer);
#endif
#if HCI_DEBUG
dump_cmd_pkt(true, sizeof(tx_buffer), tx_buffer);
#endif
int result = write_pkt(tx_buffer, cmd_pkt_len);
if (result != HCI_OK) {
@ -478,8 +477,8 @@ hci_result_t hci_send_acl_pkt(uint16_t handle, uint8_t cid, uint16_t data_len, u
const size_t buf_len = sizeof(h4_hci_acl_pkt_t) + sizeof(acl_data_t) + data_len;
uint8_t tx_buffer[buf_len];
h4_hci_acl_pkt_t *acl_pkt = (h4_hci_acl_pkt_t *) tx_buffer;
acl_data_t *acl_data = (acl_data_t *) acl_pkt->data;
h4_hci_acl_pkt_t *acl_pkt = (h4_hci_acl_pkt_t *)tx_buffer;
acl_data_t *acl_data = (acl_data_t *)acl_pkt->data;
acl_pkt->pkt_type = H4_ACL;
acl_pkt->handle = handle;
acl_pkt->pb = ACL_DATA_PB_FIRST_FLUSH;
@ -490,9 +489,9 @@ hci_result_t hci_send_acl_pkt(uint16_t handle, uint8_t cid, uint16_t data_len, u
memcpy(&acl_data->acl_data, data, data_len);
#if HCI_DEBUG
dump_acl_pkt(true, buf_len, tx_buffer);
#endif
#if HCI_DEBUG
dump_acl_pkt(true, buf_len, tx_buffer);
#endif
pending_pkt++;
@ -512,7 +511,7 @@ hci_result_t hci_read_local_version(uint8_t *hci_version, uint16_t *hci_revision
hci_result_t result = send_command(BT_HCI_OP_READ_LOCAL_VERSION_INFO, 0, NULL);
if (result == HCI_OK) {
struct bt_hci_rp_read_local_version_info *response =
(struct bt_hci_rp_read_local_version_info *) cmd_response_data;
(struct bt_hci_rp_read_local_version_info *)cmd_response_data;
*hci_version = response->hci_version;
*hci_revision = response->hci_revision;
*lmp_version = response->lmp_version;
@ -526,7 +525,7 @@ hci_result_t hci_read_local_version(uint8_t *hci_version, uint16_t *hci_revision
hci_result_t hci_read_bd_addr(bt_addr_t *addr) {
int result = send_command(BT_HCI_OP_READ_BD_ADDR, 0, NULL);
if (result == HCI_OK) {
struct bt_hci_rp_read_bd_addr *response = (struct bt_hci_rp_read_bd_addr *) cmd_response_data;
struct bt_hci_rp_read_bd_addr *response = (struct bt_hci_rp_read_bd_addr *)cmd_response_data;
memcpy(addr->val, response->bdaddr.val, sizeof_field(bt_addr_t, val));
}
@ -536,7 +535,7 @@ hci_result_t hci_read_bd_addr(bt_addr_t *addr) {
hci_result_t hci_read_rssi(uint16_t handle, int *rssi) {
int result = send_command(BT_HCI_OP_READ_RSSI, sizeof(handle), &handle);
if (result == HCI_OK) {
struct bt_hci_rp_read_rssi *response = (struct bt_hci_rp_read_rssi *) cmd_response_data;
struct bt_hci_rp_read_rssi *response = (struct bt_hci_rp_read_rssi *)cmd_response_data;
*rssi = response->rssi;
}
@ -551,7 +550,7 @@ hci_result_t hci_le_read_buffer_size(uint16_t *le_max_len, uint8_t *le_max_num)
int result = send_command(BT_HCI_OP_LE_READ_BUFFER_SIZE, 0, NULL);
if (result == HCI_OK) {
struct bt_hci_rp_le_read_buffer_size *response =
(struct bt_hci_rp_le_read_buffer_size *) cmd_response_data;
(struct bt_hci_rp_le_read_buffer_size *)cmd_response_data;
*le_max_len = response->le_max_len;
*le_max_num = response->le_max_num;
}
@ -563,7 +562,7 @@ hci_result_t hci_read_buffer_size(uint16_t *acl_max_len, uint8_t *sco_max_len, u
int result = send_command(BT_HCI_OP_READ_BUFFER_SIZE, 0, NULL);
if (result == HCI_OK) {
struct bt_hci_rp_read_buffer_size *response =
(struct bt_hci_rp_read_buffer_size *) cmd_response_data;
(struct bt_hci_rp_read_buffer_size *)cmd_response_data;
*acl_max_len = response->acl_max_len;
*sco_max_len = response->sco_max_len;
*acl_max_num = response->acl_max_num;
@ -608,10 +607,10 @@ hci_result_t hci_le_set_extended_advertising_parameters(uint8_t handle, uint16_t
.scan_req_notify_enable = scan_req_notify_enable,
};
// Assumes little-endian.
memcpy(params.prim_min_interval, (void *) &prim_min_interval,
sizeof_field(struct bt_hci_cp_le_set_ext_adv_param, prim_min_interval));
memcpy(params.prim_max_interval, (void *) &prim_max_interval,
sizeof_field(struct bt_hci_cp_le_set_ext_adv_param, prim_max_interval));
memcpy(params.prim_min_interval, (void *)&prim_min_interval,
sizeof_field(struct bt_hci_cp_le_set_ext_adv_param, prim_min_interval));
memcpy(params.prim_max_interval, (void *)&prim_max_interval,
sizeof_field(struct bt_hci_cp_le_set_ext_adv_param, prim_max_interval));
memcpy(params.peer_addr.a.val, peer_addr->a.val, sizeof_field(bt_addr_le_t, a.val));
return send_command(BT_HCI_OP_LE_SET_EXT_ADV_PARAM, sizeof(params), &params);
}
@ -620,7 +619,7 @@ hci_result_t hci_le_read_maximum_advertising_data_length(uint16_t *max_adv_data_
int result = send_command(BT_HCI_OP_LE_READ_MAX_ADV_DATA_LEN, 0, NULL);
if (result == HCI_OK) {
struct bt_hci_rp_le_read_max_adv_data_len *response =
(struct bt_hci_rp_le_read_max_adv_data_len *) cmd_response_data;
(struct bt_hci_rp_le_read_max_adv_data_len *)cmd_response_data;
*max_adv_data_len = response->max_adv_data_len;
}
@ -631,9 +630,9 @@ hci_result_t hci_le_read_local_supported_features(uint8_t features[8]) {
int result = send_command(BT_HCI_OP_LE_READ_LOCAL_FEATURES, 0, NULL);
if (result == HCI_OK) {
struct bt_hci_rp_le_read_local_features *response =
(struct bt_hci_rp_le_read_local_features *) cmd_response_data;
(struct bt_hci_rp_le_read_local_features *)cmd_response_data;
memcpy(features, response->features,
sizeof_field(struct bt_hci_rp_le_read_local_features, features));
sizeof_field(struct bt_hci_rp_le_read_local_features, features));
}
return result;
@ -685,7 +684,7 @@ hci_result_t hci_le_set_advertising_enable(uint8_t enable) {
hci_result_t hci_le_set_extended_advertising_enable(uint8_t enable, uint8_t set_num, uint8_t handle[], uint16_t duration[], uint8_t max_ext_adv_evts[]) {
uint8_t params[sizeof(struct bt_hci_cp_le_set_ext_adv_enable) +
set_num * (sizeof(struct bt_hci_ext_adv_set))];
struct bt_hci_cp_le_set_ext_adv_enable *params_p = (struct bt_hci_cp_le_set_ext_adv_enable *) &params;
struct bt_hci_cp_le_set_ext_adv_enable *params_p = (struct bt_hci_cp_le_set_ext_adv_enable *)&params;
params_p->enable = enable;
params_p->set_num = set_num;
for (size_t i = 0; i < set_num; i++) {

View File

@ -26,248 +26,462 @@
// This file is #include'd in hci.c when HCI_DEBUG is non-zero.
STATIC const char* att_opcode_name(uint16_t opcode) {
STATIC const char *att_opcode_name(uint16_t opcode) {
switch (opcode) {
case BT_ATT_OP_ERROR_RSP: return "ERROR_RSP";
case BT_ATT_OP_MTU_REQ: return "MTU_REQ";
case BT_ATT_OP_MTU_RSP: return "MTU_RSP";
case BT_ATT_OP_FIND_INFO_REQ: return "FIND_INFO_REQ";
case BT_ATT_OP_FIND_INFO_RSP: return "FIND_INFO_RSP";
case BT_ATT_OP_FIND_TYPE_REQ: return "FIND_TYPE_REQ";
case BT_ATT_OP_FIND_TYPE_RSP: return "FIND_TYPE_RSP";
case BT_ATT_OP_READ_TYPE_REQ: return "READ_TYPE_REQ";
case BT_ATT_OP_READ_TYPE_RSP: return "READ_TYPE_RSP";
case BT_ATT_OP_READ_REQ: return "READ_REQ";
case BT_ATT_OP_READ_RSP: return "READ_RSP";
case BT_ATT_OP_READ_BLOB_REQ: return "READ_BLOB_REQ";
case BT_ATT_OP_READ_BLOB_RSP: return "READ_BLOB_RSP";
case BT_ATT_OP_READ_MULT_REQ: return "READ_MULT_REQ";
case BT_ATT_OP_READ_MULT_RSP: return "READ_MULT_RSP";
case BT_ATT_OP_READ_GROUP_REQ: return "READ_GROUP_REQ";
case BT_ATT_OP_READ_GROUP_RSP: return "READ_GROUP_RSP";
case BT_ATT_OP_WRITE_REQ: return "WRITE_REQ";
case BT_ATT_OP_WRITE_RSP: return "WRITE_RSP";
case BT_ATT_OP_PREPARE_WRITE_REQ: return "PREPARE_WRITE_REQ";
case BT_ATT_OP_PREPARE_WRITE_RSP: return "PREPARE_WRITE_RSP";
case BT_ATT_OP_EXEC_WRITE_REQ: return "EXEC_WRITE_REQ";
case BT_ATT_OP_EXEC_WRITE_RSP: return "EXEC_WRITE_RSP";
case BT_ATT_OP_NOTIFY: return "NOTIFY";
case BT_ATT_OP_INDICATE: return "INDICATE";
case BT_ATT_OP_CONFIRM: return "CONFIRM";
case BT_ATT_OP_READ_MULT_VL_REQ: return "READ_MULT_VL_REQ";
case BT_ATT_OP_READ_MULT_VL_RSP: return "READ_MULT_VL_RSP";
case BT_ATT_OP_NOTIFY_MULT: return "NOTIFY_MULT";
case BT_ATT_OP_WRITE_CMD: return "WRITE_CMD";
case BT_ATT_OP_SIGNED_WRITE_CMD: return "SIGNED_WRITE_CMD";
default: return "";
case BT_ATT_OP_ERROR_RSP:
return "ERROR_RSP";
case BT_ATT_OP_MTU_REQ:
return "MTU_REQ";
case BT_ATT_OP_MTU_RSP:
return "MTU_RSP";
case BT_ATT_OP_FIND_INFO_REQ:
return "FIND_INFO_REQ";
case BT_ATT_OP_FIND_INFO_RSP:
return "FIND_INFO_RSP";
case BT_ATT_OP_FIND_TYPE_REQ:
return "FIND_TYPE_REQ";
case BT_ATT_OP_FIND_TYPE_RSP:
return "FIND_TYPE_RSP";
case BT_ATT_OP_READ_TYPE_REQ:
return "READ_TYPE_REQ";
case BT_ATT_OP_READ_TYPE_RSP:
return "READ_TYPE_RSP";
case BT_ATT_OP_READ_REQ:
return "READ_REQ";
case BT_ATT_OP_READ_RSP:
return "READ_RSP";
case BT_ATT_OP_READ_BLOB_REQ:
return "READ_BLOB_REQ";
case BT_ATT_OP_READ_BLOB_RSP:
return "READ_BLOB_RSP";
case BT_ATT_OP_READ_MULT_REQ:
return "READ_MULT_REQ";
case BT_ATT_OP_READ_MULT_RSP:
return "READ_MULT_RSP";
case BT_ATT_OP_READ_GROUP_REQ:
return "READ_GROUP_REQ";
case BT_ATT_OP_READ_GROUP_RSP:
return "READ_GROUP_RSP";
case BT_ATT_OP_WRITE_REQ:
return "WRITE_REQ";
case BT_ATT_OP_WRITE_RSP:
return "WRITE_RSP";
case BT_ATT_OP_PREPARE_WRITE_REQ:
return "PREPARE_WRITE_REQ";
case BT_ATT_OP_PREPARE_WRITE_RSP:
return "PREPARE_WRITE_RSP";
case BT_ATT_OP_EXEC_WRITE_REQ:
return "EXEC_WRITE_REQ";
case BT_ATT_OP_EXEC_WRITE_RSP:
return "EXEC_WRITE_RSP";
case BT_ATT_OP_NOTIFY:
return "NOTIFY";
case BT_ATT_OP_INDICATE:
return "INDICATE";
case BT_ATT_OP_CONFIRM:
return "CONFIRM";
case BT_ATT_OP_READ_MULT_VL_REQ:
return "READ_MULT_VL_REQ";
case BT_ATT_OP_READ_MULT_VL_RSP:
return "READ_MULT_VL_RSP";
case BT_ATT_OP_NOTIFY_MULT:
return "NOTIFY_MULT";
case BT_ATT_OP_WRITE_CMD:
return "WRITE_CMD";
case BT_ATT_OP_SIGNED_WRITE_CMD:
return "SIGNED_WRITE_CMD";
default:
return "";
}
}
STATIC const char* hci_evt_name(uint8_t evt) {
STATIC const char *hci_evt_name(uint8_t evt) {
switch (evt) {
case BT_HCI_EVT_UNKNOWN: return "UNKNOWN";
case BT_HCI_EVT_VENDOR: return "VENDOR";
case BT_HCI_EVT_INQUIRY_COMPLETE: return "INQUIRY_COMPLETE";
case BT_HCI_EVT_CONN_COMPLETE: return "CONN_COMPLETE";
case BT_HCI_EVT_CONN_REQUEST: return "CONN_REQUEST";
case BT_HCI_EVT_DISCONN_COMPLETE: return "DISCONN_COMPLETE";
case BT_HCI_EVT_AUTH_COMPLETE: return "AUTH_COMPLETE";
case BT_HCI_EVT_REMOTE_NAME_REQ_COMPLETE: return "REMOTE_NAME_REQ_COMPLETE";
case BT_HCI_EVT_ENCRYPT_CHANGE: return "ENCRYPT_CHANGE";
case BT_HCI_EVT_REMOTE_FEATURES: return "REMOTE_FEATURES";
case BT_HCI_EVT_REMOTE_VERSION_INFO: return "REMOTE_VERSION_INFO";
case BT_HCI_EVT_CMD_COMPLETE: return "CMD_COMPLETE";
case BT_HCI_EVT_CMD_STATUS: return "CMD_STATUS";
case BT_HCI_EVT_ROLE_CHANGE: return "ROLE_CHANGE";
case BT_HCI_EVT_NUM_COMPLETED_PACKETS: return "NUM_COMPLETED_PACKETS";
case BT_HCI_EVT_PIN_CODE_REQ: return "PIN_CODE_REQ";
case BT_HCI_EVT_LINK_KEY_REQ: return "LINK_KEY_REQ";
case BT_HCI_EVT_LINK_KEY_NOTIFY: return "LINK_KEY_NOTIFY";
case BT_HCI_EVT_DATA_BUF_OVERFLOW: return "DATA_BUF_OVERFLOW";
case BT_HCI_EVT_INQUIRY_RESULT_WITH_RSSI: return "INQUIRY_RESULT_WITH_RSSI";
case BT_HCI_EVT_REMOTE_EXT_FEATURES: return "REMOTE_EXT_FEATURES";
case BT_HCI_EVT_SYNC_CONN_COMPLETE: return "SYNC_CONN_COMPLETE";
case BT_HCI_EVT_EXTENDED_INQUIRY_RESULT: return "EXTENDED_INQUIRY_RESULT";
case BT_HCI_EVT_ENCRYPT_KEY_REFRESH_COMPLETE: return "ENCRYPT_KEY_REFRESH_COMPLETE";
case BT_HCI_EVT_IO_CAPA_REQ: return "IO_CAPA_REQ";
case BT_HCI_EVT_IO_CAPA_RESP: return "IO_CAPA_RESP";
case BT_HCI_EVT_USER_CONFIRM_REQ: return "USER_CONFIRM_REQ";
case BT_HCI_EVT_USER_PASSKEY_REQ: return "USER_PASSKEY_REQ";
case BT_HCI_EVT_SSP_COMPLETE: return "SSP_COMPLETE";
case BT_HCI_EVT_USER_PASSKEY_NOTIFY: return "USER_PASSKEY_NOTIFY";
case BT_HCI_EVT_LE_META_EVENT: return "LE_META_EVENT";
case BT_HCI_EVT_AUTH_PAYLOAD_TIMEOUT_EXP: return "AUTH_PAYLOAD_TIMEOUT_EXP";
default: return "";
case BT_HCI_EVT_UNKNOWN:
return "UNKNOWN";
case BT_HCI_EVT_VENDOR:
return "VENDOR";
case BT_HCI_EVT_INQUIRY_COMPLETE:
return "INQUIRY_COMPLETE";
case BT_HCI_EVT_CONN_COMPLETE:
return "CONN_COMPLETE";
case BT_HCI_EVT_CONN_REQUEST:
return "CONN_REQUEST";
case BT_HCI_EVT_DISCONN_COMPLETE:
return "DISCONN_COMPLETE";
case BT_HCI_EVT_AUTH_COMPLETE:
return "AUTH_COMPLETE";
case BT_HCI_EVT_REMOTE_NAME_REQ_COMPLETE:
return "REMOTE_NAME_REQ_COMPLETE";
case BT_HCI_EVT_ENCRYPT_CHANGE:
return "ENCRYPT_CHANGE";
case BT_HCI_EVT_REMOTE_FEATURES:
return "REMOTE_FEATURES";
case BT_HCI_EVT_REMOTE_VERSION_INFO:
return "REMOTE_VERSION_INFO";
case BT_HCI_EVT_CMD_COMPLETE:
return "CMD_COMPLETE";
case BT_HCI_EVT_CMD_STATUS:
return "CMD_STATUS";
case BT_HCI_EVT_ROLE_CHANGE:
return "ROLE_CHANGE";
case BT_HCI_EVT_NUM_COMPLETED_PACKETS:
return "NUM_COMPLETED_PACKETS";
case BT_HCI_EVT_PIN_CODE_REQ:
return "PIN_CODE_REQ";
case BT_HCI_EVT_LINK_KEY_REQ:
return "LINK_KEY_REQ";
case BT_HCI_EVT_LINK_KEY_NOTIFY:
return "LINK_KEY_NOTIFY";
case BT_HCI_EVT_DATA_BUF_OVERFLOW:
return "DATA_BUF_OVERFLOW";
case BT_HCI_EVT_INQUIRY_RESULT_WITH_RSSI:
return "INQUIRY_RESULT_WITH_RSSI";
case BT_HCI_EVT_REMOTE_EXT_FEATURES:
return "REMOTE_EXT_FEATURES";
case BT_HCI_EVT_SYNC_CONN_COMPLETE:
return "SYNC_CONN_COMPLETE";
case BT_HCI_EVT_EXTENDED_INQUIRY_RESULT:
return "EXTENDED_INQUIRY_RESULT";
case BT_HCI_EVT_ENCRYPT_KEY_REFRESH_COMPLETE:
return "ENCRYPT_KEY_REFRESH_COMPLETE";
case BT_HCI_EVT_IO_CAPA_REQ:
return "IO_CAPA_REQ";
case BT_HCI_EVT_IO_CAPA_RESP:
return "IO_CAPA_RESP";
case BT_HCI_EVT_USER_CONFIRM_REQ:
return "USER_CONFIRM_REQ";
case BT_HCI_EVT_USER_PASSKEY_REQ:
return "USER_PASSKEY_REQ";
case BT_HCI_EVT_SSP_COMPLETE:
return "SSP_COMPLETE";
case BT_HCI_EVT_USER_PASSKEY_NOTIFY:
return "USER_PASSKEY_NOTIFY";
case BT_HCI_EVT_LE_META_EVENT:
return "LE_META_EVENT";
case BT_HCI_EVT_AUTH_PAYLOAD_TIMEOUT_EXP:
return "AUTH_PAYLOAD_TIMEOUT_EXP";
default:
return "";
}
}
STATIC const char* hci_evt_le_name(uint8_t evt_le) {
STATIC const char *hci_evt_le_name(uint8_t evt_le) {
switch (evt_le) {
case BT_HCI_EVT_LE_CONN_COMPLETE: return "LE_CONN_COMPLETE";
case BT_HCI_EVT_LE_ADVERTISING_REPORT: return "LE_ADVERTISING_REPORT";
case BT_HCI_EVT_LE_CONN_UPDATE_COMPLETE: return "LE_CONN_UPDATE_COMPLETE";
case BT_HCI_EVT_LE_LTK_REQUEST: return "LE_LTK_REQUEST";
case BT_HCI_EVT_LE_CONN_PARAM_REQ: return "LE_CONN_PARAM_REQ";
case BT_HCI_EVT_LE_DATA_LEN_CHANGE: return "LE_DATA_LEN_CHANGE";
case BT_HCI_EVT_LE_P256_PUBLIC_KEY_COMPLETE: return "LE_P256_PUBLIC_KEY_COMPLETE";
case BT_HCI_EVT_LE_GENERATE_DHKEY_COMPLETE: return "LE_GENERATE_DHKEY_COMPLETE";
case BT_HCI_EVT_LE_ENH_CONN_COMPLETE: return "LE_ENH_CONN_COMPLETE";
case BT_HCI_EVT_LE_DIRECT_ADV_REPORT: return "LE_DIRECT_ADV_REPORT";
case BT_HCI_EVT_LE_PHY_UPDATE_COMPLETE: return "LE_PHY_UPDATE_COMPLETE";
case BT_HCI_EVT_LE_EXT_ADVERTISING_REPORT: return "LE_EXT_ADVERTISING_REPORT";
case BT_HCI_EVT_LE_PER_ADV_SYNC_ESTABLISHED: return "LE_PER_ADV_SYNC_ESTABLISHED";
case BT_HCI_EVT_LE_PER_ADVERTISING_REPORT: return "LE_PER_ADVERTISING_REPORT";
case BT_HCI_EVT_LE_PER_ADV_SYNC_LOST: return "LE_PER_ADV_SYNC_LOST";
case BT_HCI_EVT_LE_SCAN_TIMEOUT: return "LE_SCAN_TIMEOUT";
case BT_HCI_EVT_LE_ADV_SET_TERMINATED: return "LE_ADV_SET_TERMINATED";
case BT_HCI_EVT_LE_SCAN_REQ_RECEIVED: return "LE_SCAN_REQ_RECEIVED";
case BT_HCI_EVT_LE_CHAN_SEL_ALGO: return "LE_CHAN_SEL_ALGO";
default: return "";
case BT_HCI_EVT_LE_CONN_COMPLETE:
return "LE_CONN_COMPLETE";
case BT_HCI_EVT_LE_ADVERTISING_REPORT:
return "LE_ADVERTISING_REPORT";
case BT_HCI_EVT_LE_CONN_UPDATE_COMPLETE:
return "LE_CONN_UPDATE_COMPLETE";
case BT_HCI_EVT_LE_LTK_REQUEST:
return "LE_LTK_REQUEST";
case BT_HCI_EVT_LE_CONN_PARAM_REQ:
return "LE_CONN_PARAM_REQ";
case BT_HCI_EVT_LE_DATA_LEN_CHANGE:
return "LE_DATA_LEN_CHANGE";
case BT_HCI_EVT_LE_P256_PUBLIC_KEY_COMPLETE:
return "LE_P256_PUBLIC_KEY_COMPLETE";
case BT_HCI_EVT_LE_GENERATE_DHKEY_COMPLETE:
return "LE_GENERATE_DHKEY_COMPLETE";
case BT_HCI_EVT_LE_ENH_CONN_COMPLETE:
return "LE_ENH_CONN_COMPLETE";
case BT_HCI_EVT_LE_DIRECT_ADV_REPORT:
return "LE_DIRECT_ADV_REPORT";
case BT_HCI_EVT_LE_PHY_UPDATE_COMPLETE:
return "LE_PHY_UPDATE_COMPLETE";
case BT_HCI_EVT_LE_EXT_ADVERTISING_REPORT:
return "LE_EXT_ADVERTISING_REPORT";
case BT_HCI_EVT_LE_PER_ADV_SYNC_ESTABLISHED:
return "LE_PER_ADV_SYNC_ESTABLISHED";
case BT_HCI_EVT_LE_PER_ADVERTISING_REPORT:
return "LE_PER_ADVERTISING_REPORT";
case BT_HCI_EVT_LE_PER_ADV_SYNC_LOST:
return "LE_PER_ADV_SYNC_LOST";
case BT_HCI_EVT_LE_SCAN_TIMEOUT:
return "LE_SCAN_TIMEOUT";
case BT_HCI_EVT_LE_ADV_SET_TERMINATED:
return "LE_ADV_SET_TERMINATED";
case BT_HCI_EVT_LE_SCAN_REQ_RECEIVED:
return "LE_SCAN_REQ_RECEIVED";
case BT_HCI_EVT_LE_CHAN_SEL_ALGO:
return "LE_CHAN_SEL_ALGO";
default:
return "";
}
}
STATIC const char* hci_opcode_name(uint16_t opcode) {
STATIC const char *hci_opcode_name(uint16_t opcode) {
switch (opcode) {
case BT_OP_NOP: return "NOP";
case BT_HCI_OP_INQUIRY: return "INQUIRY";
case BT_HCI_OP_INQUIRY_CANCEL: return "INQUIRY_CANCEL";
case BT_HCI_OP_CONNECT: return "CONNECT";
case BT_HCI_OP_DISCONNECT: return "DISCONNECT";
case BT_HCI_OP_CONNECT_CANCEL: return "CONNECT_CANCEL";
case BT_HCI_OP_ACCEPT_CONN_REQ: return "ACCEPT_CONN_REQ";
case BT_HCI_OP_SETUP_SYNC_CONN: return "SETUP_SYNC_CONN";
case BT_HCI_OP_ACCEPT_SYNC_CONN_REQ: return "ACCEPT_SYNC_CONN_REQ";
case BT_HCI_OP_REJECT_CONN_REQ: return "REJECT_CONN_REQ";
case BT_HCI_OP_LINK_KEY_REPLY: return "LINK_KEY_REPLY";
case BT_HCI_OP_LINK_KEY_NEG_REPLY: return "LINK_KEY_NEG_REPLY";
case BT_HCI_OP_PIN_CODE_REPLY: return "PIN_CODE_REPLY";
case BT_HCI_OP_PIN_CODE_NEG_REPLY: return "PIN_CODE_NEG_REPLY";
case BT_HCI_OP_AUTH_REQUESTED: return "AUTH_REQUESTED";
case BT_HCI_OP_SET_CONN_ENCRYPT: return "SET_CONN_ENCRYPT";
case BT_HCI_OP_REMOTE_NAME_REQUEST: return "REMOTE_NAME_REQUEST";
case BT_HCI_OP_REMOTE_NAME_CANCEL: return "REMOTE_NAME_CANCEL";
case BT_HCI_OP_READ_REMOTE_FEATURES: return "READ_REMOTE_FEATURES";
case BT_HCI_OP_READ_REMOTE_EXT_FEATURES: return "READ_REMOTE_EXT_FEATURES";
case BT_HCI_OP_READ_REMOTE_VERSION_INFO: return "READ_REMOTE_VERSION_INFO";
case BT_HCI_OP_IO_CAPABILITY_REPLY: return "IO_CAPABILITY_REPLY";
case BT_HCI_OP_USER_CONFIRM_REPLY: return "USER_CONFIRM_REPLY";
case BT_HCI_OP_USER_CONFIRM_NEG_REPLY: return "USER_CONFIRM_NEG_REPLY";
case BT_HCI_OP_USER_PASSKEY_REPLY: return "USER_PASSKEY_REPLY";
case BT_HCI_OP_USER_PASSKEY_NEG_REPLY: return "USER_PASSKEY_NEG_REPLY";
case BT_HCI_OP_IO_CAPABILITY_NEG_REPLY: return "IO_CAPABILITY_NEG_REPLY";
case BT_HCI_OP_SET_EVENT_MASK: return "SET_EVENT_MASK";
case BT_HCI_OP_RESET: return "RESET";
case BT_HCI_OP_WRITE_LOCAL_NAME: return "WRITE_LOCAL_NAME";
case BT_HCI_OP_WRITE_PAGE_TIMEOUT: return "WRITE_PAGE_TIMEOUT";
case BT_HCI_OP_WRITE_SCAN_ENABLE: return "WRITE_SCAN_ENABLE";
case BT_HCI_OP_READ_TX_POWER_LEVEL: return "READ_TX_POWER_LEVEL";
case BT_HCI_OP_SET_CTL_TO_HOST_FLOW: return "SET_CTL_TO_HOST_FLOW";
case BT_HCI_OP_HOST_BUFFER_SIZE: return "HOST_BUFFER_SIZE";
case BT_HCI_OP_HOST_NUM_COMPLETED_PACKETS: return "HOST_NUM_COMPLETED_PACKETS";
case BT_HCI_OP_WRITE_INQUIRY_MODE: return "WRITE_INQUIRY_MODE";
case BT_HCI_OP_WRITE_SSP_MODE: return "WRITE_SSP_MODE";
case BT_HCI_OP_SET_EVENT_MASK_PAGE_2: return "SET_EVENT_MASK_PAGE_2";
case BT_HCI_OP_LE_WRITE_LE_HOST_SUPP: return "LE_WRITE_LE_HOST_SUPP";
case BT_HCI_OP_WRITE_SC_HOST_SUPP: return "WRITE_SC_HOST_SUPP";
case BT_HCI_OP_READ_AUTH_PAYLOAD_TIMEOUT: return "READ_AUTH_PAYLOAD_TIMEOUT";
case BT_HCI_OP_WRITE_AUTH_PAYLOAD_TIMEOUT: return "WRITE_AUTH_PAYLOAD_TIMEOUT";
case BT_HCI_OP_READ_LOCAL_VERSION_INFO: return "READ_LOCAL_VERSION_INFO";
case BT_HCI_OP_READ_SUPPORTED_COMMANDS: return "READ_SUPPORTED_COMMANDS";
case BT_HCI_OP_READ_LOCAL_EXT_FEATURES: return "READ_LOCAL_EXT_FEATURES";
case BT_HCI_OP_READ_LOCAL_FEATURES: return "READ_LOCAL_FEATURES";
case BT_HCI_OP_READ_BUFFER_SIZE: return "READ_BUFFER_SIZE";
case BT_HCI_OP_READ_BD_ADDR: return "READ_BD_ADDR";
case BT_HCI_OP_READ_RSSI: return "READ_RSSI";
case BT_HCI_OP_READ_ENCRYPTION_KEY_SIZE: return "READ_ENCRYPTION_KEY_SIZE";
case BT_HCI_OP_LE_SET_EVENT_MASK: return "LE_SET_EVENT_MASK";
case BT_HCI_OP_LE_READ_BUFFER_SIZE: return "LE_READ_BUFFER_SIZE";
case BT_HCI_OP_LE_READ_LOCAL_FEATURES: return "LE_READ_LOCAL_FEATURES";
case BT_HCI_OP_LE_SET_RANDOM_ADDRESS: return "LE_SET_RANDOM_ADDRESS";
case BT_HCI_OP_LE_SET_ADV_PARAM: return "LE_SET_ADV_PARAM";
case BT_HCI_OP_LE_READ_ADV_CHAN_TX_POWER: return "LE_READ_ADV_CHAN_TX_POWER";
case BT_HCI_OP_LE_SET_ADV_DATA: return "LE_SET_ADV_DATA";
case BT_HCI_OP_LE_SET_SCAN_RSP_DATA: return "LE_SET_SCAN_RSP_DATA";
case BT_HCI_OP_LE_SET_ADV_ENABLE: return "LE_SET_ADV_ENABLE";
case BT_HCI_OP_LE_SET_SCAN_PARAM: return "LE_SET_SCAN_PARAM";
case BT_HCI_OP_LE_SET_SCAN_ENABLE: return "LE_SET_SCAN_ENABLE";
case BT_HCI_OP_LE_CREATE_CONN: return "LE_CREATE_CONN";
case BT_HCI_OP_LE_CREATE_CONN_CANCEL: return "LE_CREATE_CONN_CANCEL";
case BT_HCI_OP_LE_READ_WL_SIZE: return "LE_READ_WL_SIZE";
case BT_HCI_OP_LE_CLEAR_WL: return "LE_CLEAR_WL";
case BT_HCI_OP_LE_ADD_DEV_TO_WL: return "LE_ADD_DEV_TO_WL";
case BT_HCI_OP_LE_REM_DEV_FROM_WL: return "LE_REM_DEV_FROM_WL";
case BT_HCI_OP_LE_CONN_UPDATE: return "LE_CONN_UPDATE";
case BT_HCI_OP_LE_SET_HOST_CHAN_CLASSIF: return "LE_SET_HOST_CHAN_CLASSIF";
case BT_HCI_OP_LE_READ_CHAN_MAP: return "LE_READ_CHAN_MAP";
case BT_HCI_OP_LE_READ_REMOTE_FEATURES: return "LE_READ_REMOTE_FEATURES";
case BT_HCI_OP_LE_ENCRYPT: return "LE_ENCRYPT";
case BT_HCI_OP_LE_RAND: return "LE_RAND";
case BT_HCI_OP_LE_START_ENCRYPTION: return "LE_START_ENCRYPTION";
case BT_HCI_OP_LE_LTK_REQ_REPLY: return "LE_LTK_REQ_REPLY";
case BT_HCI_OP_LE_LTK_REQ_NEG_REPLY: return "LE_LTK_REQ_NEG_REPLY";
case BT_HCI_OP_LE_READ_SUPP_STATES: return "LE_READ_SUPP_STATES";
case BT_HCI_OP_LE_RX_TEST: return "LE_RX_TEST";
case BT_HCI_OP_LE_TX_TEST: return "LE_TX_TEST";
case BT_HCI_OP_LE_TEST_END: return "LE_TEST_END";
case BT_HCI_OP_LE_CONN_PARAM_REQ_REPLY: return "LE_CONN_PARAM_REQ_REPLY";
case BT_HCI_OP_LE_CONN_PARAM_REQ_NEG_REPLY: return "LE_CONN_PARAM_REQ_NEG_REPLY";
case BT_HCI_OP_LE_SET_DATA_LEN: return "LE_SET_DATA_LEN";
case BT_HCI_OP_LE_READ_DEFAULT_DATA_LEN: return "LE_READ_DEFAULT_DATA_LEN";
case BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN: return "LE_WRITE_DEFAULT_DATA_LEN";
case BT_HCI_OP_LE_P256_PUBLIC_KEY: return "LE_P256_PUBLIC_KEY";
case BT_HCI_OP_LE_GENERATE_DHKEY: return "LE_GENERATE_DHKEY";
case BT_HCI_OP_LE_ADD_DEV_TO_RL: return "LE_ADD_DEV_TO_RL";
case BT_HCI_OP_LE_REM_DEV_FROM_RL: return "LE_REM_DEV_FROM_RL";
case BT_HCI_OP_LE_CLEAR_RL: return "LE_CLEAR_RL";
case BT_HCI_OP_LE_READ_RL_SIZE: return "LE_READ_RL_SIZE";
case BT_HCI_OP_LE_READ_PEER_RPA: return "LE_READ_PEER_RPA";
case BT_HCI_OP_LE_READ_LOCAL_RPA: return "LE_READ_LOCAL_RPA";
case BT_HCI_OP_LE_SET_ADDR_RES_ENABLE: return "LE_SET_ADDR_RES_ENABLE";
case BT_HCI_OP_LE_SET_RPA_TIMEOUT: return "LE_SET_RPA_TIMEOUT";
case BT_HCI_OP_LE_READ_MAX_DATA_LEN: return "LE_READ_MAX_DATA_LEN";
case BT_HCI_OP_LE_READ_PHY: return "LE_READ_PHY";
case BT_HCI_OP_LE_SET_DEFAULT_PHY: return "LE_SET_DEFAULT_PHY";
case BT_HCI_OP_LE_SET_PHY: return "LE_SET_PHY";
case BT_HCI_OP_LE_ENH_RX_TEST: return "LE_ENH_RX_TEST";
case BT_HCI_OP_LE_ENH_TX_TEST: return "LE_ENH_TX_TEST";
case BT_HCI_OP_LE_SET_ADV_SET_RANDOM_ADDR: return "LE_SET_ADV_SET_RANDOM_ADDR";
case BT_HCI_OP_LE_SET_EXT_ADV_PARAM: return "LE_SET_EXT_ADV_PARAM";
case BT_HCI_OP_LE_SET_EXT_ADV_DATA: return "LE_SET_EXT_ADV_DATA";
case BT_HCI_OP_LE_SET_EXT_SCAN_RSP_DATA: return "LE_SET_EXT_SCAN_RSP_DATA";
case BT_HCI_OP_LE_SET_EXT_ADV_ENABLE: return "LE_SET_EXT_ADV_ENABLE";
case BT_HCI_OP_LE_READ_MAX_ADV_DATA_LEN: return "LE_READ_MAX_ADV_DATA_LEN";
case BT_HCI_OP_LE_READ_NUM_ADV_SETS: return "LE_READ_NUM_ADV_SETS";
case BT_HCI_OP_LE_REMOVE_ADV_SET: return "LE_REMOVE_ADV_SET";
case BT_HCI_OP_CLEAR_ADV_SETS: return "CLEAR_ADV_SETS";
case BT_HCI_OP_LE_SET_PER_ADV_PARAM: return "LE_SET_PER_ADV_PARAM";
case BT_HCI_OP_LE_SET_PER_ADV_DATA: return "LE_SET_PER_ADV_DATA";
case BT_HCI_OP_LE_SET_PER_ADV_ENABLE: return "LE_SET_PER_ADV_ENABLE";
case BT_HCI_OP_LE_SET_EXT_SCAN_PARAM: return "LE_SET_EXT_SCAN_PARAM";
case BT_HCI_OP_LE_SET_EXT_SCAN_ENABLE: return "LE_SET_EXT_SCAN_ENABLE";
case BT_HCI_OP_LE_EXT_CREATE_CONN: return "LE_EXT_CREATE_CONN";
case BT_HCI_OP_LE_PER_ADV_CREATE_SYNC: return "LE_PER_ADV_CREATE_SYNC";
case BT_HCI_OP_LE_PER_ADV_CREATE_SYNC_CANCEL: return "LE_PER_ADV_CREATE_SYNC_CANCEL";
case BT_HCI_OP_LE_PER_ADV_TERMINATE_SYNC: return "LE_PER_ADV_TERMINATE_SYNC";
case BT_HCI_OP_LE_ADD_DEV_TO_PER_ADV_LIST: return "LE_ADD_DEV_TO_PER_ADV_LIST";
case BT_HCI_OP_LE_REM_DEV_FROM_PER_ADV_LIST: return "LE_REM_DEV_FROM_PER_ADV_LIST";
case BT_HCI_OP_LE_CLEAR_PER_ADV_LIST: return "LE_CLEAR_PER_ADV_LIST";
case BT_HCI_OP_LE_READ_PER_ADV_LIST_SIZE: return "LE_READ_PER_ADV_LIST_SIZE";
case BT_HCI_OP_LE_READ_TX_POWER: return "LE_READ_TX_POWER";
case BT_HCI_OP_LE_READ_RF_PATH_COMP: return "LE_READ_RF_PATH_COMP";
case BT_HCI_OP_LE_WRITE_RF_PATH_COMP: return "LE_WRITE_RF_PATH_COMP";
case BT_HCI_OP_LE_SET_PRIVACY_MODE: return "LE_SET_PRIVACY_MODE";
default: return "";
case BT_OP_NOP:
return "NOP";
case BT_HCI_OP_INQUIRY:
return "INQUIRY";
case BT_HCI_OP_INQUIRY_CANCEL:
return "INQUIRY_CANCEL";
case BT_HCI_OP_CONNECT:
return "CONNECT";
case BT_HCI_OP_DISCONNECT:
return "DISCONNECT";
case BT_HCI_OP_CONNECT_CANCEL:
return "CONNECT_CANCEL";
case BT_HCI_OP_ACCEPT_CONN_REQ:
return "ACCEPT_CONN_REQ";
case BT_HCI_OP_SETUP_SYNC_CONN:
return "SETUP_SYNC_CONN";
case BT_HCI_OP_ACCEPT_SYNC_CONN_REQ:
return "ACCEPT_SYNC_CONN_REQ";
case BT_HCI_OP_REJECT_CONN_REQ:
return "REJECT_CONN_REQ";
case BT_HCI_OP_LINK_KEY_REPLY:
return "LINK_KEY_REPLY";
case BT_HCI_OP_LINK_KEY_NEG_REPLY:
return "LINK_KEY_NEG_REPLY";
case BT_HCI_OP_PIN_CODE_REPLY:
return "PIN_CODE_REPLY";
case BT_HCI_OP_PIN_CODE_NEG_REPLY:
return "PIN_CODE_NEG_REPLY";
case BT_HCI_OP_AUTH_REQUESTED:
return "AUTH_REQUESTED";
case BT_HCI_OP_SET_CONN_ENCRYPT:
return "SET_CONN_ENCRYPT";
case BT_HCI_OP_REMOTE_NAME_REQUEST:
return "REMOTE_NAME_REQUEST";
case BT_HCI_OP_REMOTE_NAME_CANCEL:
return "REMOTE_NAME_CANCEL";
case BT_HCI_OP_READ_REMOTE_FEATURES:
return "READ_REMOTE_FEATURES";
case BT_HCI_OP_READ_REMOTE_EXT_FEATURES:
return "READ_REMOTE_EXT_FEATURES";
case BT_HCI_OP_READ_REMOTE_VERSION_INFO:
return "READ_REMOTE_VERSION_INFO";
case BT_HCI_OP_IO_CAPABILITY_REPLY:
return "IO_CAPABILITY_REPLY";
case BT_HCI_OP_USER_CONFIRM_REPLY:
return "USER_CONFIRM_REPLY";
case BT_HCI_OP_USER_CONFIRM_NEG_REPLY:
return "USER_CONFIRM_NEG_REPLY";
case BT_HCI_OP_USER_PASSKEY_REPLY:
return "USER_PASSKEY_REPLY";
case BT_HCI_OP_USER_PASSKEY_NEG_REPLY:
return "USER_PASSKEY_NEG_REPLY";
case BT_HCI_OP_IO_CAPABILITY_NEG_REPLY:
return "IO_CAPABILITY_NEG_REPLY";
case BT_HCI_OP_SET_EVENT_MASK:
return "SET_EVENT_MASK";
case BT_HCI_OP_RESET:
return "RESET";
case BT_HCI_OP_WRITE_LOCAL_NAME:
return "WRITE_LOCAL_NAME";
case BT_HCI_OP_WRITE_PAGE_TIMEOUT:
return "WRITE_PAGE_TIMEOUT";
case BT_HCI_OP_WRITE_SCAN_ENABLE:
return "WRITE_SCAN_ENABLE";
case BT_HCI_OP_READ_TX_POWER_LEVEL:
return "READ_TX_POWER_LEVEL";
case BT_HCI_OP_SET_CTL_TO_HOST_FLOW:
return "SET_CTL_TO_HOST_FLOW";
case BT_HCI_OP_HOST_BUFFER_SIZE:
return "HOST_BUFFER_SIZE";
case BT_HCI_OP_HOST_NUM_COMPLETED_PACKETS:
return "HOST_NUM_COMPLETED_PACKETS";
case BT_HCI_OP_WRITE_INQUIRY_MODE:
return "WRITE_INQUIRY_MODE";
case BT_HCI_OP_WRITE_SSP_MODE:
return "WRITE_SSP_MODE";
case BT_HCI_OP_SET_EVENT_MASK_PAGE_2:
return "SET_EVENT_MASK_PAGE_2";
case BT_HCI_OP_LE_WRITE_LE_HOST_SUPP:
return "LE_WRITE_LE_HOST_SUPP";
case BT_HCI_OP_WRITE_SC_HOST_SUPP:
return "WRITE_SC_HOST_SUPP";
case BT_HCI_OP_READ_AUTH_PAYLOAD_TIMEOUT:
return "READ_AUTH_PAYLOAD_TIMEOUT";
case BT_HCI_OP_WRITE_AUTH_PAYLOAD_TIMEOUT:
return "WRITE_AUTH_PAYLOAD_TIMEOUT";
case BT_HCI_OP_READ_LOCAL_VERSION_INFO:
return "READ_LOCAL_VERSION_INFO";
case BT_HCI_OP_READ_SUPPORTED_COMMANDS:
return "READ_SUPPORTED_COMMANDS";
case BT_HCI_OP_READ_LOCAL_EXT_FEATURES:
return "READ_LOCAL_EXT_FEATURES";
case BT_HCI_OP_READ_LOCAL_FEATURES:
return "READ_LOCAL_FEATURES";
case BT_HCI_OP_READ_BUFFER_SIZE:
return "READ_BUFFER_SIZE";
case BT_HCI_OP_READ_BD_ADDR:
return "READ_BD_ADDR";
case BT_HCI_OP_READ_RSSI:
return "READ_RSSI";
case BT_HCI_OP_READ_ENCRYPTION_KEY_SIZE:
return "READ_ENCRYPTION_KEY_SIZE";
case BT_HCI_OP_LE_SET_EVENT_MASK:
return "LE_SET_EVENT_MASK";
case BT_HCI_OP_LE_READ_BUFFER_SIZE:
return "LE_READ_BUFFER_SIZE";
case BT_HCI_OP_LE_READ_LOCAL_FEATURES:
return "LE_READ_LOCAL_FEATURES";
case BT_HCI_OP_LE_SET_RANDOM_ADDRESS:
return "LE_SET_RANDOM_ADDRESS";
case BT_HCI_OP_LE_SET_ADV_PARAM:
return "LE_SET_ADV_PARAM";
case BT_HCI_OP_LE_READ_ADV_CHAN_TX_POWER:
return "LE_READ_ADV_CHAN_TX_POWER";
case BT_HCI_OP_LE_SET_ADV_DATA:
return "LE_SET_ADV_DATA";
case BT_HCI_OP_LE_SET_SCAN_RSP_DATA:
return "LE_SET_SCAN_RSP_DATA";
case BT_HCI_OP_LE_SET_ADV_ENABLE:
return "LE_SET_ADV_ENABLE";
case BT_HCI_OP_LE_SET_SCAN_PARAM:
return "LE_SET_SCAN_PARAM";
case BT_HCI_OP_LE_SET_SCAN_ENABLE:
return "LE_SET_SCAN_ENABLE";
case BT_HCI_OP_LE_CREATE_CONN:
return "LE_CREATE_CONN";
case BT_HCI_OP_LE_CREATE_CONN_CANCEL:
return "LE_CREATE_CONN_CANCEL";
case BT_HCI_OP_LE_READ_WL_SIZE:
return "LE_READ_WL_SIZE";
case BT_HCI_OP_LE_CLEAR_WL:
return "LE_CLEAR_WL";
case BT_HCI_OP_LE_ADD_DEV_TO_WL:
return "LE_ADD_DEV_TO_WL";
case BT_HCI_OP_LE_REM_DEV_FROM_WL:
return "LE_REM_DEV_FROM_WL";
case BT_HCI_OP_LE_CONN_UPDATE:
return "LE_CONN_UPDATE";
case BT_HCI_OP_LE_SET_HOST_CHAN_CLASSIF:
return "LE_SET_HOST_CHAN_CLASSIF";
case BT_HCI_OP_LE_READ_CHAN_MAP:
return "LE_READ_CHAN_MAP";
case BT_HCI_OP_LE_READ_REMOTE_FEATURES:
return "LE_READ_REMOTE_FEATURES";
case BT_HCI_OP_LE_ENCRYPT:
return "LE_ENCRYPT";
case BT_HCI_OP_LE_RAND:
return "LE_RAND";
case BT_HCI_OP_LE_START_ENCRYPTION:
return "LE_START_ENCRYPTION";
case BT_HCI_OP_LE_LTK_REQ_REPLY:
return "LE_LTK_REQ_REPLY";
case BT_HCI_OP_LE_LTK_REQ_NEG_REPLY:
return "LE_LTK_REQ_NEG_REPLY";
case BT_HCI_OP_LE_READ_SUPP_STATES:
return "LE_READ_SUPP_STATES";
case BT_HCI_OP_LE_RX_TEST:
return "LE_RX_TEST";
case BT_HCI_OP_LE_TX_TEST:
return "LE_TX_TEST";
case BT_HCI_OP_LE_TEST_END:
return "LE_TEST_END";
case BT_HCI_OP_LE_CONN_PARAM_REQ_REPLY:
return "LE_CONN_PARAM_REQ_REPLY";
case BT_HCI_OP_LE_CONN_PARAM_REQ_NEG_REPLY:
return "LE_CONN_PARAM_REQ_NEG_REPLY";
case BT_HCI_OP_LE_SET_DATA_LEN:
return "LE_SET_DATA_LEN";
case BT_HCI_OP_LE_READ_DEFAULT_DATA_LEN:
return "LE_READ_DEFAULT_DATA_LEN";
case BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN:
return "LE_WRITE_DEFAULT_DATA_LEN";
case BT_HCI_OP_LE_P256_PUBLIC_KEY:
return "LE_P256_PUBLIC_KEY";
case BT_HCI_OP_LE_GENERATE_DHKEY:
return "LE_GENERATE_DHKEY";
case BT_HCI_OP_LE_ADD_DEV_TO_RL:
return "LE_ADD_DEV_TO_RL";
case BT_HCI_OP_LE_REM_DEV_FROM_RL:
return "LE_REM_DEV_FROM_RL";
case BT_HCI_OP_LE_CLEAR_RL:
return "LE_CLEAR_RL";
case BT_HCI_OP_LE_READ_RL_SIZE:
return "LE_READ_RL_SIZE";
case BT_HCI_OP_LE_READ_PEER_RPA:
return "LE_READ_PEER_RPA";
case BT_HCI_OP_LE_READ_LOCAL_RPA:
return "LE_READ_LOCAL_RPA";
case BT_HCI_OP_LE_SET_ADDR_RES_ENABLE:
return "LE_SET_ADDR_RES_ENABLE";
case BT_HCI_OP_LE_SET_RPA_TIMEOUT:
return "LE_SET_RPA_TIMEOUT";
case BT_HCI_OP_LE_READ_MAX_DATA_LEN:
return "LE_READ_MAX_DATA_LEN";
case BT_HCI_OP_LE_READ_PHY:
return "LE_READ_PHY";
case BT_HCI_OP_LE_SET_DEFAULT_PHY:
return "LE_SET_DEFAULT_PHY";
case BT_HCI_OP_LE_SET_PHY:
return "LE_SET_PHY";
case BT_HCI_OP_LE_ENH_RX_TEST:
return "LE_ENH_RX_TEST";
case BT_HCI_OP_LE_ENH_TX_TEST:
return "LE_ENH_TX_TEST";
case BT_HCI_OP_LE_SET_ADV_SET_RANDOM_ADDR:
return "LE_SET_ADV_SET_RANDOM_ADDR";
case BT_HCI_OP_LE_SET_EXT_ADV_PARAM:
return "LE_SET_EXT_ADV_PARAM";
case BT_HCI_OP_LE_SET_EXT_ADV_DATA:
return "LE_SET_EXT_ADV_DATA";
case BT_HCI_OP_LE_SET_EXT_SCAN_RSP_DATA:
return "LE_SET_EXT_SCAN_RSP_DATA";
case BT_HCI_OP_LE_SET_EXT_ADV_ENABLE:
return "LE_SET_EXT_ADV_ENABLE";
case BT_HCI_OP_LE_READ_MAX_ADV_DATA_LEN:
return "LE_READ_MAX_ADV_DATA_LEN";
case BT_HCI_OP_LE_READ_NUM_ADV_SETS:
return "LE_READ_NUM_ADV_SETS";
case BT_HCI_OP_LE_REMOVE_ADV_SET:
return "LE_REMOVE_ADV_SET";
case BT_HCI_OP_CLEAR_ADV_SETS:
return "CLEAR_ADV_SETS";
case BT_HCI_OP_LE_SET_PER_ADV_PARAM:
return "LE_SET_PER_ADV_PARAM";
case BT_HCI_OP_LE_SET_PER_ADV_DATA:
return "LE_SET_PER_ADV_DATA";
case BT_HCI_OP_LE_SET_PER_ADV_ENABLE:
return "LE_SET_PER_ADV_ENABLE";
case BT_HCI_OP_LE_SET_EXT_SCAN_PARAM:
return "LE_SET_EXT_SCAN_PARAM";
case BT_HCI_OP_LE_SET_EXT_SCAN_ENABLE:
return "LE_SET_EXT_SCAN_ENABLE";
case BT_HCI_OP_LE_EXT_CREATE_CONN:
return "LE_EXT_CREATE_CONN";
case BT_HCI_OP_LE_PER_ADV_CREATE_SYNC:
return "LE_PER_ADV_CREATE_SYNC";
case BT_HCI_OP_LE_PER_ADV_CREATE_SYNC_CANCEL:
return "LE_PER_ADV_CREATE_SYNC_CANCEL";
case BT_HCI_OP_LE_PER_ADV_TERMINATE_SYNC:
return "LE_PER_ADV_TERMINATE_SYNC";
case BT_HCI_OP_LE_ADD_DEV_TO_PER_ADV_LIST:
return "LE_ADD_DEV_TO_PER_ADV_LIST";
case BT_HCI_OP_LE_REM_DEV_FROM_PER_ADV_LIST:
return "LE_REM_DEV_FROM_PER_ADV_LIST";
case BT_HCI_OP_LE_CLEAR_PER_ADV_LIST:
return "LE_CLEAR_PER_ADV_LIST";
case BT_HCI_OP_LE_READ_PER_ADV_LIST_SIZE:
return "LE_READ_PER_ADV_LIST_SIZE";
case BT_HCI_OP_LE_READ_TX_POWER:
return "LE_READ_TX_POWER";
case BT_HCI_OP_LE_READ_RF_PATH_COMP:
return "LE_READ_RF_PATH_COMP";
case BT_HCI_OP_LE_WRITE_RF_PATH_COMP:
return "LE_WRITE_RF_PATH_COMP";
case BT_HCI_OP_LE_SET_PRIVACY_MODE:
return "LE_SET_PRIVACY_MODE";
default:
return "";
}
}
STATIC void dump_cmd_pkt(bool tx, uint8_t pkt_len, uint8_t pkt_data[]) {
h4_hci_cmd_pkt_t *pkt = (h4_hci_cmd_pkt_t *) pkt_data;
h4_hci_cmd_pkt_t *pkt = (h4_hci_cmd_pkt_t *)pkt_data;
mp_printf(&mp_plat_print,
"%s HCI COMMAND (%x) op: %s (%04x), len: %d, data: ",
tx ? "TX->" : "RX<-",
pkt->pkt_type,
hci_opcode_name(pkt->opcode), pkt->opcode, pkt->param_len);
"%s HCI COMMAND (%x) op: %s (%04x), len: %d, data: ",
tx ? "TX->" : "RX<-",
pkt->pkt_type,
hci_opcode_name(pkt->opcode), pkt->opcode, pkt->param_len);
for (size_t i = 0; i < pkt->param_len; i++) {
mp_printf(&mp_plat_print, "%02x ", pkt->params[i]);
}
@ -278,12 +492,12 @@ STATIC void dump_cmd_pkt(bool tx, uint8_t pkt_len, uint8_t pkt_data[]) {
}
STATIC void dump_acl_pkt(bool tx, uint8_t pkt_len, uint8_t pkt_data[]) {
h4_hci_acl_pkt_t *pkt = (h4_hci_acl_pkt_t *) pkt_data;
acl_data_t *acl = (acl_data_t *) pkt->data;
h4_hci_acl_pkt_t *pkt = (h4_hci_acl_pkt_t *)pkt_data;
acl_data_t *acl = (acl_data_t *)pkt->data;
mp_printf(&mp_plat_print,
"%s HCI ACLDATA (%x) ",
tx ? "TX->" : "RX<-", pkt->pkt_type);
"%s HCI ACLDATA (%x) ",
tx ? "TX->" : "RX<-", pkt->pkt_type);
if (pkt->pb != ACL_DATA_PB_MIDDLE && acl->cid == BT_L2CAP_CID_ATT) {
// This is the start of a fragmented acl_data packet or is a full packet,
@ -292,14 +506,14 @@ STATIC void dump_acl_pkt(bool tx, uint8_t pkt_len, uint8_t pkt_data[]) {
}
mp_printf(&mp_plat_print,
"handle: %04x, pb: %d, bc: %d, data_len: %d, ",
pkt->handle, pkt->pb, pkt->bc, pkt->data_len);
"handle: %04x, pb: %d, bc: %d, data_len: %d, ",
pkt->handle, pkt->pb, pkt->bc, pkt->data_len);
if (pkt->pb != ACL_DATA_PB_MIDDLE) {
// This is the start of a fragmented acl_data packet or is a full packet.
mp_printf(&mp_plat_print,
"acl data_len: %d, cid: %04x, data: ",
acl->acl_data_len, acl->cid);
"acl data_len: %d, cid: %04x, data: ",
acl->acl_data_len, acl->cid);
for (size_t i = 0; i < acl->acl_data_len; i++) {
mp_printf(&mp_plat_print, "%02x ", acl->acl_data[i]);
}
@ -316,15 +530,15 @@ STATIC void dump_acl_pkt(bool tx, uint8_t pkt_len, uint8_t pkt_data[]) {
}
STATIC void dump_evt_pkt(bool tx, uint8_t pkt_len, uint8_t pkt_data[]) {
h4_hci_evt_pkt_t *pkt = (h4_hci_evt_pkt_t *) pkt_data;
h4_hci_evt_pkt_t *pkt = (h4_hci_evt_pkt_t *)pkt_data;
mp_printf(&mp_plat_print,
"%s HCI EVENT (%x) evt: %s (%02x), param_len: %d, data: ",
tx ? "TX->" : "RX<-",
pkt->pkt_type,
pkt->evt == BT_HCI_EVT_LE_META_EVENT
"%s HCI EVENT (%x) evt: %s (%02x), param_len: %d, data: ",
tx ? "TX->" : "RX<-",
pkt->pkt_type,
pkt->evt == BT_HCI_EVT_LE_META_EVENT
? hci_evt_le_name(pkt->params[0])
: hci_evt_name(pkt->evt),
pkt->evt, pkt->param_len);
pkt->evt, pkt->param_len);
for (size_t i = 0; i < pkt->param_len; i++) {
mp_printf(&mp_plat_print, "%02x ", pkt->params[i]);
}

View File

@ -29,40 +29,36 @@
/** Bluetooth Device Address */
typedef struct {
uint8_t val[6];
uint8_t val[6];
} bt_addr_t;
/** Bluetooth LE Device Address */
typedef struct {
uint8_t type;
bt_addr_t a;
uint8_t type;
bt_addr_t a;
} bt_addr_le_t;
#define BT_ADDR_ANY ((bt_addr_t[]) { { { 0, 0, 0, 0, 0, 0 } } })
#define BT_ADDR_NONE ((bt_addr_t[]) { { \
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } } })
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } } })
#define BT_ADDR_LE_ANY ((bt_addr_le_t[]) { { 0, { { 0, 0, 0, 0, 0, 0 } } } })
#define BT_ADDR_LE_NONE ((bt_addr_le_t[]) { { 0, \
{ { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } } } })
{ { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } } } })
static inline int bt_addr_cmp(const bt_addr_t *a, const bt_addr_t *b)
{
return memcmp(a, b, sizeof(*a));
static inline int bt_addr_cmp(const bt_addr_t *a, const bt_addr_t *b) {
return memcmp(a, b, sizeof(*a));
}
static inline int bt_addr_le_cmp(const bt_addr_le_t *a, const bt_addr_le_t *b)
{
return memcmp(a, b, sizeof(*a));
static inline int bt_addr_le_cmp(const bt_addr_le_t *a, const bt_addr_le_t *b) {
return memcmp(a, b, sizeof(*a));
}
static inline void bt_addr_copy(bt_addr_t *dst, const bt_addr_t *src)
{
memcpy(dst, src, sizeof(*dst));
static inline void bt_addr_copy(bt_addr_t *dst, const bt_addr_t *src) {
memcpy(dst, src, sizeof(*dst));
}
static inline void bt_addr_le_copy(bt_addr_le_t *dst, const bt_addr_le_t *src)
{
memcpy(dst, src, sizeof(*dst));
static inline void bt_addr_le_copy(bt_addr_le_t *dst, const bt_addr_le_t *src) {
memcpy(dst, src, sizeof(*dst));
}
#define BT_ADDR_IS_RPA(a) (((a)->val[5] & 0xc0) == 0x40)
@ -76,22 +72,20 @@ static inline void bt_addr_le_copy(bt_addr_le_t *dst, const bt_addr_le_t *src)
int bt_addr_le_create_nrpa(bt_addr_le_t *addr);
int bt_addr_le_create_static(bt_addr_le_t *addr);
static inline bool bt_addr_le_is_rpa(const bt_addr_le_t *addr)
{
if (addr->type != BT_ADDR_LE_RANDOM) {
return false;
}
static inline bool bt_addr_le_is_rpa(const bt_addr_le_t *addr) {
if (addr->type != BT_ADDR_LE_RANDOM) {
return false;
}
return BT_ADDR_IS_RPA(&addr->a);
return BT_ADDR_IS_RPA(&addr->a);
}
static inline bool bt_addr_le_is_identity(const bt_addr_le_t *addr)
{
if (addr->type == BT_ADDR_LE_PUBLIC) {
return true;
}
static inline bool bt_addr_le_is_identity(const bt_addr_le_t *addr) {
if (addr->type == BT_ADDR_LE_PUBLIC) {
return true;
}
return BT_ADDR_IS_STATIC(&addr->a);
return BT_ADDR_IS_STATIC(&addr->a);
}
/**

View File

@ -12,30 +12,30 @@
#define ZEPHYR_INCLUDE_BLUETOOTH_ATT_H_
/* Error codes for Error response PDU */
#define BT_ATT_ERR_INVALID_HANDLE 0x01
#define BT_ATT_ERR_READ_NOT_PERMITTED 0x02
#define BT_ATT_ERR_WRITE_NOT_PERMITTED 0x03
#define BT_ATT_ERR_INVALID_PDU 0x04
#define BT_ATT_ERR_AUTHENTICATION 0x05
#define BT_ATT_ERR_NOT_SUPPORTED 0x06
#define BT_ATT_ERR_INVALID_OFFSET 0x07
#define BT_ATT_ERR_AUTHORIZATION 0x08
#define BT_ATT_ERR_PREPARE_QUEUE_FULL 0x09
#define BT_ATT_ERR_ATTRIBUTE_NOT_FOUND 0x0a
#define BT_ATT_ERR_ATTRIBUTE_NOT_LONG 0x0b
#define BT_ATT_ERR_ENCRYPTION_KEY_SIZE 0x0c
#define BT_ATT_ERR_INVALID_ATTRIBUTE_LEN 0x0d
#define BT_ATT_ERR_UNLIKELY 0x0e
#define BT_ATT_ERR_INSUFFICIENT_ENCRYPTION 0x0f
#define BT_ATT_ERR_UNSUPPORTED_GROUP_TYPE 0x10
#define BT_ATT_ERR_INSUFFICIENT_RESOURCES 0x11
#define BT_ATT_ERR_DB_OUT_OF_SYNC 0x12
#define BT_ATT_ERR_VALUE_NOT_ALLOWED 0x13
#define BT_ATT_ERR_INVALID_HANDLE 0x01
#define BT_ATT_ERR_READ_NOT_PERMITTED 0x02
#define BT_ATT_ERR_WRITE_NOT_PERMITTED 0x03
#define BT_ATT_ERR_INVALID_PDU 0x04
#define BT_ATT_ERR_AUTHENTICATION 0x05
#define BT_ATT_ERR_NOT_SUPPORTED 0x06
#define BT_ATT_ERR_INVALID_OFFSET 0x07
#define BT_ATT_ERR_AUTHORIZATION 0x08
#define BT_ATT_ERR_PREPARE_QUEUE_FULL 0x09
#define BT_ATT_ERR_ATTRIBUTE_NOT_FOUND 0x0a
#define BT_ATT_ERR_ATTRIBUTE_NOT_LONG 0x0b
#define BT_ATT_ERR_ENCRYPTION_KEY_SIZE 0x0c
#define BT_ATT_ERR_INVALID_ATTRIBUTE_LEN 0x0d
#define BT_ATT_ERR_UNLIKELY 0x0e
#define BT_ATT_ERR_INSUFFICIENT_ENCRYPTION 0x0f
#define BT_ATT_ERR_UNSUPPORTED_GROUP_TYPE 0x10
#define BT_ATT_ERR_INSUFFICIENT_RESOURCES 0x11
#define BT_ATT_ERR_DB_OUT_OF_SYNC 0x12
#define BT_ATT_ERR_VALUE_NOT_ALLOWED 0x13
/* Common Profile Error Codes (from CSS) */
#define BT_ATT_ERR_WRITE_REQ_REJECTED 0xfc
#define BT_ATT_ERR_CCC_IMPROPER_CONF 0xfd
#define BT_ATT_ERR_PROCEDURE_IN_PROGRESS 0xfe
#define BT_ATT_ERR_OUT_OF_RANGE 0xff
#define BT_ATT_ERR_WRITE_REQ_REJECTED 0xfc
#define BT_ATT_ERR_CCC_IMPROPER_CONF 0xfd
#define BT_ATT_ERR_PROCEDURE_IN_PROGRESS 0xfe
#define BT_ATT_ERR_OUT_OF_RANGE 0xff
#endif /* ZEPHYR_INCLUDE_BLUETOOTH_ATT_H_ */

View File

@ -13,260 +13,260 @@
// for __packed
#include <sys/cdefs.h>
#define BT_EATT_PSM 0x27
#define BT_ATT_DEFAULT_LE_MTU 23
#define BT_ATT_TIMEOUT K_SECONDS(30)
#define BT_EATT_PSM 0x27
#define BT_ATT_DEFAULT_LE_MTU 23
#define BT_ATT_TIMEOUT K_SECONDS(30)
//FIX #if BT_L2CAP_RX_MTU < CONFIG_BT_L2CAP_TX_MTU
// FIX #if BT_L2CAP_RX_MTU < CONFIG_BT_L2CAP_TX_MTU
// #define BT_ATT_MTU BT_L2CAP_RX_MTU
// #else
// #define BT_ATT_MTU CONFIG_BT_L2CAP_TX_MTU
// #endif
struct bt_att_hdr {
uint8_t code;
uint8_t code;
} __packed;
#define BT_ATT_OP_ERROR_RSP 0x01
#define BT_ATT_OP_ERROR_RSP 0x01
struct bt_att_error_rsp {
uint8_t request;
uint16_t handle;
uint8_t error;
uint8_t request;
uint16_t handle;
uint8_t error;
} __packed;
#define BT_ATT_OP_MTU_REQ 0x02
#define BT_ATT_OP_MTU_REQ 0x02
struct bt_att_exchange_mtu_req {
uint16_t mtu;
uint16_t mtu;
} __packed;
#define BT_ATT_OP_MTU_RSP 0x03
#define BT_ATT_OP_MTU_RSP 0x03
struct bt_att_exchange_mtu_rsp {
uint16_t mtu;
uint16_t mtu;
} __packed;
/* Find Information Request */
#define BT_ATT_OP_FIND_INFO_REQ 0x04
#define BT_ATT_OP_FIND_INFO_REQ 0x04
struct bt_att_find_info_req {
uint16_t start_handle;
uint16_t end_handle;
uint16_t start_handle;
uint16_t end_handle;
} __packed;
/* Format field values for BT_ATT_OP_FIND_INFO_RSP */
#define BT_ATT_INFO_16 0x01
#define BT_ATT_INFO_128 0x02
#define BT_ATT_INFO_16 0x01
#define BT_ATT_INFO_128 0x02
struct bt_att_info_16 {
uint16_t handle;
uint16_t uuid;
uint16_t handle;
uint16_t uuid;
} __packed;
struct bt_att_info_128 {
uint16_t handle;
uint8_t uuid[16];
uint16_t handle;
uint8_t uuid[16];
} __packed;
/* Find Information Response */
#define BT_ATT_OP_FIND_INFO_RSP 0x05
#define BT_ATT_OP_FIND_INFO_RSP 0x05
struct bt_att_find_info_rsp {
uint8_t format;
uint8_t info[];
uint8_t format;
uint8_t info[];
} __packed;
/* Find By Type Value Request */
#define BT_ATT_OP_FIND_TYPE_REQ 0x06
#define BT_ATT_OP_FIND_TYPE_REQ 0x06
struct bt_att_find_type_req {
uint16_t start_handle;
uint16_t end_handle;
uint16_t type;
uint8_t value[];
uint16_t start_handle;
uint16_t end_handle;
uint16_t type;
uint8_t value[];
} __packed;
struct bt_att_handle_group {
uint16_t start_handle;
uint16_t end_handle;
uint16_t start_handle;
uint16_t end_handle;
} __packed;
/* Find By Type Value Response */
#define BT_ATT_OP_FIND_TYPE_RSP 0x07
#define BT_ATT_OP_FIND_TYPE_RSP 0x07
struct bt_att_find_type_rsp {
uint8_t _dummy[0];
struct bt_att_handle_group list[];
uint8_t _dummy[0];
struct bt_att_handle_group list[];
} __packed;
/* Read By Type Request */
#define BT_ATT_OP_READ_TYPE_REQ 0x08
#define BT_ATT_OP_READ_TYPE_REQ 0x08
struct bt_att_read_type_req {
uint16_t start_handle;
uint16_t end_handle;
uint8_t uuid[];
uint16_t start_handle;
uint16_t end_handle;
uint8_t uuid[];
} __packed;
struct bt_att_data {
uint16_t handle;
uint8_t value[];
uint16_t handle;
uint8_t value[];
} __packed;
/* Read By Type Response */
#define BT_ATT_OP_READ_TYPE_RSP 0x09
#define BT_ATT_OP_READ_TYPE_RSP 0x09
struct bt_att_read_type_rsp {
uint8_t len;
struct bt_att_data data[];
uint8_t len;
struct bt_att_data data[];
} __packed;
/* Read Request */
#define BT_ATT_OP_READ_REQ 0x0a
#define BT_ATT_OP_READ_REQ 0x0a
struct bt_att_read_req {
uint16_t handle;
uint16_t handle;
} __packed;
/* Read Response */
#define BT_ATT_OP_READ_RSP 0x0b
#define BT_ATT_OP_READ_RSP 0x0b
struct bt_att_read_rsp {
uint8_t _dummy[0];
uint8_t value[];
uint8_t _dummy[0];
uint8_t value[];
} __packed;
/* Read Blob Request */
#define BT_ATT_OP_READ_BLOB_REQ 0x0c
#define BT_ATT_OP_READ_BLOB_REQ 0x0c
struct bt_att_read_blob_req {
uint16_t handle;
uint16_t offset;
uint16_t handle;
uint16_t offset;
} __packed;
/* Read Blob Response */
#define BT_ATT_OP_READ_BLOB_RSP 0x0d
#define BT_ATT_OP_READ_BLOB_RSP 0x0d
struct bt_att_read_blob_rsp {
uint8_t _dummy[0];
uint8_t value[];
uint8_t _dummy[0];
uint8_t value[];
} __packed;
/* Read Multiple Request */
#define BT_ATT_READ_MULT_MIN_LEN_REQ 0x04
#define BT_ATT_READ_MULT_MIN_LEN_REQ 0x04
#define BT_ATT_OP_READ_MULT_REQ 0x0e
#define BT_ATT_OP_READ_MULT_REQ 0x0e
struct bt_att_read_mult_req {
uint8_t _dummy[0];
uint16_t handles[];
uint8_t _dummy[0];
uint16_t handles[];
} __packed;
/* Read Multiple Respose */
#define BT_ATT_OP_READ_MULT_RSP 0x0f
#define BT_ATT_OP_READ_MULT_RSP 0x0f
struct bt_att_read_mult_rsp {
uint8_t _dummy[0];
uint8_t value[];
uint8_t _dummy[0];
uint8_t value[];
} __packed;
/* Read by Group Type Request */
#define BT_ATT_OP_READ_GROUP_REQ 0x10
#define BT_ATT_OP_READ_GROUP_REQ 0x10
struct bt_att_read_group_req {
uint16_t start_handle;
uint16_t end_handle;
uint8_t uuid[];
uint16_t start_handle;
uint16_t end_handle;
uint8_t uuid[];
} __packed;
struct bt_att_group_data {
uint16_t start_handle;
uint16_t end_handle;
uint8_t value[];
uint16_t start_handle;
uint16_t end_handle;
uint8_t value[];
} __packed;
/* Read by Group Type Response */
#define BT_ATT_OP_READ_GROUP_RSP 0x11
#define BT_ATT_OP_READ_GROUP_RSP 0x11
struct bt_att_read_group_rsp {
uint8_t len;
struct bt_att_group_data data[];
uint8_t len;
struct bt_att_group_data data[];
} __packed;
/* Write Request */
#define BT_ATT_OP_WRITE_REQ 0x12
#define BT_ATT_OP_WRITE_REQ 0x12
struct bt_att_write_req {
uint16_t handle;
uint8_t value[];
uint16_t handle;
uint8_t value[];
} __packed;
/* Write Response */
#define BT_ATT_OP_WRITE_RSP 0x13
#define BT_ATT_OP_WRITE_RSP 0x13
/* Prepare Write Request */
#define BT_ATT_OP_PREPARE_WRITE_REQ 0x16
#define BT_ATT_OP_PREPARE_WRITE_REQ 0x16
struct bt_att_prepare_write_req {
uint16_t handle;
uint16_t offset;
uint8_t value[];
uint16_t handle;
uint16_t offset;
uint8_t value[];
} __packed;
/* Prepare Write Respond */
#define BT_ATT_OP_PREPARE_WRITE_RSP 0x17
#define BT_ATT_OP_PREPARE_WRITE_RSP 0x17
struct bt_att_prepare_write_rsp {
uint16_t handle;
uint16_t offset;
uint8_t value[];
uint16_t handle;
uint16_t offset;
uint8_t value[];
} __packed;
/* Execute Write Request */
#define BT_ATT_FLAG_CANCEL 0x00
#define BT_ATT_FLAG_EXEC 0x01
#define BT_ATT_FLAG_CANCEL 0x00
#define BT_ATT_FLAG_EXEC 0x01
#define BT_ATT_OP_EXEC_WRITE_REQ 0x18
#define BT_ATT_OP_EXEC_WRITE_REQ 0x18
struct bt_att_exec_write_req {
uint8_t flags;
uint8_t flags;
} __packed;
/* Execute Write Response */
#define BT_ATT_OP_EXEC_WRITE_RSP 0x19
#define BT_ATT_OP_EXEC_WRITE_RSP 0x19
/* Handle Value Notification */
#define BT_ATT_OP_NOTIFY 0x1b
#define BT_ATT_OP_NOTIFY 0x1b
struct bt_att_notify {
uint16_t handle;
uint8_t value[];
uint16_t handle;
uint8_t value[];
} __packed;
/* Handle Value Indication */
#define BT_ATT_OP_INDICATE 0x1d
#define BT_ATT_OP_INDICATE 0x1d
struct bt_att_indicate {
uint16_t handle;
uint8_t value[];
uint16_t handle;
uint8_t value[];
} __packed;
/* Handle Value Confirm */
#define BT_ATT_OP_CONFIRM 0x1e
#define BT_ATT_OP_CONFIRM 0x1e
struct bt_att_signature {
uint8_t value[12];
uint8_t value[12];
} __packed;
#define BT_ATT_OP_READ_MULT_VL_REQ 0x20
#define BT_ATT_OP_READ_MULT_VL_REQ 0x20
struct bt_att_read_mult_vl_req {
uint8_t _dummy[0];
uint16_t handles[];
uint8_t _dummy[0];
uint16_t handles[];
} __packed;
/* Read Multiple Respose */
#define BT_ATT_OP_READ_MULT_VL_RSP 0x21
#define BT_ATT_OP_READ_MULT_VL_RSP 0x21
struct bt_att_read_mult_vl_rsp {
uint16_t len;
uint8_t value[];
uint16_t len;
uint8_t value[];
} __packed;
/* Handle Multiple Value Notification */
#define BT_ATT_OP_NOTIFY_MULT 0x23
#define BT_ATT_OP_NOTIFY_MULT 0x23
struct bt_att_notify_mult {
uint16_t handle;
uint16_t len;
uint8_t value[];
uint16_t handle;
uint16_t len;
uint8_t value[];
} __packed;
/* Write Command */
#define BT_ATT_OP_WRITE_CMD 0x52
#define BT_ATT_OP_WRITE_CMD 0x52
struct bt_att_write_cmd {
uint16_t handle;
uint8_t value[];
uint16_t handle;
uint8_t value[];
} __packed;
/* Signed Write Command */
#define BT_ATT_OP_SIGNED_WRITE_CMD 0xd2
#define BT_ATT_OP_SIGNED_WRITE_CMD 0xd2
struct bt_att_signed_write_cmd {
uint16_t handle;
uint8_t value[];
uint16_t handle;
uint8_t value[];
} __packed;

File diff suppressed because it is too large Load Diff

View File

@ -50,20 +50,20 @@ extern "C" {
int bt_send(struct net_buf *buf);
enum {
/** Passthrough mode
*
* While in this mode the buffers are passed as is between the stack
* and the driver.
*/
BT_HCI_RAW_MODE_PASSTHROUGH = 0x00,
/** Passthrough mode
*
* While in this mode the buffers are passed as is between the stack
* and the driver.
*/
BT_HCI_RAW_MODE_PASSTHROUGH = 0x00,
/** H:4 mode
*
* While in this mode H:4 headers will added into the buffers
* according to the buffer type when coming from the stack and will be
* removed and used to set the buffer type.
*/
BT_HCI_RAW_MODE_H4 = 0x01,
/** H:4 mode
*
* While in this mode H:4 headers will added into the buffers
* according to the buffer type when coming from the stack and will be
* removed and used to set the buffer type.
*/
BT_HCI_RAW_MODE_H4 = 0x01,
};
/** @brief Set Bluetooth RAW channel mode
@ -93,31 +93,31 @@ uint8_t bt_hci_raw_get_mode(void);
* @param _func Handler function to be called.
*/
#define BT_HCI_RAW_CMD_EXT(_op, _min_len, _func) \
{ \
.op = _op, \
.min_len = _min_len, \
.func = _func, \
}
{ \
.op = _op, \
.min_len = _min_len, \
.func = _func, \
}
struct bt_hci_raw_cmd_ext {
/** Opcode of the command */
uint16_t op;
/** Opcode of the command */
uint16_t op;
/** Minimal length of the command */
size_t min_len;
/** Minimal length of the command */
size_t min_len;
/** Handler function.
*
* Handler function to be called when a command is intercepted.
*
* @param buf Buffer containing the command.
*
* @return HCI Status code or BT_HCI_ERR_EXT_HANDLED if command has
* been handled already and a response has been sent as oppose to
* BT_HCI_ERR_SUCCESS which just indicates that the command can be
* sent to the controller to be processed.
*/
uint8_t (*func)(struct net_buf *buf);
/** Handler function.
*
* Handler function to be called when a command is intercepted.
*
* @param buf Buffer containing the command.
*
* @return HCI Status code or BT_HCI_ERR_EXT_HANDLED if command has
* been handled already and a response has been sent as oppose to
* BT_HCI_ERR_SUCCESS which just indicates that the command can be
* sent to the controller to be processed.
*/
uint8_t (*func)(struct net_buf *buf);
};
/** @brief Register Bluetooth RAW command extension table

View File

@ -32,11 +32,11 @@ extern "C" {
#define BT_VS_CMD_BIT_READ_TX_POWER 14
#define BT_VS_CMD_SUP_FEAT(cmd) BT_LE_FEAT_TEST(cmd, \
BT_VS_CMD_BIT_SUP_FEAT)
BT_VS_CMD_BIT_SUP_FEAT)
#define BT_VS_CMD_READ_STATIC_ADDRS(cmd) BT_LE_FEAT_TEST(cmd, \
BT_VS_CMD_BIT_READ_STATIC_ADDRS)
BT_VS_CMD_BIT_READ_STATIC_ADDRS)
#define BT_VS_CMD_READ_KEY_ROOTS(cmd) BT_LE_FEAT_TEST(cmd, \
BT_VS_CMD_BIT_READ_KEY_ROOTS)
BT_VS_CMD_BIT_READ_KEY_ROOTS)
#define BT_HCI_VS_HW_PLAT_INTEL 0x0001
#define BT_HCI_VS_HW_PLAT_NORDIC 0x0002
@ -50,44 +50,44 @@ extern "C" {
#define BT_HCI_VS_FW_VAR_VS_CTLR 0x0002
#define BT_HCI_VS_FW_VAR_FW_LOADER 0x0003
#define BT_HCI_VS_FW_VAR_RESCUE_IMG 0x0004
#define BT_HCI_OP_VS_READ_VERSION_INFO BT_OP(BT_OGF_VS, 0x0001)
#define BT_HCI_OP_VS_READ_VERSION_INFO BT_OP(BT_OGF_VS, 0x0001)
struct bt_hci_rp_vs_read_version_info {
uint8_t status;
uint16_t hw_platform;
uint16_t hw_variant;
uint8_t fw_variant;
uint8_t fw_version;
uint16_t fw_revision;
uint32_t fw_build;
uint8_t status;
uint16_t hw_platform;
uint16_t hw_variant;
uint8_t fw_variant;
uint8_t fw_version;
uint16_t fw_revision;
uint32_t fw_build;
} __packed;
#define BT_HCI_OP_VS_READ_SUPPORTED_COMMANDS BT_OP(BT_OGF_VS, 0x0002)
#define BT_HCI_OP_VS_READ_SUPPORTED_COMMANDS BT_OP(BT_OGF_VS, 0x0002)
struct bt_hci_rp_vs_read_supported_commands {
uint8_t status;
uint8_t commands[64];
uint8_t status;
uint8_t commands[64];
} __packed;
#define BT_HCI_OP_VS_READ_SUPPORTED_FEATURES BT_OP(BT_OGF_VS, 0x0003)
#define BT_HCI_OP_VS_READ_SUPPORTED_FEATURES BT_OP(BT_OGF_VS, 0x0003)
struct bt_hci_rp_vs_read_supported_features {
uint8_t status;
uint8_t features[8];
uint8_t status;
uint8_t features[8];
} __packed;
#define BT_HCI_OP_VS_SET_EVENT_MASK BT_OP(BT_OGF_VS, 0x0004)
struct bt_hci_cp_vs_set_event_mask {
uint8_t event_mask[8];
uint8_t event_mask[8];
} __packed;
#define BT_HCI_VS_RESET_SOFT 0x00
#define BT_HCI_VS_RESET_HARD 0x01
#define BT_HCI_OP_VS_RESET BT_OP(BT_OGF_VS, 0x0005)
struct bt_hci_cp_vs_reset {
uint8_t type;
uint8_t type;
} __packed;
#define BT_HCI_OP_VS_WRITE_BD_ADDR BT_OP(BT_OGF_VS, 0x0006)
struct bt_hci_cp_vs_write_bd_addr {
bt_addr_t bdaddr;
bt_addr_t bdaddr;
} __packed;
#define BT_HCI_VS_TRACE_DISABLED 0x00
@ -97,60 +97,60 @@ struct bt_hci_cp_vs_write_bd_addr {
#define BT_HCI_VS_TRACE_VDC 0x01
#define BT_HCI_OP_VS_SET_TRACE_ENABLE BT_OP(BT_OGF_VS, 0x0007)
struct bt_hci_cp_vs_set_trace_enable {
uint8_t enable;
uint8_t type;
uint8_t enable;
uint8_t type;
} __packed;
#define BT_HCI_OP_VS_READ_BUILD_INFO BT_OP(BT_OGF_VS, 0x0008)
struct bt_hci_rp_vs_read_build_info {
uint8_t status;
uint8_t info[];
uint8_t status;
uint8_t info[];
} __packed;
struct bt_hci_vs_static_addr {
bt_addr_t bdaddr;
uint8_t ir[16];
bt_addr_t bdaddr;
uint8_t ir[16];
} __packed;
#define BT_HCI_OP_VS_READ_STATIC_ADDRS BT_OP(BT_OGF_VS, 0x0009)
struct bt_hci_rp_vs_read_static_addrs {
uint8_t status;
uint8_t num_addrs;
struct bt_hci_vs_static_addr a[];
uint8_t status;
uint8_t num_addrs;
struct bt_hci_vs_static_addr a[];
} __packed;
#define BT_HCI_OP_VS_READ_KEY_HIERARCHY_ROOTS BT_OP(BT_OGF_VS, 0x000a)
struct bt_hci_rp_vs_read_key_hierarchy_roots {
uint8_t status;
uint8_t ir[16];
uint8_t er[16];
uint8_t status;
uint8_t ir[16];
uint8_t er[16];
} __packed;
#define BT_HCI_OP_VS_READ_CHIP_TEMP BT_OP(BT_OGF_VS, 0x000b)
struct bt_hci_rp_vs_read_chip_temp {
uint8_t status;
int8_t temps;
uint8_t status;
int8_t temps;
} __packed;
struct bt_hci_vs_cmd {
uint16_t vendor_id;
uint16_t opcode_base;
uint16_t vendor_id;
uint16_t opcode_base;
} __packed;
#define BT_HCI_VS_VID_ANDROID 0x0001
#define BT_HCI_VS_VID_MICROSOFT 0x0002
#define BT_HCI_OP_VS_READ_HOST_STACK_CMDS BT_OP(BT_OGF_VS, 0x000c)
struct bt_hci_rp_vs_read_host_stack_cmds {
uint8_t status;
uint8_t num_cmds;
struct bt_hci_vs_cmd c[];
uint8_t status;
uint8_t num_cmds;
struct bt_hci_vs_cmd c[];
} __packed;
#define BT_HCI_VS_SCAN_REQ_REPORTS_DISABLED 0x00
#define BT_HCI_VS_SCAN_REQ_REPORTS_ENABLED 0x01
#define BT_HCI_OP_VS_SET_SCAN_REQ_REPORTS BT_OP(BT_OGF_VS, 0x000d)
struct bt_hci_cp_vs_set_scan_req_reports {
uint8_t enable;
uint8_t enable;
} __packed;
#define BT_HCI_VS_LL_HANDLE_TYPE_ADV 0x00
@ -159,37 +159,37 @@ struct bt_hci_cp_vs_set_scan_req_reports {
#define BT_HCI_VS_LL_TX_POWER_LEVEL_NO_PREF 0x7F
#define BT_HCI_OP_VS_WRITE_TX_POWER_LEVEL BT_OP(BT_OGF_VS, 0x000e)
struct bt_hci_cp_vs_write_tx_power_level {
uint8_t handle_type;
uint16_t handle;
int8_t tx_power_level;
uint8_t handle_type;
uint16_t handle;
int8_t tx_power_level;
} __packed;
struct bt_hci_rp_vs_write_tx_power_level {
uint8_t status;
uint8_t handle_type;
uint16_t handle;
int8_t selected_tx_power;
uint8_t status;
uint8_t handle_type;
uint16_t handle;
int8_t selected_tx_power;
} __packed;
#define BT_HCI_OP_VS_READ_TX_POWER_LEVEL BT_OP(BT_OGF_VS, 0x000f)
struct bt_hci_cp_vs_read_tx_power_level {
uint8_t handle_type;
uint16_t handle;
uint8_t handle_type;
uint16_t handle;
} __packed;
struct bt_hci_rp_vs_read_tx_power_level {
uint8_t status;
uint8_t handle_type;
uint16_t handle;
int8_t tx_power_level;
uint8_t status;
uint8_t handle_type;
uint16_t handle;
int8_t tx_power_level;
} __packed;
#define BT_HCI_OP_VS_READ_USB_TRANSPORT_MODE BT_OP(BT_OGF_VS, 0x0010)
struct bt_hci_rp_vs_read_usb_transport_mode {
uint8_t status;
uint8_t num_supported_modes;
uint8_t supported_mode[];
uint8_t status;
uint8_t num_supported_modes;
uint8_t supported_mode[];
} __packed;
#define BT_HCI_VS_USB_H2_MODE 0x00
@ -198,19 +198,19 @@ struct bt_hci_rp_vs_read_usb_transport_mode {
#define BT_HCI_OP_VS_SET_USB_TRANSPORT_MODE BT_OP(BT_OGF_VS, 0x0011)
struct bt_hci_cp_vs_set_usb_transport_mode {
uint8_t mode;
uint8_t mode;
} __packed;
/* Events */
struct bt_hci_evt_vs {
uint8_t subevent;
uint8_t subevent;
} __packed;
#define BT_HCI_EVT_VS_FATAL_ERROR 0x02
struct bt_hci_evt_vs_fatal_error {
uint64_t pc;
uint8_t err_info[];
uint64_t pc;
uint8_t err_info[];
} __packed;
#define BT_HCI_VS_TRACE_LMP_TX 0x01
@ -220,14 +220,14 @@ struct bt_hci_evt_vs_fatal_error {
#define BT_HCI_VS_TRACE_LE_CONN_IND 0x05
#define BT_HCI_EVT_VS_TRACE_INFO 0x03
struct bt_hci_evt_vs_trace_info {
uint8_t type;
uint8_t data[];
uint8_t type;
uint8_t data[];
} __packed;
#define BT_HCI_EVT_VS_SCAN_REQ_RX 0x04
struct bt_hci_evt_vs_scan_req_rx {
bt_addr_le_t addr;
int8_t rssi;
bt_addr_le_t addr;
int8_t rssi;
} __packed;
/* Event mask bits */
@ -243,133 +243,133 @@ struct bt_hci_evt_vs_scan_req_rx {
#define BT_HCI_MESH_EVT_PREFIX 0xF0
struct bt_hci_cp_mesh {
uint8_t opcode;
uint8_t opcode;
} __packed;
#define BT_HCI_OC_MESH_GET_OPTS 0x00
struct bt_hci_rp_mesh_get_opts {
uint8_t status;
uint8_t opcode;
uint8_t revision;
uint8_t ch_map;
int8_t min_tx_power;
int8_t max_tx_power;
uint8_t max_scan_filter;
uint8_t max_filter_pattern;
uint8_t max_adv_slot;
uint8_t max_tx_window;
uint8_t evt_prefix_len;
uint8_t evt_prefix;
uint8_t status;
uint8_t opcode;
uint8_t revision;
uint8_t ch_map;
int8_t min_tx_power;
int8_t max_tx_power;
uint8_t max_scan_filter;
uint8_t max_filter_pattern;
uint8_t max_adv_slot;
uint8_t max_tx_window;
uint8_t evt_prefix_len;
uint8_t evt_prefix;
} __packed;
#define BT_HCI_MESH_PATTERN_LEN_MAX 0x0f
#define BT_HCI_OC_MESH_SET_SCAN_FILTER 0x01
struct bt_hci_mesh_pattern {
uint8_t pattern_len;
uint8_t pattern[];
uint8_t pattern_len;
uint8_t pattern[];
} __packed;
struct bt_hci_cp_mesh_set_scan_filter {
uint8_t scan_filter;
uint8_t filter_dup;
uint8_t num_patterns;
struct bt_hci_mesh_pattern patterns[];
uint8_t scan_filter;
uint8_t filter_dup;
uint8_t num_patterns;
struct bt_hci_mesh_pattern patterns[];
} __packed;
struct bt_hci_rp_mesh_set_scan_filter {
uint8_t status;
uint8_t opcode;
uint8_t scan_filter;
uint8_t status;
uint8_t opcode;
uint8_t scan_filter;
} __packed;
#define BT_HCI_OC_MESH_ADVERTISE 0x02
struct bt_hci_cp_mesh_advertise {
uint8_t adv_slot;
uint8_t own_addr_type;
bt_addr_t random_addr;
uint8_t ch_map;
int8_t tx_power;
uint8_t min_tx_delay;
uint8_t max_tx_delay;
uint8_t retx_count;
uint8_t retx_interval;
uint8_t scan_delay;
uint16_t scan_duration;
uint8_t scan_filter;
uint8_t data_len;
uint8_t data[31];
uint8_t adv_slot;
uint8_t own_addr_type;
bt_addr_t random_addr;
uint8_t ch_map;
int8_t tx_power;
uint8_t min_tx_delay;
uint8_t max_tx_delay;
uint8_t retx_count;
uint8_t retx_interval;
uint8_t scan_delay;
uint16_t scan_duration;
uint8_t scan_filter;
uint8_t data_len;
uint8_t data[31];
} __packed;
struct bt_hci_rp_mesh_advertise {
uint8_t status;
uint8_t opcode;
uint8_t adv_slot;
uint8_t status;
uint8_t opcode;
uint8_t adv_slot;
} __packed;
#define BT_HCI_OC_MESH_ADVERTISE_TIMED 0x03
struct bt_hci_cp_mesh_advertise_timed {
uint8_t adv_slot;
uint8_t own_addr_type;
bt_addr_t random_addr;
uint8_t ch_map;
int8_t tx_power;
uint8_t retx_count;
uint8_t retx_interval;
uint32_t instant;
uint16_t tx_delay;
uint16_t tx_window;
uint8_t data_len;
uint8_t data[31];
uint8_t adv_slot;
uint8_t own_addr_type;
bt_addr_t random_addr;
uint8_t ch_map;
int8_t tx_power;
uint8_t retx_count;
uint8_t retx_interval;
uint32_t instant;
uint16_t tx_delay;
uint16_t tx_window;
uint8_t data_len;
uint8_t data[31];
} __packed;
struct bt_hci_rp_mesh_advertise_timed {
uint8_t status;
uint8_t opcode;
uint8_t adv_slot;
uint8_t status;
uint8_t opcode;
uint8_t adv_slot;
} __packed;
#define BT_HCI_OC_MESH_ADVERTISE_CANCEL 0x04
struct bt_hci_cp_mesh_advertise_cancel {
uint8_t adv_slot;
uint8_t adv_slot;
} __packed;
struct bt_hci_rp_mesh_advertise_cancel {
uint8_t status;
uint8_t opcode;
uint8_t adv_slot;
uint8_t status;
uint8_t opcode;
uint8_t adv_slot;
} __packed;
#define BT_HCI_OC_MESH_SET_SCANNING 0x05
struct bt_hci_cp_mesh_set_scanning {
uint8_t enable;
uint8_t ch_map;
uint8_t scan_filter;
uint8_t enable;
uint8_t ch_map;
uint8_t scan_filter;
} __packed;
struct bt_hci_rp_mesh_set_scanning {
uint8_t status;
uint8_t opcode;
uint8_t status;
uint8_t opcode;
} __packed;
/* Events */
struct bt_hci_evt_mesh {
uint8_t prefix;
uint8_t subevent;
uint8_t prefix;
uint8_t subevent;
} __packed;
#define BT_HCI_EVT_MESH_ADV_COMPLETE 0x00
struct bt_hci_evt_mesh_adv_complete {
uint8_t adv_slot;
uint8_t adv_slot;
} __packed;
#define BT_HCI_EVT_MESH_SCANNING_REPORT 0x01
struct bt_hci_evt_mesh_scan_report {
bt_addr_le_t addr;
uint8_t chan;
int8_t rssi;
uint32_t instant;
uint8_t data_len;
uint8_t data[];
bt_addr_le_t addr;
uint8_t chan;
int8_t rssi;
uint32_t instant;
uint8_t data_len;
uint8_t data[];
} __packed;
struct bt_hci_evt_mesh_scanning_report {
uint8_t num_reports;
struct bt_hci_evt_mesh_scan_report reports[];
uint8_t num_reports;
struct bt_hci_evt_mesh_scan_report reports[];
} __packed;
#ifdef __cplusplus

View File

@ -15,8 +15,8 @@
#include <string.h>
enum l2cap_conn_list_action {
BT_L2CAP_CHAN_LOOKUP,
BT_L2CAP_CHAN_DETACH,
BT_L2CAP_CHAN_LOOKUP,
BT_L2CAP_CHAN_DETACH,
};
#define BT_L2CAP_CID_BR_SIG 0x0001
@ -28,14 +28,14 @@ enum l2cap_conn_list_action {
#define BT_L2CAP_PSM_RFCOMM 0x0003
struct bt_l2cap_hdr {
uint16_t len;
uint16_t cid;
uint16_t len;
uint16_t cid;
} __packed;
struct bt_l2cap_sig_hdr {
uint8_t code;
uint8_t ident;
uint16_t len;
uint8_t code;
uint8_t ident;
uint16_t len;
} __packed;
#define BT_L2CAP_REJ_NOT_UNDERSTOOD 0x0000
@ -44,19 +44,19 @@ struct bt_l2cap_sig_hdr {
#define BT_L2CAP_CMD_REJECT 0x01
struct bt_l2cap_cmd_reject {
uint16_t reason;
uint8_t data[];
uint16_t reason;
uint8_t data[];
} __packed;
struct bt_l2cap_cmd_reject_cid_data {
uint16_t scid;
uint16_t dcid;
uint16_t scid;
uint16_t dcid;
} __packed;
#define BT_L2CAP_CONN_REQ 0x02
struct bt_l2cap_conn_req {
uint16_t psm;
uint16_t scid;
uint16_t psm;
uint16_t scid;
} __packed;
/* command statuses in reposnse */
@ -74,10 +74,10 @@ struct bt_l2cap_conn_req {
#define BT_L2CAP_CONN_RSP 0x03
struct bt_l2cap_conn_rsp {
uint16_t dcid;
uint16_t scid;
uint16_t result;
uint16_t status;
uint16_t dcid;
uint16_t scid;
uint16_t result;
uint16_t status;
} __packed;
#define BT_L2CAP_CONF_SUCCESS 0x0000
@ -86,17 +86,17 @@ struct bt_l2cap_conn_rsp {
#define BT_L2CAP_CONF_REQ 0x04
struct bt_l2cap_conf_req {
uint16_t dcid;
uint16_t flags;
uint8_t data[];
uint16_t dcid;
uint16_t flags;
uint8_t data[];
} __packed;
#define BT_L2CAP_CONF_RSP 0x05
struct bt_l2cap_conf_rsp {
uint16_t scid;
uint16_t flags;
uint16_t result;
uint8_t data[];
uint16_t scid;
uint16_t flags;
uint16_t result;
uint8_t data[];
} __packed;
/* Option type used by MTU config request data */
@ -106,21 +106,21 @@ struct bt_l2cap_conf_rsp {
#define BT_L2CAP_CONF_MASK 0x7f
struct bt_l2cap_conf_opt {
uint8_t type;
uint8_t len;
uint8_t data[];
uint8_t type;
uint8_t len;
uint8_t data[];
} __packed;
#define BT_L2CAP_DISCONN_REQ 0x06
struct bt_l2cap_disconn_req {
uint16_t dcid;
uint16_t scid;
uint16_t dcid;
uint16_t scid;
} __packed;
#define BT_L2CAP_DISCONN_RSP 0x07
struct bt_l2cap_disconn_rsp {
uint16_t dcid;
uint16_t scid;
uint16_t dcid;
uint16_t scid;
} __packed;
#define BT_L2CAP_INFO_FEAT_MASK 0x0002
@ -128,7 +128,7 @@ struct bt_l2cap_disconn_rsp {
#define BT_L2CAP_INFO_REQ 0x0a
struct bt_l2cap_info_req {
uint16_t type;
uint16_t type;
} __packed;
/* info result */
@ -137,17 +137,17 @@ struct bt_l2cap_info_req {
#define BT_L2CAP_INFO_RSP 0x0b
struct bt_l2cap_info_rsp {
uint16_t type;
uint16_t result;
uint8_t data[];
uint16_t type;
uint16_t result;
uint8_t data[];
} __packed;
#define BT_L2CAP_CONN_PARAM_REQ 0x12
struct bt_l2cap_conn_param_req {
uint16_t min_interval;
uint16_t max_interval;
uint16_t latency;
uint16_t timeout;
uint16_t min_interval;
uint16_t max_interval;
uint16_t latency;
uint16_t timeout;
} __packed;
#define BT_L2CAP_CONN_PARAM_ACCEPTED 0x0000
@ -155,16 +155,16 @@ struct bt_l2cap_conn_param_req {
#define BT_L2CAP_CONN_PARAM_RSP 0x13
struct bt_l2cap_conn_param_rsp {
uint16_t result;
uint16_t result;
} __packed;
#define BT_L2CAP_LE_CONN_REQ 0x14
struct bt_l2cap_le_conn_req {
uint16_t psm;
uint16_t scid;
uint16_t mtu;
uint16_t mps;
uint16_t credits;
uint16_t psm;
uint16_t scid;
uint16_t mtu;
uint16_t mps;
uint16_t credits;
} __packed;
/* valid results in conn response on LE */
@ -182,42 +182,42 @@ struct bt_l2cap_le_conn_req {
#define BT_L2CAP_LE_CONN_RSP 0x15
struct bt_l2cap_le_conn_rsp {
uint16_t dcid;
uint16_t mtu;
uint16_t mps;
uint16_t credits;
uint16_t result;
uint16_t dcid;
uint16_t mtu;
uint16_t mps;
uint16_t credits;
uint16_t result;
} __packed;
#define BT_L2CAP_LE_CREDITS 0x16
struct bt_l2cap_le_credits {
uint16_t cid;
uint16_t credits;
uint16_t cid;
uint16_t credits;
} __packed;
#define BT_L2CAP_ECRED_CONN_REQ 0x17
struct bt_l2cap_ecred_conn_req {
uint16_t psm;
uint16_t mtu;
uint16_t mps;
uint16_t credits;
uint16_t scid[];
uint16_t psm;
uint16_t mtu;
uint16_t mps;
uint16_t credits;
uint16_t scid[];
} __packed;
#define BT_L2CAP_ECRED_CONN_RSP 0x18
struct bt_l2cap_ecred_conn_rsp {
uint16_t mtu;
uint16_t mps;
uint16_t credits;
uint16_t result;
uint16_t dcid[];
uint16_t mtu;
uint16_t mps;
uint16_t credits;
uint16_t result;
uint16_t dcid[];
} __packed;
#define BT_L2CAP_ECRED_RECONF_REQ 0x19
struct bt_l2cap_ecred_reconf_req {
uint16_t mtu;
uint16_t mps;
uint16_t scid[];
uint16_t mtu;
uint16_t mps;
uint16_t scid[];
} __packed;
#define BT_L2CAP_RECONF_SUCCESS 0x0000
@ -226,5 +226,5 @@ struct bt_l2cap_ecred_reconf_req {
#define BT_L2CAP_ECRED_RECONF_RSP 0x1a
struct bt_l2cap_ecred_reconf_rsp {
uint16_t result;
uint16_t result;
} __packed;

View File

@ -57,7 +57,7 @@ STATIC void nibble_write(mp_soft_qspi_obj_t *self, uint8_t v) {
}
STATIC int mp_soft_qspi_ioctl(void *self_in, uint32_t cmd) {
mp_soft_qspi_obj_t *self = (mp_soft_qspi_obj_t*)self_in;
mp_soft_qspi_obj_t *self = (mp_soft_qspi_obj_t *)self_in;
switch (cmd) {
case MP_QSPI_IOCTL_INIT:
@ -67,7 +67,7 @@ STATIC int mp_soft_qspi_ioctl(void *self_in, uint32_t cmd) {
// Configure pins
mp_hal_pin_write(self->clk, 0);
mp_hal_pin_output(self->clk);
//mp_hal_pin_write(self->clk, 1);
// mp_hal_pin_write(self->clk, 1);
mp_hal_pin_output(self->io0);
mp_hal_pin_input(self->io1);
mp_hal_pin_write(self->io2, 1);
@ -155,19 +155,19 @@ STATIC void mp_soft_qspi_qwrite(mp_soft_qspi_obj_t *self, size_t len, const uint
SCK_LOW(self);
}
//mp_hal_pin_input(self->io1);
// mp_hal_pin_input(self->io1);
}
STATIC void mp_soft_qspi_write_cmd_data(void *self_in, uint8_t cmd, size_t len, uint32_t data) {
mp_soft_qspi_obj_t *self = (mp_soft_qspi_obj_t*)self_in;
mp_soft_qspi_obj_t *self = (mp_soft_qspi_obj_t *)self_in;
uint32_t cmd_buf = cmd | data << 8;
CS_LOW(self);
mp_soft_qspi_transfer(self, 1 + len, (uint8_t*)&cmd_buf, NULL);
mp_soft_qspi_transfer(self, 1 + len, (uint8_t *)&cmd_buf, NULL);
CS_HIGH(self);
}
STATIC void mp_soft_qspi_write_cmd_addr_data(void *self_in, uint8_t cmd, uint32_t addr, size_t len, const uint8_t *src) {
mp_soft_qspi_obj_t *self = (mp_soft_qspi_obj_t*)self_in;
mp_soft_qspi_obj_t *self = (mp_soft_qspi_obj_t *)self_in;
uint8_t cmd_buf[4] = {cmd, addr >> 16, addr >> 8, addr};
CS_LOW(self);
mp_soft_qspi_transfer(self, 4, cmd_buf, NULL);
@ -176,16 +176,16 @@ STATIC void mp_soft_qspi_write_cmd_addr_data(void *self_in, uint8_t cmd, uint32_
}
STATIC uint32_t mp_soft_qspi_read_cmd(void *self_in, uint8_t cmd, size_t len) {
mp_soft_qspi_obj_t *self = (mp_soft_qspi_obj_t*)self_in;
mp_soft_qspi_obj_t *self = (mp_soft_qspi_obj_t *)self_in;
uint32_t cmd_buf = cmd;
CS_LOW(self);
mp_soft_qspi_transfer(self, 1 + len, (uint8_t*)&cmd_buf, (uint8_t*)&cmd_buf);
mp_soft_qspi_transfer(self, 1 + len, (uint8_t *)&cmd_buf, (uint8_t *)&cmd_buf);
CS_HIGH(self);
return cmd_buf >> 8;
}
STATIC void mp_soft_qspi_read_cmd_qaddr_qdata(void *self_in, uint8_t cmd, uint32_t addr, size_t len, uint8_t *dest) {
mp_soft_qspi_obj_t *self = (mp_soft_qspi_obj_t*)self_in;
mp_soft_qspi_obj_t *self = (mp_soft_qspi_obj_t *)self_in;
uint8_t cmd_buf[7] = {cmd, addr >> 16, addr >> 8, addr};
CS_LOW(self);
mp_soft_qspi_transfer(self, 1, cmd_buf, NULL);

View File

@ -27,7 +27,7 @@
#include "drivers/bus/spi.h"
int mp_soft_spi_ioctl(void *self_in, uint32_t cmd) {
mp_soft_spi_obj_t *self = (mp_soft_spi_obj_t*)self_in;
mp_soft_spi_obj_t *self = (mp_soft_spi_obj_t *)self_in;
switch (cmd) {
case MP_SPI_IOCTL_INIT:
@ -45,7 +45,7 @@ int mp_soft_spi_ioctl(void *self_in, uint32_t cmd) {
}
void mp_soft_spi_transfer(void *self_in, size_t len, const uint8_t *src, uint8_t *dest) {
mp_soft_spi_obj_t *self = (mp_soft_spi_obj_t*)self_in;
mp_soft_spi_obj_t *self = (mp_soft_spi_obj_t *)self_in;
uint32_t delay_half = self->delay_half;
// only MSB transfer is implemented

View File

@ -50,9 +50,15 @@ STATIC mp_obj_t machine_mem_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t va
uintptr_t addr = MICROPY_MACHINE_MEM_GET_READ_ADDR(index, self->elem_size);
uint32_t val;
switch (self->elem_size) {
case 1: val = (*(uint8_t*)addr); break;
case 2: val = (*(uint16_t*)addr); break;
default: val = (*(uint32_t*)addr); break;
case 1:
val = (*(uint8_t *)addr);
break;
case 2:
val = (*(uint16_t *)addr);
break;
default:
val = (*(uint32_t *)addr);
break;
}
return mp_obj_new_int(val);
} else {
@ -60,9 +66,15 @@ STATIC mp_obj_t machine_mem_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t va
uintptr_t addr = MICROPY_MACHINE_MEM_GET_WRITE_ADDR(index, self->elem_size);
uint32_t val = mp_obj_get_int_truncated(value);
switch (self->elem_size) {
case 1: (*(uint8_t*)addr) = val; break;
case 2: (*(uint16_t*)addr) = val; break;
default: (*(uint32_t*)addr) = val; break;
case 1:
(*(uint8_t *)addr) = val;
break;
case 2:
(*(uint16_t *)addr) = val;
break;
default:
(*(uint32_t *)addr) = val;
break;
}
return mp_const_none;
}

View File

@ -26,7 +26,7 @@ STATIC mp_obj_t signal_make_new(const mp_obj_type_t *type, size_t n_args, const
bool invert = false;
#if defined(MICROPY_PY_MACHINE_PIN_MAKE_NEW)
mp_pin_p_t *pin_p = (mp_pin_t*)mp_proto_get(QSTR_pin_protocol, pin);
mp_pin_p_t *pin_p = (mp_pin_t *)mp_proto_get(QSTR_pin_protocol, pin);
if (pin_p == NULL) {
// If first argument isn't a Pin-like object, we filter out "invert"
@ -64,8 +64,7 @@ STATIC mp_obj_t signal_make_new(const mp_obj_type_t *type, size_t n_args, const
pin = MICROPY_PY_MACHINE_PIN_MAKE_NEW(NULL, n_args, n_kw, pin_args);
mp_local_free(pin_args);
}
else
} else
#endif
// Otherwise there should be 1 or 2 args
{
@ -154,7 +153,7 @@ const mp_obj_type_t machine_signal_type = {
.make_new = signal_make_new,
.call = signal_call,
.protocol = &signal_pin_p,
.locals_dict = (void*)&signal_locals_dict,
.locals_dict = (void *)&signal_locals_dict,
};
#endif // MICROPY_PY_MACHINE

View File

@ -34,9 +34,9 @@ typedef struct _mp_obj_btree_t {
STATIC const mp_obj_type_t btree_type;
#define CHECK_ERROR(res) \
if (res == RET_ERROR) { \
mp_raise_OSError(errno); \
}
if (res == RET_ERROR) { \
mp_raise_OSError(errno); \
}
void __dbpanic(DB *db) {
printf("__dbpanic(%p)\n", db);
@ -74,8 +74,8 @@ STATIC mp_obj_t btree_put(size_t n_args, const mp_obj_t *args) {
(void)n_args;
mp_obj_btree_t *self = MP_OBJ_TO_PTR(args[0]);
DBT key, val;
key.data = (void*)mp_obj_str_get_data(args[1], &key.size);
val.data = (void*)mp_obj_str_get_data(args[2], &val.size);
key.data = (void *)mp_obj_str_get_data(args[1], &key.size);
val.data = (void *)mp_obj_str_get_data(args[2], &val.size);
return MP_OBJ_NEW_SMALL_INT(__bt_put(self->db, &key, &val, 0));
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(btree_put_obj, 3, 4, btree_put);
@ -83,7 +83,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(btree_put_obj, 3, 4, btree_put);
STATIC mp_obj_t btree_get(size_t n_args, const mp_obj_t *args) {
mp_obj_btree_t *self = MP_OBJ_TO_PTR(args[0]);
DBT key, val;
key.data = (void*)mp_obj_str_get_data(args[1], &key.size);
key.data = (void *)mp_obj_str_get_data(args[1], &key.size);
int res = __bt_get(self->db, &key, &val, 0);
if (res == RET_SPECIAL) {
if (n_args > 2) {
@ -102,7 +102,7 @@ STATIC mp_obj_t btree_seq(size_t n_args, const mp_obj_t *args) {
int flags = MP_OBJ_SMALL_INT_VALUE(args[1]);
DBT key, val;
if (n_args > 2) {
key.data = (void*)mp_obj_str_get_data(args[2], &key.size);
key.data = (void *)mp_obj_str_get_data(args[2], &key.size);
}
int res = __bt_seq(self->db, &key, &val, flags);
@ -177,7 +177,7 @@ STATIC mp_obj_t btree_iternext(mp_obj_t self_in) {
if (self->start_key != MP_OBJ_NULL) {
int flags = R_FIRST;
if (self->start_key != mp_const_none) {
key.data = (void*)mp_obj_str_get_data(self->start_key, &key.size);
key.data = (void *)mp_obj_str_get_data(self->start_key, &key.size);
flags = R_CURSOR;
} else if (desc) {
flags = R_LAST;
@ -195,7 +195,7 @@ STATIC mp_obj_t btree_iternext(mp_obj_t self_in) {
if (self->end_key != mp_const_none) {
DBT end_key;
end_key.data = (void*)mp_obj_str_get_data(self->end_key, &end_key.size);
end_key.data = (void *)mp_obj_str_get_data(self->end_key, &end_key.size);
BTREE *t = self->db->internal;
int cmp = t->bt_cmp(&key, &end_key);
if (desc) {
@ -230,7 +230,7 @@ STATIC mp_obj_t btree_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
if (value == MP_OBJ_NULL) {
// delete
DBT key;
key.data = (void*)mp_obj_str_get_data(index, &key.size);
key.data = (void *)mp_obj_str_get_data(index, &key.size);
int res = __bt_delete(self->db, &key, 0);
if (res == RET_SPECIAL) {
nlr_raise(mp_obj_new_exception(&mp_type_KeyError));
@ -240,7 +240,7 @@ STATIC mp_obj_t btree_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
} else if (value == MP_OBJ_SENTINEL) {
// load
DBT key, val;
key.data = (void*)mp_obj_str_get_data(index, &key.size);
key.data = (void *)mp_obj_str_get_data(index, &key.size);
int res = __bt_get(self->db, &key, &val, 0);
if (res == RET_SPECIAL) {
nlr_raise(mp_obj_new_exception(&mp_type_KeyError));
@ -250,8 +250,8 @@ STATIC mp_obj_t btree_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
} else {
// store
DBT key, val;
key.data = (void*)mp_obj_str_get_data(index, &key.size);
val.data = (void*)mp_obj_str_get_data(value, &val.size);
key.data = (void *)mp_obj_str_get_data(index, &key.size);
val.data = (void *)mp_obj_str_get_data(value, &val.size);
int res = __bt_put(self->db, &key, &val, 0);
CHECK_ERROR(res);
return mp_const_none;
@ -263,7 +263,7 @@ STATIC mp_obj_t btree_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs
switch (op) {
case MP_BINARY_OP_CONTAINS: {
DBT key, val;
key.data = (void*)mp_obj_str_get_data(rhs_in, &key.size);
key.data = (void *)mp_obj_str_get_data(rhs_in, &key.size);
int res = __bt_get(self->db, &key, &val, 0);
CHECK_ERROR(res);
return mp_obj_new_bool(res != RET_SPECIAL);
@ -296,7 +296,7 @@ STATIC const mp_obj_type_t btree_type = {
.iternext = btree_iternext,
.binary_op = btree_binary_op,
.subscr = btree_subscr,
.locals_dict = (void*)&btree_locals_dict,
.locals_dict = (void *)&btree_locals_dict,
};
STATIC FILEVTABLE btree_stream_fvtable = {
@ -324,14 +324,14 @@ STATIC mp_obj_t mod_btree_open(size_t n_args, const mp_obj_t *pos_args, mp_map_t
mp_arg_val_t minkeypage;
} args;
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args,
MP_ARRAY_SIZE(allowed_args), allowed_args, (mp_arg_val_t*)&args);
MP_ARRAY_SIZE(allowed_args), allowed_args, (mp_arg_val_t *)&args);
BTREEINFO openinfo = {0};
openinfo.flags = args.flags.u_int;
openinfo.cachesize = args.cachesize.u_int;
openinfo.psize = args.pagesize.u_int;
openinfo.minkeypage = args.minkeypage.u_int;
DB *db = __bt_open(pos_args[0], &btree_stream_fvtable, &openinfo, /*dflags*/0);
DB *db = __bt_open(pos_args[0], &btree_stream_fvtable, &openinfo, /*dflags*/ 0);
if (db == NULL) {
mp_raise_OSError(errno);
}
@ -350,7 +350,7 @@ STATIC MP_DEFINE_CONST_DICT(mp_module_btree_globals, mp_module_btree_globals_tab
const mp_obj_module_t mp_module_btree = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&mp_module_btree_globals,
.globals = (mp_obj_dict_t *)&mp_module_btree_globals,
};
#endif // MICROPY_PY_BTREE

View File

@ -22,8 +22,8 @@ typedef struct _mp_obj_framebuf_t {
uint8_t format;
} mp_obj_framebuf_t;
typedef void (*setpixel_t)(const mp_obj_framebuf_t*, int, int, uint32_t);
typedef uint32_t (*getpixel_t)(const mp_obj_framebuf_t*, int, int);
typedef void (*setpixel_t)(const mp_obj_framebuf_t *, int, int, uint32_t);
typedef uint32_t (*getpixel_t)(const mp_obj_framebuf_t *, int, int);
typedef void (*fill_rect_t)(const mp_obj_framebuf_t *, int, int, int, int, uint32_t);
typedef struct _mp_framebuf_p_t {
@ -47,20 +47,20 @@ typedef struct _mp_framebuf_p_t {
STATIC void mono_horiz_setpixel(const mp_obj_framebuf_t *fb, int x, int y, uint32_t col) {
size_t index = (x + y * fb->stride) >> 3;
int offset = fb->format == FRAMEBUF_MHMSB ? x & 0x07 : 7 - (x & 0x07);
((uint8_t*)fb->buf)[index] = (((uint8_t*)fb->buf)[index] & ~(0x01 << offset)) | ((col != 0) << offset);
((uint8_t *)fb->buf)[index] = (((uint8_t *)fb->buf)[index] & ~(0x01 << offset)) | ((col != 0) << offset);
}
STATIC uint32_t mono_horiz_getpixel(const mp_obj_framebuf_t *fb, int x, int y) {
size_t index = (x + y * fb->stride) >> 3;
int offset = fb->format == FRAMEBUF_MHMSB ? x & 0x07 : 7 - (x & 0x07);
return (((uint8_t*)fb->buf)[index] >> (offset)) & 0x01;
return (((uint8_t *)fb->buf)[index] >> (offset)) & 0x01;
}
STATIC void mono_horiz_fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w, int h, uint32_t col) {
int reverse = fb->format == FRAMEBUF_MHMSB;
int advance = fb->stride >> 3;
while (w--) {
uint8_t *b = &((uint8_t*)fb->buf)[(x >> 3) + y * advance];
uint8_t *b = &((uint8_t *)fb->buf)[(x >> 3) + y * advance];
int offset = reverse ? x & 7 : 7 - (x & 7);
for (int hh = h; hh; --hh) {
*b = (*b & ~(0x01 << offset)) | ((col != 0) << offset);
@ -75,16 +75,16 @@ STATIC void mono_horiz_fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int
STATIC void mvlsb_setpixel(const mp_obj_framebuf_t *fb, int x, int y, uint32_t col) {
size_t index = (y >> 3) * fb->stride + x;
uint8_t offset = y & 0x07;
((uint8_t*)fb->buf)[index] = (((uint8_t*)fb->buf)[index] & ~(0x01 << offset)) | ((col != 0) << offset);
((uint8_t *)fb->buf)[index] = (((uint8_t *)fb->buf)[index] & ~(0x01 << offset)) | ((col != 0) << offset);
}
STATIC uint32_t mvlsb_getpixel(const mp_obj_framebuf_t *fb, int x, int y) {
return (((uint8_t*)fb->buf)[(y >> 3) * fb->stride + x] >> (y & 0x07)) & 0x01;
return (((uint8_t *)fb->buf)[(y >> 3) * fb->stride + x] >> (y & 0x07)) & 0x01;
}
STATIC void mvlsb_fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w, int h, uint32_t col) {
while (h--) {
uint8_t *b = &((uint8_t*)fb->buf)[(y >> 3) * fb->stride + x];
uint8_t *b = &((uint8_t *)fb->buf)[(y >> 3) * fb->stride + x];
uint8_t offset = y & 0x07;
for (int ww = w; ww; --ww) {
*b = (*b & ~(0x01 << offset)) | ((col != 0) << offset);
@ -97,15 +97,15 @@ STATIC void mvlsb_fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w, in
// Functions for RGB565 format
STATIC void rgb565_setpixel(const mp_obj_framebuf_t *fb, int x, int y, uint32_t col) {
((uint16_t*)fb->buf)[x + y * fb->stride] = col;
((uint16_t *)fb->buf)[x + y * fb->stride] = col;
}
STATIC uint32_t rgb565_getpixel(const mp_obj_framebuf_t *fb, int x, int y) {
return ((uint16_t*)fb->buf)[x + y * fb->stride];
return ((uint16_t *)fb->buf)[x + y * fb->stride];
}
STATIC void rgb565_fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w, int h, uint32_t col) {
uint16_t *b = &((uint16_t*)fb->buf)[x + y * fb->stride];
uint16_t *b = &((uint16_t *)fb->buf)[x + y * fb->stride];
while (h--) {
for (int ww = w; ww; --ww) {
*b++ = col;
@ -117,7 +117,7 @@ STATIC void rgb565_fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w, i
// Functions for GS2_HMSB format
STATIC void gs2_hmsb_setpixel(const mp_obj_framebuf_t *fb, int x, int y, uint32_t col) {
uint8_t *pixel = &((uint8_t*)fb->buf)[(x + y * fb->stride) >> 2];
uint8_t *pixel = &((uint8_t *)fb->buf)[(x + y * fb->stride) >> 2];
uint8_t shift = (x & 0x3) << 1;
uint8_t mask = 0x3 << shift;
uint8_t color = (col & 0x3) << shift;
@ -125,14 +125,14 @@ STATIC void gs2_hmsb_setpixel(const mp_obj_framebuf_t *fb, int x, int y, uint32_
}
STATIC uint32_t gs2_hmsb_getpixel(const mp_obj_framebuf_t *fb, int x, int y) {
uint8_t pixel = ((uint8_t*)fb->buf)[(x + y * fb->stride) >> 2];
uint8_t pixel = ((uint8_t *)fb->buf)[(x + y * fb->stride) >> 2];
uint8_t shift = (x & 0x3) << 1;
return (pixel >> shift) & 0x3;
}
STATIC void gs2_hmsb_fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w, int h, uint32_t col) {
for (int xx=x; xx < x+w; xx++) {
for (int yy=y; yy < y+h; yy++) {
for (int xx = x; xx < x + w; xx++) {
for (int yy = y; yy < y + h; yy++) {
gs2_hmsb_setpixel(fb, xx, yy, col);
}
}
@ -141,7 +141,7 @@ STATIC void gs2_hmsb_fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w,
// Functions for GS4_HMSB format
STATIC void gs4_hmsb_setpixel(const mp_obj_framebuf_t *fb, int x, int y, uint32_t col) {
uint8_t *pixel = &((uint8_t*)fb->buf)[(x + y * fb->stride) >> 1];
uint8_t *pixel = &((uint8_t *)fb->buf)[(x + y * fb->stride) >> 1];
if (x % 2) {
*pixel = ((uint8_t)col & 0x0f) | (*pixel & 0xf0);
@ -152,15 +152,15 @@ STATIC void gs4_hmsb_setpixel(const mp_obj_framebuf_t *fb, int x, int y, uint32_
STATIC uint32_t gs4_hmsb_getpixel(const mp_obj_framebuf_t *fb, int x, int y) {
if (x % 2) {
return ((uint8_t*)fb->buf)[(x + y * fb->stride) >> 1] & 0x0f;
return ((uint8_t *)fb->buf)[(x + y * fb->stride) >> 1] & 0x0f;
}
return ((uint8_t*)fb->buf)[(x + y * fb->stride) >> 1] >> 4;
return ((uint8_t *)fb->buf)[(x + y * fb->stride) >> 1] >> 4;
}
STATIC void gs4_hmsb_fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w, int h, uint32_t col) {
col &= 0x0f;
uint8_t *pixel_pair = &((uint8_t*)fb->buf)[(x + y * fb->stride) >> 1];
uint8_t *pixel_pair = &((uint8_t *)fb->buf)[(x + y * fb->stride) >> 1];
uint8_t col_shifted_left = col << 4;
uint8_t col_pixel_pair = col_shifted_left | col;
int pixel_count_till_next_line = (fb->stride - w) >> 1;
@ -192,16 +192,16 @@ STATIC void gs4_hmsb_fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w,
// Functions for GS8 format
STATIC void gs8_setpixel(const mp_obj_framebuf_t *fb, int x, int y, uint32_t col) {
uint8_t *pixel = &((uint8_t*)fb->buf)[(x + y * fb->stride)];
uint8_t *pixel = &((uint8_t *)fb->buf)[(x + y * fb->stride)];
*pixel = col & 0xff;
}
STATIC uint32_t gs8_getpixel(const mp_obj_framebuf_t *fb, int x, int y) {
return ((uint8_t*)fb->buf)[(x + y * fb->stride)];
return ((uint8_t *)fb->buf)[(x + y * fb->stride)];
}
STATIC void gs8_fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w, int h, uint32_t col) {
uint8_t *pixel = &((uint8_t*)fb->buf)[(x + y * fb->stride)];
uint8_t *pixel = &((uint8_t *)fb->buf)[(x + y * fb->stride)];
while (h--) {
memset(pixel, col, w);
pixel += fb->stride;
@ -287,7 +287,7 @@ STATIC mp_obj_t framebuf_make_new(const mp_obj_type_t *type, size_t n_args, cons
STATIC const mp_obj_type_t mp_type_framebuf;
// Helper to ensure we have the native super class instead of a subclass.
static mp_obj_framebuf_t* native_framebuf(mp_obj_t framebuf_obj) {
static mp_obj_framebuf_t *native_framebuf(mp_obj_t framebuf_obj) {
mp_obj_t native_framebuf = mp_instance_cast_to_native_base(framebuf_obj, &mp_type_framebuf);
mp_obj_assert_native_inited(native_framebuf);
return MP_OBJ_TO_PTR(native_framebuf);
@ -384,9 +384,9 @@ STATIC mp_obj_t framebuf_rect(size_t n_args, const mp_obj_t *args) {
mp_int_t col = mp_obj_get_int(args[5]);
fill_rect(self, x, y, w, 1, col);
fill_rect(self, x, y + h- 1, w, 1, col);
fill_rect(self, x, y + h - 1, w, 1, col);
fill_rect(self, x, y, 1, h, col);
fill_rect(self, x + w- 1, y, 1, h, col);
fill_rect(self, x + w - 1, y, 1, h, col);
return mp_const_none;
}
@ -423,9 +423,15 @@ STATIC mp_obj_t framebuf_line(size_t n_args, const mp_obj_t *args) {
bool steep;
if (dy > dx) {
mp_int_t temp;
temp = x1; x1 = y1; y1 = temp;
temp = dx; dx = dy; dy = temp;
temp = sx; sx = sy; sy = temp;
temp = x1;
x1 = y1;
y1 = temp;
temp = dx;
dx = dy;
dy = temp;
temp = sx;
sx = sy;
sy = temp;
steep = true;
} else {
steep = false;
@ -473,7 +479,7 @@ STATIC mp_obj_t framebuf_blit(size_t n_args, const mp_obj_t *args) {
(y >= self->height) ||
(-x >= source->width) ||
(-y >= source->height)
) {
) {
// Out of bounds, no-op.
return mp_const_none;
}
@ -547,7 +553,7 @@ STATIC mp_obj_t framebuf_text(size_t n_args, const mp_obj_t *args) {
// loop over chars
for (; *str; ++str) {
// get char and make sure its in range of font
int chr = *(uint8_t*)str;
int chr = *(uint8_t *)str;
if (chr < 32 || chr > 127) {
chr = 127;
}
@ -590,7 +596,7 @@ STATIC const mp_obj_type_t mp_type_framebuf = {
.name = MP_QSTR_FrameBuffer,
.make_new = framebuf_make_new,
.buffer_p = { .get_buffer = framebuf_get_buffer },
.locals_dict = (mp_obj_dict_t*)&framebuf_locals_dict,
.locals_dict = (mp_obj_dict_t *)&framebuf_locals_dict,
};
// this factory function is provided for backwards compatibility with old FrameBuffer1 class
@ -633,7 +639,7 @@ STATIC MP_DEFINE_CONST_DICT(framebuf_module_globals, framebuf_module_globals_tab
const mp_obj_module_t mp_module_framebuf = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&framebuf_module_globals,
.globals = (mp_obj_dict_t *)&framebuf_module_globals,
};
#endif // MICROPY_PY_FRAMEBUF

View File

@ -19,7 +19,7 @@
#include "lwip/init.h"
#include "lwip/tcp.h"
#include "lwip/udp.h"
//#include "lwip/raw.h"
// #include "lwip/raw.h"
#include "lwip/dns.h"
#include "lwip/igmp.h"
#if LWIP_VERSION_MAJOR < 2
@ -71,7 +71,7 @@ void mod_lwip_register_poll(void (*poll)(void *arg), void *poll_arg);
void mod_lwip_deregister_poll(void (*poll)(void *arg), void *poll_arg);
STATIC void slip_lwip_poll(void *netif) {
slipif_poll((struct netif*)netif);
slipif_poll((struct netif *)netif);
}
STATIC const mp_obj_type_t lwip_slip_type;
@ -120,7 +120,7 @@ STATIC mp_obj_t lwip_slip_make_new(mp_obj_t type_in, size_t n_args, size_t n_kw,
struct netif *n = &lwip_slip_obj.lwip_netif;
if (netif_add(n, &iplocal, IP_ADDR_BROADCAST, &ipremote, NULL, slipif_init, ip_input) == NULL) {
mp_raise_ValueError("out of memory");
mp_raise_ValueError("out of memory");
}
netif_set_up(n);
netif_set_default(n);
@ -146,7 +146,7 @@ STATIC const mp_obj_type_t lwip_slip_type = {
{ &mp_type_type },
.name = MP_QSTR_slip,
.make_new = lwip_slip_make_new,
.locals_dict = (mp_obj_dict_t*)&lwip_slip_locals_dict,
.locals_dict = (mp_obj_dict_t *)&lwip_slip_locals_dict,
};
#endif // MICROPY_PY_LWIP_SLIP
@ -158,7 +158,7 @@ STATIC const mp_obj_type_t lwip_slip_type = {
// lwIP 2 changed LWIP_VERSION and it can no longer be used in macros,
// so we define our own equivalent version that can.
#define LWIP_VERSION_MACRO (LWIP_VERSION_MAJOR << 24 | LWIP_VERSION_MINOR << 16 \
| LWIP_VERSION_REVISION << 8 | LWIP_VERSION_RC)
| LWIP_VERSION_REVISION << 8 | LWIP_VERSION_RC)
// Extension to lwIP error codes
#define _ERR_BADF -16
@ -271,11 +271,11 @@ typedef struct _lwip_socket_obj_t {
} lwip_socket_obj_t;
static inline void poll_sockets(void) {
#ifdef MICROPY_EVENT_POLL_HOOK
#ifdef MICROPY_EVENT_POLL_HOOK
MICROPY_EVENT_POLL_HOOK;
#else
#else
mp_hal_delay_ms(1);
#endif
#endif
}
/*******************************************************************************/
@ -295,7 +295,7 @@ STATIC void _lwip_udp_incoming(void *arg, struct udp_pcb *upcb, struct pbuf *p,
STATIC void _lwip_udp_incoming(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr, u16_t port)
#endif
{
lwip_socket_obj_t *socket = (lwip_socket_obj_t*)arg;
lwip_socket_obj_t *socket = (lwip_socket_obj_t *)arg;
if (socket->incoming.pbuf != NULL) {
// That's why they call it "unreliable". No room in the inn, drop the packet.
@ -309,7 +309,7 @@ STATIC void _lwip_udp_incoming(void *arg, struct udp_pcb *upcb, struct pbuf *p,
// Callback for general tcp errors.
STATIC void _lwip_tcp_error(void *arg, err_t err) {
lwip_socket_obj_t *socket = (lwip_socket_obj_t*)arg;
lwip_socket_obj_t *socket = (lwip_socket_obj_t *)arg;
// Pass the error code back via the connection variable.
socket->state = err;
@ -319,7 +319,7 @@ STATIC void _lwip_tcp_error(void *arg, err_t err) {
// Callback for tcp connection requests. Error code err is unused. (See tcp.h)
STATIC err_t _lwip_tcp_connected(void *arg, struct tcp_pcb *tpcb, err_t err) {
lwip_socket_obj_t *socket = (lwip_socket_obj_t*)arg;
lwip_socket_obj_t *socket = (lwip_socket_obj_t *)arg;
socket->state = STATE_CONNECTED;
return ERR_OK;
@ -337,9 +337,8 @@ STATIC err_t _lwip_tcp_recv_unaccepted(void *arg, struct tcp_pcb *pcb, struct pb
// "Poll" (idle) callback to be called ASAP after accept callback
// to execute Python callback function, as it can't be executed
// from accept callback itself.
STATIC err_t _lwip_tcp_accept_finished(void *arg, struct tcp_pcb *pcb)
{
lwip_socket_obj_t *socket = (lwip_socket_obj_t*)arg;
STATIC err_t _lwip_tcp_accept_finished(void *arg, struct tcp_pcb *pcb) {
lwip_socket_obj_t *socket = (lwip_socket_obj_t *)arg;
tcp_poll(pcb, NULL, 0);
exec_user_callback(socket);
return ERR_OK;
@ -347,7 +346,7 @@ STATIC err_t _lwip_tcp_accept_finished(void *arg, struct tcp_pcb *pcb)
// Callback for incoming tcp connections.
STATIC err_t _lwip_tcp_accept(void *arg, struct tcp_pcb *newpcb, err_t err) {
lwip_socket_obj_t *socket = (lwip_socket_obj_t*)arg;
lwip_socket_obj_t *socket = (lwip_socket_obj_t *)arg;
tcp_recv(newpcb, _lwip_tcp_recv_unaccepted);
if (socket->incoming.connection != NULL) {
@ -369,7 +368,7 @@ STATIC err_t _lwip_tcp_accept(void *arg, struct tcp_pcb *newpcb, err_t err) {
// Callback for inbound tcp packets.
STATIC err_t _lwip_tcp_recv(void *arg, struct tcp_pcb *tcpb, struct pbuf *p, err_t err) {
lwip_socket_obj_t *socket = (lwip_socket_obj_t*)arg;
lwip_socket_obj_t *socket = (lwip_socket_obj_t *)arg;
if (p == NULL) {
// Other side has closed connection.
@ -443,7 +442,9 @@ STATIC mp_uint_t lwip_udp_receive(lwip_socket_obj_t *socket, byte *buf, mp_uint_
if (socket->timeout != -1) {
for (mp_uint_t retries = socket->timeout / 100; retries--;) {
mp_hal_delay_ms(100);
if (socket->incoming.pbuf != NULL) break;
if (socket->incoming.pbuf != NULL) {
break;
}
}
if (socket->incoming.pbuf == NULL) {
*_errno = MP_ETIMEDOUT;
@ -467,16 +468,16 @@ STATIC mp_uint_t lwip_udp_receive(lwip_socket_obj_t *socket, byte *buf, mp_uint_
pbuf_free(p);
socket->incoming.pbuf = NULL;
return (mp_uint_t) result;
return (mp_uint_t)result;
}
// For use in stream virtual methods
#define STREAM_ERROR_CHECK(socket) \
if (socket->state < 0) { \
*_errno = error_lookup_table[-socket->state]; \
return MP_STREAM_ERROR; \
} \
assert(socket->pcb.tcp);
if (socket->state < 0) { \
*_errno = error_lookup_table[-socket->state]; \
return MP_STREAM_ERROR; \
} \
assert(socket->pcb.tcp);
// Helper function for send/sendto to handle TCP packets
@ -575,7 +576,7 @@ STATIC mp_uint_t lwip_tcp_receive(lwip_socket_obj_t *socket, byte *buf, mp_uint_
len = remaining;
}
memcpy(buf, (byte*)p->payload + socket->recv_offset, len);
memcpy(buf, (byte *)p->payload + socket->recv_offset, len);
remaining -= len;
if (remaining == 0) {
@ -622,10 +623,15 @@ STATIC mp_obj_t lwip_socket_make_new(const mp_obj_type_t *type, size_t n_args, s
}
switch (socket->type) {
case MOD_NETWORK_SOCK_STREAM: socket->pcb.tcp = tcp_new(); break;
case MOD_NETWORK_SOCK_DGRAM: socket->pcb.udp = udp_new(); break;
//case MOD_NETWORK_SOCK_RAW: socket->pcb.raw = raw_new(); break;
default: mp_raise_OSError(MP_EINVAL);
case MOD_NETWORK_SOCK_STREAM:
socket->pcb.tcp = tcp_new();
break;
case MOD_NETWORK_SOCK_DGRAM:
socket->pcb.udp = udp_new();
break;
// case MOD_NETWORK_SOCK_RAW: socket->pcb.raw = raw_new(); break;
default:
mp_raise_OSError(MP_EINVAL);
}
if (socket->pcb.tcp == NULL) {
@ -635,7 +641,7 @@ STATIC mp_obj_t lwip_socket_make_new(const mp_obj_type_t *type, size_t n_args, s
switch (socket->type) {
case MOD_NETWORK_SOCK_STREAM: {
// Register the socket object as our callback argument.
tcp_arg(socket->pcb.tcp, (void*)socket);
tcp_arg(socket->pcb.tcp, (void *)socket);
// Register our error callback.
tcp_err(socket->pcb.tcp, _lwip_tcp_error);
break;
@ -643,7 +649,7 @@ STATIC mp_obj_t lwip_socket_make_new(const mp_obj_type_t *type, size_t n_args, s
case MOD_NETWORK_SOCK_DGRAM: {
// Register our receive callback now. Since UDP sockets don't require binding or connection
// before use, there's no other good time to do it.
udp_recv(socket->pcb.udp, _lwip_udp_incoming, (void*)socket);
udp_recv(socket->pcb.udp, _lwip_udp_incoming, (void *)socket);
break;
}
}
@ -731,7 +737,9 @@ STATIC mp_obj_t lwip_socket_accept(mp_obj_t self_in) {
} else if (socket->timeout != -1) {
for (mp_uint_t retries = socket->timeout / 100; retries--;) {
mp_hal_delay_ms(100);
if (socket->incoming.connection != NULL) break;
if (socket->incoming.connection != NULL) {
break;
}
}
if (socket->incoming.connection == NULL) {
mp_raise_OSError(MP_ETIMEDOUT);
@ -759,7 +767,7 @@ STATIC mp_obj_t lwip_socket_accept(mp_obj_t self_in) {
socket2->state = STATE_CONNECTED;
socket2->recv_offset = 0;
socket2->callback = MP_OBJ_NULL;
tcp_arg(socket2->pcb.tcp, (void*)socket2);
tcp_arg(socket2->pcb.tcp, (void *)socket2);
tcp_err(socket2->pcb.tcp, _lwip_tcp_error);
tcp_recv(socket2->pcb.tcp, _lwip_tcp_recv);
@ -815,7 +823,9 @@ STATIC mp_obj_t lwip_socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
if (socket->timeout != -1) {
for (mp_uint_t retries = socket->timeout / 100; retries--;) {
mp_hal_delay_ms(100);
if (socket->state != STATE_CONNECTING) break;
if (socket->state != STATE_CONNECTING) {
break;
}
}
if (socket->state == STATE_CONNECTING) {
mp_raise_OSError(MP_EINPROGRESS);
@ -826,9 +836,9 @@ STATIC mp_obj_t lwip_socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
}
}
if (socket->state == STATE_CONNECTED) {
err = ERR_OK;
err = ERR_OK;
} else {
err = socket->state;
err = socket->state;
}
break;
}
@ -896,11 +906,11 @@ STATIC mp_obj_t lwip_socket_recv(mp_obj_t self_in, mp_obj_t len_in) {
mp_uint_t ret = 0;
switch (socket->type) {
case MOD_NETWORK_SOCK_STREAM: {
ret = lwip_tcp_receive(socket, (byte*)vstr.buf, len, &_errno);
ret = lwip_tcp_receive(socket, (byte *)vstr.buf, len, &_errno);
break;
}
case MOD_NETWORK_SOCK_DGRAM: {
ret = lwip_udp_receive(socket, (byte*)vstr.buf, len, NULL, NULL, &_errno);
ret = lwip_udp_receive(socket, (byte *)vstr.buf, len, NULL, NULL, &_errno);
break;
}
}
@ -963,12 +973,12 @@ STATIC mp_obj_t lwip_socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
switch (socket->type) {
case MOD_NETWORK_SOCK_STREAM: {
memcpy(ip, &socket->peer, sizeof(socket->peer));
port = (mp_uint_t) socket->peer_port;
ret = lwip_tcp_receive(socket, (byte*)vstr.buf, len, &_errno);
port = (mp_uint_t)socket->peer_port;
ret = lwip_tcp_receive(socket, (byte *)vstr.buf, len, &_errno);
break;
}
case MOD_NETWORK_SOCK_DGRAM: {
ret = lwip_udp_receive(socket, (byte*)vstr.buf, len, ip, &port, &_errno);
ret = lwip_udp_receive(socket, (byte *)vstr.buf, len, ip, &port, &_errno);
break;
}
}
@ -1017,7 +1027,7 @@ STATIC mp_obj_t lwip_socket_sendall(mp_obj_t self_in, mp_obj_t buf_in) {
mp_raise_OSError(_errno);
}
bufinfo.len -= ret;
bufinfo.buf = (char*)bufinfo.buf + ret;
bufinfo.buf = (char *)bufinfo.buf + ret;
}
break;
}
@ -1095,7 +1105,7 @@ STATIC mp_obj_t lwip_socket_setsockopt(size_t n_args, const mp_obj_t *args) {
}
// POSIX setsockopt has order: group addr, if addr, lwIP has it vice-versa
err_t err = igmp_joingroup((ip_addr_t*)bufinfo.buf + 1, bufinfo.buf);
err_t err = igmp_joingroup((ip_addr_t *)bufinfo.buf + 1, bufinfo.buf);
if (err != ERR_OK) {
mp_raise_OSError(error_lookup_table[-err]);
}
@ -1192,8 +1202,10 @@ STATIC mp_uint_t lwip_socket_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_
}
break;
}
case MOD_NETWORK_SOCK_DGRAM: udp_remove(socket->pcb.udp); break;
//case MOD_NETWORK_SOCK_RAW: raw_remove(socket->pcb.raw); break;
case MOD_NETWORK_SOCK_DGRAM:
udp_remove(socket->pcb.udp);
break;
// case MOD_NETWORK_SOCK_RAW: raw_remove(socket->pcb.raw); break;
}
socket->pcb.tcp = NULL;
socket->state = _ERR_BADF;
@ -1252,7 +1264,7 @@ STATIC const mp_obj_type_t lwip_socket_type = {
.print = lwip_socket_print,
.make_new = lwip_socket_make_new,
.protocol = &lwip_socket_stream_p,
.locals_dict = (mp_obj_dict_t*)&lwip_socket_locals_dict,
.locals_dict = (mp_obj_dict_t *)&lwip_socket_locals_dict,
};
/******************************************************************************/
@ -1272,18 +1284,18 @@ void sys_arch_unprotect(sys_prot_t state) {
// itself a "list" but isn't; we only support a single interface.
typedef struct nic_poll {
void (* poll)(void *arg);
void (*poll)(void *arg);
void *poll_arg;
} nic_poll_t;
STATIC nic_poll_t lwip_poll_list;
void mod_lwip_register_poll(void (* poll)(void *arg), void *poll_arg) {
void mod_lwip_register_poll(void (*poll)(void *arg), void *poll_arg) {
lwip_poll_list.poll = poll;
lwip_poll_list.poll_arg = poll_arg;
}
void mod_lwip_deregister_poll(void (* poll)(void *arg), void *poll_arg) {
void mod_lwip_deregister_poll(void (*poll)(void *arg), void *poll_arg) {
lwip_poll_list.poll = NULL;
}
@ -1350,9 +1362,9 @@ STATIC mp_obj_t lwip_getaddrinfo(size_t n_args, const mp_obj_t *args) {
}
}
if (!((family == 0 || family == MOD_NETWORK_AF_INET)
&& (type == 0 || type == MOD_NETWORK_SOCK_STREAM)
&& proto == 0
&& flags == 0)) {
&& (type == 0 || type == MOD_NETWORK_SOCK_STREAM)
&& proto == 0
&& flags == 0)) {
mp_warning("unsupported getaddrinfo constraints");
}
}
@ -1360,7 +1372,7 @@ STATIC mp_obj_t lwip_getaddrinfo(size_t n_args, const mp_obj_t *args) {
getaddrinfo_state_t state;
state.status = 0;
err_t ret = dns_gethostbyname(host, (ip_addr_t*)&state.ipaddr, lwip_getaddrinfo_cb, &state);
err_t ret = dns_gethostbyname(host, (ip_addr_t *)&state.ipaddr, lwip_getaddrinfo_cb, &state);
switch (ret) {
case ERR_OK:
// cached
@ -1386,8 +1398,8 @@ STATIC mp_obj_t lwip_getaddrinfo(size_t n_args, const mp_obj_t *args) {
tuple->items[1] = MP_OBJ_NEW_SMALL_INT(MOD_NETWORK_SOCK_STREAM);
tuple->items[2] = MP_OBJ_NEW_SMALL_INT(0);
tuple->items[3] = MP_OBJ_NEW_QSTR(MP_QSTR_);
tuple->items[4] = netutils_format_inet_addr((uint8_t*)&state.ipaddr, port, NETUTILS_BIG);
return mp_obj_new_list(1, (mp_obj_t*)&tuple);
tuple->items[4] = netutils_format_inet_addr((uint8_t *)&state.ipaddr, port, NETUTILS_BIG);
return mp_obj_new_list(1, (mp_obj_t *)&tuple);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(lwip_getaddrinfo_obj, 2, 6, lwip_getaddrinfo);
@ -1409,9 +1421,9 @@ STATIC const mp_rom_map_elem_t mp_module_lwip_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_print_pcbs), MP_ROM_PTR(&lwip_print_pcbs_obj) },
// objects
{ MP_ROM_QSTR(MP_QSTR_socket), MP_ROM_PTR(&lwip_socket_type) },
#if MICROPY_PY_LWIP_SLIP
#if MICROPY_PY_LWIP_SLIP
{ MP_ROM_QSTR(MP_QSTR_slip), MP_ROM_PTR(&lwip_slip_type) },
#endif
#endif
// class constants
{ MP_ROM_QSTR(MP_QSTR_AF_INET), MP_ROM_INT(MOD_NETWORK_AF_INET) },
{ MP_ROM_QSTR(MP_QSTR_AF_INET6), MP_ROM_INT(MOD_NETWORK_AF_INET6) },
@ -1431,7 +1443,7 @@ STATIC MP_DEFINE_CONST_DICT(mp_module_lwip_globals, mp_module_lwip_globals_table
const mp_obj_module_t mp_module_lwip = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&mp_module_lwip_globals,
.globals = (mp_obj_dict_t *)&mp_module_lwip_globals,
};
#endif // MICROPY_PY_LWIP

View File

@ -105,7 +105,7 @@ STATIC mp_obj_t onewire_crc8(mp_obj_t data) {
mp_get_buffer_raise(data, &bufinfo, MP_BUFFER_READ);
uint8_t crc = 0;
for (size_t i = 0; i < bufinfo.len; ++i) {
uint8_t byte = ((uint8_t*)bufinfo.buf)[i];
uint8_t byte = ((uint8_t *)bufinfo.buf)[i];
for (int b = 0; b < 8; ++b) {
uint8_t fb_bit = (crc ^ byte) & 0x01;
if (fb_bit == 0x01) {
@ -137,5 +137,5 @@ STATIC MP_DEFINE_CONST_DICT(onewire_module_globals, onewire_module_globals_table
const mp_obj_module_t mp_module_onewire = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&onewire_module_globals,
.globals = (mp_obj_dict_t *)&onewire_module_globals,
};

View File

@ -12,11 +12,11 @@
#include "extmod/modubinascii.h"
static void check_not_unicode(const mp_obj_t arg) {
#if MICROPY_CPYTHON_COMPAT
#if MICROPY_CPYTHON_COMPAT
if (MP_OBJ_IS_STR(arg)) {
mp_raise_TypeError(translate("a bytes-like object is required"));
}
#endif
#endif
}
mp_obj_t mod_binascii_hexlify(size_t n_args, const mp_obj_t *args) {
@ -41,7 +41,7 @@ mp_obj_t mod_binascii_hexlify(size_t n_args, const mp_obj_t *args) {
sep = mp_obj_str_get_str(args[1]);
}
vstr_init_len(&vstr, out_len);
byte *in = bufinfo.buf, *out = (byte*)vstr.buf;
byte *in = bufinfo.buf, *out = (byte *)vstr.buf;
for (mp_uint_t i = bufinfo.len; i--;) {
byte d = (*in >> 4);
if (d > 9) {
@ -70,7 +70,7 @@ mp_obj_t mod_binascii_unhexlify(mp_obj_t data) {
}
vstr_t vstr;
vstr_init_len(&vstr, bufinfo.len / 2);
byte *in = bufinfo.buf, *out = (byte*)vstr.buf;
byte *in = bufinfo.buf, *out = (byte *)vstr.buf;
byte hex_byte = 0;
for (mp_uint_t i = bufinfo.len; i--;) {
byte hex_ch = *in++;
@ -161,7 +161,7 @@ mp_obj_t mod_binascii_b2a_base64(mp_obj_t data) {
vstr_init_len(&vstr, ((bufinfo.len != 0) ? (((bufinfo.len - 1) / 3) + 1) * 4 : 0) + 1);
// First pass, we convert input buffer to numeric base 64 values
byte *in = bufinfo.buf, *out = (byte*)vstr.buf;
byte *in = bufinfo.buf, *out = (byte *)vstr.buf;
mp_uint_t i;
for (i = bufinfo.len; i >= 3; i -= 3) {
*out++ = (in[0] & 0xFC) >> 2;
@ -175,8 +175,7 @@ mp_obj_t mod_binascii_b2a_base64(mp_obj_t data) {
if (i == 2) {
*out++ = (in[0] & 0x03) << 4 | (in[1] & 0xF0) >> 4;
*out++ = (in[1] & 0x0F) << 2;
}
else {
} else {
*out++ = (in[0] & 0x03) << 4;
*out++ = 64;
}
@ -184,7 +183,7 @@ mp_obj_t mod_binascii_b2a_base64(mp_obj_t data) {
}
// Second pass, we convert number base 64 values to actual base64 ascii encoding
out = (byte*)vstr.buf;
out = (byte *)vstr.buf;
for (mp_uint_t j = vstr.len - 1; j--;) {
if (*out < 26) {
*out += 'A';
@ -193,7 +192,7 @@ mp_obj_t mod_binascii_b2a_base64(mp_obj_t data) {
} else if (*out < 62) {
*out += '0' - 52;
} else if (*out == 62) {
*out ='+';
*out = '+';
} else if (*out == 63) {
*out = '/';
} else {
@ -237,7 +236,7 @@ STATIC MP_DEFINE_CONST_DICT(mp_module_binascii_globals, mp_module_binascii_globa
const mp_obj_module_t mp_module_ubinascii = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&mp_module_binascii_globals,
.globals = (mp_obj_dict_t *)&mp_module_binascii_globals,
};
#endif //MICROPY_PY_UBINASCII
#endif // MICROPY_PY_UBINASCII

View File

@ -105,7 +105,7 @@ STATIC mp_obj_t uctypes_struct_make_new(const mp_obj_type_t *type, size_t n_args
mp_arg_check_num(n_args, kw_args, 2, 3, false);
mp_obj_uctypes_struct_t *o = m_new_obj(mp_obj_uctypes_struct_t);
o->base.type = type;
o->addr = (void*)(uintptr_t)mp_obj_int_get_truncated(args[0]);
o->addr = (void *)(uintptr_t)mp_obj_int_get_truncated(args[0]);
o->desc = args[1];
o->flags = LAYOUT_NATIVE;
if (n_args == 3) {
@ -125,8 +125,12 @@ STATIC void uctypes_struct_print(const mp_print_t *print, mp_obj_t self_in, mp_p
mp_int_t offset = MP_OBJ_SMALL_INT_VALUE(t->items[0]);
uint agg_type = GET_TYPE(offset, AGG_TYPE_BITS);
switch (agg_type) {
case PTR: typen = "PTR"; break;
case ARRAY: typen = "ARRAY"; break;
case PTR:
typen = "PTR";
break;
case ARRAY:
typen = "ARRAY";
break;
}
} else {
typen = "ERROR";
@ -157,10 +161,10 @@ STATIC mp_uint_t uctypes_struct_agg_size(mp_obj_tuple_t *t, int layout_type, mp_
case STRUCT:
return uctypes_struct_size(t->items[1], layout_type, max_field_size);
case PTR:
if (sizeof(void*) > *max_field_size) {
*max_field_size = sizeof(void*);
if (sizeof(void *) > *max_field_size) {
*max_field_size = sizeof(void *);
}
return sizeof(void*);
return sizeof(void *);
case ARRAY: {
mp_int_t arr_sz = MP_OBJ_SMALL_INT_VALUE(t->items[1]);
uint val_type = GET_TYPE(arr_sz, VAL_TYPE_BITS);
@ -189,7 +193,7 @@ STATIC mp_uint_t uctypes_struct_agg_size(mp_obj_tuple_t *t, int layout_type, mp_
STATIC mp_uint_t uctypes_struct_size(mp_obj_t desc_in, int layout_type, mp_uint_t *max_field_size) {
if (!MP_OBJ_IS_TYPE(desc_in, &mp_type_dict)) {
if (MP_OBJ_IS_TYPE(desc_in, &mp_type_tuple)) {
return uctypes_struct_agg_size((mp_obj_tuple_t*)MP_OBJ_TO_PTR(desc_in), layout_type, max_field_size);
return uctypes_struct_agg_size((mp_obj_tuple_t *)MP_OBJ_TO_PTR(desc_in), layout_type, max_field_size);
} else if (MP_OBJ_IS_SMALL_INT(desc_in)) {
// We allow sizeof on both type definitions and structures/structure fields,
// but scalar structure field is lowered into native Python int, so all
@ -276,11 +280,11 @@ static inline void set_unaligned(uint val_type, byte *p, int big_endian, mp_obj_
static inline mp_uint_t get_aligned_basic(uint val_type, void *p) {
switch (val_type) {
case UINT8:
return *(uint8_t*)p;
return *(uint8_t *)p;
case UINT16:
return *(uint16_t*)p;
return *(uint16_t *)p;
case UINT32:
return *(uint32_t*)p;
return *(uint32_t *)p;
}
assert(0);
return 0;
@ -289,11 +293,14 @@ static inline mp_uint_t get_aligned_basic(uint val_type, void *p) {
static inline void set_aligned_basic(uint val_type, void *p, mp_uint_t v) {
switch (val_type) {
case UINT8:
*(uint8_t*)p = (uint8_t)v; return;
*(uint8_t *)p = (uint8_t)v;
return;
case UINT16:
*(uint16_t*)p = (uint16_t)v; return;
*(uint16_t *)p = (uint16_t)v;
return;
case UINT32:
*(uint32_t*)p = (uint32_t)v; return;
*(uint32_t *)p = (uint32_t)v;
return;
}
assert(0);
}
@ -301,26 +308,26 @@ static inline void set_aligned_basic(uint val_type, void *p, mp_uint_t v) {
STATIC mp_obj_t get_aligned(uint val_type, void *p, mp_int_t index) {
switch (val_type) {
case UINT8:
return MP_OBJ_NEW_SMALL_INT(((uint8_t*)p)[index]);
return MP_OBJ_NEW_SMALL_INT(((uint8_t *)p)[index]);
case INT8:
return MP_OBJ_NEW_SMALL_INT(((int8_t*)p)[index]);
return MP_OBJ_NEW_SMALL_INT(((int8_t *)p)[index]);
case UINT16:
return MP_OBJ_NEW_SMALL_INT(((uint16_t*)p)[index]);
return MP_OBJ_NEW_SMALL_INT(((uint16_t *)p)[index]);
case INT16:
return MP_OBJ_NEW_SMALL_INT(((int16_t*)p)[index]);
return MP_OBJ_NEW_SMALL_INT(((int16_t *)p)[index]);
case UINT32:
return mp_obj_new_int_from_uint(((uint32_t*)p)[index]);
return mp_obj_new_int_from_uint(((uint32_t *)p)[index]);
case INT32:
return mp_obj_new_int(((int32_t*)p)[index]);
return mp_obj_new_int(((int32_t *)p)[index]);
case UINT64:
return mp_obj_new_int_from_ull(((uint64_t*)p)[index]);
return mp_obj_new_int_from_ull(((uint64_t *)p)[index]);
case INT64:
return mp_obj_new_int_from_ll(((int64_t*)p)[index]);
return mp_obj_new_int_from_ll(((int64_t *)p)[index]);
#if MICROPY_PY_BUILTINS_FLOAT
case FLOAT32:
return mp_obj_new_float((mp_float_t)((float*)p)[index]);
return mp_obj_new_float((mp_float_t)((float *)p)[index]);
case FLOAT64:
return mp_obj_new_float(((double*)p)[index]);
return mp_obj_new_float(((double *)p)[index]);
#endif
default:
assert(0);
@ -333,9 +340,9 @@ STATIC void set_aligned(uint val_type, void *p, mp_int_t index, mp_obj_t val) {
if (val_type == FLOAT32 || val_type == FLOAT64) {
mp_float_t v = mp_obj_get_float(val);
if (val_type == FLOAT32) {
((float*)p)[index] = v;
((float *)p)[index] = v;
} else {
((double*)p)[index] = v;
((double *)p)[index] = v;
}
return;
}
@ -343,21 +350,27 @@ STATIC void set_aligned(uint val_type, void *p, mp_int_t index, mp_obj_t val) {
mp_int_t v = mp_obj_get_int_truncated(val);
switch (val_type) {
case UINT8:
((uint8_t*)p)[index] = (uint8_t)v; return;
((uint8_t *)p)[index] = (uint8_t)v;
return;
case INT8:
((int8_t*)p)[index] = (int8_t)v; return;
((int8_t *)p)[index] = (int8_t)v;
return;
case UINT16:
((uint16_t*)p)[index] = (uint16_t)v; return;
((uint16_t *)p)[index] = (uint16_t)v;
return;
case INT16:
((int16_t*)p)[index] = (int16_t)v; return;
((int16_t *)p)[index] = (int16_t)v;
return;
case UINT32:
((uint32_t*)p)[index] = (uint32_t)v; return;
((uint32_t *)p)[index] = (uint32_t)v;
return;
case INT32:
((int32_t*)p)[index] = (int32_t)v; return;
((int32_t *)p)[index] = (int32_t)v;
return;
case INT64:
case UINT64:
if (sizeof(mp_int_t) == 8) {
((uint64_t*)p)[index] = (uint64_t)v;
((uint64_t *)p)[index] = (uint64_t)v;
} else {
// TODO: Doesn't offer atomic store semantics, but should at least try
set_unaligned(val_type, p, MP_ENDIANNESS_BIG, val);
@ -373,7 +386,7 @@ STATIC mp_obj_t uctypes_struct_attr_op(mp_obj_t self_in, qstr attr, mp_obj_t set
// TODO: Support at least OrderedDict in addition
if (!MP_OBJ_IS_TYPE(self->desc, &mp_type_dict)) {
mp_raise_TypeError(translate("struct: no fields"));
mp_raise_TypeError(translate("struct: no fields"));
}
mp_obj_t deref = mp_obj_dict_get(self->desc, MP_OBJ_NEW_QSTR(attr));
@ -381,7 +394,7 @@ 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);
// 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));
@ -451,7 +464,7 @@ 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);
// printf("agg type=%d offset=%x\n", agg_type, offset);
switch (agg_type) {
case STRUCT: {
@ -475,7 +488,7 @@ 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);
// printf("PTR/ARR base addr=%p\n", o->addr);
return MP_OBJ_FROM_PTR(o);
}
}
@ -555,7 +568,7 @@ STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t base_in, mp_obj_t index_in, mp_ob
}
} else if (agg_type == PTR) {
byte *p = *(void**)self->addr;
byte *p = *(void **)self->addr;
if (MP_OBJ_IS_SMALL_INT(t->items[1])) {
uint val_type = GET_TYPE(MP_OBJ_SMALL_INT_VALUE(t->items[1]), VAL_TYPE_BITS);
return get_aligned(val_type, p, index);
@ -603,7 +616,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(uctypes_struct_addressof_obj, uctypes_struct_addressof
/// captured by reference (and thus memory pointed by bytearray may change
/// or become invalid at later time). Use bytes_at() to capture by value.
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));
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);
@ -612,7 +625,7 @@ MP_DEFINE_CONST_FUN_OBJ_2(uctypes_struct_bytearray_at_obj, uctypes_struct_bytear
/// captured by value, i.e. copied. Use bytearray_at() to capture by reference
/// ("zero copy").
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));
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);
@ -690,7 +703,7 @@ STATIC MP_DEFINE_CONST_DICT(mp_module_uctypes_globals, mp_module_uctypes_globals
const mp_obj_module_t mp_module_uctypes = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&mp_module_uctypes_globals,
.globals = (mp_obj_dict_t *)&mp_module_uctypes_globals,
};
#endif

View File

@ -49,8 +49,8 @@ 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(mbedtls_sha256_context));
o->base.type = type;
mbedtls_sha256_init((mbedtls_sha256_context*)&o->state);
mbedtls_sha256_starts((mbedtls_sha256_context*)&o->state, 0);
mbedtls_sha256_init((mbedtls_sha256_context *)&o->state);
mbedtls_sha256_starts((mbedtls_sha256_context *)&o->state, 0);
if (n_args == 1) {
uhashlib_sha256_update(MP_OBJ_FROM_PTR(o), args[0]);
}
@ -61,7 +61,7 @@ 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);
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(arg, &bufinfo, MP_BUFFER_READ);
mbedtls_sha256_update((mbedtls_sha256_context*)&self->state, bufinfo.buf, bufinfo.len);
mbedtls_sha256_update((mbedtls_sha256_context *)&self->state, bufinfo.buf, bufinfo.len);
return mp_const_none;
}
@ -69,25 +69,25 @@ STATIC mp_obj_t uhashlib_sha256_digest(mp_obj_t self_in) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
vstr_t vstr;
vstr_init_len(&vstr, 32);
mbedtls_sha256_finish((mbedtls_sha256_context*)&self->state, (unsigned char *)vstr.buf);
mbedtls_sha256_finish((mbedtls_sha256_context *)&self->state, (unsigned char *)vstr.buf);
return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr);
}
#else
static void check_not_unicode(const mp_obj_t arg) {
#if MICROPY_CPYTHON_COMPAT
#if MICROPY_CPYTHON_COMPAT
if (MP_OBJ_IS_STR(arg)) {
mp_raise_TypeError(translate("a bytes-like object is required"));
}
#endif
#endif
}
STATIC mp_obj_t uhashlib_sha256_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_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(CRYAL_SHA256_CTX));
o->base.type = type;
sha256_init((CRYAL_SHA256_CTX*)o->state);
sha256_init((CRYAL_SHA256_CTX *)o->state);
if (n_args == 1) {
uhashlib_sha256_update(MP_OBJ_FROM_PTR(o), args[0]);
}
@ -99,7 +99,7 @@ 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);
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);
sha256_update((CRYAL_SHA256_CTX *)self->state, bufinfo.buf, bufinfo.len);
return mp_const_none;
}
@ -107,7 +107,7 @@ STATIC mp_obj_t uhashlib_sha256_digest(mp_obj_t self_in) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
vstr_t vstr;
vstr_init_len(&vstr, SHA256_BLOCK_SIZE);
sha256_final((CRYAL_SHA256_CTX*)self->state, (byte*)vstr.buf);
sha256_final((CRYAL_SHA256_CTX *)self->state, (byte *)vstr.buf);
return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr);
}
#endif
@ -126,7 +126,7 @@ STATIC const mp_obj_type_t uhashlib_sha256_type = {
{ &mp_type_type },
.name = MP_QSTR_sha256,
.make_new = uhashlib_sha256_make_new,
.locals_dict = (void*)&uhashlib_sha256_locals_dict,
.locals_dict = (void *)&uhashlib_sha256_locals_dict,
};
#endif
@ -138,7 +138,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;
SHA1_Init((SHA1_CTX*)o->state);
SHA1_Init((SHA1_CTX *)o->state);
if (n_args == 1) {
uhashlib_sha1_update(MP_OBJ_FROM_PTR(o), args[0]);
}
@ -150,7 +150,7 @@ 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);
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(arg, &bufinfo, MP_BUFFER_READ);
SHA1_Update((SHA1_CTX*)self->state, bufinfo.buf, bufinfo.len);
SHA1_Update((SHA1_CTX *)self->state, bufinfo.buf, bufinfo.len);
return mp_const_none;
}
@ -158,7 +158,7 @@ STATIC mp_obj_t uhashlib_sha1_digest(mp_obj_t self_in) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
vstr_t vstr;
vstr_init_len(&vstr, SHA1_SIZE);
SHA1_Final((byte*)vstr.buf, (SHA1_CTX*)self->state);
SHA1_Final((byte *)vstr.buf, (SHA1_CTX *)self->state);
return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr);
}
#endif
@ -168,8 +168,8 @@ 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;
mbedtls_sha1_init((mbedtls_sha1_context*)o->state);
mbedtls_sha1_starts((mbedtls_sha1_context*)o->state);
mbedtls_sha1_init((mbedtls_sha1_context *)o->state);
mbedtls_sha1_starts((mbedtls_sha1_context *)o->state);
if (n_args == 1) {
uhashlib_sha1_update(MP_OBJ_FROM_PTR(o), args[0]);
}
@ -180,7 +180,7 @@ 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);
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(arg, &bufinfo, MP_BUFFER_READ);
mbedtls_sha1_update((mbedtls_sha1_context*)self->state, bufinfo.buf, bufinfo.len);
mbedtls_sha1_update((mbedtls_sha1_context *)self->state, bufinfo.buf, bufinfo.len);
return mp_const_none;
}
@ -188,8 +188,8 @@ STATIC mp_obj_t uhashlib_sha1_digest(mp_obj_t self_in) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
vstr_t vstr;
vstr_init_len(&vstr, 20);
mbedtls_sha1_finish((mbedtls_sha1_context*)self->state, (byte*)vstr.buf);
mbedtls_sha1_free((mbedtls_sha1_context*)self->state);
mbedtls_sha1_finish((mbedtls_sha1_context *)self->state, (byte *)vstr.buf);
mbedtls_sha1_free((mbedtls_sha1_context *)self->state);
return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr);
}
#endif
@ -207,7 +207,7 @@ STATIC const mp_obj_type_t uhashlib_sha1_type = {
{ &mp_type_type },
.name = MP_QSTR_sha1,
.make_new = uhashlib_sha1_make_new,
.locals_dict = (void*)&uhashlib_sha1_locals_dict,
.locals_dict = (void *)&uhashlib_sha1_locals_dict,
};
#endif
@ -225,11 +225,11 @@ STATIC MP_DEFINE_CONST_DICT(mp_module_uhashlib_globals, mp_module_uhashlib_globa
const mp_obj_module_t mp_module_uhashlib = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&mp_module_uhashlib_globals,
.globals = (mp_obj_dict_t *)&mp_module_uhashlib_globals,
};
#if MICROPY_PY_UHASHLIB_SHA256
#include "crypto-algorithms/sha256.c"
#endif
#endif //MICROPY_PY_UHASHLIB
#endif // MICROPY_PY_UHASHLIB

View File

@ -95,7 +95,7 @@ STATIC MP_DEFINE_CONST_DICT(mp_module_uheapq_globals, mp_module_uheapq_globals_t
const mp_obj_module_t mp_module_uheapq = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&mp_module_uheapq_globals,
.globals = (mp_obj_dict_t *)&mp_module_uheapq_globals,
};
#endif //MICROPY_PY_UHEAPQ
#endif // MICROPY_PY_UHEAPQ

View File

@ -85,8 +85,8 @@ STATIC byte ujson_stream_next(ujson_stream_t *s) {
#define CIRCUITPY_JSON_READ_CHUNK_SIZE 64
STATIC mp_uint_t ujson_python_readinto(mp_obj_t obj, void *buf, mp_uint_t size, int *errcode) {
(void) size; // Ignore size because we know it's always 1.
ujson_stream_t* s = obj;
(void)size; // Ignore size because we know it's always 1.
ujson_stream_t *s = obj;
if (s->start == s->end) {
*errcode = 0;
@ -99,7 +99,7 @@ STATIC mp_uint_t ujson_python_readinto(mp_obj_t obj, void *buf, mp_uint_t size,
s->end = mp_obj_get_int(ret);
}
*((uint8_t *)buf) = ((uint8_t*) s->bytearray_obj.items)[s->start];
*((uint8_t *)buf) = ((uint8_t *)s->bytearray_obj.items)[s->start];
s->start++;
return 1;
}
@ -139,7 +139,7 @@ STATIC mp_obj_t _mod_ujson_load(mp_obj_t stream_obj, bool return_first_json) {
mp_obj_t stack_key = MP_OBJ_NULL;
S_NEXT(s);
for (;;) {
cont:
cont:
if (S_END(s)) {
break;
}
@ -186,11 +186,21 @@ STATIC mp_obj_t _mod_ujson_load(mp_obj_t stream_obj, bool return_first_json) {
if (c == '\\') {
c = S_NEXT(s);
switch (c) {
case 'b': c = 0x08; break;
case 'f': c = 0x0c; break;
case 'n': c = 0x0a; break;
case 'r': c = 0x0d; break;
case 't': c = 0x09; break;
case 'b':
c = 0x08;
break;
case 'f':
c = 0x0c;
break;
case 'n':
c = 0x0a;
break;
case 'r':
c = 0x0d;
break;
case 't':
c = 0x09;
break;
case 'u': {
mp_uint_t num = 0;
for (int i = 0; i < 4; i++) {
@ -216,7 +226,16 @@ STATIC mp_obj_t _mod_ujson_load(mp_obj_t stream_obj, bool return_first_json) {
next = mp_obj_new_str(vstr.buf, vstr.len);
break;
case '-':
case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9': {
bool flt = false;
vstr_reset(&vstr);
for (;;) {
@ -298,7 +317,7 @@ STATIC mp_obj_t _mod_ujson_load(mp_obj_t stream_obj, bool return_first_json) {
}
}
}
success:
success:
// It is legal for a stream to have contents after JSON.
// E.g., A UART is not closed after receiving an object; in load() we will
// return the first complete JSON object, while in loads() we will retain
@ -319,7 +338,7 @@ STATIC mp_obj_t _mod_ujson_load(mp_obj_t stream_obj, bool return_first_json) {
vstr_clear(&vstr);
return stack_top;
fail:
fail:
mp_raise_ValueError(translate("syntax error in JSON"));
}
@ -331,18 +350,18 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_ujson_load_obj, mod_ujson_load);
STATIC mp_obj_t mod_ujson_loads(mp_obj_t obj) {
size_t len;
const char *buf = mp_obj_str_get_data(obj, &len);
vstr_t vstr = {len, len, (char*)buf, true};
vstr_t vstr = {len, len, (char *)buf, true};
mp_obj_stringio_t sio = {{&mp_type_stringio}, &vstr, 0, MP_OBJ_NULL};
return _mod_ujson_load(MP_OBJ_FROM_PTR(&sio), false);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_ujson_loads_obj, mod_ujson_loads);
STATIC const mp_rom_map_elem_t mp_module_ujson_globals_table[] = {
#if CIRCUITPY
#if CIRCUITPY
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_json) },
#else
#else
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ujson) },
#endif
#endif
{ MP_ROM_QSTR(MP_QSTR_dump), MP_ROM_PTR(&mod_ujson_dump_obj) },
{ MP_ROM_QSTR(MP_QSTR_dumps), MP_ROM_PTR(&mod_ujson_dumps_obj) },
{ MP_ROM_QSTR(MP_QSTR_load), MP_ROM_PTR(&mod_ujson_load_obj) },
@ -353,7 +372,7 @@ STATIC MP_DEFINE_CONST_DICT(mp_module_ujson_globals, mp_module_ujson_globals_tab
const mp_obj_module_t mp_module_ujson = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&mp_module_ujson_globals,
.globals = (mp_obj_dict_t *)&mp_module_ujson_globals,
};
#endif //MICROPY_PY_UJSON
#endif // MICROPY_PY_UJSON

View File

@ -18,15 +18,14 @@
STATIC uint32_t yasmarang_pad = 0xeda4baba, yasmarang_n = 69, yasmarang_d = 233;
STATIC uint8_t yasmarang_dat = 0;
STATIC uint32_t yasmarang(void)
{
yasmarang_pad += yasmarang_dat + yasmarang_d * yasmarang_n;
yasmarang_pad = (yasmarang_pad<<3) + (yasmarang_pad>>29);
yasmarang_n = yasmarang_pad | 2;
yasmarang_d ^= (yasmarang_pad<<31) + (yasmarang_pad>>1);
yasmarang_dat ^= (char) yasmarang_pad ^ (yasmarang_d>>8) ^ 1;
STATIC uint32_t yasmarang(void) {
yasmarang_pad += yasmarang_dat + yasmarang_d * yasmarang_n;
yasmarang_pad = (yasmarang_pad << 3) + (yasmarang_pad >> 29);
yasmarang_n = yasmarang_pad | 2;
yasmarang_d ^= (yasmarang_pad << 31) + (yasmarang_pad >> 1);
yasmarang_dat ^= (char)yasmarang_pad ^ (yasmarang_d >> 8) ^ 1;
return (yasmarang_pad^(yasmarang_d<<5)^(yasmarang_pad>>18)^(yasmarang_dat<<1));
return yasmarang_pad ^ (yasmarang_d << 5) ^ (yasmarang_pad >> 18) ^ (yasmarang_dat << 1);
} /* yasmarang */
// End of Yasmarang
@ -148,9 +147,11 @@ STATIC mp_float_t yasmarang_float(void) {
union {
mp_float_t f;
#if MP_ENDIANNESS_LITTLE
struct { mp_float_int_t frc:MP_FLOAT_FRAC_BITS, exp:MP_FLOAT_EXP_BITS, sgn:1; } p;
struct { mp_float_int_t frc : MP_FLOAT_FRAC_BITS, exp : MP_FLOAT_EXP_BITS, sgn : 1;
} p;
#else
struct { mp_float_int_t sgn:1, exp:MP_FLOAT_EXP_BITS, frc:MP_FLOAT_FRAC_BITS; } p;
struct { mp_float_int_t sgn : 1, exp : MP_FLOAT_EXP_BITS, frc : MP_FLOAT_FRAC_BITS;
} p;
#endif
} u;
u.p.sgn = 0;
@ -198,7 +199,7 @@ STATIC MP_DEFINE_CONST_DICT(mp_module_urandom_globals, mp_module_urandom_globals
const mp_obj_module_t mp_module_urandom = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&mp_module_urandom_globals,
.globals = (mp_obj_dict_t *)&mp_module_urandom_globals,
};
#endif //MICROPY_PY_URANDOM
#endif // MICROPY_PY_URANDOM

View File

@ -52,7 +52,7 @@ STATIC mp_obj_t match_group(mp_obj_t self_in, mp_obj_t no_in) {
return mp_const_none;
}
return mp_obj_new_str_of_type(mp_obj_get_type(self->str),
(const byte*)start, self->caps[no * 2 + 1] - start);
(const byte *)start, self->caps[no * 2 + 1] - start);
}
MP_DEFINE_CONST_FUN_OBJ_2(match_group_obj, match_group);
@ -141,7 +141,7 @@ STATIC const mp_obj_type_t match_type = {
{ &mp_type_type },
.name = MP_QSTR_match,
.print = match_print,
.locals_dict = (void*)&match_locals_dict,
.locals_dict = (void *)&match_locals_dict,
};
STATIC void re_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
@ -157,7 +157,7 @@ STATIC mp_obj_t ure_exec(bool is_anchored, uint n_args, const mp_obj_t *args) {
size_t len;
subj.begin = mp_obj_str_get_data(args[1], &len);
subj.end = subj.begin + len;
#if MICROPY_PY_URE_MATCH_SPAN_START_END
#if MICROPY_PY_URE_MATCH_SPAN_START_END
if (n_args > 2) {
const mp_obj_type_t *self_type = mp_obj_get_type(args[1]);
mp_int_t str_len = MP_OBJ_SMALL_INT_VALUE(mp_obj_len_maybe(args[1]));
@ -185,14 +185,14 @@ STATIC mp_obj_t ure_exec(bool is_anchored, uint n_args, const mp_obj_t *args) {
subj.begin = (const char *)pos_ptr;
subj.end = (const char *)endpos_ptr;
}
#endif
#endif
int caps_num = (self->re.sub + 1) * 2;
mp_obj_match_t *match = m_new_obj_var(mp_obj_match_t, char*, caps_num);
mp_obj_match_t *match = m_new_obj_var(mp_obj_match_t, char *, caps_num);
// cast is a workaround for a bug in msvc: it treats const char** as a const pointer instead of a pointer to pointer to const char
memset((char*)match->caps, 0, caps_num * sizeof(char*));
memset((char *)match->caps, 0, caps_num * sizeof(char *));
int res = re1_5_recursiveloopprog(&self->re, &subj, match->caps, caps_num, is_anchored);
if (res == 0) {
m_del_var(mp_obj_match_t, char*, caps_num, match);
m_del_var(mp_obj_match_t, char *, caps_num, match);
return mp_const_none;
}
@ -227,10 +227,10 @@ STATIC mp_obj_t re_split(size_t n_args, const mp_obj_t *args) {
}
mp_obj_t retval = mp_obj_new_list(0, NULL);
const char **caps = mp_local_alloc(caps_num * sizeof(char*));
const char **caps = mp_local_alloc(caps_num * sizeof(char *));
while (true) {
// cast is a workaround for a bug in msvc: it treats const char** as a const pointer instead of a pointer to pointer to const char
memset((char**)caps, 0, caps_num * sizeof(char*));
memset((char **)caps, 0, caps_num * sizeof(char *));
int res = re1_5_recursiveloopprog(&self->re, &subj, caps, caps_num, false);
// if we didn't have a match, or had an empty match, it's time to stop
@ -238,7 +238,7 @@ STATIC mp_obj_t re_split(size_t n_args, const mp_obj_t *args) {
break;
}
mp_obj_t s = mp_obj_new_str_of_type(str_type, (const byte*)subj.begin, caps[0] - subj.begin);
mp_obj_t s = mp_obj_new_str_of_type(str_type, (const byte *)subj.begin, caps[0] - subj.begin);
mp_obj_list_append(retval, s);
if (self->re.sub > 0) {
mp_raise_NotImplementedError(translate("Splitting with sub-captures"));
@ -249,9 +249,9 @@ STATIC mp_obj_t re_split(size_t n_args, const mp_obj_t *args) {
}
}
// cast is a workaround for a bug in msvc (see above)
mp_local_free((char**)caps);
mp_local_free((char **)caps);
mp_obj_t s = mp_obj_new_str_of_type(str_type, (const byte*)subj.begin, subj.end - subj.begin);
mp_obj_t s = mp_obj_new_str_of_type(str_type, (const byte *)subj.begin, subj.end - subj.begin);
mp_obj_list_append(retval, s);
return retval;
}
@ -278,14 +278,14 @@ STATIC mp_obj_t re_sub_helper(mp_obj_t self_in, size_t n_args, const mp_obj_t *a
vstr_t vstr_return;
vstr_return.buf = NULL; // We'll init the vstr after the first match
mp_obj_match_t *match = mp_local_alloc(sizeof(mp_obj_match_t) + caps_num * sizeof(char*));
mp_obj_match_t *match = mp_local_alloc(sizeof(mp_obj_match_t) + caps_num * sizeof(char *));
match->base.type = &match_type;
match->num_matches = caps_num / 2; // caps_num counts start and end pointers
match->str = where;
for (;;) {
// cast is a workaround for a bug in msvc: it treats const char** as a const pointer instead of a pointer to pointer to const char
memset((char*)match->caps, 0, caps_num * sizeof(char*));
memset((char *)match->caps, 0, caps_num * sizeof(char *));
int res = re1_5_recursiveloopprog(&self->re, &subj, match->caps, caps_num, false);
// If we didn't have a match, or had an empty match, it's time to stop
@ -302,7 +302,7 @@ STATIC mp_obj_t re_sub_helper(mp_obj_t self_in, size_t n_args, const mp_obj_t *a
vstr_add_strn(&vstr_return, subj.begin, match->caps[0] - subj.begin);
// Get replacement string
const char* repl = mp_obj_str_get_str((mp_obj_is_callable(replace) ? mp_call_function_1(replace, MP_OBJ_FROM_PTR(match)) : replace));
const char *repl = mp_obj_str_get_str((mp_obj_is_callable(replace) ? mp_call_function_1(replace, MP_OBJ_FROM_PTR(match)) : replace));
// Append replacement string to result, substituting any regex groups
while (*repl != '\0') {
@ -384,13 +384,13 @@ STATIC MP_DEFINE_CONST_DICT(re_locals_dict, re_locals_dict_table);
STATIC const mp_obj_type_t re_type = {
{ &mp_type_type },
#if CIRCUITPY
#if CIRCUITPY
.name = MP_QSTR_re,
#else
#else
.name = MP_QSTR_ure,
#endif
#endif
.print = re_print,
.locals_dict = (void*)&re_locals_dict,
.locals_dict = (void *)&re_locals_dict,
};
STATIC mp_obj_t mod_re_compile(size_t n_args, const mp_obj_t *args) {
@ -407,7 +407,7 @@ STATIC mp_obj_t mod_re_compile(size_t n_args, const mp_obj_t *args) {
}
int error = re1_5_compilecode(&o->re, re_str);
if (error != 0) {
error:
error:
mp_raise_ValueError(translate("Error in regex"));
}
if (flags & FLAG_DEBUG) {
@ -445,11 +445,11 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_re_sub_obj, 3, 5, mod_re_sub);
#endif
STATIC const mp_rom_map_elem_t mp_module_re_globals_table[] = {
#if CIRCUITPY
#if CIRCUITPY
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_re) },
#else
#else
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ure) },
#endif
#endif
{ MP_ROM_QSTR(MP_QSTR_compile), MP_ROM_PTR(&mod_re_compile_obj) },
{ MP_ROM_QSTR(MP_QSTR_match), MP_ROM_PTR(&mod_re_match_obj) },
{ MP_ROM_QSTR(MP_QSTR_search), MP_ROM_PTR(&mod_re_search_obj) },
@ -463,7 +463,7 @@ STATIC MP_DEFINE_CONST_DICT(mp_module_re_globals, mp_module_re_globals_table);
const mp_obj_module_t mp_module_ure = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&mp_module_re_globals,
.globals = (mp_obj_dict_t *)&mp_module_re_globals,
};
// Source files #include'd here to make sure they're compiled in
@ -475,4 +475,4 @@ const mp_obj_module_t mp_module_ure = {
#include "re1.5/recursiveloop.c"
#include "re1.5/charclass.c"
#endif //MICROPY_PY_URE
#endif // MICROPY_PY_URE

View File

@ -45,9 +45,9 @@ STATIC void poll_map_add(mp_map_t *poll_map, const mp_obj_t *obj, mp_uint_t obj_
} else {
// object exists; update its flags
if (or_flags) {
((poll_obj_t*)elem->value)->flags |= flags;
((poll_obj_t *)elem->value)->flags |= flags;
} else {
((poll_obj_t*)elem->value)->flags = flags;
((poll_obj_t *)elem->value)->flags = flags;
}
}
}
@ -61,7 +61,7 @@ STATIC mp_uint_t poll_map_poll(mp_map_t *poll_map, mp_uint_t *rwx_num) {
continue;
}
poll_obj_t *poll_obj = (poll_obj_t*)poll_map->table[i].value;
poll_obj_t *poll_obj = (poll_obj_t *)poll_map->table[i].value;
int errcode;
mp_int_t ret = poll_obj->ioctl(poll_obj->obj, MP_STREAM_POLL, poll_obj->flags, &errcode);
poll_obj->flags_ret = ret;
@ -138,15 +138,15 @@ STATIC mp_obj_t select_select(uint n_args, const mp_obj_t *args) {
if (!MP_MAP_SLOT_IS_FILLED(&poll_map, i)) {
continue;
}
poll_obj_t *poll_obj = (poll_obj_t*)poll_map.table[i].value;
poll_obj_t *poll_obj = (poll_obj_t *)poll_map.table[i].value;
if (poll_obj->flags_ret & MP_STREAM_POLL_RD) {
((mp_obj_list_t*)list_array[0])->items[rwx_len[0]++] = poll_obj->obj;
((mp_obj_list_t *)list_array[0])->items[rwx_len[0]++] = poll_obj->obj;
}
if (poll_obj->flags_ret & MP_STREAM_POLL_WR) {
((mp_obj_list_t*)list_array[1])->items[rwx_len[1]++] = poll_obj->obj;
((mp_obj_list_t *)list_array[1])->items[rwx_len[1]++] = poll_obj->obj;
}
if ((poll_obj->flags_ret & ~(MP_STREAM_POLL_RD | MP_STREAM_POLL_WR)) != 0) {
((mp_obj_list_t*)list_array[2])->items[rwx_len[2]++] = poll_obj->obj;
((mp_obj_list_t *)list_array[2])->items[rwx_len[2]++] = poll_obj->obj;
}
}
mp_map_deinit(&poll_map);
@ -199,7 +199,7 @@ STATIC mp_obj_t poll_modify(mp_obj_t self_in, mp_obj_t obj_in, mp_obj_t eventmas
if (elem == NULL) {
mp_raise_OSError(MP_ENOENT);
}
((poll_obj_t*)elem->value)->flags = mp_obj_get_int(eventmask_in);
((poll_obj_t *)elem->value)->flags = mp_obj_get_int(eventmask_in);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_3(poll_modify_obj, poll_modify);
@ -249,7 +249,7 @@ STATIC mp_obj_t poll_poll(uint n_args, const mp_obj_t *args) {
if (!MP_MAP_SLOT_IS_FILLED(&self->poll_map, i)) {
continue;
}
poll_obj_t *poll_obj = (poll_obj_t*)self->poll_map.table[i].value;
poll_obj_t *poll_obj = (poll_obj_t *)self->poll_map.table[i].value;
if (poll_obj->flags_ret != 0) {
mp_obj_t tuple[2] = {poll_obj->obj, MP_OBJ_NEW_SMALL_INT(poll_obj->flags_ret)};
ret_list->items[n_ready++] = mp_obj_new_tuple(2, tuple);
@ -292,7 +292,7 @@ STATIC mp_obj_t poll_iternext(mp_obj_t self_in) {
if (!MP_MAP_SLOT_IS_FILLED(&self->poll_map, i)) {
continue;
}
poll_obj_t *poll_obj = (poll_obj_t*)self->poll_map.table[i].value;
poll_obj_t *poll_obj = (poll_obj_t *)self->poll_map.table[i].value;
if (poll_obj->flags_ret != 0) {
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(self->ret_tuple);
t->items[0] = poll_obj->obj;
@ -324,7 +324,7 @@ STATIC const mp_obj_type_t mp_type_poll = {
.name = MP_QSTR_poll,
.getiter = mp_identity_getiter,
.iternext = poll_iternext,
.locals_dict = (void*)&poll_locals_dict,
.locals_dict = (void *)&poll_locals_dict,
};
/// \function poll()
@ -352,7 +352,7 @@ STATIC MP_DEFINE_CONST_DICT(mp_module_select_globals, mp_module_select_globals_t
const mp_obj_module_t mp_module_uselect = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&mp_module_select_globals,
.globals = (mp_obj_dict_t *)&mp_module_select_globals,
};
#endif // MICROPY_PY_USELECT

View File

@ -34,11 +34,11 @@ struct ssl_args {
STATIC const mp_obj_type_t ussl_socket_type;
STATIC mp_obj_ssl_socket_t *socket_new(mp_obj_t sock, struct ssl_args *args) {
#if MICROPY_PY_USSL_FINALISER
#if MICROPY_PY_USSL_FINALISER
mp_obj_ssl_socket_t *o = m_new_obj_with_finaliser(mp_obj_ssl_socket_t);
#else
#else
mp_obj_ssl_socket_t *o = m_new_obj(mp_obj_ssl_socket_t);
#endif
#endif
o->base.type = &ussl_socket_type;
o->buf = NULL;
o->bytes_left = 0;
@ -54,13 +54,13 @@ STATIC mp_obj_ssl_socket_t *socket_new(mp_obj_t sock, struct ssl_args *args) {
if (args->key.u_obj != mp_const_none) {
size_t len;
const byte *data = (const byte*)mp_obj_str_get_data(args->key.u_obj, &len);
const byte *data = (const byte *)mp_obj_str_get_data(args->key.u_obj, &len);
int res = ssl_obj_memory_load(o->ssl_ctx, SSL_OBJ_RSA_KEY, data, len, NULL);
if (res != SSL_OK) {
mp_raise_ValueError(translate("invalid key"));
}
data = (const byte*)mp_obj_str_get_data(args->cert.u_obj, &len);
data = (const byte *)mp_obj_str_get_data(args->cert.u_obj, &len);
res = ssl_obj_memory_load(o->ssl_ctx, SSL_OBJ_X509_CERT, data, len, NULL);
if (res != SSL_OK) {
mp_raise_ValueError(translate("invalid cert"));
@ -73,7 +73,7 @@ STATIC mp_obj_ssl_socket_t *socket_new(mp_obj_t sock, struct ssl_args *args) {
SSL_EXTENSIONS *ext = ssl_ext_new();
if (args->server_hostname.u_obj != mp_const_none) {
ext->host_name = (char*)mp_obj_str_get_str(args->server_hostname.u_obj);
ext->host_name = (char *)mp_obj_str_get_str(args->server_hostname.u_obj);
}
o->ssl_sock = ssl_client_new(o->ssl_ctx, (long)sock, NULL, 0, ext);
@ -192,9 +192,9 @@ STATIC const mp_rom_map_elem_t ussl_socket_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) },
{ MP_ROM_QSTR(MP_QSTR_setblocking), MP_ROM_PTR(&socket_setblocking_obj) },
{ MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&mp_stream_close_obj) },
#if MICROPY_PY_USSL_FINALISER
#if MICROPY_PY_USSL_FINALISER
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&mp_stream_close_obj) },
#endif
#endif
};
STATIC MP_DEFINE_CONST_DICT(ussl_socket_locals_dict, ussl_socket_locals_dict_table);
@ -214,7 +214,7 @@ STATIC const mp_obj_type_t ussl_socket_type = {
.getiter = NULL,
.iternext = NULL,
.protocol = &ussl_socket_stream_p,
.locals_dict = (void*)&ussl_socket_locals_dict,
.locals_dict = (void *)&ussl_socket_locals_dict,
};
STATIC mp_obj_t mod_ssl_wrap_socket(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
@ -231,7 +231,7 @@ STATIC mp_obj_t mod_ssl_wrap_socket(size_t n_args, const mp_obj_t *pos_args, mp_
struct ssl_args args;
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args,
MP_ARRAY_SIZE(allowed_args), allowed_args, (mp_arg_val_t*)&args);
MP_ARRAY_SIZE(allowed_args), allowed_args, (mp_arg_val_t *)&args);
return MP_OBJ_FROM_PTR(socket_new(sock, &args));
}
@ -246,7 +246,7 @@ STATIC MP_DEFINE_CONST_DICT(mp_module_ssl_globals, mp_module_ssl_globals_table);
const mp_obj_module_t mp_module_ussl = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&mp_module_ssl_globals,
.globals = (mp_obj_dict_t *)&mp_module_ssl_globals,
};
#endif // MICROPY_PY_USSL

View File

@ -53,7 +53,7 @@ STATIC void mbedtls_debug(void *ctx, int level, const char *file, int line, cons
#endif
STATIC int _mbedtls_ssl_send(void *ctx, const byte *buf, size_t len) {
mp_obj_t sock = *(mp_obj_t*)ctx;
mp_obj_t sock = *(mp_obj_t *)ctx;
const mp_stream_p_t *sock_stream = mp_get_stream(sock);
int err;
@ -70,7 +70,7 @@ STATIC int _mbedtls_ssl_send(void *ctx, const byte *buf, size_t len) {
}
STATIC int _mbedtls_ssl_recv(void *ctx, byte *buf, size_t len) {
mp_obj_t sock = *(mp_obj_t*)ctx;
mp_obj_t sock = *(mp_obj_t *)ctx;
const mp_stream_p_t *sock_stream = mp_get_stream(sock);
int err;
@ -91,11 +91,11 @@ STATIC mp_obj_ssl_socket_t *socket_new(mp_obj_t sock, struct ssl_args *args) {
// Verify the socket object has the full stream protocol
mp_get_stream_raise(sock, MP_STREAM_OP_READ | MP_STREAM_OP_WRITE | MP_STREAM_OP_IOCTL);
#if MICROPY_PY_USSL_FINALISER
#if MICROPY_PY_USSL_FINALISER
mp_obj_ssl_socket_t *o = m_new_obj_with_finaliser(mp_obj_ssl_socket_t);
#else
#else
mp_obj_ssl_socket_t *o = m_new_obj(mp_obj_ssl_socket_t);
#endif
#endif
o->base.type = &ussl_socket_type;
o->sock = sock;
@ -119,9 +119,9 @@ STATIC mp_obj_ssl_socket_t *socket_new(mp_obj_t sock, struct ssl_args *args) {
}
ret = mbedtls_ssl_config_defaults(&o->conf,
args->server_side.u_bool ? MBEDTLS_SSL_IS_SERVER : MBEDTLS_SSL_IS_CLIENT,
MBEDTLS_SSL_TRANSPORT_STREAM,
MBEDTLS_SSL_PRESET_DEFAULT);
args->server_side.u_bool ? MBEDTLS_SSL_IS_SERVER : MBEDTLS_SSL_IS_CLIENT,
MBEDTLS_SSL_TRANSPORT_STREAM,
MBEDTLS_SSL_PRESET_DEFAULT);
if (ret != 0) {
goto cleanup;
}
@ -149,13 +149,13 @@ STATIC mp_obj_ssl_socket_t *socket_new(mp_obj_t sock, struct ssl_args *args) {
if (args->key.u_obj != MP_OBJ_NULL) {
size_t key_len;
const byte *key = (const byte*)mp_obj_str_get_data(args->key.u_obj, &key_len);
const byte *key = (const byte *)mp_obj_str_get_data(args->key.u_obj, &key_len);
// len should include terminating null
ret = mbedtls_pk_parse_key(&o->pkey, key, key_len + 1, NULL, 0);
assert(ret == 0);
size_t cert_len;
const byte *cert = (const byte*)mp_obj_str_get_data(args->cert.u_obj, &cert_len);
const byte *cert = (const byte *)mp_obj_str_get_data(args->cert.u_obj, &cert_len);
// len should include terminating null
ret = mbedtls_x509_crt_parse(&o->cert, cert, cert_len + 1);
assert(ret == 0);
@ -194,7 +194,7 @@ STATIC mp_obj_t mod_ssl_getpeercert(mp_obj_t o_in, mp_obj_t binary_form) {
if (!mp_obj_is_true(binary_form)) {
mp_raise_NotImplementedError(NULL);
}
const mbedtls_x509_crt* peer_cert = mbedtls_ssl_get_peer_cert(&o->ssl);
const mbedtls_x509_crt *peer_cert = mbedtls_ssl_get_peer_cert(&o->ssl);
return mp_obj_new_bytes(peer_cert->raw.p, peer_cert->raw.len);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_ssl_getpeercert_obj, mod_ssl_getpeercert);
@ -275,9 +275,9 @@ STATIC const mp_rom_map_elem_t ussl_socket_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) },
{ MP_ROM_QSTR(MP_QSTR_setblocking), MP_ROM_PTR(&socket_setblocking_obj) },
{ MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&mp_stream_close_obj) },
#if MICROPY_PY_USSL_FINALISER
#if MICROPY_PY_USSL_FINALISER
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&mp_stream_close_obj) },
#endif
#endif
{ MP_ROM_QSTR(MP_QSTR_getpeercert), MP_ROM_PTR(&mod_ssl_getpeercert_obj) },
};
@ -298,7 +298,7 @@ STATIC const mp_obj_type_t ussl_socket_type = {
.getiter = NULL,
.iternext = NULL,
.protocol = &ussl_socket_stream_p,
.locals_dict = (void*)&ussl_socket_locals_dict,
.locals_dict = (void *)&ussl_socket_locals_dict,
};
STATIC mp_obj_t mod_ssl_wrap_socket(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
@ -315,7 +315,7 @@ STATIC mp_obj_t mod_ssl_wrap_socket(size_t n_args, const mp_obj_t *pos_args, mp_
struct ssl_args args;
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args,
MP_ARRAY_SIZE(allowed_args), allowed_args, (mp_arg_val_t*)&args);
MP_ARRAY_SIZE(allowed_args), allowed_args, (mp_arg_val_t *)&args);
return MP_OBJ_FROM_PTR(socket_new(sock, &args));
}
@ -330,7 +330,7 @@ STATIC MP_DEFINE_CONST_DICT(mp_module_ssl_globals, mp_module_ssl_globals_table);
const mp_obj_module_t mp_module_ussl = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&mp_module_ssl_globals,
.globals = (mp_obj_dict_t *)&mp_module_ssl_globals,
};
#endif // MICROPY_PY_USSL

View File

@ -171,9 +171,12 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_utimeq_dump_obj, mod_utimeq_dump);
STATIC mp_obj_t utimeq_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
mp_obj_utimeq_t *self = MP_OBJ_TO_PTR(self_in);
switch (op) {
case MP_UNARY_OP_BOOL: return mp_obj_new_bool(self->len != 0);
case MP_UNARY_OP_LEN: return MP_OBJ_NEW_SMALL_INT(self->len);
default: return MP_OBJ_NULL; // op not supported
case MP_UNARY_OP_BOOL:
return mp_obj_new_bool(self->len != 0);
case MP_UNARY_OP_LEN:
return MP_OBJ_NEW_SMALL_INT(self->len);
default:
return MP_OBJ_NULL; // op not supported
}
}
@ -193,7 +196,7 @@ STATIC const mp_obj_type_t utimeq_type = {
.name = MP_QSTR_utimeq,
.make_new = utimeq_make_new,
.unary_op = utimeq_unary_op,
.locals_dict = (void*)&utimeq_locals_dict,
.locals_dict = (void *)&utimeq_locals_dict,
};
STATIC const mp_rom_map_elem_t mp_module_utimeq_globals_table[] = {
@ -205,7 +208,7 @@ STATIC MP_DEFINE_CONST_DICT(mp_module_utimeq_globals, mp_module_utimeq_globals_t
const mp_obj_module_t mp_module_utimeq = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&mp_module_utimeq_globals,
.globals = (mp_obj_dict_t *)&mp_module_utimeq_globals,
};
#endif //MICROPY_PY_UTIMEQ
#endif // MICROPY_PY_UTIMEQ

View File

@ -31,9 +31,9 @@ typedef struct _mp_obj_decompio_t {
} mp_obj_decompio_t;
STATIC int read_src_stream(TINF_DATA *data) {
byte *p = (void*)data;
byte *p = (void *)data;
p -= offsetof(mp_obj_decompio_t, decomp);
mp_obj_decompio_t *self = (mp_obj_decompio_t*)p;
mp_obj_decompio_t *self = (mp_obj_decompio_t *)p;
const mp_stream_p_t *stream = mp_get_stream(self->src_stream);
int err;
@ -73,7 +73,7 @@ STATIC mp_obj_t decompio_make_new(const mp_obj_type_t *type, size_t n_args, cons
} else if (dict_opt >= 0) {
dict_opt = uzlib_zlib_parse_header(&o->decomp);
if (dict_opt < 0) {
header_error:
header_error:
mp_raise_ValueError(translate("compression header"));
}
dict_sz = 1 << dict_opt;
@ -92,7 +92,7 @@ STATIC mp_uint_t decompio_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *er
}
o->decomp.dest = buf;
o->decomp.dest_limit = (unsigned char*)buf+size;
o->decomp.dest_limit = (unsigned char *)buf + size;
int st = uzlib_uncompress_chksum(&o->decomp);
if (st == TINF_DONE) {
o->eof = true;
@ -101,7 +101,7 @@ STATIC mp_uint_t decompio_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *er
*errcode = MP_EINVAL;
return MP_STREAM_ERROR;
}
return o->decomp.dest - (byte*)buf;
return o->decomp.dest - (byte *)buf;
}
STATIC const mp_rom_map_elem_t decompio_locals_dict_table[] = {
@ -122,7 +122,7 @@ STATIC const mp_obj_type_t decompio_type = {
.name = MP_QSTR_DecompIO,
.make_new = decompio_make_new,
.protocol = &decompio_stream_p,
.locals_dict = (void*)&decompio_locals_dict,
.locals_dict = (void *)&decompio_locals_dict,
};
STATIC mp_obj_t mod_uzlib_decompress(size_t n_args, const mp_obj_t *args) {
@ -138,7 +138,7 @@ STATIC mp_obj_t mod_uzlib_decompress(size_t n_args, const mp_obj_t *args) {
byte *dest_buf = m_new(byte, dest_buf_size);
decomp->dest = dest_buf;
decomp->dest_limit = dest_buf+dest_buf_size;
decomp->dest_limit = dest_buf + dest_buf_size;
DEBUG_printf("uzlib: Initial out buffer: " UINT_FMT " bytes\n", decomp->destSize);
decomp->source = bufinfo.buf;
decomp->source_limit = (unsigned char *)bufinfo.buf + bufinfo.len;
@ -173,7 +173,7 @@ STATIC mp_obj_t mod_uzlib_decompress(size_t n_args, const mp_obj_t *args) {
mp_uint_t final_sz = decomp->dest - dest_buf;
DEBUG_printf("uzlib: Resizing from " UINT_FMT " to final size: " UINT_FMT " bytes\n", dest_buf_size, final_sz);
dest_buf = (byte*)m_renew(byte, dest_buf, dest_buf_size, final_sz);
dest_buf = (byte *)m_renew(byte, dest_buf, dest_buf_size, final_sz);
mp_obj_t res = mp_obj_new_bytearray_by_ref(final_sz, dest_buf);
m_del_obj(TINF_DATA, decomp);
return res;
@ -193,7 +193,7 @@ STATIC MP_DEFINE_CONST_DICT(mp_module_uzlib_globals, mp_module_uzlib_globals_tab
const mp_obj_module_t mp_module_uzlib = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&mp_module_uzlib_globals,
.globals = (mp_obj_dict_t *)&mp_module_uzlib_globals,
};
// Source files #include'd here to make sure they're compiled in

View File

@ -127,7 +127,7 @@ STATIC void handle_op(mp_obj_webrepl_t *self) {
open_args[1] = MP_OBJ_NEW_QSTR(MP_QSTR_wb);
}
self->cur_file = mp_builtin_open(2, open_args, (mp_map_t*)&mp_const_empty_map);
self->cur_file = mp_builtin_open(2, open_args, (mp_map_t *)&mp_const_empty_map);
#if 0
struct mp_stream_seek_t seek = { .offset = self->hdr.offset, .whence = 0 };
@ -161,13 +161,13 @@ STATIC mp_uint_t _webrepl_read(mp_obj_t self_in, void *buf, mp_uint_t size, int
mp_obj_webrepl_t *self = self_in;
const mp_stream_p_t *sock_stream = mp_get_stream(self->sock);
mp_uint_t out_sz = sock_stream->read(self->sock, buf, size, errcode);
//DEBUG_printf("webrepl: Read %d initial bytes from websocket\n", out_sz);
// DEBUG_printf("webrepl: Read %d initial bytes from websocket\n", out_sz);
if (out_sz == 0 || out_sz == MP_STREAM_ERROR) {
return out_sz;
}
if (self->state == STATE_PASSWD) {
char c = *(char*)buf;
char c = *(char *)buf;
if (c == '\r' || c == '\n') {
self->hdr.fname[self->data_to_recv] = 0;
DEBUG_printf("webrepl: entered password: %s\n", self->hdr.fname);
@ -195,8 +195,8 @@ STATIC mp_uint_t _webrepl_read(mp_obj_t self_in, void *buf, mp_uint_t size, int
DEBUG_printf("webrepl: received bin data, hdr_to_recv: %d, data_to_recv=%d\n", self->hdr_to_recv, self->data_to_recv);
if (self->hdr_to_recv != 0) {
char *p = (char*)&self->hdr + sizeof(self->hdr) - self->hdr_to_recv;
*p++ = *(char*)buf;
char *p = (char *)&self->hdr + sizeof(self->hdr) - self->hdr_to_recv;
*p++ = *(char *)buf;
if (--self->hdr_to_recv != 0) {
mp_uint_t hdr_sz = sock_stream->read(self->sock, p, self->hdr_to_recv, errcode);
if (hdr_sz == MP_STREAM_ERROR) {
@ -217,7 +217,7 @@ STATIC mp_uint_t _webrepl_read(mp_obj_t self_in, void *buf, mp_uint_t size, int
if (self->data_to_recv != 0) {
static byte filebuf[512];
filebuf[0] = *(byte*)buf;
filebuf[0] = *(byte *)buf;
mp_uint_t buf_sz = 1;
if (--self->data_to_recv != 0) {
size_t to_read = MIN(sizeof(filebuf) - 1, self->data_to_recv);
@ -321,7 +321,7 @@ STATIC const mp_obj_type_t webrepl_type = {
.name = MP_QSTR__webrepl,
.make_new = webrepl_make_new,
.protocol = &webrepl_stream_p,
.locals_dict = (mp_obj_dict_t*)&webrepl_locals_dict,
.locals_dict = (mp_obj_dict_t *)&webrepl_locals_dict,
};
STATIC const mp_rom_map_elem_t webrepl_module_globals_table[] = {
@ -334,7 +334,7 @@ STATIC MP_DEFINE_CONST_DICT(webrepl_module_globals, webrepl_module_globals_table
const mp_obj_module_t mp_module_webrepl = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&webrepl_module_globals,
.globals = (mp_obj_dict_t *)&webrepl_module_globals,
};
#endif // MICROPY_PY_WEBREPL

View File

@ -50,11 +50,11 @@ STATIC mp_obj_t websocket_make_new(const mp_obj_type_t *type, size_t n_args, con
if (n_args > 1 && args[1] == mp_const_true) {
o->opts |= BLOCKING_WRITE;
}
return MP_OBJ_FROM_PTR(o);
return MP_OBJ_FROM_PTR(o);
}
STATIC mp_uint_t websocket_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
mp_obj_websocket_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_websocket_t *self = MP_OBJ_TO_PTR(self_in);
const mp_stream_p_t *stream_p = mp_get_stream(self->sock);
while (1) {
if (self->to_recv != 0) {
@ -162,7 +162,7 @@ STATIC mp_uint_t websocket_read(mp_obj_t self_in, void *buf, mp_uint_t size, int
self->msg_sz -= out_sz;
if (self->msg_sz == 0) {
byte last_state;
no_payload:
no_payload:
last_state = self->state;
self->state = FRAME_HEADER;
self->to_recv = 2;
@ -179,7 +179,7 @@ no_payload:
return 0;
}
//DEBUG_printf("Finished receiving ctrl message %x, ignoring\n", self->last_flags);
// DEBUG_printf("Finished receiving ctrl message %x, ignoring\n", self->last_flags);
continue;
}
}
@ -196,7 +196,7 @@ no_payload:
}
STATIC mp_uint_t websocket_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
mp_obj_websocket_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_websocket_t *self = MP_OBJ_TO_PTR(self_in);
assert(size < 0x10000);
byte header[4] = {0x80 | (self->opts & FRAME_OPCODE_MASK)};
int hdr_sz;
@ -276,7 +276,7 @@ STATIC const mp_obj_type_t websocket_type = {
.name = MP_QSTR_websocket,
.make_new = websocket_make_new,
.protocol = &websocket_stream_p,
.locals_dict = (void*)&websocket_locals_dict,
.locals_dict = (void *)&websocket_locals_dict,
};
STATIC const mp_rom_map_elem_t websocket_module_globals_table[] = {
@ -288,7 +288,7 @@ STATIC MP_DEFINE_CONST_DICT(websocket_module_globals, websocket_module_globals_t
const mp_obj_module_t mp_module_websocket = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&websocket_module_globals,
.globals = (mp_obj_dict_t *)&websocket_module_globals,
};
#endif // MICROPY_PY_WEBSOCKET

@ -1 +1 @@
Subproject commit 2ecad9586d088ee66f1b208ff2204906eba9e987
Subproject commit b64fa6d4c73287edef9ccf09cfd6ec5009f9628b

View File

@ -65,7 +65,7 @@ STATIC mp_obj_t time_ticks_diff(mp_obj_t end_in, mp_obj_t start_in) {
// Optimized formula avoiding if conditions. We adjust difference "forward",
// wrap it around and adjust back.
mp_int_t diff = ((end - start + MICROPY_PY_UTIME_TICKS_PERIOD / 2) & (MICROPY_PY_UTIME_TICKS_PERIOD - 1))
- MICROPY_PY_UTIME_TICKS_PERIOD / 2;
- MICROPY_PY_UTIME_TICKS_PERIOD / 2;
return MP_OBJ_NEW_SMALL_INT(diff);
}
MP_DEFINE_CONST_FUN_OBJ_2(mp_utime_ticks_diff_obj, time_ticks_diff);

View File

@ -75,7 +75,7 @@ STATIC mp_vfs_mount_t *lookup_path(mp_obj_t path_in, mp_obj_t *path_out) {
mp_vfs_mount_t *vfs = mp_vfs_lookup_path(path, &p_out);
if (vfs != MP_VFS_NONE && vfs != MP_VFS_ROOT) {
*path_out = mp_obj_new_str_of_type(mp_obj_get_type(path_in),
(const byte*)p_out, strlen(p_out));
(const byte *)p_out, strlen(p_out));
}
return vfs;
}
@ -106,7 +106,7 @@ mp_import_stat_t mp_vfs_import_stat(const char *path) {
}
// If the mounted object has the VFS protocol, call its import_stat helper
const mp_vfs_proto_t *proto = (mp_vfs_proto_t*)mp_proto_get(MP_QSTR_protocol_vfs, vfs->obj);
const mp_vfs_proto_t *proto = (mp_vfs_proto_t *)mp_proto_get(MP_QSTR_protocol_vfs, vfs->obj);
if (proto != NULL) {
return proto->import_stat(MP_OBJ_TO_PTR(vfs->obj), path_out);
}
@ -168,7 +168,7 @@ mp_obj_t mp_vfs_mount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args
vfs->next = NULL;
// call the underlying object to do any mounting operation
mp_vfs_proxy_call(vfs, MP_QSTR_mount, 2, (mp_obj_t*)&args);
mp_vfs_proxy_call(vfs, MP_QSTR_mount, 2, (mp_obj_t *)&args);
// check that the destination mount point is unused
const char *path_out;
@ -245,7 +245,7 @@ mp_obj_t mp_vfs_open(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args)
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
mp_vfs_mount_t *vfs = lookup_path(args[ARG_file].u_obj, &args[ARG_file].u_obj);
return mp_vfs_proxy_call(vfs, MP_QSTR_open, 2, (mp_obj_t*)&args);
return mp_vfs_proxy_call(vfs, MP_QSTR_open, 2, (mp_obj_t *)&args);
}
MP_DEFINE_CONST_FUN_OBJ_KW(mp_vfs_open_obj, 0, mp_vfs_open);
@ -314,7 +314,7 @@ mp_obj_t mp_vfs_ilistdir_it_iternext(mp_obj_t self_in) {
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(3, NULL));
t->items[0] = mp_obj_new_str_of_type(
self->is_str ? &mp_type_str : &mp_type_bytes,
(const byte*)vfs->str + 1, vfs->len - 1);
(const byte *)vfs->str + 1, vfs->len - 1);
t->items[1] = MP_OBJ_NEW_SMALL_INT(MP_S_IFDIR);
t->items[2] = MP_OBJ_NEW_SMALL_INT(0); // no inode number
return MP_OBJ_FROM_PTR(t);

View File

@ -12,8 +12,8 @@
// return values of mp_vfs_lookup_path
// ROOT is 0 so that the default current directory is the root directory
#define MP_VFS_NONE ((mp_vfs_mount_t*)1)
#define MP_VFS_ROOT ((mp_vfs_mount_t*)0)
#define MP_VFS_NONE ((mp_vfs_mount_t *)1)
#define MP_VFS_ROOT ((mp_vfs_mount_t *)0)
// MicroPython's port-standardized versions of stat constants
#define MP_S_IFDIR (0x4000)

View File

@ -136,7 +136,7 @@ STATIC mp_obj_t mp_vfs_fat_ilistdir_it_iternext(mp_obj_t self_in) {
if (self->is_str) {
t->items[0] = mp_obj_new_str(fn, strlen(fn));
} else {
t->items[0] = mp_obj_new_bytes((const byte*)fn, strlen(fn));
t->items[0] = mp_obj_new_bytes((const byte *)fn, strlen(fn));
}
if (fno.fattrib & AM_DIR) {
// dir
@ -234,9 +234,9 @@ STATIC mp_obj_t fat_vfs_rename(mp_obj_t vfs_in, mp_obj_t path_in, mp_obj_t path_
mp_raise_OSError(fresult_to_errno_table[res]);
}
if ((fno.fattrib & AM_DIR) != 0 &&
strlen(new_path) > strlen(old_path) &&
new_path[strlen(old_path)] == '/' &&
strncmp(old_path, new_path, strlen(old_path)) == 0) {
strlen(new_path) > strlen(old_path) &&
new_path[strlen(old_path)] == '/' &&
strncmp(old_path, new_path, strlen(old_path)) == 0) {
mp_raise_OSError(MP_EINVAL);
}
@ -324,11 +324,11 @@ STATIC mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) {
} else {
mode |= MP_S_IFREG;
}
#if MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_NONE
#if MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_NONE
// On non-longint builds, the number of seconds since 1970 (epoch) is too
// large to fit in a smallint, so just return 31-DEC-1999 (0).
mp_obj_t seconds = MP_OBJ_NEW_SMALL_INT(946684800);
#else
#else
mp_obj_t seconds = mp_obj_new_int_from_uint(
timeutils_seconds_since_epoch(
1980 + ((fno.fdate >> 9) & 0x7f),
@ -338,7 +338,7 @@ STATIC mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) {
(fno.ftime >> 5) & 0x3f,
2 * (fno.ftime & 0x1f)
));
#endif
#endif
t->items[0] = MP_OBJ_NEW_SMALL_INT(mode); // st_mode
t->items[1] = MP_OBJ_NEW_SMALL_INT(0); // st_ino
t->items[2] = MP_OBJ_NEW_SMALL_INT(0); // st_dev
@ -434,7 +434,7 @@ STATIC mp_obj_t vfs_fat_setlabel(mp_obj_t self_in, mp_obj_t label_in) {
const char *label_str = mp_obj_str_get_str(label_in);
FRESULT res = f_setlabel(&self->fatfs, label_str);
if (res != FR_OK) {
if(res == FR_WRITE_PROTECTED) {
if (res == FR_WRITE_PROTECTED) {
mp_raise_msg(&mp_type_OSError, translate("Read-only filesystem"));
}
mp_raise_OSError(fresult_to_errno_table[res]);
@ -467,9 +467,9 @@ STATIC const mp_rom_map_elem_t fat_vfs_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&fat_vfs_statvfs_obj) },
{ MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&vfs_fat_mount_obj) },
{ MP_ROM_QSTR(MP_QSTR_umount), MP_ROM_PTR(&fat_vfs_umount_obj) },
#if MICROPY_FATFS_USE_LABEL
#if MICROPY_FATFS_USE_LABEL
{ MP_ROM_QSTR(MP_QSTR_label), MP_ROM_PTR(&fat_vfs_label_obj) },
#endif
#endif
};
STATIC MP_DEFINE_CONST_DICT(fat_vfs_locals_dict, fat_vfs_locals_dict_table);
@ -483,7 +483,7 @@ const mp_obj_type_t mp_fat_vfs_type = {
.name = MP_QSTR_VfsFat,
.make_new = fat_vfs_make_new,
.protocol = &fat_vfs_proto,
.locals_dict = (mp_obj_dict_t*)&fat_vfs_locals_dict,
.locals_dict = (mp_obj_dict_t *)&fat_vfs_locals_dict,
};

View File

@ -26,32 +26,31 @@
typedef void *bdev_t;
STATIC fs_user_mount_t *disk_get_device(void *bdev) {
return (fs_user_mount_t*)bdev;
return (fs_user_mount_t *)bdev;
}
/*-----------------------------------------------------------------------*/
/* Read Sector(s) */
/*-----------------------------------------------------------------------*/
DRESULT disk_read (
DRESULT disk_read(
bdev_t pdrv, /* Physical drive */
BYTE *buff, /* Data buffer to store read data */
DWORD sector, /* Sector address (LBA) */
UINT count /* Number of sectors to read (1..128) */
)
{
) {
fs_user_mount_t *vfs = disk_get_device(pdrv);
if (vfs == NULL) {
return RES_PARERR;
}
if (vfs->flags & FSUSER_NATIVE) {
mp_uint_t (*f)(uint8_t*, uint32_t, uint32_t) = (void*)(uintptr_t)vfs->readblocks[2];
mp_uint_t (*f)(uint8_t *, uint32_t, uint32_t) = (void *)(uintptr_t)vfs->readblocks[2];
if (f(buff, sector, count) != 0) {
return RES_ERROR;
}
} else {
mp_obj_array_t ar = {{&mp_type_bytearray}, BYTEARRAY_TYPECODE, 0, count * SECSIZE(&vfs->fatfs), buff};
mp_obj_array_t ar = {{&mp_type_bytearray}, BYTEARRAY_TYPECODE, 0, count *SECSIZE(&vfs->fatfs), buff};
vfs->readblocks[2] = MP_OBJ_NEW_SMALL_INT(sector);
vfs->readblocks[3] = MP_OBJ_FROM_PTR(&ar);
nlr_buf_t nlr;
@ -74,13 +73,12 @@ DRESULT disk_read (
/* Write Sector(s) */
/*-----------------------------------------------------------------------*/
DRESULT disk_write (
DRESULT disk_write(
bdev_t pdrv, /* Physical drive */
const BYTE *buff, /* Data to be written */
DWORD sector, /* Sector address (LBA) */
UINT count /* Number of sectors to write (1..128) */
)
{
) {
fs_user_mount_t *vfs = disk_get_device(pdrv);
if (vfs == NULL) {
return RES_PARERR;
@ -92,12 +90,12 @@ DRESULT disk_write (
}
if (vfs->flags & FSUSER_NATIVE) {
mp_uint_t (*f)(const uint8_t*, uint32_t, uint32_t) = (void*)(uintptr_t)vfs->writeblocks[2];
mp_uint_t (*f)(const uint8_t *, uint32_t, uint32_t) = (void *)(uintptr_t)vfs->writeblocks[2];
if (f(buff, sector, count) != 0) {
return RES_ERROR;
}
} else {
mp_obj_array_t ar = {{&mp_type_bytearray}, BYTEARRAY_TYPECODE, 0, count * SECSIZE(&vfs->fatfs), (void*)buff};
mp_obj_array_t ar = {{&mp_type_bytearray}, BYTEARRAY_TYPECODE, 0, count *SECSIZE(&vfs->fatfs), (void *)buff};
vfs->writeblocks[2] = MP_OBJ_NEW_SMALL_INT(sector);
vfs->writeblocks[3] = MP_OBJ_FROM_PTR(&ar);
nlr_buf_t nlr;
@ -121,12 +119,11 @@ DRESULT disk_write (
/* Miscellaneous Functions */
/*-----------------------------------------------------------------------*/
DRESULT disk_ioctl (
DRESULT disk_ioctl(
bdev_t pdrv, /* Physical drive */
BYTE cmd, /* Control code */
void *buff /* Buffer to send/receive control data */
)
{
) {
fs_user_mount_t *vfs = disk_get_device(pdrv);
if (vfs == NULL) {
return RES_PARERR;
@ -145,8 +142,8 @@ DRESULT disk_ioctl (
uint8_t bp_op = op_map[cmd & 7];
if (bp_op != 0) {
if (vfs->flags & FSUSER_NATIVE) {
bool (*f)(size_t, mp_int_t*) = (void*)(uintptr_t)vfs->u.ioctl[2];
if (!f(bp_op, (mp_int_t*) &out_value)) {
bool (*f)(size_t, mp_int_t *) = (void *)(uintptr_t)vfs->u.ioctl[2];
if (!f(bp_op, (mp_int_t *)&out_value)) {
return RES_ERROR;
}
} else {
@ -190,26 +187,26 @@ DRESULT disk_ioctl (
return RES_OK;
case GET_SECTOR_COUNT: {
*((DWORD*)buff) = out_value;
*((DWORD *)buff) = out_value;
return RES_OK;
}
case GET_SECTOR_SIZE: {
if (out_value == 0) {
// Default sector size
*((WORD*)buff) = 512;
*((WORD *)buff) = 512;
} else {
*((WORD*)buff) = out_value;
*((WORD *)buff) = out_value;
}
#if _MAX_SS != _MIN_SS
// need to store ssize because we use it in disk_read/disk_write
vfs->fatfs.ssize = *((WORD*)buff);
vfs->fatfs.ssize = *((WORD *)buff);
#endif
return RES_OK;
}
case GET_BLOCK_SIZE:
*((DWORD*)buff) = 1; // erase block size in units of sector size
*((DWORD *)buff) = 1; // erase block size in units of sector size
return RES_OK;
case IOCTL_INIT:
@ -223,7 +220,7 @@ DRESULT disk_ioctl (
} else {
stat = 0;
}
*((DSTATUS*)buff) = stat;
*((DSTATUS *)buff) = stat;
return RES_OK;
}

View File

@ -83,7 +83,7 @@ STATIC mp_uint_t file_obj_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg,
pyb_file_obj_t *self = MP_OBJ_TO_PTR(o_in);
if (request == MP_STREAM_SEEK) {
struct mp_stream_seek_t *s = (struct mp_stream_seek_t*)(uintptr_t)arg;
struct mp_stream_seek_t *s = (struct mp_stream_seek_t *)(uintptr_t)arg;
switch (s->whence) {
case 0: // SEEK_SET
@ -248,7 +248,7 @@ const mp_obj_type_t mp_type_vfs_fat_fileio = {
.getiter = mp_identity_getiter,
.iternext = mp_stream_unbuffered_iter,
.protocol = &fileio_stream_p,
.locals_dict = (mp_obj_dict_t*)&rawfile_locals_dict,
.locals_dict = (mp_obj_dict_t *)&rawfile_locals_dict,
};
#endif
@ -268,7 +268,7 @@ const mp_obj_type_t mp_type_vfs_fat_textio = {
.getiter = mp_identity_getiter,
.iternext = mp_stream_unbuffered_iter,
.protocol = &textio_stream_p,
.locals_dict = (mp_obj_dict_t*)&rawfile_locals_dict,
.locals_dict = (mp_obj_dict_t *)&rawfile_locals_dict,
};
// Factory function for I/O stream classes

View File

@ -42,7 +42,7 @@ STATIC mp_obj_t vfs_posix_get_path_obj(mp_obj_vfs_posix_t *self, mp_obj_t path)
}
}
STATIC mp_obj_t vfs_posix_fun1_helper(mp_obj_t self_in, mp_obj_t path_in, int (*f)(const char*)) {
STATIC mp_obj_t vfs_posix_fun1_helper(mp_obj_t self_in, mp_obj_t path_in, int (*f)(const char *)) {
mp_obj_vfs_posix_t *self = MP_OBJ_TO_PTR(self_in);
int ret = f(vfs_posix_get_path_str(self, path_in));
if (ret != 0) {
@ -168,7 +168,7 @@ STATIC mp_obj_t vfs_posix_ilistdir_it_iternext(mp_obj_t self_in) {
if (self->is_str) {
t->items[0] = mp_obj_new_str(fn, strlen(fn));
} else {
t->items[0] = mp_obj_new_bytes((const byte*)fn, strlen(fn));
t->items[0] = mp_obj_new_bytes((const byte *)fn, strlen(fn));
}
#ifdef _DIRENT_HAVE_D_TYPE
@ -338,7 +338,7 @@ const mp_obj_type_t mp_type_vfs_posix = {
.name = MP_QSTR_VfsPosix,
.make_new = vfs_posix_make_new,
.protocol = &vfs_posix_proto,
.locals_dict = (mp_obj_dict_t*)&vfs_posix_locals_dict,
.locals_dict = (mp_obj_dict_t *)&vfs_posix_locals_dict,
};
#endif // MICROPY_VFS_POSIX

View File

@ -58,7 +58,7 @@ mp_obj_t mp_vfs_posix_file_open(const mp_obj_type_t *type, mp_obj_t file_in, mp_
case '+':
mode_rw = O_RDWR;
break;
#if MICROPY_PY_IO_FILEIO
#if MICROPY_PY_IO_FILEIO
// If we don't have io.FileIO, then files are in text mode implicitly
case 'b':
type = &mp_type_vfs_posix_fileio;
@ -66,7 +66,7 @@ mp_obj_t mp_vfs_posix_file_open(const mp_obj_type_t *type, mp_obj_t file_in, mp_
case 't':
type = &mp_type_vfs_posix_textio;
break;
#endif
#endif
}
}
@ -159,7 +159,7 @@ STATIC mp_uint_t vfs_posix_file_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_
}
return 0;
case MP_STREAM_SEEK: {
struct mp_stream_seek_t *s = (struct mp_stream_seek_t*)arg;
struct mp_stream_seek_t *s = (struct mp_stream_seek_t *)arg;
off_t off = lseek(o->fd, s->offset, s->whence);
if (off == (off_t)-1) {
*errcode = errno;
@ -213,7 +213,7 @@ const mp_obj_type_t mp_type_vfs_posix_fileio = {
.getiter = mp_identity_getiter,
.iternext = mp_stream_unbuffered_iter,
.protocol = &fileio_stream_p,
.locals_dict = (mp_obj_dict_t*)&rawfile_locals_dict,
.locals_dict = (mp_obj_dict_t *)&rawfile_locals_dict,
};
#endif
@ -233,10 +233,10 @@ const mp_obj_type_t mp_type_vfs_posix_textio = {
.getiter = mp_identity_getiter,
.iternext = mp_stream_unbuffered_iter,
.protocol = &textio_stream_p,
.locals_dict = (mp_obj_dict_t*)&rawfile_locals_dict,
.locals_dict = (mp_obj_dict_t *)&rawfile_locals_dict,
};
const mp_obj_vfs_posix_file_t mp_sys_stdin_obj = {{&mp_type_textio}, STDIN_FILENO};
const mp_obj_vfs_posix_file_t mp_sys_stdin_obj = {{&mp_type_textio}, STDIN_FILENO};
const mp_obj_vfs_posix_file_t mp_sys_stdout_obj = {{&mp_type_textio}, STDOUT_FILENO};
const mp_obj_vfs_posix_file_t mp_sys_stderr_obj = {{&mp_type_textio}, STDERR_FILENO};

View File

@ -21,7 +21,7 @@ typedef struct _mp_reader_vfs_t {
} mp_reader_vfs_t;
STATIC mp_uint_t mp_reader_vfs_readbyte(void *data) {
mp_reader_vfs_t *reader = (mp_reader_vfs_t*)data;
mp_reader_vfs_t *reader = (mp_reader_vfs_t *)data;
if (reader->pos >= reader->len) {
if (reader->len < sizeof(reader->buf)) {
return MP_READER_EOF;
@ -43,7 +43,7 @@ STATIC mp_uint_t mp_reader_vfs_readbyte(void *data) {
}
STATIC void mp_reader_vfs_close(void *data) {
mp_reader_vfs_t *reader = (mp_reader_vfs_t*)data;
mp_reader_vfs_t *reader = (mp_reader_vfs_t *)data;
mp_stream_close(reader->file);
m_del_obj(mp_reader_vfs_t, reader);
}
@ -51,7 +51,7 @@ STATIC void mp_reader_vfs_close(void *data) {
void mp_reader_new_file(mp_reader_t *reader, const char *filename) {
mp_reader_vfs_t *rf = m_new_obj(mp_reader_vfs_t);
mp_obj_t arg = mp_obj_new_str(filename, strlen(filename));
rf->file = mp_vfs_open(1, &arg, (mp_map_t*)&mp_const_empty_map);
rf->file = mp_vfs_open(1, &arg, (mp_map_t *)&mp_const_empty_map);
int errcode;
rf->len = mp_stream_rw(rf->file, rf->buf, sizeof(rf->buf), &errcode, MP_STREAM_RW_READ | MP_STREAM_RW_ONCE);
if (errcode != 0) {

View File

@ -7,13 +7,13 @@
#include "py/proto.h"
int mp_virtual_pin_read(mp_obj_t pin) {
mp_obj_base_t* s = (mp_obj_base_t*)MP_OBJ_TO_PTR(pin);
mp_obj_base_t *s = (mp_obj_base_t *)MP_OBJ_TO_PTR(pin);
const mp_pin_p_t *pin_p = mp_proto_get(MP_QSTR_protocol_pin, s);
return pin_p->ioctl(pin, MP_PIN_READ, 0, NULL);
}
void mp_virtual_pin_write(mp_obj_t pin, int value) {
mp_obj_base_t* s = (mp_obj_base_t*)MP_OBJ_TO_PTR(pin);
mp_obj_base_t *s = (mp_obj_base_t *)MP_OBJ_TO_PTR(pin);
const mp_pin_p_t *pin_p = mp_proto_get(MP_QSTR_protocol_pin, s);
pin_p->ioctl(pin, MP_PIN_WRITE, value, NULL);
}

View File

@ -65,7 +65,7 @@ void netutils_parse_ipv4_addr(mp_obj_t addr_in, uint8_t *out_ip, netutils_endian
}
const char *s = addr_str;
const char *s_top = addr_str + addr_len;
for (mp_uint_t i = 3 ; ; i--) {
for (mp_uint_t i = 3; ; i--) {
mp_uint_t val = 0;
for (; s < s_top && *s != '.'; s++) {
val = val * 10 + *s - '0';

View File

@ -36,11 +36,11 @@
#define LEAPOCH ((31 + 29) * 86400)
#define DAYS_PER_400Y (365*400 + 97)
#define DAYS_PER_100Y (365*100 + 24)
#define DAYS_PER_4Y (365*4 + 1)
#define DAYS_PER_400Y (365 * 400 + 97)
#define DAYS_PER_100Y (365 * 100 + 24)
#define DAYS_PER_4Y (365 * 4 + 1)
STATIC const uint16_t days_since_jan1[]= { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 };
STATIC const uint16_t days_since_jan1[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 };
bool timeutils_is_leap_year(mp_uint_t year) {
return (year % 4 == 0 && year % 100 != 0) || year % 400 == 0;
@ -164,7 +164,7 @@ void timeutils_seconds_since_epoch_to_struct_time(mp_uint_t t, timeutils_struct_
}
mp_uint_t timeutils_seconds_since_epoch(mp_uint_t year, mp_uint_t month, mp_uint_t date,
mp_uint_t hour, mp_uint_t minute, mp_uint_t second) {
mp_uint_t hour, mp_uint_t minute, mp_uint_t second) {
mp_uint_t t = timeutils_seconds_since_2000(year, month, date, hour, minute, second);
return t + EPOCH1970_EPOCH2000_DIFF_SECS;
}

View File

@ -30,14 +30,14 @@
#define EPOCH1970_EPOCH2000_DIFF_SECS 946684800
typedef struct _timeutils_struct_time_t {
uint16_t tm_year; // i.e. 2014
uint8_t tm_mon; // 1..12
uint8_t tm_mday; // 1..31
uint8_t tm_hour; // 0..23
uint8_t tm_min; // 0..59
uint8_t tm_sec; // 0..59
uint8_t tm_wday; // 0..6 0 = Monday
uint16_t tm_yday; // 1..366
uint16_t tm_year; // i.e. 2014
uint8_t tm_mon; // 1..12
uint8_t tm_mday; // 1..31
uint8_t tm_hour; // 0..23
uint8_t tm_min; // 0..59
uint8_t tm_sec; // 0..59
uint8_t tm_wday; // 0..6 0 = Monday
uint16_t tm_yday; // 1..366
} timeutils_struct_time_t;
bool timeutils_is_leap_year(mp_uint_t year);
@ -53,7 +53,7 @@ mp_uint_t timeutils_seconds_since_2000(mp_uint_t year, mp_uint_t month,
void timeutils_seconds_since_epoch_to_struct_time(mp_uint_t t, timeutils_struct_time_t *tm);
mp_uint_t timeutils_seconds_since_epoch(mp_uint_t year, mp_uint_t month, mp_uint_t date,
mp_uint_t hour, mp_uint_t minute, mp_uint_t second);
mp_uint_t hour, mp_uint_t minute, mp_uint_t second);
mp_uint_t timeutils_mktime(mp_uint_t year, mp_int_t month, mp_int_t mday,
mp_int_t hours, mp_int_t minutes, mp_int_t seconds);

View File

@ -26,10 +26,10 @@
#include "lib/utils/buffer_helper.h"
void normalize_buffer_bounds(int32_t* start, int32_t end, size_t* length) {
void normalize_buffer_bounds(int32_t *start, int32_t end, size_t *length) {
if (end < 0) {
end += *length;
} else if (((size_t) end) > *length) {
} else if (((size_t)end) > *length) {
end = *length;
}
if (*start < 0) {

View File

@ -30,6 +30,6 @@
#include <stdint.h>
#include <string.h>
void normalize_buffer_bounds(int32_t* start, int32_t end, size_t* length);
void normalize_buffer_bounds(int32_t *start, int32_t end, size_t *length);
#endif // MICROPY_INCLUDED_LIB_UTILS_BUFFER_HELPER_H

View File

@ -29,6 +29,6 @@
#include "py/obj.h"
STATIC mp_obj_t default___enter__(mp_obj_t self_in) {
return self_in;
return self_in;
}
MP_DEFINE_CONST_FUN_OBJ_1(default___enter___obj, default___enter__);

View File

@ -108,7 +108,7 @@ STATIC void strn_print_strn(void *data, const char *str, size_t len) {
// when linkings against it statically.
// GCC 9 gives a warning about missing attributes so it's excluded until
// uClibc+GCC9 support is needed.
int __GI_vsnprintf(char *str, size_t size, const char *fmt, va_list ap) __attribute__((weak, alias ("vsnprintf")));
int __GI_vsnprintf(char *str, size_t size, const char *fmt, va_list ap) __attribute__((weak, alias("vsnprintf")));
#endif
int vsnprintf(char *str, size_t size, const char *fmt, va_list ap) {
@ -134,4 +134,4 @@ int snprintf(char *str, size_t size, const char *fmt, ...) {
return ret;
}
#endif //MICROPY_USE_INTERNAL_PRINTF
#endif // MICROPY_USE_INTERNAL_PRINTF

32
lib/utils/pyexec.c Executable file → Normal file
View File

@ -85,7 +85,7 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
} else if (exec_flags & EXEC_FLAG_SOURCE_IS_FILENAME) {
lex = mp_lexer_new_from_file(source);
} else {
lex = (mp_lexer_t*)source;
lex = (mp_lexer_t *)source;
}
// source is a lexer, parse and compile the script
qstr source_name = lex->source_name;
@ -95,7 +95,7 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
mp_parse_tree_t parse_tree = mp_parse(lex, input_kind);
module_fun = mp_compile(&parse_tree, source_name, MP_EMIT_OPT_NONE, exec_flags & EXEC_FLAG_IS_REPL);
// Clear the parse tree because it has a heap pointer we don't need anymore.
*((uint32_t volatile*) &parse_tree.chunk) = 0;
*((uint32_t volatile *)&parse_tree.chunk) = 0;
#else
mp_raise_msg(&mp_type_RuntimeError, translate("script compilation not supported"));
#endif
@ -132,12 +132,12 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
if (mp_obj_is_subclass_fast(mp_obj_get_type((mp_obj_t)nlr.ret_val), &mp_type_SystemExit)) {
// at the moment, the value of SystemExit is unused
ret = pyexec_system_exit;
#if CIRCUITPY_ALARM
#if CIRCUITPY_ALARM
} else if (mp_obj_is_subclass_fast(mp_obj_get_type((mp_obj_t)nlr.ret_val), &mp_type_DeepSleepRequest)) {
ret = PYEXEC_DEEP_SLEEP;
#endif
#endif
} else {
if ((mp_obj_t) nlr.ret_val != MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception))) {
if ((mp_obj_t)nlr.ret_val != MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception))) {
mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);
}
ret = PYEXEC_EXCEPTION;
@ -169,8 +169,8 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
size_t n_pool, n_qstr, n_str_data_bytes, n_total_bytes;
qstr_pool_info(&n_pool, &n_qstr, &n_str_data_bytes, &n_total_bytes);
printf("qstr:\n n_pool=" UINT_FMT "\n n_qstr=" UINT_FMT "\n "
"n_str_data_bytes=" UINT_FMT "\n n_total_bytes=" UINT_FMT "\n",
(unsigned)n_pool, (unsigned)n_qstr, (unsigned)n_str_data_bytes, (unsigned)n_total_bytes);
"n_str_data_bytes=" UINT_FMT "\n n_total_bytes=" UINT_FMT "\n",
(unsigned)n_pool, (unsigned)n_qstr, (unsigned)n_str_data_bytes, (unsigned)n_total_bytes);
}
#if MICROPY_ENABLE_GC
@ -195,7 +195,7 @@ typedef struct _repl_t {
// but it was moved to MP_STATE_VM(repl_line) as containing
// root pointer. Still keep structure in case more state
// will be added later.
//vstr_t line;
// vstr_t line;
bool cont_line;
} repl_t;
@ -307,10 +307,10 @@ STATIC int pyexec_friendly_repl_process_char(int c) {
} else {
if (ret == CHAR_CTRL_C) {
// cancel everything
mp_hal_stdout_tx_str("\r\n");
repl.cont_line = false;
goto input_restart;
// cancel everything
mp_hal_stdout_tx_str("\r\n");
repl.cont_line = false;
goto input_restart;
} else if (ret == CHAR_CTRL_D) {
// stop entering compound statement
goto exec;
@ -326,13 +326,13 @@ STATIC int pyexec_friendly_repl_process_char(int c) {
return 0;
}
exec: ;
exec:;
int ret = parse_compile_execute(MP_STATE_VM(repl_line), MP_PARSE_SINGLE_INPUT, EXEC_FLAG_ALLOW_DEBUGGING | EXEC_FLAG_IS_REPL | EXEC_FLAG_SOURCE_IS_VSTR, NULL);
if (ret & PYEXEC_FORCED_EXIT) {
return ret;
}
input_restart:
input_restart:
vstr_reset(MP_STATE_VM(repl_line));
repl.cont_line = false;
readline_init(MP_STATE_VM(repl_line), ">>> ");
@ -409,11 +409,11 @@ int pyexec_friendly_repl(void) {
vstr_t line;
vstr_init(&line, 32);
#if defined(USE_HOST_MODE) && MICROPY_HW_HAS_LCD
#if defined(USE_HOST_MODE) && MICROPY_HW_HAS_LCD
// in host mode, we enable the LCD for the repl
mp_obj_t lcd_o = mp_call_function_0(mp_load_name(qstr_from_str("LCD")));
mp_call_function_1(mp_load_attr(lcd_o, qstr_from_str("light")), mp_const_true);
#endif
#endif
friendly_repl_reset:
mp_hal_stdout_tx_str("\r\n");

View File

@ -35,7 +35,7 @@ typedef enum {
typedef struct {
int return_code;
const mp_obj_type_t * exception_type;
const mp_obj_type_t *exception_type;
int exception_line;
} pyexec_result_t;

View File

@ -20,7 +20,7 @@ void mp_hal_stdout_tx_strn_cooked(const char *str, size_t len) {
i = 1;
}
// Lump all characters on the next line together.
while((last_cr || str[i] != '\n') && i < len) {
while ((last_cr || str[i] != '\n') && i < len) {
last_cr = str[i] == '\r';
i++;
}

View File

@ -65,7 +65,7 @@ STATIC mp_uint_t stdio_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *er
if (c == '\r') {
c = '\n';
}
((byte*)buf)[i] = c;
((byte *)buf)[i] = c;
}
return size;
} else {
@ -87,7 +87,7 @@ STATIC mp_uint_t stdio_write(mp_obj_t self_in, const void *buf, mp_uint_t size,
STATIC mp_uint_t stdio_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
sys_stdio_obj_t *self = MP_OBJ_TO_PTR(self_in);
(void) self;
(void)self;
// For now, pretend we actually flush the stdio stream.
if (request == MP_STREAM_FLUSH) {
@ -106,9 +106,9 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(stdio_obj___exit___obj, 4, 4, stdio_o
// TODO gc hook to close the file if not already closed
STATIC const mp_rom_map_elem_t stdio_locals_dict_table[] = {
#if MICROPY_PY_SYS_STDIO_BUFFER
#if MICROPY_PY_SYS_STDIO_BUFFER
{ MP_ROM_QSTR(MP_QSTR_buffer), MP_ROM_PTR(&stdio_buffer_obj) },
#endif
#endif
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_stream_read_obj) },
{ MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto_obj) },
{ MP_ROM_QSTR(MP_QSTR_readline), MP_ROM_PTR(&mp_stream_unbuffered_readline_obj)},
@ -138,7 +138,7 @@ STATIC const mp_obj_type_t stdio_obj_type = {
.getiter = mp_identity_getiter,
.iternext = mp_stream_unbuffered_iter,
.protocol = &stdio_obj_stream_p,
.locals_dict = (mp_obj_dict_t*)&stdio_locals_dict,
.locals_dict = (mp_obj_dict_t *)&stdio_locals_dict,
};
const sys_stdio_obj_t mp_sys_stdin_obj = {{&stdio_obj_type}, .fd = STDIO_FD_IN};
@ -148,7 +148,7 @@ const sys_stdio_obj_t mp_sys_stderr_obj = {{&stdio_obj_type}, .fd = STDIO_FD_ERR
#if MICROPY_PY_SYS_STDIO_BUFFER
STATIC mp_uint_t stdio_buffer_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
for (uint i = 0; i < size; i++) {
((byte*)buf)[i] = mp_hal_stdin_rx_chr();
((byte *)buf)[i] = mp_hal_stdin_rx_chr();
}
return size;
}

View File

@ -78,6 +78,7 @@ msgstr "%q sedang digunakan"
#: extmod/moductypes.c ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c
#: py/objstrunicode.c
msgid "%q index out of range"
@ -981,6 +982,7 @@ msgstr "Gagal untuk mengalokasikan buffer RX"
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/esp32s2/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
@ -1268,7 +1270,7 @@ msgstr "File tidak valid"
msgid "Invalid format chunk size"
msgstr "Ukuran potongan format tidak valid"
#: ports/esp32s2/common-hal/pwmio/PWMOut.c
#: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/pwmio/PWMOut.c
msgid "Invalid frequency"
msgstr ""
@ -2335,7 +2337,7 @@ msgstr "Baudrate tidak didukung"
msgid "Unsupported format"
msgstr "Format tidak didukung"
#: py/moduerrno.c
#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c
msgid "Unsupported operation"
msgstr "Operasi yang tidak didukung"
@ -2900,6 +2902,10 @@ msgstr ""
msgid "differentiation order out of range"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "dimensions do not match"
msgstr ""
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@ -3390,10 +3396,6 @@ msgstr ""
msgid "math domain error"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix dimensions do not match"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix is not positive definite"
msgstr ""
@ -3751,6 +3753,7 @@ msgstr "Muncul dari PulseIn yang kosong"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/objdict.c py/objlist.c py/objset.c
#: shared-bindings/ps2io/Ps2.c
msgid "pop from empty %q"
@ -3776,6 +3779,8 @@ msgstr ""
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h
@ -4207,10 +4212,6 @@ msgstr ""
msgid "value_count must be > 0"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "vectors must have same lengths"
msgstr ""
#: ports/esp32s2/common-hal/alarm/pin/__init__.c
msgid "wakeup conflict"
msgstr ""

View File

@ -2851,6 +2851,10 @@ msgstr ""
msgid "differentiation order out of range"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "dimensions do not match"
msgstr ""
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@ -3104,6 +3108,7 @@ msgstr ""
#: extmod/ulab/code/numerical/numerical.c
#: ports/esp32s2/common-hal/pulseio/PulseIn.c py/obj.c
#: shared-bindings/bitmaptools/__init__.c
msgid "index out of range"
msgstr ""
@ -3356,10 +3361,6 @@ msgstr ""
msgid "math domain error"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix dimensions do not match"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix is not positive definite"
msgstr ""
@ -3693,7 +3694,7 @@ msgstr ""
msgid "parameters must be registers in sequence r0 to r3"
msgstr ""
#: shared-bindings/displayio/Bitmap.c
#: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c
msgid "pixel coordinates out of bounds"
msgstr ""
@ -4174,10 +4175,6 @@ msgstr ""
msgid "value_count must be > 0"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "vectors must have same lengths"
msgstr ""
#: ports/esp32s2/common-hal/alarm/pin/__init__.c
msgid "wakeup conflict"
msgstr ""

View File

@ -76,6 +76,7 @@ msgstr "Používá se %q"
#: extmod/moductypes.c ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c
#: py/objstrunicode.c
msgid "%q index out of range"
@ -965,6 +966,7 @@ msgstr ""
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/esp32s2/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
@ -1250,7 +1252,7 @@ msgstr ""
msgid "Invalid format chunk size"
msgstr ""
#: ports/esp32s2/common-hal/pwmio/PWMOut.c
#: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/pwmio/PWMOut.c
msgid "Invalid frequency"
msgstr ""
@ -2294,7 +2296,7 @@ msgstr ""
msgid "Unsupported format"
msgstr ""
#: py/moduerrno.c
#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c
msgid "Unsupported operation"
msgstr ""
@ -2852,6 +2854,10 @@ msgstr ""
msgid "differentiation order out of range"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "dimensions do not match"
msgstr ""
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@ -3342,10 +3348,6 @@ msgstr ""
msgid "math domain error"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix dimensions do not match"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix is not positive definite"
msgstr ""
@ -3702,6 +3704,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/objdict.c py/objlist.c py/objset.c
#: shared-bindings/ps2io/Ps2.c
msgid "pop from empty %q"
@ -3727,6 +3730,8 @@ msgstr ""
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h
@ -4157,10 +4162,6 @@ msgstr ""
msgid "value_count must be > 0"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "vectors must have same lengths"
msgstr ""
#: ports/esp32s2/common-hal/alarm/pin/__init__.c
msgid "wakeup conflict"
msgstr ""

View File

@ -6,14 +6,14 @@ msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
"PO-Revision-Date: 2021-02-25 00:24+0000\n"
"PO-Revision-Date: 2021-03-16 00:47+0000\n"
"Last-Translator: Daniel Glocker <mystboy666@gmail.com>\n"
"Language: de_DE\n"
"MIME-Version: 1.0\n"
"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.5\n"
"X-Generator: Weblate 4.5.2-dev\n"
#: main.c
msgid ""
@ -81,6 +81,7 @@ msgstr "%q in Benutzung"
#: extmod/moductypes.c ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c
#: py/objstrunicode.c
msgid "%q index out of range"
@ -983,6 +984,7 @@ msgstr "Konnte keinen RX Buffer allozieren"
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/esp32s2/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
@ -1272,7 +1274,7 @@ msgstr "Ungültige Datei"
msgid "Invalid format chunk size"
msgstr "Ungültige format chunk size"
#: ports/esp32s2/common-hal/pwmio/PWMOut.c
#: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/pwmio/PWMOut.c
msgid "Invalid frequency"
msgstr "Ungültige Frequenz"
@ -1645,7 +1647,7 @@ msgstr "Spielt nicht ab"
#: main.c
msgid "Not running saved code.\n"
msgstr ""
msgstr "Gespeicherter Code wird nicht ausgeführt.\n"
#: shared-bindings/_bleio/__init__.c
msgid "Not settable"
@ -1857,6 +1859,8 @@ msgstr "Der Präfixbuffer muss sich auf dem Heap befinden"
#: main.c
msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n"
msgstr ""
"Drücke eine beliebige Taste um REPL zu betreten. Drücke STRG-D zum "
"neuladen.\n"
#: main.c
msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n"
@ -2345,7 +2349,7 @@ msgstr "Nicht unterstützter display bus type"
msgid "Unsupported format"
msgstr "Nicht unterstütztes Format"
#: py/moduerrno.c
#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c
msgid "Unsupported operation"
msgstr "Nicht unterstützte Operation"
@ -2926,6 +2930,10 @@ msgstr "diff Argument muss ein ndarray sein"
msgid "differentiation order out of range"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "dimensions do not match"
msgstr ""
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@ -3424,10 +3432,6 @@ msgstr "map buffer zu klein"
msgid "math domain error"
msgstr "Mathe-Domain-Fehler"
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix dimensions do not match"
msgstr "Matrix Dimensionen stimmen nicht überein"
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix is not positive definite"
msgstr "Matrix ist nicht positiv definitiv"
@ -3788,6 +3792,7 @@ msgstr "pop von einem leeren PulseIn"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/objdict.c py/objlist.c py/objset.c
#: shared-bindings/ps2io/Ps2.c
msgid "pop from empty %q"
@ -3813,6 +3818,8 @@ msgstr "pow () mit 3 Argumenten erfordert Integer"
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h
@ -4250,10 +4257,6 @@ msgstr "Wert muss in %d Byte(s) passen"
msgid "value_count must be > 0"
msgstr "value_count muss größer als 0 sein"
#: extmod/ulab/code/linalg/linalg.c
msgid "vectors must have same lengths"
msgstr "Vektoren müssen die selbe Länge haben"
#: ports/esp32s2/common-hal/alarm/pin/__init__.c
msgid "wakeup conflict"
msgstr ""
@ -4343,6 +4346,12 @@ msgstr ""
msgid "zi must be of shape (n_section, 2)"
msgstr ""
#~ msgid "matrix dimensions do not match"
#~ msgstr "Matrix Dimensionen stimmen nicht überein"
#~ msgid "vectors must have same lengths"
#~ msgstr "Vektoren müssen die selbe Länge haben"
#~ msgid "Group full"
#~ msgstr "Gruppe voll"

View File

@ -73,6 +73,7 @@ msgstr ""
#: extmod/moductypes.c ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c
#: py/objstrunicode.c
msgid "%q index out of range"
@ -962,6 +963,7 @@ msgstr ""
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/esp32s2/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
@ -1247,7 +1249,7 @@ msgstr ""
msgid "Invalid format chunk size"
msgstr ""
#: ports/esp32s2/common-hal/pwmio/PWMOut.c
#: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/pwmio/PWMOut.c
msgid "Invalid frequency"
msgstr ""
@ -2291,7 +2293,7 @@ msgstr ""
msgid "Unsupported format"
msgstr ""
#: py/moduerrno.c
#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c
msgid "Unsupported operation"
msgstr ""
@ -2849,6 +2851,10 @@ msgstr ""
msgid "differentiation order out of range"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "dimensions do not match"
msgstr ""
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@ -3339,10 +3345,6 @@ msgstr ""
msgid "math domain error"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix dimensions do not match"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix is not positive definite"
msgstr ""
@ -3699,6 +3701,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/objdict.c py/objlist.c py/objset.c
#: shared-bindings/ps2io/Ps2.c
msgid "pop from empty %q"
@ -3724,6 +3727,8 @@ msgstr ""
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h
@ -4154,10 +4159,6 @@ msgstr ""
msgid "value_count must be > 0"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "vectors must have same lengths"
msgstr ""
#: ports/esp32s2/common-hal/alarm/pin/__init__.c
msgid "wakeup conflict"
msgstr ""

View File

@ -72,6 +72,7 @@ msgstr ""
#: extmod/moductypes.c ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c
#: py/objstrunicode.c
msgid "%q index out of range"
@ -961,6 +962,7 @@ msgstr ""
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/esp32s2/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
@ -1246,7 +1248,7 @@ msgstr ""
msgid "Invalid format chunk size"
msgstr ""
#: ports/esp32s2/common-hal/pwmio/PWMOut.c
#: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/pwmio/PWMOut.c
msgid "Invalid frequency"
msgstr ""
@ -2290,7 +2292,7 @@ msgstr ""
msgid "Unsupported format"
msgstr ""
#: py/moduerrno.c
#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c
msgid "Unsupported operation"
msgstr ""
@ -2848,6 +2850,10 @@ msgstr ""
msgid "differentiation order out of range"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "dimensions do not match"
msgstr ""
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@ -3338,10 +3344,6 @@ msgstr ""
msgid "math domain error"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix dimensions do not match"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix is not positive definite"
msgstr ""
@ -3698,6 +3700,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/objdict.c py/objlist.c py/objset.c
#: shared-bindings/ps2io/Ps2.c
msgid "pop from empty %q"
@ -3723,6 +3726,8 @@ msgstr ""
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h
@ -4153,10 +4158,6 @@ msgstr ""
msgid "value_count must be > 0"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "vectors must have same lengths"
msgstr ""
#: ports/esp32s2/common-hal/alarm/pin/__init__.c
msgid "wakeup conflict"
msgstr ""

View File

@ -84,6 +84,7 @@ msgstr "%q está siendo utilizado"
#: extmod/moductypes.c ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c
#: py/objstrunicode.c
msgid "%q index out of range"
@ -988,6 +989,7 @@ msgstr "Ha fallado la asignación del buffer RX"
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/esp32s2/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
@ -1283,7 +1285,7 @@ msgstr "Archivo inválido"
msgid "Invalid format chunk size"
msgstr "Formato de fragmento de formato no válido"
#: ports/esp32s2/common-hal/pwmio/PWMOut.c
#: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/pwmio/PWMOut.c
msgid "Invalid frequency"
msgstr "Frecuencia inválida"
@ -2364,7 +2366,7 @@ msgstr "Sin capacidad de bus tipo display"
msgid "Unsupported format"
msgstr "Formato no soportado"
#: py/moduerrno.c
#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c
msgid "Unsupported operation"
msgstr "Operación no soportada"
@ -2938,6 +2940,10 @@ msgstr "El argumento diff debe ser un ndarray"
msgid "differentiation order out of range"
msgstr "Orden de diferenciación fuera de rango"
#: extmod/ulab/code/linalg/linalg.c
msgid "dimensions do not match"
msgstr ""
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@ -3431,10 +3437,6 @@ msgstr "map buffer muy pequeño"
msgid "math domain error"
msgstr "error de dominio matemático"
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix dimensions do not match"
msgstr "las dimensiones de la matriz no coinciden"
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix is not positive definite"
msgstr "matrix no es definida positiva"
@ -3795,6 +3797,7 @@ msgstr "pop de un PulseIn vacío"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/objdict.c py/objlist.c py/objset.c
#: shared-bindings/ps2io/Ps2.c
msgid "pop from empty %q"
@ -3820,6 +3823,8 @@ msgstr "pow() con 3 argumentos requiere enteros"
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h
@ -4253,10 +4258,6 @@ msgstr "el valor debe caber en %d byte(s)"
msgid "value_count must be > 0"
msgstr "value_count debe ser > 0"
#: extmod/ulab/code/linalg/linalg.c
msgid "vectors must have same lengths"
msgstr "los vectores deben tener el mismo tamaño"
#: ports/esp32s2/common-hal/alarm/pin/__init__.c
msgid "wakeup conflict"
msgstr "conflicto de wakeup"
@ -4346,6 +4347,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 "matrix dimensions do not match"
#~ msgstr "las dimensiones de la matriz no coinciden"
#~ msgid "vectors must have same lengths"
#~ msgstr "los vectores deben tener el mismo tamaño"
#~ msgid "Group full"
#~ msgstr "Group lleno"

View File

@ -72,6 +72,7 @@ msgstr "%q ay ginagamit"
#: extmod/moductypes.c ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c
#: py/objstrunicode.c
msgid "%q index out of range"
@ -975,6 +976,7 @@ msgstr "Nabigong ilaan ang RX buffer"
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/esp32s2/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
@ -1262,7 +1264,7 @@ msgstr "Mali ang file"
msgid "Invalid format chunk size"
msgstr "Mali ang format ng chunk size"
#: ports/esp32s2/common-hal/pwmio/PWMOut.c
#: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/pwmio/PWMOut.c
msgid "Invalid frequency"
msgstr ""
@ -2313,7 +2315,7 @@ msgstr "Hindi supportadong tipo ng bitmap"
msgid "Unsupported format"
msgstr "Hindi supportadong format"
#: py/moduerrno.c
#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c
msgid "Unsupported operation"
msgstr "Hindi sinusuportahang operasyon"
@ -2890,6 +2892,10 @@ msgstr ""
msgid "differentiation order out of range"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "dimensions do not match"
msgstr ""
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@ -3386,10 +3392,6 @@ msgstr "masyadong maliit ang buffer map"
msgid "math domain error"
msgstr "may pagkakamali sa math domain"
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix dimensions do not match"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix is not positive definite"
msgstr ""
@ -3748,6 +3750,7 @@ msgstr "pop mula sa walang laman na PulseIn"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/objdict.c py/objlist.c py/objset.c
#: shared-bindings/ps2io/Ps2.c
msgid "pop from empty %q"
@ -3773,6 +3776,8 @@ msgstr "pow() na may 3 argumento kailangan ng integers"
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h
@ -4207,10 +4212,6 @@ msgstr ""
msgid "value_count must be > 0"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "vectors must have same lengths"
msgstr ""
#: ports/esp32s2/common-hal/alarm/pin/__init__.c
msgid "wakeup conflict"
msgstr ""

View File

@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
"PO-Revision-Date: 2021-02-21 22:27+0000\n"
"PO-Revision-Date: 2021-03-16 14:54+0000\n"
"Last-Translator: Hugo Dahl <hugo@code-jedi.com>\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"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.5\n"
"X-Generator: Weblate 4.5.2-dev\n"
#: main.c
msgid ""
@ -84,6 +84,7 @@ msgstr "%q en cours d'utilisation"
#: extmod/moductypes.c ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c
#: py/objstrunicode.c
msgid "%q index out of range"
@ -358,7 +359,7 @@ msgstr "Tous les automates finis sont utilisés"
#: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "All sync event channels in use"
msgstr "Tous les canaux d'événements sync (sync event channels) sont utilisés"
msgstr "Tout les canaux d'événements sync sont utilisés"
#: shared-bindings/pwmio/PWMOut.c
msgid "All timers for this pin are in use"
@ -519,7 +520,7 @@ msgstr "Tampon + décalage trop petit %d %d %d"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "Buffer elements must be 4 bytes long or less"
msgstr ""
msgstr "Éléments du tampon doit être 4 octets ou moins"
#: shared-module/usb_hid/Device.c
#, c-format
@ -995,6 +996,7 @@ msgstr "Echec de l'allocation du tampon RX"
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/esp32s2/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
@ -1118,7 +1120,7 @@ msgstr "IV doit être de longueur de %d octets"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "In-buffer elements must be <= 4 bytes long"
msgstr ""
msgstr "Éléments dans le tampon doivent être <= à 4 octets"
#: py/persistentcode.c
msgid ""
@ -1290,7 +1292,7 @@ msgstr "Fichier invalide"
msgid "Invalid format chunk size"
msgstr "Taille de bloc de formatage invalide"
#: ports/esp32s2/common-hal/pwmio/PWMOut.c
#: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/pwmio/PWMOut.c
msgid "Invalid frequency"
msgstr "Fréquence non valide"
@ -1587,11 +1589,11 @@ msgstr "Pas de support matériel pour cette broche"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "No in in program"
msgstr ""
msgstr "Programme n'a pas de \"in\""
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "No in or out in program"
msgstr ""
msgstr "Programme n'a aucun \"in\" ni \"out\""
#: shared-bindings/aesio/aes.c
msgid "No key was specified"
@ -1744,7 +1746,7 @@ msgstr "Plus de sockets"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "Out-buffer elements must be <= 4 bytes long"
msgstr ""
msgstr "Éléments du tampon de sortie doivent être <= à 4 octets"
#: shared-bindings/bitops/__init__.c
#, c-format
@ -1775,7 +1777,7 @@ msgstr ""
#: ports/raspberrypi/common-hal/countio/Counter.c
msgid "PWM slice already in use"
msgstr ""
msgstr "PWM slice déja utilisée"
#: ports/raspberrypi/common-hal/countio/Counter.c
msgid "PWM slice channel A already in use"
@ -1820,7 +1822,7 @@ msgstr "La broche est entrée uniquement"
#: ports/raspberrypi/common-hal/countio/Counter.c
msgid "Pin must be on PWM Channel B"
msgstr ""
msgstr "La broche doit être sur le canal B du PWM"
#: ports/atmel-samd/common-hal/countio/Counter.c
msgid "Pin must support hardware interrupts"
@ -1843,7 +1845,7 @@ msgstr ""
#: ports/raspberrypi/common-hal/rotaryio/IncrementalEncoder.c
msgid "Pins must be sequential"
msgstr ""
msgstr "Les broches doivent être séquentielles"
#: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c
msgid "Pins must share PWM slice"
@ -2374,7 +2376,7 @@ msgstr "Type de bus d'affichage non supporté"
msgid "Unsupported format"
msgstr "Format non supporté"
#: py/moduerrno.c
#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c
msgid "Unsupported operation"
msgstr "Opération non supportée"
@ -2594,7 +2596,7 @@ msgstr "opération binaire '%q' non implémentée"
#: shared-bindings/busio/UART.c
msgid "bits must be in range 5 to 9"
msgstr ""
msgstr "les bits doivent être compris entre 5 et 9"
#: shared-bindings/audiomixer/Mixer.c
msgid "bits_per_sample must be 8 or 16"
@ -2832,7 +2834,7 @@ msgstr "le cercle ne peut être enregistré que dans un seul parent"
#: shared-bindings/bitmaptools/__init__.c
msgid "clip point must be (x,y) tuple"
msgstr ""
msgstr "point de coupure doît être un tuple (x,y)"
#: shared-bindings/msgpack/ExtType.c
msgid "code outside range 0~127"
@ -2955,6 +2957,10 @@ msgstr "l'argument diff doit être un ndarray"
msgid "differentiation order out of range"
msgstr "differentiation order hors de portée"
#: extmod/ulab/code/linalg/linalg.c
msgid "dimensions do not match"
msgstr "les dimensions ne correspondent pas"
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@ -3452,10 +3458,6 @@ msgstr "tampon trop petit"
msgid "math domain error"
msgstr "erreur de domaine math"
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix dimensions do not match"
msgstr "les dimensions de la matrice ne correspondent pas"
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix is not positive definite"
msgstr "la matrice n'est pas définie positive"
@ -3817,6 +3819,7 @@ msgstr "'pop' d'une entrée PulseIn vide"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/objdict.c py/objlist.c py/objset.c
#: shared-bindings/ps2io/Ps2.c
msgid "pop from empty %q"
@ -3842,6 +3845,8 @@ msgstr "pow() avec 3 arguments nécessite des entiers"
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h
@ -4275,10 +4280,6 @@ msgstr "la valeur doit tenir dans %d octet(s)"
msgid "value_count must be > 0"
msgstr "'value_count' doit être > 0"
#: extmod/ulab/code/linalg/linalg.c
msgid "vectors must have same lengths"
msgstr "les vecteurs doivent avoir la même longueur"
#: ports/esp32s2/common-hal/alarm/pin/__init__.c
msgid "wakeup conflict"
msgstr "conflit au réveil"
@ -4368,6 +4369,12 @@ 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 "matrix dimensions do not match"
#~ msgstr "les dimensions de la matrice ne correspondent pas"
#~ msgid "vectors must have same lengths"
#~ msgstr "les vecteurs doivent avoir la même longueur"
#~ msgid "Group full"
#~ msgstr "Groupe plein"

View File

@ -73,6 +73,7 @@ msgstr ""
#: extmod/moductypes.c ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c
#: py/objstrunicode.c
msgid "%q index out of range"
@ -962,6 +963,7 @@ msgstr ""
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/esp32s2/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
@ -1247,7 +1249,7 @@ msgstr ""
msgid "Invalid format chunk size"
msgstr ""
#: ports/esp32s2/common-hal/pwmio/PWMOut.c
#: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/pwmio/PWMOut.c
msgid "Invalid frequency"
msgstr ""
@ -2291,7 +2293,7 @@ msgstr ""
msgid "Unsupported format"
msgstr ""
#: py/moduerrno.c
#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c
msgid "Unsupported operation"
msgstr ""
@ -2849,6 +2851,10 @@ msgstr ""
msgid "differentiation order out of range"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "dimensions do not match"
msgstr ""
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@ -3339,10 +3345,6 @@ msgstr ""
msgid "math domain error"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix dimensions do not match"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix is not positive definite"
msgstr ""
@ -3699,6 +3701,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/objdict.c py/objlist.c py/objset.c
#: shared-bindings/ps2io/Ps2.c
msgid "pop from empty %q"
@ -3724,6 +3727,8 @@ msgstr ""
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h
@ -4154,10 +4159,6 @@ msgstr ""
msgid "value_count must be > 0"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "vectors must have same lengths"
msgstr ""
#: ports/esp32s2/common-hal/alarm/pin/__init__.c
msgid "wakeup conflict"
msgstr ""

View File

@ -7,15 +7,15 @@ 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-02-18 15:50+0000\n"
"Last-Translator: Luca De Filippo <luca.defilippo@translationcommons.org>\n"
"PO-Revision-Date: 2021-03-16 14:54+0000\n"
"Last-Translator: Alessandro Mandelli <mandelli.alessandro@ngi.it>\n"
"Language-Team: \n"
"Language: it_IT\n"
"MIME-Version: 1.0\n"
"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.5\n"
"X-Generator: Weblate 4.5.2-dev\n"
#: main.c
msgid ""
@ -82,6 +82,7 @@ msgstr "%q in uso"
#: extmod/moductypes.c ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c
#: py/objstrunicode.c
msgid "%q index out of range"
@ -970,9 +971,9 @@ msgid "Failed sending command."
msgstr ""
#: ports/nrf/sd_mutex.c
#, fuzzy, c-format
#, c-format
msgid "Failed to acquire mutex, err 0x%04x"
msgstr "Impossibile leggere valore dell'attributo. status: 0x%02x"
msgstr "Impossibile acquisire il mutex, err 0x%04x"
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
#: ports/raspberrypi/common-hal/busio/UART.c
@ -984,6 +985,7 @@ msgstr "Impossibile allocare buffer RX"
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/esp32s2/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
@ -1014,9 +1016,9 @@ msgid "Failed to parse MP3 file"
msgstr ""
#: ports/nrf/sd_mutex.c
#, fuzzy, c-format
#, c-format
msgid "Failed to release mutex, err 0x%04x"
msgstr "Impossibile leggere valore dell'attributo. status: 0x%02x"
msgstr "Impossibile rilasciare il mutex, err 0x%04x"
#: supervisor/shared/safe_mode.c
msgid "Failed to write internal flash."
@ -1273,7 +1275,7 @@ msgstr "File non valido"
msgid "Invalid format chunk size"
msgstr ""
#: ports/esp32s2/common-hal/pwmio/PWMOut.c
#: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/pwmio/PWMOut.c
msgid "Invalid frequency"
msgstr ""
@ -2334,7 +2336,7 @@ msgstr "tipo di bitmap non supportato"
msgid "Unsupported format"
msgstr "Formato non supportato"
#: py/moduerrno.c
#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c
msgid "Unsupported operation"
msgstr "Operazione non supportata"
@ -2901,6 +2903,10 @@ msgstr ""
msgid "differentiation order out of range"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "dimensions do not match"
msgstr ""
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@ -3398,10 +3404,6 @@ msgstr "map buffer troppo piccolo"
msgid "math domain error"
msgstr "errore di dominio matematico"
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix dimensions do not match"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix is not positive definite"
msgstr ""
@ -3765,6 +3767,7 @@ msgstr "pop sun un PulseIn vuoto"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/objdict.c py/objlist.c py/objset.c
#: shared-bindings/ps2io/Ps2.c
msgid "pop from empty %q"
@ -3790,6 +3793,8 @@ msgstr "pow() con 3 argomenti richiede interi"
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h
@ -4159,9 +4164,9 @@ msgid "unindent does not match any outer indentation level"
msgstr ""
#: py/objstr.c
#, fuzzy, c-format
#, c-format
msgid "unknown conversion specifier %c"
msgstr "specificatore di conversione %s sconosciuto"
msgstr "specificatore di conversione %c sconosciuto"
#: py/objstr.c
msgid "unknown format code '%c' for object of type '%q'"
@ -4224,10 +4229,6 @@ msgstr ""
msgid "value_count must be > 0"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "vectors must have same lengths"
msgstr ""
#: ports/esp32s2/common-hal/alarm/pin/__init__.c
msgid "wakeup conflict"
msgstr ""

View File

@ -78,6 +78,7 @@ msgstr "%qは使用中"
#: extmod/moductypes.c ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c
#: py/objstrunicode.c
msgid "%q index out of range"
@ -973,6 +974,7 @@ msgstr "RXバッファの確保に失敗"
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/esp32s2/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
@ -1260,7 +1262,7 @@ msgstr "不正なファイル"
msgid "Invalid format chunk size"
msgstr "フォーマットチャンクのサイズが不正"
#: ports/esp32s2/common-hal/pwmio/PWMOut.c
#: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/pwmio/PWMOut.c
msgid "Invalid frequency"
msgstr "不正な周波数"
@ -2314,7 +2316,7 @@ msgstr ""
msgid "Unsupported format"
msgstr "非対応の形式"
#: py/moduerrno.c
#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c
msgid "Unsupported operation"
msgstr "非対応の操作"
@ -2876,6 +2878,10 @@ msgstr "引数はndarrayでなければなりません"
msgid "differentiation order out of range"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "dimensions do not match"
msgstr ""
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@ -3367,10 +3373,6 @@ msgstr ""
msgid "math domain error"
msgstr "定義域エラー"
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix dimensions do not match"
msgstr "行列の次元が一致しません"
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix is not positive definite"
msgstr "正定値行列ではありません"
@ -3729,6 +3731,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/objdict.c py/objlist.c py/objset.c
#: shared-bindings/ps2io/Ps2.c
msgid "pop from empty %q"
@ -3754,6 +3757,8 @@ msgstr "pow()の第3引数には整数が必要"
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h
@ -4185,10 +4190,6 @@ msgstr "値は%dバイトに収まらなければなりません"
msgid "value_count must be > 0"
msgstr "value_countは0より大きくなければなりません"
#: extmod/ulab/code/linalg/linalg.c
msgid "vectors must have same lengths"
msgstr ""
#: ports/esp32s2/common-hal/alarm/pin/__init__.c
msgid "wakeup conflict"
msgstr ""
@ -4278,6 +4279,9 @@ msgstr "ziはfloat値でなければなりません"
msgid "zi must be of shape (n_section, 2)"
msgstr ""
#~ msgid "matrix dimensions do not match"
#~ msgstr "行列の次元が一致しません"
#~ msgid "Group full"
#~ msgstr "グループが一杯"

View File

@ -74,6 +74,7 @@ msgstr "%q 사용 중입니다"
#: extmod/moductypes.c ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c
#: py/objstrunicode.c
msgid "%q index out of range"
@ -965,6 +966,7 @@ msgstr ""
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/esp32s2/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
@ -1250,7 +1252,7 @@ msgstr "파일이 유효하지 않습니다"
msgid "Invalid format chunk size"
msgstr "형식 청크 크기가 잘못되었습니다"
#: ports/esp32s2/common-hal/pwmio/PWMOut.c
#: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/pwmio/PWMOut.c
msgid "Invalid frequency"
msgstr ""
@ -2295,7 +2297,7 @@ msgstr ""
msgid "Unsupported format"
msgstr ""
#: py/moduerrno.c
#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c
msgid "Unsupported operation"
msgstr ""
@ -2853,6 +2855,10 @@ msgstr ""
msgid "differentiation order out of range"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "dimensions do not match"
msgstr ""
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@ -3343,10 +3349,6 @@ msgstr ""
msgid "math domain error"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix dimensions do not match"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix is not positive definite"
msgstr ""
@ -3703,6 +3705,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/objdict.c py/objlist.c py/objset.c
#: shared-bindings/ps2io/Ps2.c
msgid "pop from empty %q"
@ -3728,6 +3731,8 @@ msgstr ""
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h
@ -4158,10 +4163,6 @@ msgstr ""
msgid "value_count must be > 0"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "vectors must have same lengths"
msgstr ""
#: ports/esp32s2/common-hal/alarm/pin/__init__.c
msgid "wakeup conflict"
msgstr ""

View File

@ -76,6 +76,7 @@ msgstr "%q in gebruik"
#: extmod/moductypes.c ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c
#: py/objstrunicode.c
msgid "%q index out of range"
@ -973,6 +974,7 @@ msgstr "RX buffer alloceren mislukt"
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/esp32s2/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
@ -1261,7 +1263,7 @@ msgstr "Ongeldig bestand"
msgid "Invalid format chunk size"
msgstr "Ongeldig formaat stuk grootte"
#: ports/esp32s2/common-hal/pwmio/PWMOut.c
#: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/pwmio/PWMOut.c
msgid "Invalid frequency"
msgstr "Onjuiste frequentie"
@ -2335,7 +2337,7 @@ msgstr "Niet-ondersteund beeldscherm bus type"
msgid "Unsupported format"
msgstr "Niet-ondersteunde format"
#: py/moduerrno.c
#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c
msgid "Unsupported operation"
msgstr "Niet-ondersteunde operatie"
@ -2906,6 +2908,10 @@ msgstr "diff argument moet een ndarray zijn"
msgid "differentiation order out of range"
msgstr "differentiatievolgorde buiten bereik"
#: extmod/ulab/code/linalg/linalg.c
msgid "dimensions do not match"
msgstr ""
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@ -3400,10 +3406,6 @@ msgstr "map buffer te klein"
msgid "math domain error"
msgstr "fout in het wiskundig domein (math domain error)"
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix dimensions do not match"
msgstr "matrix afmetingen komen niet overeen"
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix is not positive definite"
msgstr "matrix is niet positief-definiet"
@ -3761,6 +3763,7 @@ msgstr "pop van een lege PulseIn"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/objdict.c py/objlist.c py/objset.c
#: shared-bindings/ps2io/Ps2.c
msgid "pop from empty %q"
@ -3786,6 +3789,8 @@ msgstr "pow() met 3 argumenten vereist integers"
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h
@ -4218,10 +4223,6 @@ msgstr "waarde moet in %d byte(s) passen"
msgid "value_count must be > 0"
msgstr "value_count moet groter dan 0 zijn"
#: extmod/ulab/code/linalg/linalg.c
msgid "vectors must have same lengths"
msgstr "vectoren moeten van gelijke lengte zijn"
#: ports/esp32s2/common-hal/alarm/pin/__init__.c
msgid "wakeup conflict"
msgstr "conflict bij ontwaken"
@ -4311,6 +4312,12 @@ 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 "matrix dimensions do not match"
#~ msgstr "matrix afmetingen komen niet overeen"
#~ msgid "vectors must have same lengths"
#~ msgstr "vectoren moeten van gelijke lengte zijn"
#~ msgid "Group full"
#~ msgstr "Groep is vol"

View File

@ -78,6 +78,7 @@ msgstr "%q w użyciu"
#: extmod/moductypes.c ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c
#: py/objstrunicode.c
msgid "%q index out of range"
@ -973,6 +974,7 @@ msgstr "Nie udała się alokacja bufora RX"
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/esp32s2/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
@ -1260,7 +1262,7 @@ msgstr "Zły plik"
msgid "Invalid format chunk size"
msgstr "Zła wielkość fragmentu formatu"
#: ports/esp32s2/common-hal/pwmio/PWMOut.c
#: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/pwmio/PWMOut.c
msgid "Invalid frequency"
msgstr "Nieprawidłowa częstotliwość"
@ -2305,7 +2307,7 @@ msgstr "Zły typ magistrali wyświetlaczy"
msgid "Unsupported format"
msgstr "Zły format"
#: py/moduerrno.c
#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c
msgid "Unsupported operation"
msgstr "Zła operacja"
@ -2870,6 +2872,10 @@ msgstr ""
msgid "differentiation order out of range"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "dimensions do not match"
msgstr ""
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@ -3360,10 +3366,6 @@ msgstr "bufor mapy zbyt mały"
msgid "math domain error"
msgstr "błąd domeny"
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix dimensions do not match"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix is not positive definite"
msgstr ""
@ -3721,6 +3723,7 @@ msgstr "pop z pustego PulseIn"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/objdict.c py/objlist.c py/objset.c
#: shared-bindings/ps2io/Ps2.c
msgid "pop from empty %q"
@ -3746,6 +3749,8 @@ msgstr "trzyargumentowe pow() wymaga liczb całkowitych"
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h
@ -4177,10 +4182,6 @@ msgstr "wartość musi mieścić się w %d bajtach"
msgid "value_count must be > 0"
msgstr "value_count musi być > 0"
#: extmod/ulab/code/linalg/linalg.c
msgid "vectors must have same lengths"
msgstr "wektory muszą mieć identyczną długość"
#: ports/esp32s2/common-hal/alarm/pin/__init__.c
msgid "wakeup conflict"
msgstr ""
@ -4270,6 +4271,9 @@ msgstr ""
msgid "zi must be of shape (n_section, 2)"
msgstr ""
#~ msgid "vectors must have same lengths"
#~ msgstr "wektory muszą mieć identyczną długość"
#~ msgid "Group full"
#~ msgstr "Grupa pełna"

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-03-09 16:55+0000\n"
"PO-Revision-Date: 2021-03-16 14:54+0000\n"
"Last-Translator: Wellington Terumi Uemura <wellingtonuemura@gmail.com>\n"
"Language-Team: \n"
"Language: pt_BR\n"
@ -82,6 +82,7 @@ msgstr "%q em uso"
#: extmod/moductypes.c ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c
#: py/objstrunicode.c
msgid "%q index out of range"
@ -991,6 +992,7 @@ msgstr "Falha ao alocar buffer RX"
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/esp32s2/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
@ -1285,7 +1287,7 @@ msgstr "Arquivo inválido"
msgid "Invalid format chunk size"
msgstr "Tamanho do pedaço de formato inválido"
#: ports/esp32s2/common-hal/pwmio/PWMOut.c
#: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/pwmio/PWMOut.c
msgid "Invalid frequency"
msgstr "Frequência inválida"
@ -2369,7 +2371,7 @@ msgstr "Não há suporte para o tipo do display bus"
msgid "Unsupported format"
msgstr "Formato não suportado"
#: py/moduerrno.c
#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c
msgid "Unsupported operation"
msgstr "Operação não suportada"
@ -2946,6 +2948,10 @@ msgstr "O argumento diff deve ser um ndarray"
msgid "differentiation order out of range"
msgstr "ordem de diferenciação fora do alcance"
#: extmod/ulab/code/linalg/linalg.c
msgid "dimensions do not match"
msgstr "as dimensões não coincidem"
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@ -3440,10 +3446,6 @@ msgstr "o mapa do buffer é muito pequeno"
msgid "math domain error"
msgstr "erro de domínio matemático"
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix dimensions do not match"
msgstr "as dimensões da matriz não coincidem"
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix is not positive definite"
msgstr "a matriz não é definitiva positiva"
@ -3807,6 +3809,7 @@ msgstr "pop a partir de um PulseIn vazio"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/objdict.c py/objlist.c py/objset.c
#: shared-bindings/ps2io/Ps2.c
msgid "pop from empty %q"
@ -3832,6 +3835,8 @@ msgstr "o pow() com 3 argumentos requer números inteiros"
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h
@ -4264,10 +4269,6 @@ msgstr "o valor deve caber em %d byte(s)"
msgid "value_count must be > 0"
msgstr "o value_count deve ser > 0"
#: extmod/ulab/code/linalg/linalg.c
msgid "vectors must have same lengths"
msgstr "os vetores devem ter os mesmos comprimentos"
#: ports/esp32s2/common-hal/alarm/pin/__init__.c
msgid "wakeup conflict"
msgstr "conflito de wakeup"
@ -4357,6 +4358,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 "matrix dimensions do not match"
#~ msgstr "as dimensões da matriz não coincidem"
#~ msgid "vectors must have same lengths"
#~ msgstr "os vetores devem ter os mesmos comprimentos"
#~ msgid "Group full"
#~ msgstr "Grupo cheio"

View File

@ -6,8 +6,8 @@ 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-03-09 16:55+0000\n"
"Last-Translator: Jonny Bergdahl <jonny@bergdahl.it>\n"
"PO-Revision-Date: 2021-03-16 15:42+0000\n"
"Last-Translator: امير محمد العمري <amyr82669@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: sv\n"
"MIME-Version: 1.0\n"
@ -81,6 +81,7 @@ msgstr "%q används redan"
#: extmod/moductypes.c ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c
#: py/objstrunicode.c
msgid "%q index out of range"
@ -125,7 +126,7 @@ msgstr "%q ska vara en int"
#: py/bc.c py/objnamedtuple.c
msgid "%q() takes %d positional arguments but %d were given"
msgstr "%q() kräver %d positionsargument men %d gavs"
msgstr "% q () tar% d positionsargument men% d gavs"
#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c
#, c-format
@ -979,6 +980,7 @@ msgstr "Det gick inte att tilldela RX-buffert"
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/esp32s2/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
@ -1268,7 +1270,7 @@ msgstr "Felaktig fil"
msgid "Invalid format chunk size"
msgstr "Ogiltig formatsegmentstorlek"
#: ports/esp32s2/common-hal/pwmio/PWMOut.c
#: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/pwmio/PWMOut.c
msgid "Invalid frequency"
msgstr "Ogiltig frekvens"
@ -2341,7 +2343,7 @@ msgstr "Busstyp för display stöds inte"
msgid "Unsupported format"
msgstr "Formatet stöds inte"
#: py/moduerrno.c
#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c
msgid "Unsupported operation"
msgstr "Åtgärd som inte stöds"
@ -2910,6 +2912,10 @@ msgstr "argumentet diff måste vara en ndarray"
msgid "differentiation order out of range"
msgstr "differentieringsordning utanför intervallet"
#: extmod/ulab/code/linalg/linalg.c
msgid "dimensions do not match"
msgstr "dimensioner matchar inte"
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@ -3403,10 +3409,6 @@ msgstr "map-buffert för liten"
msgid "math domain error"
msgstr "matematikdomänfel"
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix dimensions do not match"
msgstr "matrisdimensioner matchar inte"
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix is not positive definite"
msgstr "matrisen är inte positiv bestämd"
@ -3764,6 +3766,7 @@ msgstr "pop från en tom PulseIn"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/objdict.c py/objlist.c py/objset.c
#: shared-bindings/ps2io/Ps2.c
msgid "pop from empty %q"
@ -3789,6 +3792,8 @@ msgstr "pow() med 3 argument kräver heltal"
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h
@ -4221,10 +4226,6 @@ msgstr "värdet måste passa i %d byte(s)"
msgid "value_count must be > 0"
msgstr "value_count måste vara > 0"
#: extmod/ulab/code/linalg/linalg.c
msgid "vectors must have same lengths"
msgstr "vektorer måste ha samma längd"
#: ports/esp32s2/common-hal/alarm/pin/__init__.c
msgid "wakeup conflict"
msgstr "wakeup-konflikt"
@ -4314,6 +4315,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 "matrix dimensions do not match"
#~ msgstr "matrisdimensioner matchar inte"
#~ msgid "vectors must have same lengths"
#~ msgstr "vektorer måste ha samma längd"
#~ msgid "Group full"
#~ msgstr "Gruppen är full"

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-03-09 01:49+0000\n"
"PO-Revision-Date: 2021-03-16 00:47+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.5.1\n"
"X-Generator: Weblate 4.5.2-dev\n"
#: main.c
msgid ""
@ -83,6 +83,7 @@ msgstr "%q zhèngzài shǐyòng"
#: extmod/moductypes.c ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c
#: py/objstrunicode.c
msgid "%q index out of range"
@ -978,6 +979,7 @@ msgstr "Fēnpèi RX huǎnchōng shībài"
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/esp32s2/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
@ -1270,7 +1272,7 @@ msgstr "Wúxiào de wénjiàn"
msgid "Invalid format chunk size"
msgstr "Géshì kuài dàxiǎo wúxiào"
#: ports/esp32s2/common-hal/pwmio/PWMOut.c
#: ports/esp32s2/common-hal/busio/I2C.c ports/esp32s2/common-hal/pwmio/PWMOut.c
msgid "Invalid frequency"
msgstr "Wúxiào de pínlǜ"
@ -1818,7 +1820,7 @@ msgstr ""
#: ports/raspberrypi/common-hal/rotaryio/IncrementalEncoder.c
msgid "Pins must be sequential"
msgstr ""
msgstr "yǐn jiǎo bì xū shì lián xù de"
#: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c
msgid "Pins must share PWM slice"
@ -2338,7 +2340,7 @@ msgstr "Bù zhīchí de gōnggòng qìchē lèixíng"
msgid "Unsupported format"
msgstr "Bù zhīchí de géshì"
#: py/moduerrno.c
#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c
msgid "Unsupported operation"
msgstr "Bù zhīchí de cāozuò"
@ -2909,6 +2911,10 @@ msgstr "bùtóng de cānshù bìxū shì ndarray"
msgid "differentiation order out of range"
msgstr "chā yì shùn xù fàn wéi"
#: extmod/ulab/code/linalg/linalg.c
msgid "dimensions do not match"
msgstr ""
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@ -3400,10 +3406,6 @@ msgstr "dìtú huǎnchōng qū tài xiǎo"
msgid "math domain error"
msgstr "shùxué yù cuòwù"
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix dimensions do not match"
msgstr "jǔzhèn chǐcùn bù pǐpèi"
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix is not positive definite"
msgstr "jǔzhèn bùshì zhèngdìng de"
@ -3760,6 +3762,7 @@ msgstr "cóng kōng mài chōng tán chū"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/raspberrypi/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/objdict.c py/objlist.c py/objset.c
#: shared-bindings/ps2io/Ps2.c
msgid "pop from empty %q"
@ -3785,6 +3788,8 @@ msgstr "pow() yǒu 3 cānshù xūyào zhěngshù"
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2/mpconfigboard.h
@ -3806,7 +3811,7 @@ msgstr "zài qǐdòng shí tóngshí àn xià liǎng gè ànniǔ.\n"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "pull masks conflict with direction masks"
msgstr ""
msgstr "lā kǒu zhào yǔ fāng xiàng miàn mó chōng tū"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "pull_threshold must be between 1 and 32"
@ -4217,10 +4222,6 @@ msgstr "Zhí bìxū fúhé %d zì jié"
msgid "value_count must be > 0"
msgstr "zhí jìshù bìxū wèi > 0"
#: extmod/ulab/code/linalg/linalg.c
msgid "vectors must have same lengths"
msgstr "xiàngliàng bìxū jùyǒu xiāngtóng de chángdù"
#: ports/esp32s2/common-hal/alarm/pin/__init__.c
msgid "wakeup conflict"
msgstr "huàn xǐng chōng tū"
@ -4310,6 +4311,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 "matrix dimensions do not match"
#~ msgstr "jǔzhèn chǐcùn bù pǐpèi"
#~ msgid "vectors must have same lengths"
#~ msgstr "xiàngliàng bìxū jùyǒu xiāngtóng de chángdù"
#~ msgid "Group full"
#~ msgstr "Fēnzǔ yǐ mǎn"

View File

@ -11,12 +11,12 @@
// Workaround for setting file translation mode: we must distinguish toolsets
// since mingw has no _set_fmode, and altering msvc's _fmode directly has no effect
STATIC int set_fmode_impl(int mode) {
#ifndef _MSC_VER
#ifndef _MSC_VER
_fmode = mode;
return 0;
#else
#else
return _set_fmode(mode);
#endif
#endif
}
void set_fmode_binary(void) {

View File

@ -28,20 +28,20 @@ STATIC void gc_helper_get_regs(regs_t arr) {
register long r13 asm ("r13");
register long r14 asm ("r14");
register long r15 asm ("r15");
#ifdef __clang__
#ifdef __clang__
// TODO:
// This is dirty workaround for Clang. It tries to get around
// uncompliant (wrt to GCC) behavior of handling register variables.
// Application of this patch here is random, and done only to unbreak
// MacOS build. Better, cross-arch ways to deal with Clang issues should
// be found.
asm("" : "=r"(rbx));
asm("" : "=r"(rbp));
asm("" : "=r"(r12));
asm("" : "=r"(r13));
asm("" : "=r"(r14));
asm("" : "=r"(r15));
#endif
asm ("" : "=r" (rbx));
asm ("" : "=r" (rbp));
asm ("" : "=r" (r12));
asm ("" : "=r" (r13));
asm ("" : "=r" (r14));
asm ("" : "=r" (r15));
#endif
arr[0] = rbx;
arr[1] = rbp;
arr[2] = r12;
@ -120,7 +120,7 @@ void gc_collect(void) {
regs_t regs;
gc_helper_get_regs(regs);
// GC stack (and regs because we captured them)
void **regs_ptr = (void**)(void*)&regs;
void **regs_ptr = (void **)(void *)&regs;
gc_collect_root(regs_ptr, ((mp_uint_t)MP_STATE_THREAD(stack_top) - (mp_uint_t)&regs) / sizeof(mp_uint_t));
#if MICROPY_EMIT_NATIVE
mp_unix_mark_exec();
@ -128,4 +128,4 @@ void gc_collect(void) {
gc_collect_end();
}
#endif //MICROPY_ENABLE_GC
#endif // MICROPY_ENABLE_GC

View File

@ -23,7 +23,7 @@ mp_uint_t mp_verbose_flag = 0;
// Heap size of GC heap (if enabled)
// Make it larger on a 64 bit machine, because pointers are larger.
long heap_size = 1024*1024 * (sizeof(mp_uint_t) / 4);
long heap_size = 1024 * 1024 * (sizeof(mp_uint_t) / 4);
STATIC void stderr_print_strn(void *env, const char *str, mp_uint_t len) {
(void)env;
@ -77,28 +77,28 @@ STATIC int compile_and_save(const char *file, const char *output_file, const cha
STATIC int usage(char **argv) {
printf(
"usage: %s [<opts>] [-X <implopt>] <input filename>\n"
"Options:\n"
"-o : output file for compiled bytecode (defaults to input with .mpy extension)\n"
"-s : source filename to embed in the compiled bytecode (defaults to input file)\n"
"-v : verbose (trace various operations); can be multiple\n"
"-O[N] : apply bytecode optimizations of level N\n"
"\n"
"Target specific options:\n"
"-msmall-int-bits=number : set the maximum bits used to encode a small-int\n"
"-mno-unicode : don't support unicode in compiled strings\n"
"-mcache-lookup-bc : cache map lookups in the bytecode\n"
"\n"
"Implementation specific options:\n", argv[0]
);
"usage: %s [<opts>] [-X <implopt>] <input filename>\n"
"Options:\n"
"-o : output file for compiled bytecode (defaults to input with .mpy extension)\n"
"-s : source filename to embed in the compiled bytecode (defaults to input file)\n"
"-v : verbose (trace various operations); can be multiple\n"
"-O[N] : apply bytecode optimizations of level N\n"
"\n"
"Target specific options:\n"
"-msmall-int-bits=number : set the maximum bits used to encode a small-int\n"
"-mno-unicode : don't support unicode in compiled strings\n"
"-mcache-lookup-bc : cache map lookups in the bytecode\n"
"\n"
"Implementation specific options:\n", argv[0]
);
int impl_opts_cnt = 0;
printf(
" emit={bytecode,native,viper} -- set the default code emitter\n"
);
" emit={bytecode,native,viper} -- set the default code emitter\n"
);
impl_opts_cnt++;
printf(
" heapsize=<n> -- set the heap size for the GC (default %ld)\n"
, heap_size);
" heapsize=<n> -- set the heap size for the GC (default %ld)\n"
, heap_size);
impl_opts_cnt++;
if (impl_opts_cnt == 0) {
@ -162,9 +162,9 @@ MP_NOINLINE int main_(int argc, char **argv) {
gc_init(heap, heap + heap_size);
mp_init();
#ifdef _WIN32
#ifdef _WIN32
set_fmode_binary();
#endif
#endif
mp_obj_list_init(mp_sys_path, 0);
mp_obj_list_init(mp_sys_argv, 0);
@ -189,7 +189,8 @@ MP_NOINLINE int main_(int argc, char **argv) {
MP_STATE_VM(mp_optimise_value) = argv[a][2] & 0xf;
} else {
MP_STATE_VM(mp_optimise_value) = 0;
for (char *p = argv[a] + 1; *p && *p == 'O'; p++, MP_STATE_VM(mp_optimise_value)++);
for (char *p = argv[a] + 1; *p && *p == 'O'; p++, MP_STATE_VM(mp_optimise_value)++) {;
}
}
} else if (strcmp(argv[a], "-o") == 0) {
if (a + 1 >= argc) {
@ -264,6 +265,6 @@ void nlr_jump_fail(void *val) {
exit(1);
}
void serial_write(const char* text) {
void serial_write(const char *text) {
printf("%s", text);
}

View File

@ -68,45 +68,45 @@
// MINGW only handles these errno names.
#ifdef __MINGW32__
#define MICROPY_PY_UERRNO_LIST \
X(EPERM) \
X(ENOENT) \
X(ESRCH) \
X(EINTR) \
X(EIO) \
X(ENXIO) \
X(E2BIG) \
X(ENOEXEC) \
X(EBADF) \
X(ECHILD) \
X(EAGAIN) \
X(ENOMEM) \
X(EACCES) \
X(EFAULT) \
X(EBUSY) \
X(EEXIST) \
X(EXDEV) \
X(ENODEV) \
X(ENOTDIR) \
X(EISDIR) \
X(EINVAL) \
X(ENFILE) \
X(EMFILE) \
X(ENOTTY) \
X(EFBIG) \
X(ENOSPC) \
X(ESPIPE) \
X(EROFS) \
X(EMLINK) \
X(EPIPE) \
X(EDOM) \
X(ERANGE) \
X(EDEADLOCK) \
X(EDEADLK) \
X(ENAMETOOLONG) \
X(ENOLCK) \
X(ENOSYS) \
X(ENOTEMPTY) \
X(EILSEQ)
X(EPERM) \
X(ENOENT) \
X(ESRCH) \
X(EINTR) \
X(EIO) \
X(ENXIO) \
X(E2BIG) \
X(ENOEXEC) \
X(EBADF) \
X(ECHILD) \
X(EAGAIN) \
X(ENOMEM) \
X(EACCES) \
X(EFAULT) \
X(EBUSY) \
X(EEXIST) \
X(EXDEV) \
X(ENODEV) \
X(ENOTDIR) \
X(EISDIR) \
X(EINVAL) \
X(ENFILE) \
X(EMFILE) \
X(ENOTTY) \
X(EFBIG) \
X(ENOSPC) \
X(ESPIPE) \
X(EROFS) \
X(EMLINK) \
X(EPIPE) \
X(EDOM) \
X(ERANGE) \
X(EDEADLOCK) \
X(EDEADLK) \
X(ENAMETOOLONG) \
X(ENOLCK) \
X(ENOSYS) \
X(ENOTEMPTY) \
X(EILSEQ)
#endif
// type definitions for the specific machine
@ -114,7 +114,7 @@
#ifdef __LP64__
typedef long mp_int_t; // must be pointer size
typedef unsigned long mp_uint_t; // must be pointer size
#elif defined ( __MINGW32__ ) && defined( _WIN64 )
#elif defined(__MINGW32__) && defined(_WIN64)
#include <stdint.h>
typedef __int64 mp_int_t;
typedef unsigned __int64 mp_uint_t;
@ -141,7 +141,7 @@ typedef long mp_off_t;
// We need to provide a declaration/definition of alloca()
#ifdef __FreeBSD__
#include <stdlib.h>
#elif defined( _WIN32 )
#elif defined(_WIN32)
#include <malloc.h>
#else
#include <alloca.h>

View File

@ -93,8 +93,8 @@
#endif
// </h>
//<h> Generic Clock Generator Division
//<o> Generic clock generator 0 division <0x0000-0xFFFF>
// <h> Generic Clock Generator Division
// <o> Generic clock generator 0 division <0x0000-0xFFFF>
// <i>
// <id> gclk_gen_0_div
#ifndef CONF_GCLK_GEN_0_DIV
@ -177,8 +177,8 @@
#endif
// </h>
//<h> Generic Clock Generator Division
//<o> Generic clock generator 1 division <0x0000-0xFFFF>
// <h> Generic Clock Generator Division
// <o> Generic clock generator 1 division <0x0000-0xFFFF>
// <i>
// <id> gclk_gen_1_div
#ifndef CONF_GCLK_GEN_1_DIV
@ -263,8 +263,8 @@
#endif
// </h>
//<h> Generic Clock Generator Division
//<o> Generic clock generator 2 division <0x0000-0xFFFF>
// <h> Generic Clock Generator Division
// <o> Generic clock generator 2 division <0x0000-0xFFFF>
// <i>
// <id> gclk_gen_2_div
#ifndef CONF_GCLK_GEN_2_DIV
@ -349,8 +349,8 @@
#endif
// </h>
//<h> Generic Clock Generator Division
//<o> Generic clock generator 3 division <0x0000-0xFFFF>
// <h> Generic Clock Generator Division
// <o> Generic clock generator 3 division <0x0000-0xFFFF>
// <i>
// <id> gclk_gen_3_div
#ifndef CONF_GCLK_GEN_3_DIV
@ -435,8 +435,8 @@
#endif
// </h>
//<h> Generic Clock Generator Division
//<o> Generic clock generator 4 division <0x0000-0xFFFF>
// <h> Generic Clock Generator Division
// <o> Generic clock generator 4 division <0x0000-0xFFFF>
// <i>
// <id> gclk_gen_4_div
#ifndef CONF_GCLK_GEN_4_DIV
@ -521,8 +521,8 @@
#endif
// </h>
//<h> Generic Clock Generator Division
//<o> Generic clock generator 5 division <0x0000-0xFFFF>
// <h> Generic Clock Generator Division
// <o> Generic clock generator 5 division <0x0000-0xFFFF>
// <i>
// <id> gclk_gen_5_div
#ifndef CONF_GCLK_GEN_5_DIV
@ -607,8 +607,8 @@
#endif
// </h>
//<h> Generic Clock Generator Division
//<o> Generic clock generator 6 division <0x0000-0xFFFF>
// <h> Generic Clock Generator Division
// <o> Generic clock generator 6 division <0x0000-0xFFFF>
// <i>
// <id> gclk_gen_6_div
#ifndef CONF_GCLK_GEN_6_DIV
@ -693,8 +693,8 @@
#endif
// </h>
//<h> Generic Clock Generator Division
//<o> Generic clock generator 7 division <0x0000-0xFFFF>
// <h> Generic Clock Generator Division
// <o> Generic clock generator 7 division <0x0000-0xFFFF>
// <i>
// <id> gclk_gen_7_div
#ifndef CONF_GCLK_GEN_7_DIV

View File

@ -294,12 +294,12 @@
// BAUD: register value low [7:0]
// BAUDLOW: register value high [15:8], only used for odd BAUD + BAUDLOW
#define CONF_SERCOM_1_I2CM_BAUD_BAUDLOW \
(((CONF_GCLK_SERCOM1_CORE_FREQUENCY - (CONF_SERCOM_1_I2CM_BAUD * 10) \
- (CONF_SERCOM_1_I2CM_TRISE * (CONF_SERCOM_1_I2CM_BAUD / 100) * (CONF_GCLK_SERCOM1_CORE_FREQUENCY / 10000) \
/ 1000)) \
* 10 \
+ 5) \
/ (CONF_SERCOM_1_I2CM_BAUD * 10))
(((CONF_GCLK_SERCOM1_CORE_FREQUENCY - (CONF_SERCOM_1_I2CM_BAUD * 10) \
- (CONF_SERCOM_1_I2CM_TRISE * (CONF_SERCOM_1_I2CM_BAUD / 100) * (CONF_GCLK_SERCOM1_CORE_FREQUENCY / 10000) \
/ 1000)) \
* 10 \
+ 5) \
/ (CONF_SERCOM_1_I2CM_BAUD * 10))
#ifndef CONF_SERCOM_1_I2CM_BAUD_RATE
#if CONF_SERCOM_1_I2CM_BAUD_BAUDLOW > (0xFF * 2)
#warning Requested I2C baudrate too low, please check
@ -309,9 +309,9 @@
#define CONF_SERCOM_1_I2CM_BAUD_RATE 1
#else
#define CONF_SERCOM_1_I2CM_BAUD_RATE \
((CONF_SERCOM_1_I2CM_BAUD_BAUDLOW & 0x1) \
? (CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2) + ((CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2 + 1) << 8) \
: (CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2))
((CONF_SERCOM_1_I2CM_BAUD_BAUDLOW & 0x1) \
? (CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2) + ((CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2 + 1) << 8) \
: (CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2))
#endif
#endif
@ -506,7 +506,7 @@
#if CONF_SERCOM_2_USART_SAMPR == 0
#ifndef CONF_SERCOM_2_USART_BAUD_RATE
#define CONF_SERCOM_2_USART_BAUD_RATE \
65536 - ((65536 * 16.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY)
65536 - ((65536 * 16.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY)
#endif
#ifndef CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH
#define CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH 0
@ -514,7 +514,7 @@
#elif CONF_SERCOM_2_USART_SAMPR == 1
#ifndef CONF_SERCOM_2_USART_BAUD_RATE
#define CONF_SERCOM_2_USART_BAUD_RATE \
((CONF_GCLK_SERCOM2_CORE_FREQUENCY) / (CONF_SERCOM_2_USART_BAUD * 16)) - (CONF_SERCOM_2_USART_FRACTIONAL / 8)
((CONF_GCLK_SERCOM2_CORE_FREQUENCY) / (CONF_SERCOM_2_USART_BAUD * 16)) - (CONF_SERCOM_2_USART_FRACTIONAL / 8)
#endif
#ifndef CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH
#define CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH 0
@ -522,7 +522,7 @@
#elif CONF_SERCOM_2_USART_SAMPR == 2
#ifndef CONF_SERCOM_2_USART_BAUD_RATE
#define CONF_SERCOM_2_USART_BAUD_RATE \
65536 - ((65536 * 8.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY)
65536 - ((65536 * 8.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY)
#endif
#ifndef CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH
#define CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH 0
@ -530,7 +530,7 @@
#elif CONF_SERCOM_2_USART_SAMPR == 3
#ifndef CONF_SERCOM_2_USART_BAUD_RATE
#define CONF_SERCOM_2_USART_BAUD_RATE \
((CONF_GCLK_SERCOM2_CORE_FREQUENCY) / (CONF_SERCOM_2_USART_BAUD * 8)) - (CONF_SERCOM_2_USART_FRACTIONAL / 8)
((CONF_GCLK_SERCOM2_CORE_FREQUENCY) / (CONF_SERCOM_2_USART_BAUD * 8)) - (CONF_SERCOM_2_USART_FRACTIONAL / 8)
#endif
#ifndef CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH
#define CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH 0
@ -538,7 +538,7 @@
#elif CONF_SERCOM_2_USART_SAMPR == 4
#ifndef CONF_SERCOM_2_USART_BAUD_RATE
#define CONF_SERCOM_2_USART_BAUD_RATE \
65536 - ((65536 * 3.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY)
65536 - ((65536 * 3.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY)
#endif
#ifndef CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH
#define CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH 0
@ -552,9 +552,9 @@
#define CONF_SERCOM_3_SPI_ENABLE 1
#endif
//<o> SPI DMA TX Channel <0-32>
//<i> This defines DMA channel to be used
//<id> spi_master_dma_tx_channel
// <o> SPI DMA TX Channel <0-32>
// <i> This defines DMA channel to be used
// <id> spi_master_dma_tx_channel
#ifndef CONF_SERCOM_3_SPI_M_DMA_TX_CHANNEL
#define CONF_SERCOM_3_SPI_M_DMA_TX_CHANNEL 0
#endif
@ -565,9 +565,9 @@
#define CONF_SERCOM_3_SPI_RX_CHANNEL 1
#endif
//<o> DMA Channel <0-32>
//<i> This defines DMA channel to be used
//<id> spi_master_dma_rx_channel
// <o> DMA Channel <0-32>
// <i> This defines DMA channel to be used
// <id> spi_master_dma_rx_channel
#ifndef CONF_SERCOM_3_SPI_M_DMA_RX_CHANNEL
#define CONF_SERCOM_3_SPI_M_DMA_RX_CHANNEL 1
#endif

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