Merge branch 'main' into rp_dp_parallel

This commit is contained in:
Mark 2021-03-15 20:00:13 -05:00 committed by GitHub
commit e326d7ca80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1794 changed files with 32838 additions and 25471 deletions

View File

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

View File

@ -7,7 +7,6 @@ name: pre-commit
on: on:
pull_request: pull_request:
push: push:
branches: [main]
jobs: jobs:
pre-commit: pre-commit:
@ -16,10 +15,13 @@ jobs:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- uses: actions/setup-python@v1 - uses: actions/setup-python@v1
- name: Install deps - 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 - name: Populate selected submodules
run: git submodule update --init extmod/ulab 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())')" run: echo >>$GITHUB_ENV PY="$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')"
- uses: actions/cache@v2 - uses: actions/cache@v2
with: with:

View File

@ -11,3 +11,16 @@ repos:
exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*|ports/esp32s2/esp-idf-config/.*|ports/esp32s2/boards/.*/sdkconfig)' exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*|ports/esp32s2/esp-idf-config/.*|ports/esp32s2/boards/.*/sdkconfig)'
- id: trailing-whitespace - id: trailing-whitespace
exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*)' 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: sh -c "git diff --staged --name-only | xargs python3 tools/codeformat.py"
types_or: [c, python]
language: system

View File

@ -123,8 +123,7 @@ STATIC void send_error(uint16_t conn_handle, uint8_t opcode, uint16_t handle, ui
.code = BT_ATT_OP_ERROR_RSP, .code = BT_ATT_OP_ERROR_RSP,
}, { }, {
.request = opcode, .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);
} }
@ -580,7 +579,7 @@ bool att_is_connected(void) {
} }
bool att_address_is_connected(bt_addr_le_t *addr) { 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) { bool att_handle_is_connected(uint16_t handle) {
@ -624,7 +623,7 @@ bool att_disconnect_all(void) {
bleio_connections[i].mtu = BT_ATT_DEFAULT_LE_MTU; 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) {
@ -644,7 +643,8 @@ bool att_notify(uint16_t handle, const uint8_t* value, int length) {
uint8_t notify_bytes[sizeof(notify_t) + allowed_length]; uint8_t notify_bytes[sizeof(notify_t) + allowed_length];
notify_t *notify = (notify_t *)notify_bytes; notify_t *notify = (notify_t *)notify_bytes;
notify->hdr.code = BT_ATT_OP_NOTIFY;; notify->hdr.code = BT_ATT_OP_NOTIFY;
;
notify->ntf.handle = handle; notify->ntf.handle = handle;
memcpy(notify->ntf.value, value, allowed_length); memcpy(notify->ntf.value, value, allowed_length);
hci_send_acl_pkt(bleio_connections[i].conn_handle, BT_L2CAP_CID_ATT, hci_send_acl_pkt(bleio_connections[i].conn_handle, BT_L2CAP_CID_ATT,
@ -653,7 +653,7 @@ bool att_notify(uint16_t handle, const uint8_t* value, int length) {
num_notifications++; 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) {
@ -673,7 +673,8 @@ bool att_indicate(uint16_t handle, const uint8_t* value, int length) {
uint8_t indicate_bytes[sizeof(indicate_t) + allowed_length]; uint8_t indicate_bytes[sizeof(indicate_t) + allowed_length];
indicate_t *indicate = (indicate_t *)indicate_bytes; indicate_t *indicate = (indicate_t *)indicate_bytes;
indicate->hdr.code = BT_ATT_OP_INDICATE;; indicate->hdr.code = BT_ATT_OP_INDICATE;
;
indicate->ind.handle = handle; indicate->ind.handle = handle;
memcpy(indicate->ind.value, value, allowed_length); memcpy(indicate->ind.value, value, allowed_length);
@ -694,7 +695,7 @@ bool att_indicate(uint16_t handle, const uint8_t* value, int length) {
num_indications++; num_indications++;
} }
return (num_indications > 0); return num_indications > 0;
} }
STATIC void process_error(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) { STATIC void process_error(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) {
@ -741,8 +742,7 @@ STATIC void process_mtu_req(uint16_t conn_handle, uint8_t dlen, uint8_t data[])
.code = BT_ATT_OP_MTU_RSP, .code = BT_ATT_OP_MTU_RSP,
}, { }, {
.mtu = mtu, .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);
} }
@ -865,8 +865,7 @@ int att_find_info_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_
}, { }, {
.start_handle = start_handle, .start_handle = start_handle,
.end_handle = end_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);
} }
@ -1585,8 +1584,7 @@ int att_read_req(uint16_t conn_handle, uint16_t handle, uint8_t response_buffer[
.code = BT_ATT_OP_READ_REQ, .code = BT_ATT_OP_READ_REQ,
}, { }, {
.handle = handle, .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);
} }

View File

@ -167,8 +167,7 @@ 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[]) 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; h4_hci_evt_pkt_t *pkt = (h4_hci_evt_pkt_t *)pkt_data;
switch (pkt->evt) { switch (pkt->evt) {

View File

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

View File

@ -45,23 +45,19 @@ typedef struct {
#define BT_ADDR_LE_NONE ((bt_addr_le_t[]) { { 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) static inline int bt_addr_cmp(const bt_addr_t *a, const bt_addr_t *b) {
{
return memcmp(a, b, sizeof(*a)); 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) 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)); return memcmp(a, b, sizeof(*a));
} }
static inline void bt_addr_copy(bt_addr_t *dst, const bt_addr_t *src) static inline void bt_addr_copy(bt_addr_t *dst, const bt_addr_t *src) {
{
memcpy(dst, src, sizeof(*dst)); memcpy(dst, src, sizeof(*dst));
} }
static inline void bt_addr_le_copy(bt_addr_le_t *dst, const bt_addr_le_t *src) static inline void bt_addr_le_copy(bt_addr_le_t *dst, const bt_addr_le_t *src) {
{
memcpy(dst, src, sizeof(*dst)); memcpy(dst, src, sizeof(*dst));
} }
@ -76,8 +72,7 @@ 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_nrpa(bt_addr_le_t *addr);
int bt_addr_le_create_static(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) static inline bool bt_addr_le_is_rpa(const bt_addr_le_t *addr) {
{
if (addr->type != BT_ADDR_LE_RANDOM) { if (addr->type != BT_ADDR_LE_RANDOM) {
return false; return false;
} }
@ -85,8 +80,7 @@ static inline bool bt_addr_le_is_rpa(const bt_addr_le_t *addr)
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) static inline bool bt_addr_le_is_identity(const bt_addr_le_t *addr) {
{
if (addr->type == BT_ADDR_LE_PUBLIC) { if (addr->type == BT_ADDR_LE_PUBLIC) {
return true; return true;
} }

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); uintptr_t addr = MICROPY_MACHINE_MEM_GET_READ_ADDR(index, self->elem_size);
uint32_t val; uint32_t val;
switch (self->elem_size) { switch (self->elem_size) {
case 1: val = (*(uint8_t*)addr); break; case 1:
case 2: val = (*(uint16_t*)addr); break; val = (*(uint8_t *)addr);
default: val = (*(uint32_t*)addr); break; break;
case 2:
val = (*(uint16_t *)addr);
break;
default:
val = (*(uint32_t *)addr);
break;
} }
return mp_obj_new_int(val); return mp_obj_new_int(val);
} else { } 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); uintptr_t addr = MICROPY_MACHINE_MEM_GET_WRITE_ADDR(index, self->elem_size);
uint32_t val = mp_obj_get_int_truncated(value); uint32_t val = mp_obj_get_int_truncated(value);
switch (self->elem_size) { switch (self->elem_size) {
case 1: (*(uint8_t*)addr) = val; break; case 1:
case 2: (*(uint16_t*)addr) = val; break; (*(uint8_t *)addr) = val;
default: (*(uint32_t*)addr) = val; break; break;
case 2:
(*(uint16_t *)addr) = val;
break;
default:
(*(uint32_t *)addr) = val;
break;
} }
return mp_const_none; return mp_const_none;
} }

View File

@ -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); pin = MICROPY_PY_MACHINE_PIN_MAKE_NEW(NULL, n_args, n_kw, pin_args);
mp_local_free(pin_args); mp_local_free(pin_args);
} } else
else
#endif #endif
// Otherwise there should be 1 or 2 args // Otherwise there should be 1 or 2 args
{ {

View File

@ -423,9 +423,15 @@ STATIC mp_obj_t framebuf_line(size_t n_args, const mp_obj_t *args) {
bool steep; bool steep;
if (dy > dx) { if (dy > dx) {
mp_int_t temp; mp_int_t temp;
temp = x1; x1 = y1; y1 = temp; temp = x1;
temp = dx; dx = dy; dy = temp; x1 = y1;
temp = sx; sx = sy; sy = temp; y1 = temp;
temp = dx;
dx = dy;
dy = temp;
temp = sx;
sx = sy;
sy = temp;
steep = true; steep = true;
} else { } else {
steep = false; steep = false;

View File

@ -337,8 +337,7 @@ 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 // "Poll" (idle) callback to be called ASAP after accept callback
// to execute Python callback function, as it can't be executed // to execute Python callback function, as it can't be executed
// from accept callback itself. // from accept callback itself.
STATIC err_t _lwip_tcp_accept_finished(void *arg, struct tcp_pcb *pcb) STATIC err_t _lwip_tcp_accept_finished(void *arg, struct tcp_pcb *pcb) {
{
lwip_socket_obj_t *socket = (lwip_socket_obj_t *)arg; lwip_socket_obj_t *socket = (lwip_socket_obj_t *)arg;
tcp_poll(pcb, NULL, 0); tcp_poll(pcb, NULL, 0);
exec_user_callback(socket); exec_user_callback(socket);
@ -443,7 +442,9 @@ STATIC mp_uint_t lwip_udp_receive(lwip_socket_obj_t *socket, byte *buf, mp_uint_
if (socket->timeout != -1) { if (socket->timeout != -1) {
for (mp_uint_t retries = socket->timeout / 100; retries--;) { for (mp_uint_t retries = socket->timeout / 100; retries--;) {
mp_hal_delay_ms(100); mp_hal_delay_ms(100);
if (socket->incoming.pbuf != NULL) break; if (socket->incoming.pbuf != NULL) {
break;
}
} }
if (socket->incoming.pbuf == NULL) { if (socket->incoming.pbuf == NULL) {
*_errno = MP_ETIMEDOUT; *_errno = MP_ETIMEDOUT;
@ -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) { switch (socket->type) {
case MOD_NETWORK_SOCK_STREAM: socket->pcb.tcp = tcp_new(); break; case MOD_NETWORK_SOCK_STREAM:
case MOD_NETWORK_SOCK_DGRAM: socket->pcb.udp = udp_new(); break; 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; // case MOD_NETWORK_SOCK_RAW: socket->pcb.raw = raw_new(); break;
default: mp_raise_OSError(MP_EINVAL); default:
mp_raise_OSError(MP_EINVAL);
} }
if (socket->pcb.tcp == NULL) { if (socket->pcb.tcp == NULL) {
@ -731,7 +737,9 @@ STATIC mp_obj_t lwip_socket_accept(mp_obj_t self_in) {
} else if (socket->timeout != -1) { } else if (socket->timeout != -1) {
for (mp_uint_t retries = socket->timeout / 100; retries--;) { for (mp_uint_t retries = socket->timeout / 100; retries--;) {
mp_hal_delay_ms(100); mp_hal_delay_ms(100);
if (socket->incoming.connection != NULL) break; if (socket->incoming.connection != NULL) {
break;
}
} }
if (socket->incoming.connection == NULL) { if (socket->incoming.connection == NULL) {
mp_raise_OSError(MP_ETIMEDOUT); mp_raise_OSError(MP_ETIMEDOUT);
@ -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) { if (socket->timeout != -1) {
for (mp_uint_t retries = socket->timeout / 100; retries--;) { for (mp_uint_t retries = socket->timeout / 100; retries--;) {
mp_hal_delay_ms(100); mp_hal_delay_ms(100);
if (socket->state != STATE_CONNECTING) break; if (socket->state != STATE_CONNECTING) {
break;
}
} }
if (socket->state == STATE_CONNECTING) { if (socket->state == STATE_CONNECTING) {
mp_raise_OSError(MP_EINPROGRESS); mp_raise_OSError(MP_EINPROGRESS);
@ -1192,7 +1202,9 @@ STATIC mp_uint_t lwip_socket_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_
} }
break; break;
} }
case MOD_NETWORK_SOCK_DGRAM: udp_remove(socket->pcb.udp); 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_RAW: raw_remove(socket->pcb.raw); break;
} }
socket->pcb.tcp = NULL; socket->pcb.tcp = NULL;

View File

@ -175,8 +175,7 @@ mp_obj_t mod_binascii_b2a_base64(mp_obj_t data) {
if (i == 2) { if (i == 2) {
*out++ = (in[0] & 0x03) << 4 | (in[1] & 0xF0) >> 4; *out++ = (in[0] & 0x03) << 4 | (in[1] & 0xF0) >> 4;
*out++ = (in[1] & 0x0F) << 2; *out++ = (in[1] & 0x0F) << 2;
} } else {
else {
*out++ = (in[0] & 0x03) << 4; *out++ = (in[0] & 0x03) << 4;
*out++ = 64; *out++ = 64;
} }

View File

@ -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]); mp_int_t offset = MP_OBJ_SMALL_INT_VALUE(t->items[0]);
uint agg_type = GET_TYPE(offset, AGG_TYPE_BITS); uint agg_type = GET_TYPE(offset, AGG_TYPE_BITS);
switch (agg_type) { switch (agg_type) {
case PTR: typen = "PTR"; break; case PTR:
case ARRAY: typen = "ARRAY"; break; typen = "PTR";
break;
case ARRAY:
typen = "ARRAY";
break;
} }
} else { } else {
typen = "ERROR"; typen = "ERROR";
@ -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) { static inline void set_aligned_basic(uint val_type, void *p, mp_uint_t v) {
switch (val_type) { switch (val_type) {
case UINT8: case UINT8:
*(uint8_t*)p = (uint8_t)v; return; *(uint8_t *)p = (uint8_t)v;
return;
case UINT16: case UINT16:
*(uint16_t*)p = (uint16_t)v; return; *(uint16_t *)p = (uint16_t)v;
return;
case UINT32: case UINT32:
*(uint32_t*)p = (uint32_t)v; return; *(uint32_t *)p = (uint32_t)v;
return;
} }
assert(0); assert(0);
} }
@ -343,17 +350,23 @@ 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); mp_int_t v = mp_obj_get_int_truncated(val);
switch (val_type) { switch (val_type) {
case UINT8: case UINT8:
((uint8_t*)p)[index] = (uint8_t)v; return; ((uint8_t *)p)[index] = (uint8_t)v;
return;
case INT8: case INT8:
((int8_t*)p)[index] = (int8_t)v; return; ((int8_t *)p)[index] = (int8_t)v;
return;
case UINT16: case UINT16:
((uint16_t*)p)[index] = (uint16_t)v; return; ((uint16_t *)p)[index] = (uint16_t)v;
return;
case INT16: case INT16:
((int16_t*)p)[index] = (int16_t)v; return; ((int16_t *)p)[index] = (int16_t)v;
return;
case UINT32: case UINT32:
((uint32_t*)p)[index] = (uint32_t)v; return; ((uint32_t *)p)[index] = (uint32_t)v;
return;
case INT32: case INT32:
((int32_t*)p)[index] = (int32_t)v; return; ((int32_t *)p)[index] = (int32_t)v;
return;
case INT64: case INT64:
case UINT64: case UINT64:
if (sizeof(mp_int_t) == 8) { if (sizeof(mp_int_t) == 8) {

View File

@ -186,11 +186,21 @@ STATIC mp_obj_t _mod_ujson_load(mp_obj_t stream_obj, bool return_first_json) {
if (c == '\\') { if (c == '\\') {
c = S_NEXT(s); c = S_NEXT(s);
switch (c) { switch (c) {
case 'b': c = 0x08; break; case 'b':
case 'f': c = 0x0c; break; c = 0x08;
case 'n': c = 0x0a; break; break;
case 'r': c = 0x0d; break; case 'f':
case 't': c = 0x09; break; c = 0x0c;
break;
case 'n':
c = 0x0a;
break;
case 'r':
c = 0x0d;
break;
case 't':
c = 0x09;
break;
case 'u': { case 'u': {
mp_uint_t num = 0; mp_uint_t num = 0;
for (int i = 0; i < 4; i++) { 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); next = mp_obj_new_str(vstr.buf, vstr.len);
break; break;
case '-': 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; bool flt = false;
vstr_reset(&vstr); vstr_reset(&vstr);
for (;;) { for (;;) {

View File

@ -18,15 +18,14 @@
STATIC uint32_t yasmarang_pad = 0xeda4baba, yasmarang_n = 69, yasmarang_d = 233; STATIC uint32_t yasmarang_pad = 0xeda4baba, yasmarang_n = 69, yasmarang_d = 233;
STATIC uint8_t yasmarang_dat = 0; STATIC uint8_t yasmarang_dat = 0;
STATIC uint32_t yasmarang(void) STATIC uint32_t yasmarang(void) {
{
yasmarang_pad += yasmarang_dat + yasmarang_d * yasmarang_n; yasmarang_pad += yasmarang_dat + yasmarang_d * yasmarang_n;
yasmarang_pad = (yasmarang_pad << 3) + (yasmarang_pad >> 29); yasmarang_pad = (yasmarang_pad << 3) + (yasmarang_pad >> 29);
yasmarang_n = yasmarang_pad | 2; yasmarang_n = yasmarang_pad | 2;
yasmarang_d ^= (yasmarang_pad << 31) + (yasmarang_pad >> 1); yasmarang_d ^= (yasmarang_pad << 31) + (yasmarang_pad >> 1);
yasmarang_dat ^= (char)yasmarang_pad ^ (yasmarang_d >> 8) ^ 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 */ } /* yasmarang */
// End of Yasmarang // End of Yasmarang
@ -148,9 +147,11 @@ STATIC mp_float_t yasmarang_float(void) {
union { union {
mp_float_t f; mp_float_t f;
#if MP_ENDIANNESS_LITTLE #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 #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 #endif
} u; } u;
u.p.sgn = 0; u.p.sgn = 0;

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) { 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); mp_obj_utimeq_t *self = MP_OBJ_TO_PTR(self_in);
switch (op) { switch (op) {
case MP_UNARY_OP_BOOL: return mp_obj_new_bool(self->len != 0); case MP_UNARY_OP_BOOL:
case MP_UNARY_OP_LEN: return MP_OBJ_NEW_SMALL_INT(self->len); return mp_obj_new_bool(self->len != 0);
default: return MP_OBJ_NULL; // op not supported case MP_UNARY_OP_LEN:
return MP_OBJ_NEW_SMALL_INT(self->len);
default:
return MP_OBJ_NULL; // op not supported
} }
} }

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

View File

@ -34,12 +34,11 @@ STATIC fs_user_mount_t *disk_get_device(void *bdev) {
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
DRESULT disk_read( DRESULT disk_read(
bdev_t pdrv, /* Physical drive nmuber (0..) */ bdev_t pdrv, /* Physical drive */
BYTE *buff, /* Data buffer to store read data */ BYTE *buff, /* Data buffer to store read data */
DWORD sector, /* Sector address (LBA) */ DWORD sector, /* Sector address (LBA) */
UINT count /* Number of sectors to read (1..128) */ UINT count /* Number of sectors to read (1..128) */
) ) {
{
fs_user_mount_t *vfs = disk_get_device(pdrv); fs_user_mount_t *vfs = disk_get_device(pdrv);
if (vfs == NULL) { if (vfs == NULL) {
return RES_PARERR; return RES_PARERR;
@ -75,12 +74,11 @@ DRESULT disk_read (
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
DRESULT disk_write( DRESULT disk_write(
bdev_t pdrv, /* Physical drive nmuber (0..) */ bdev_t pdrv, /* Physical drive */
const BYTE *buff, /* Data to be written */ const BYTE *buff, /* Data to be written */
DWORD sector, /* Sector address (LBA) */ DWORD sector, /* Sector address (LBA) */
UINT count /* Number of sectors to write (1..128) */ UINT count /* Number of sectors to write (1..128) */
) ) {
{
fs_user_mount_t *vfs = disk_get_device(pdrv); fs_user_mount_t *vfs = disk_get_device(pdrv);
if (vfs == NULL) { if (vfs == NULL) {
return RES_PARERR; return RES_PARERR;
@ -122,11 +120,10 @@ DRESULT disk_write (
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
DRESULT disk_ioctl( DRESULT disk_ioctl(
bdev_t pdrv, /* Physical drive nmuber (0..) */ bdev_t pdrv, /* Physical drive */
BYTE cmd, /* Control code */ BYTE cmd, /* Control code */
void *buff /* Buffer to send/receive control data */ void *buff /* Buffer to send/receive control data */
) ) {
{
fs_user_mount_t *vfs = disk_get_device(pdrv); fs_user_mount_t *vfs = disk_get_device(pdrv);
if (vfs == NULL) { if (vfs == NULL) {
return RES_PARERR; return RES_PARERR;

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

View File

@ -3695,7 +3695,7 @@ msgstr ""
msgid "out of range of source" msgid "out of range of source"
msgstr "" msgstr ""
#: shared-bindings/displayio/Bitmap.c #: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c
msgid "out of range of target" msgid "out of range of target"
msgstr "" msgstr ""

View File

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

View File

@ -3646,7 +3646,7 @@ msgstr ""
msgid "out of range of source" msgid "out of range of source"
msgstr "" msgstr ""
#: shared-bindings/displayio/Bitmap.c #: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c
msgid "out of range of target" msgid "out of range of target"
msgstr "" msgstr ""

View File

@ -3732,7 +3732,7 @@ msgstr ""
msgid "out of range of source" msgid "out of range of source"
msgstr "Außerhalb des Bereichs der Quelle" msgstr "Außerhalb des Bereichs der Quelle"
#: shared-bindings/displayio/Bitmap.c #: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c
msgid "out of range of target" msgid "out of range of target"
msgstr "Außerhalb des Bereichs des Ziels" msgstr "Außerhalb des Bereichs des Ziels"

View File

@ -3643,7 +3643,7 @@ msgstr ""
msgid "out of range of source" msgid "out of range of source"
msgstr "" msgstr ""
#: shared-bindings/displayio/Bitmap.c #: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c
msgid "out of range of target" msgid "out of range of target"
msgstr "" msgstr ""

View File

@ -3642,7 +3642,7 @@ msgstr ""
msgid "out of range of source" msgid "out of range of source"
msgstr "" msgstr ""
#: shared-bindings/displayio/Bitmap.c #: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c
msgid "out of range of target" msgid "out of range of target"
msgstr "" msgstr ""

View File

@ -8,15 +8,15 @@ msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n" "POT-Creation-Date: 2021-01-04 12:55-0600\n"
"PO-Revision-Date: 2021-03-07 15:50+0000\n" "PO-Revision-Date: 2021-03-12 02:03+0000\n"
"Last-Translator: Jose David M <jquintana202020@gmail.com>\n" "Last-Translator: Alvaro Figueroa <alvaro@greencore.co.cr>\n"
"Language-Team: \n" "Language-Team: \n"
"Language: es\n" "Language: es\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n" "Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.5.1\n" "X-Generator: Weblate 4.5.2-dev\n"
#: main.c #: main.c
msgid "" msgid ""
@ -1836,7 +1836,7 @@ msgstr ""
#: ports/raspberrypi/common-hal/rotaryio/IncrementalEncoder.c #: ports/raspberrypi/common-hal/rotaryio/IncrementalEncoder.c
msgid "Pins must be sequential" msgid "Pins must be sequential"
msgstr "" msgstr "Los pines deben estar en orden secuencial"
#: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c
msgid "Pins must share PWM slice" msgid "Pins must share PWM slice"
@ -2142,11 +2142,10 @@ msgid ""
"enough power for the whole circuit and press reset (after ejecting " "enough power for the whole circuit and press reset (after ejecting "
"CIRCUITPY).\n" "CIRCUITPY).\n"
msgstr "" msgstr ""
"La alimentación del microntrolador cayó. Asegúrate que tu fuente de " "La alimentación del microntrolador bajó. Asegúrate que tu fuente de "
"alimentación\n" "alimentación\n"
"pueda aportar suficiente energía para todo el circuito y presiona reset " "pueda aportar suficiente energía para todo el circuito y presiona reset "
"(luego de\n" "(luego de expulsar CIRCUITPY)\n"
"expulsar CIRCUITPY)\n"
#: shared-module/audiomixer/MixerVoice.c #: shared-module/audiomixer/MixerVoice.c
msgid "The sample's bits_per_sample does not match the mixer's" msgid "The sample's bits_per_sample does not match the mixer's"
@ -2818,7 +2817,7 @@ msgstr "circulo solo puede ser registrado con un pariente"
#: shared-bindings/bitmaptools/__init__.c #: shared-bindings/bitmaptools/__init__.c
msgid "clip point must be (x,y) tuple" msgid "clip point must be (x,y) tuple"
msgstr "El punto clip debe ser una tupla (x, y)" msgstr "El punto de recorte debe ser una tupla (x, y)"
#: shared-bindings/msgpack/ExtType.c #: shared-bindings/msgpack/ExtType.c
msgid "code outside range 0~127" msgid "code outside range 0~127"
@ -3740,7 +3739,7 @@ msgstr "ord() espera un carácter, pero encontró un string de longitud %d"
msgid "out of range of source" msgid "out of range of source"
msgstr "fuera de rango de fuente" msgstr "fuera de rango de fuente"
#: shared-bindings/displayio/Bitmap.c #: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c
msgid "out of range of target" msgid "out of range of target"
msgstr "fuera de rango del objetivo" msgstr "fuera de rango del objetivo"
@ -3842,7 +3841,7 @@ msgstr "presionando ambos botones al inicio.\n"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "pull masks conflict with direction masks" msgid "pull masks conflict with direction masks"
msgstr "" msgstr "máscara de pull en conflicto con máscara de dirección"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c #: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "pull_threshold must be between 1 and 32" msgid "pull_threshold must be between 1 and 32"

View File

@ -3691,7 +3691,7 @@ msgstr "ord() umaasa ng character pero string ng %d haba ang nakita"
msgid "out of range of source" msgid "out of range of source"
msgstr "" msgstr ""
#: shared-bindings/displayio/Bitmap.c #: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c
msgid "out of range of target" msgid "out of range of target"
msgstr "" msgstr ""

View File

@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: 0.1\n" "Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\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-14 23:02+0000\n"
"Last-Translator: Hugo Dahl <hugo@code-jedi.com>\n" "Last-Translator: Hugo Dahl <hugo@code-jedi.com>\n"
"Language: fr\n" "Language: fr\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n" "Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\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 #: main.c
msgid "" msgid ""
@ -358,7 +358,7 @@ msgstr "Tous les automates finis sont utilisés"
#: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "All sync event channels in use" msgid "All sync event channels in use"
msgstr "Tous les canaux d'événements sync (sync event channels) sont utilisés" msgstr "Tout canaux d'événements sync (sync event channels) sont utilisés"
#: shared-bindings/pwmio/PWMOut.c #: shared-bindings/pwmio/PWMOut.c
msgid "All timers for this pin are in use" msgid "All timers for this pin are in use"
@ -3760,7 +3760,7 @@ msgstr ""
msgid "out of range of source" msgid "out of range of source"
msgstr "dépassement des bornes de source" msgstr "dépassement des bornes de source"
#: shared-bindings/displayio/Bitmap.c #: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c
msgid "out of range of target" msgid "out of range of target"
msgstr "dépassement des bornes de target" msgstr "dépassement des bornes de target"

View File

@ -3643,7 +3643,7 @@ msgstr ""
msgid "out of range of source" msgid "out of range of source"
msgstr "" msgstr ""
#: shared-bindings/displayio/Bitmap.c #: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c
msgid "out of range of target" msgid "out of range of target"
msgstr "" msgstr ""

View File

@ -3707,7 +3707,7 @@ msgstr ""
msgid "out of range of source" msgid "out of range of source"
msgstr "" msgstr ""
#: shared-bindings/displayio/Bitmap.c #: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c
msgid "out of range of target" msgid "out of range of target"
msgstr "" msgstr ""

View File

@ -3671,7 +3671,7 @@ msgstr "ord()は1文字を要求しますが、長さ %d の文字列が与え
msgid "out of range of source" msgid "out of range of source"
msgstr "ソースが範囲外" msgstr "ソースが範囲外"
#: shared-bindings/displayio/Bitmap.c #: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c
msgid "out of range of target" msgid "out of range of target"
msgstr "" msgstr ""

View File

@ -3647,7 +3647,7 @@ msgstr ""
msgid "out of range of source" msgid "out of range of source"
msgstr "" msgstr ""
#: shared-bindings/displayio/Bitmap.c #: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c
msgid "out of range of target" msgid "out of range of target"
msgstr "" msgstr ""

View File

@ -3704,7 +3704,7 @@ msgstr "ord() verwacht een teken (char) maar vond een string van lengte %d"
msgid "out of range of source" msgid "out of range of source"
msgstr "buiten bereik van bron" msgstr "buiten bereik van bron"
#: shared-bindings/displayio/Bitmap.c #: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c
msgid "out of range of target" msgid "out of range of target"
msgstr "buiten bereik van doel" msgstr "buiten bereik van doel"

View File

@ -3664,7 +3664,7 @@ msgstr "ord() oczekuje znaku, a jest łańcuch od długości %d"
msgid "out of range of source" msgid "out of range of source"
msgstr "" msgstr ""
#: shared-bindings/displayio/Bitmap.c #: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c
msgid "out of range of target" msgid "out of range of target"
msgstr "" msgstr ""

View File

@ -3749,7 +3749,7 @@ msgstr ""
msgid "out of range of source" msgid "out of range of source"
msgstr "fora do alcance da fonte" msgstr "fora do alcance da fonte"
#: shared-bindings/displayio/Bitmap.c #: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c
msgid "out of range of target" msgid "out of range of target"
msgstr "fora do alcance do alvo" msgstr "fora do alcance do alvo"

View File

@ -3707,7 +3707,7 @@ msgstr "ord() förväntade sig ett tecken, men en sträng med längden %d hittad
msgid "out of range of source" msgid "out of range of source"
msgstr "utanför räckvidd för source" msgstr "utanför räckvidd för source"
#: shared-bindings/displayio/Bitmap.c #: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c
msgid "out of range of target" msgid "out of range of target"
msgstr "utanför räckvidd för target" msgstr "utanför räckvidd för target"

View File

@ -3704,7 +3704,7 @@ msgstr "ord() yùqí zìfú, dàn chángdù zìfú chuàn %d"
msgid "out of range of source" msgid "out of range of source"
msgstr "yuán fàn wéi wài" msgstr "yuán fàn wéi wài"
#: shared-bindings/displayio/Bitmap.c #: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c
msgid "out of range of target" msgid "out of range of target"
msgstr "mù biāo fàn wéi wài" msgstr "mù biāo fàn wéi wài"

View File

@ -189,7 +189,8 @@ MP_NOINLINE int main_(int argc, char **argv) {
MP_STATE_VM(mp_optimise_value) = argv[a][2] & 0xf; MP_STATE_VM(mp_optimise_value) = argv[a][2] & 0xf;
} else { } else {
MP_STATE_VM(mp_optimise_value) = 0; 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) { } else if (strcmp(argv[a], "-o") == 0) {
if (a + 1 >= argc) { if (a + 1 >= argc) {

View File

@ -64,14 +64,16 @@ void audio_dma_free_channel(uint8_t channel) {
} }
void audio_dma_disable_channel(uint8_t channel) { void audio_dma_disable_channel(uint8_t channel) {
if (channel >= AUDIO_DMA_CHANNEL_COUNT) if (channel >= AUDIO_DMA_CHANNEL_COUNT) {
return; return;
}
dma_disable_channel(channel); dma_disable_channel(channel);
} }
void audio_dma_enable_channel(uint8_t channel) { void audio_dma_enable_channel(uint8_t channel) {
if (channel >= AUDIO_DMA_CHANNEL_COUNT) if (channel >= AUDIO_DMA_CHANNEL_COUNT) {
return; return;
}
dma_enable_channel(channel); dma_enable_channel(channel);
} }
@ -375,13 +377,25 @@ void evsyshandler_common(void) {
} }
#ifdef SAM_D5X_E5X #ifdef SAM_D5X_E5X
void EVSYS_0_Handler(void) { evsyshandler_common(); } void EVSYS_0_Handler(void) {
void EVSYS_1_Handler(void) { evsyshandler_common(); } evsyshandler_common();
void EVSYS_2_Handler(void) { evsyshandler_common(); } }
void EVSYS_3_Handler(void) { evsyshandler_common(); } void EVSYS_1_Handler(void) {
void EVSYS_4_Handler(void) { evsyshandler_common(); } evsyshandler_common();
}
void EVSYS_2_Handler(void) {
evsyshandler_common();
}
void EVSYS_3_Handler(void) {
evsyshandler_common();
}
void EVSYS_4_Handler(void) {
evsyshandler_common();
}
#else #else
void EVSYS_Handler(void) { evsyshandler_common(); } void EVSYS_Handler(void) {
evsyshandler_common();
}
#endif #endif
#endif #endif

View File

@ -52,8 +52,11 @@ void port_finish_background_task(void) {
REG_PORT_OUTCLR1 = (1 << 3); REG_PORT_OUTCLR1 = (1 << 3);
} }
#else #else
void port_start_background_task(void) {} void port_start_background_task(void) {
void port_finish_background_task(void) {} }
void port_finish_background_task(void) {
}
#endif #endif
void port_background_task(void) {} void port_background_task(void) {
}

View File

@ -57,8 +57,7 @@ const mp_obj_property_t samd_clock_enabled_obj = {
.base.type = &mp_type_property, .base.type = &mp_type_property,
.proxy = {(mp_obj_t)&samd_clock_get_enabled_obj, .proxy = {(mp_obj_t)&samd_clock_get_enabled_obj,
(mp_obj_t)&mp_const_none_obj, (mp_obj_t)&mp_const_none_obj,
(mp_obj_t)&mp_const_none_obj, (mp_obj_t)&mp_const_none_obj,},
},
}; };
//| parent: Union[Clock, None] //| parent: Union[Clock, None]
@ -67,15 +66,17 @@ const mp_obj_property_t samd_clock_enabled_obj = {
STATIC mp_obj_t samd_clock_get_parent(mp_obj_t self_in) { STATIC mp_obj_t samd_clock_get_parent(mp_obj_t self_in) {
samd_clock_obj_t *self = MP_OBJ_TO_PTR(self_in); samd_clock_obj_t *self = MP_OBJ_TO_PTR(self_in);
uint8_t p_type, p_index; uint8_t p_type, p_index;
if (!clock_get_parent(self->type, self->index, &p_type, &p_index)) if (!clock_get_parent(self->type, self->index, &p_type, &p_index)) {
return mp_const_none; return mp_const_none;
}
const mp_map_t *samd_map = &samd_clock_globals.map; const mp_map_t *samd_map = &samd_clock_globals.map;
for (uint8_t i = 0; i < samd_map->alloc; i++) { for (uint8_t i = 0; i < samd_map->alloc; i++) {
samd_clock_obj_t *iter = samd_map->table[i].value; samd_clock_obj_t *iter = samd_map->table[i].value;
if (iter->type == p_type && iter->index == p_index) if (iter->type == p_type && iter->index == p_index) {
return iter; return iter;
} }
}
return mp_const_none; return mp_const_none;
} }
@ -85,8 +86,7 @@ const mp_obj_property_t samd_clock_parent_obj = {
.base.type = &mp_type_property, .base.type = &mp_type_property,
.proxy = {(mp_obj_t)&samd_clock_get_parent_obj, .proxy = {(mp_obj_t)&samd_clock_get_parent_obj,
(mp_obj_t)&mp_const_none_obj, (mp_obj_t)&mp_const_none_obj,
(mp_obj_t)&mp_const_none_obj, (mp_obj_t)&mp_const_none_obj,},
},
}; };
//| frequency: int //| frequency: int
@ -103,8 +103,7 @@ const mp_obj_property_t samd_clock_frequency_obj = {
.base.type = &mp_type_property, .base.type = &mp_type_property,
.proxy = {(mp_obj_t)&samd_clock_get_frequency_obj, .proxy = {(mp_obj_t)&samd_clock_get_frequency_obj,
(mp_obj_t)&mp_const_none_obj, (mp_obj_t)&mp_const_none_obj,
(mp_obj_t)&mp_const_none_obj, (mp_obj_t)&mp_const_none_obj,},
},
}; };
//| calibration: int //| calibration: int
@ -120,10 +119,12 @@ MP_DEFINE_CONST_FUN_OBJ_1(samd_clock_get_calibration_obj, samd_clock_get_calibra
STATIC mp_obj_t samd_clock_set_calibration(mp_obj_t self_in, mp_obj_t calibration) { STATIC mp_obj_t samd_clock_set_calibration(mp_obj_t self_in, mp_obj_t calibration) {
samd_clock_obj_t *self = MP_OBJ_TO_PTR(self_in); samd_clock_obj_t *self = MP_OBJ_TO_PTR(self_in);
int ret = clock_set_calibration(self->type, self->index, mp_obj_get_int(calibration)); int ret = clock_set_calibration(self->type, self->index, mp_obj_get_int(calibration));
if (ret == -2) if (ret == -2) {
mp_raise_AttributeError(translate("calibration is read only")); mp_raise_AttributeError(translate("calibration is read only"));
if (ret == -1) }
if (ret == -1) {
mp_raise_ValueError(translate("calibration is out of range")); mp_raise_ValueError(translate("calibration is out of range"));
}
return mp_const_none; return mp_const_none;
} }
@ -133,8 +134,7 @@ const mp_obj_property_t samd_clock_calibration_obj = {
.base.type = &mp_type_property, .base.type = &mp_type_property,
.proxy = {(mp_obj_t)&samd_clock_get_calibration_obj, .proxy = {(mp_obj_t)&samd_clock_get_calibration_obj,
(mp_obj_t)&samd_clock_set_calibration_obj, (mp_obj_t)&samd_clock_set_calibration_obj,
(mp_obj_t)&mp_const_none_obj, (mp_obj_t)&mp_const_none_obj,},
},
}; };
STATIC const mp_rom_map_elem_t samd_clock_locals_dict_table[] = { STATIC const mp_rom_map_elem_t samd_clock_locals_dict_table[] = {

View File

@ -43,8 +43,7 @@ void board_init(void) {
// GCLK_GENCTRL_DIVSEL | // GCLK_GENCTRL_DIVSEL |
GCLK_GENCTRL_OE | GCLK_GENCTRL_OE |
GCLK_GENCTRL_GENEN; GCLK_GENCTRL_GENEN;
while ( GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_GENCTRL6) while (GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_GENCTRL6) {
{
// Wait for synchronization // Wait for synchronization
} }
} }

View File

@ -28,8 +28,7 @@
#include "mpconfigboard.h" #include "mpconfigboard.h"
#include "hal/include/hal_gpio.h" #include "hal/include/hal_gpio.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -28,8 +28,7 @@
#include "mpconfigboard.h" #include "mpconfigboard.h"
#include "hal/include/hal_gpio.h" #include "hal/include/hal_gpio.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -28,8 +28,7 @@
#include "mpconfigboard.h" #include "mpconfigboard.h"
#include "hal/include/hal_gpio.h" #include "hal/include/hal_gpio.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -27,8 +27,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
#include "mpconfigboard.h" #include "mpconfigboard.h"
void board_init(void) void board_init(void) {
{
// struct port_config pin_conf; // struct port_config pin_conf;
// port_get_config_defaults(&pin_conf); // port_get_config_defaults(&pin_conf);
// //

View File

@ -27,8 +27,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
#include "mpconfigboard.h" #include "mpconfigboard.h"
void board_init(void) void board_init(void) {
{
// struct port_config pin_conf; // struct port_config pin_conf;
// port_get_config_defaults(&pin_conf); // port_get_config_defaults(&pin_conf);
// //

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

0
ports/atmel-samd/boards/circuitbrains_basic_m0/pins.c Executable file → Normal file
View File

View File

@ -31,8 +31,7 @@
#include "supervisor/shared/board.h" #include "supervisor/shared/board.h"
#include "hal/include/hal_gpio.h" #include "hal/include/hal_gpio.h"
void board_init(void) void board_init(void) {
{
} }
// Check the status of the two buttons on CircuitPlayground Express. If both are // Check the status of the two buttons on CircuitPlayground Express. If both are

View File

@ -31,8 +31,7 @@
#include "hal/include/hal_gpio.h" #include "hal/include/hal_gpio.h"
#include "supervisor/shared/board.h" #include "supervisor/shared/board.h"
void board_init(void) void board_init(void) {
{
} }
// Check the status of the two buttons on CircuitPlayground Express. If both are // Check the status of the two buttons on CircuitPlayground Express. If both are

View File

@ -31,8 +31,7 @@
#include "hal/include/hal_gpio.h" #include "hal/include/hal_gpio.h"
#include "supervisor/shared/board.h" #include "supervisor/shared/board.h"
void board_init(void) void board_init(void) {
{
} }
// Check the status of the two buttons on CircuitPlayground Express. If both are // Check the status of the two buttons on CircuitPlayground Express. If both are

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -27,8 +27,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
#include "mpconfigboard.h" #include "mpconfigboard.h"
void board_init(void) void board_init(void) {
{
// struct port_config pin_conf; // struct port_config pin_conf;
// port_get_config_defaults(&pin_conf); // port_get_config_defaults(&pin_conf);
// //

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -57,8 +57,9 @@ uint32_t lookupCfg(uint32_t key, uint32_t defl) {
} else { } else {
ptr += 4; ptr += 4;
while (*ptr) { while (*ptr) {
if (*ptr == key) if (*ptr == key) {
return ptr[1]; return ptr[1];
}
ptr += 2; ptr += 2;
} }
} }

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -68,5 +68,6 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj)}, {MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj)},
{MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj)}, {MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj)},
{MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)}}; {MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)}
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

3
ports/atmel-samd/boards/sparkfun_lumidrive/board.c Executable file → Normal file
View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -19,14 +19,18 @@ STATIC mp_obj_t _bhb_init_adc(void) {
GCLK_CLKCTRL_ID_ADC; GCLK_CLKCTRL_ID_ADC;
/* Wait for bus synchronization. */ /* Wait for bus synchronization. */
while (GCLK->STATUS.bit.SYNCBUSY) {}; while (GCLK->STATUS.bit.SYNCBUSY) {
}
;
uint32_t bias = (*((uint32_t *)ADC_FUSES_BIASCAL_ADDR) & ADC_FUSES_BIASCAL_Msk) >> ADC_FUSES_BIASCAL_Pos; uint32_t bias = (*((uint32_t *)ADC_FUSES_BIASCAL_ADDR) & ADC_FUSES_BIASCAL_Msk) >> ADC_FUSES_BIASCAL_Pos;
uint32_t linearity = (*((uint32_t *)ADC_FUSES_LINEARITY_0_ADDR) & ADC_FUSES_LINEARITY_0_Msk) >> ADC_FUSES_LINEARITY_0_Pos; uint32_t linearity = (*((uint32_t *)ADC_FUSES_LINEARITY_0_ADDR) & ADC_FUSES_LINEARITY_0_Msk) >> ADC_FUSES_LINEARITY_0_Pos;
linearity |= ((*((uint32_t *)ADC_FUSES_LINEARITY_1_ADDR) & ADC_FUSES_LINEARITY_1_Msk) >> ADC_FUSES_LINEARITY_1_Pos) << 5; linearity |= ((*((uint32_t *)ADC_FUSES_LINEARITY_1_ADDR) & ADC_FUSES_LINEARITY_1_Msk) >> ADC_FUSES_LINEARITY_1_Pos) << 5;
/* Wait for bus synchronization. */ /* Wait for bus synchronization. */
while (ADC->STATUS.bit.SYNCBUSY) {}; while (ADC->STATUS.bit.SYNCBUSY) {
}
;
/* Write the calibration data. */ /* Write the calibration data. */
ADC->CALIB.reg = ADC_CALIB_BIAS_CAL(bias) | ADC_CALIB_LINEARITY_CAL(linearity); ADC->CALIB.reg = ADC_CALIB_BIAS_CAL(bias) | ADC_CALIB_LINEARITY_CAL(linearity);
@ -70,7 +74,9 @@ STATIC mp_obj_t _bhb_init_adc(void) {
PORT->Group[1].PMUX[4].reg |= PORT_PMUX_PMUXE_B; PORT->Group[1].PMUX[4].reg |= PORT_PMUX_PMUXE_B;
/* Wait for bus synchronization. */ /* Wait for bus synchronization. */
while (ADC->STATUS.bit.SYNCBUSY) {}; while (ADC->STATUS.bit.SYNCBUSY) {
}
;
/* Enable the ADC. */ /* Enable the ADC. */
ADC->CTRLA.bit.ENABLE = true; ADC->CTRLA.bit.ENABLE = true;
@ -83,13 +89,17 @@ STATIC mp_obj_t _bhb_init_adc(void) {
STATIC mp_obj_t _bhb_read_adc(void) { STATIC mp_obj_t _bhb_read_adc(void) {
/* Wait for bus synchronization. */ /* Wait for bus synchronization. */
while (ADC->STATUS.bit.SYNCBUSY) {}; while (ADC->STATUS.bit.SYNCBUSY) {
}
;
/* Start the ADC using a software trigger. */ /* Start the ADC using a software trigger. */
ADC->SWTRIG.bit.START = true; ADC->SWTRIG.bit.START = true;
/* Wait for the result ready flag to be set. */ /* Wait for the result ready flag to be set. */
while (ADC->INTFLAG.bit.RESRDY == 0); while (ADC->INTFLAG.bit.RESRDY == 0) {
;
}
/* Clear the flag. */ /* Clear the flag. */
ADC->INTFLAG.reg = ADC_INTFLAG_RESRDY; ADC->INTFLAG.reg = ADC_INTFLAG_RESRDY;

View File

@ -28,8 +28,7 @@
#include "mpconfigboard.h" #include "mpconfigboard.h"
#include "hal/include/hal_gpio.h" #include "hal/include/hal_gpio.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -28,8 +28,7 @@
#include "mpconfigboard.h" #include "mpconfigboard.h"
#include "hal/include/hal_gpio.h" #include "hal/include/hal_gpio.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -41,7 +41,9 @@ void pew_tick(void) {
digitalio_digitalinout_obj_t *pin; digitalio_digitalinout_obj_t *pin;
pew_obj_t *pew = MP_STATE_VM(pew_singleton); pew_obj_t *pew = MP_STATE_VM(pew_singleton);
if (!pew) { return; } if (!pew) {
return;
}
pin = MP_OBJ_TO_PTR(pew->cols[col]); pin = MP_OBJ_TO_PTR(pew->cols[col]);
++col; ++col;

View File

@ -159,10 +159,12 @@ void analogout_reset(void) {
audioout_reset(); audioout_reset();
#elif HAVE_ANALOGOUT #elif HAVE_ANALOGOUT
#ifdef SAMD21 #ifdef SAMD21
while (DAC->STATUS.reg & DAC_STATUS_SYNCBUSY) {} while (DAC->STATUS.reg & DAC_STATUS_SYNCBUSY) {
}
#endif #endif
#ifdef SAM_D5X_E5X #ifdef SAM_D5X_E5X
while (DAC->SYNCBUSY.reg & DAC_SYNCBUSY_SWRST) {} while (DAC->SYNCBUSY.reg & DAC_SYNCBUSY_SWRST) {
}
#endif #endif
DAC->CTRLA.reg |= DAC_CTRLA_SWRST; DAC->CTRLA.reg |= DAC_CTRLA_SWRST;
#endif #endif

View File

@ -77,7 +77,8 @@ void i2sout_reset(void) {
#endif #endif
if (I2S->CTRLA.bit.ENABLE == 1) { if (I2S->CTRLA.bit.ENABLE == 1) {
I2S->CTRLA.bit.ENABLE = 0; I2S->CTRLA.bit.ENABLE = 0;
while (I2S->SYNCBUSY.bit.ENABLE == 1) {} while (I2S->SYNCBUSY.bit.ENABLE == 1) {
}
} }
// Make sure the I2S peripheral is running so we can see if the resources we need are free. // Make sure the I2S peripheral is running so we can see if the resources we need are free.
@ -168,7 +169,8 @@ void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t* self,
if (I2S->CTRLA.bit.ENABLE == 0) { if (I2S->CTRLA.bit.ENABLE == 0) {
I2S->CTRLA.bit.SWRST = 1; I2S->CTRLA.bit.SWRST = 1;
while (I2S->CTRLA.bit.SWRST == 1) {} while (I2S->CTRLA.bit.SWRST == 1) {
}
} else { } else {
#ifdef SAMD21 #ifdef SAMD21
if ((I2S->CTRLA.vec.SEREN & (1 << serializer)) != 0) { if ((I2S->CTRLA.vec.SEREN & (1 << serializer)) != 0) {
@ -314,16 +316,19 @@ void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t* self,
I2S->INTFLAG.reg = I2S_INTFLAG_TXUR0 | I2S_INTFLAG_TXUR1; I2S->INTFLAG.reg = I2S_INTFLAG_TXUR0 | I2S_INTFLAG_TXUR1;
I2S->CTRLA.vec.CKEN = 1 << self->clock_unit; I2S->CTRLA.vec.CKEN = 1 << self->clock_unit;
while ((I2S->SYNCBUSY.vec.CKEN & (1 << self->clock_unit)) != 0) {} while ((I2S->SYNCBUSY.vec.CKEN & (1 << self->clock_unit)) != 0) {
}
// Init the serializer after the clock. Otherwise, it will never enable because its unclocked. // Init the serializer after the clock. Otherwise, it will never enable because its unclocked.
#ifdef SAMD21 #ifdef SAMD21
I2S->CTRLA.vec.SEREN = 1 << self->serializer; I2S->CTRLA.vec.SEREN = 1 << self->serializer;
while ((I2S->SYNCBUSY.vec.SEREN & (1 << self->serializer)) != 0) {} while ((I2S->SYNCBUSY.vec.SEREN & (1 << self->serializer)) != 0) {
}
#endif #endif
#ifdef SAM_D5X_E5X #ifdef SAM_D5X_E5X
I2S->CTRLA.bit.TXEN = 1; I2S->CTRLA.bit.TXEN = 1;
while (I2S->SYNCBUSY.bit.TXEN == 1) {} while (I2S->SYNCBUSY.bit.TXEN == 1) {
}
#endif #endif
self->playing = true; self->playing = true;
@ -354,20 +359,24 @@ void common_hal_audiobusio_i2sout_stop(audiobusio_i2sout_obj_t* self) {
#ifdef SAMD21 #ifdef SAMD21
I2S->CTRLA.vec.SEREN &= ~(1 << self->serializer); I2S->CTRLA.vec.SEREN &= ~(1 << self->serializer);
while ((I2S->SYNCBUSY.vec.SEREN & (1 << self->serializer)) != 0) {} while ((I2S->SYNCBUSY.vec.SEREN & (1 << self->serializer)) != 0) {
}
#endif #endif
#ifdef SAM_D5X_E5X #ifdef SAM_D5X_E5X
I2S->CTRLA.bit.TXEN = 0; I2S->CTRLA.bit.TXEN = 0;
while (I2S->SYNCBUSY.bit.TXEN == 1) {} while (I2S->SYNCBUSY.bit.TXEN == 1) {
}
#endif #endif
#ifdef SAMD21 #ifdef SAMD21
if (self->clock_unit == 0) { if (self->clock_unit == 0) {
I2S->CTRLA.bit.CKEN0 = 0; I2S->CTRLA.bit.CKEN0 = 0;
while (I2S->SYNCBUSY.bit.CKEN0 == 1) {} while (I2S->SYNCBUSY.bit.CKEN0 == 1) {
}
} else { } else {
I2S->CTRLA.bit.CKEN1 = 0; I2S->CTRLA.bit.CKEN1 = 0;
while (I2S->SYNCBUSY.bit.CKEN1 == 1) {} while (I2S->SYNCBUSY.bit.CKEN1 == 1) {
}
} }
#endif #endif
disconnect_gclk_from_peripheral(self->gclk, I2S_GCLK_ID_0 + self->clock_unit); disconnect_gclk_from_peripheral(self->gclk, I2S_GCLK_ID_0 + self->clock_unit);

View File

@ -1,7 +1,7 @@
print('uPy') print("uPy")
print('a long string that is not interned') print("a long string that is not interned")
print('a string that has unicode αβγ chars') print("a string that has unicode αβγ chars")
print(b'bytes 1234\x01') print(b"bytes 1234\x01")
print(123456789) print(123456789)
for i in range(4): for i in range(4):
print(i) print(i)

View File

@ -27,11 +27,47 @@
import os import os
import os.path import os.path
pins = ["PA00", "PA01", "PA02", "PA03", "PB08", "PB09", "PA04", "PA05", "PA06", pins = [
"PA07", "PA08", "PA09", "PA10", "PA11", "PB10", "PB11", "PA12", "PA13", "PA00",
"PA14", "PA15", "PA16", "PA17", "PA18", "PA19", "PA20", "PA21", "PA22", "PA01",
"PA23", "PA24", "PA25", "PB22", "PB23", "PA27", "PA28", "PA29", "PA30", "PA02",
"PA31", "PB02", "PB03"] "PA03",
"PB08",
"PB09",
"PA04",
"PA05",
"PA06",
"PA07",
"PA08",
"PA09",
"PA10",
"PA11",
"PB10",
"PB11",
"PA12",
"PA13",
"PA14",
"PA15",
"PA16",
"PA17",
"PA18",
"PA19",
"PA20",
"PA21",
"PA22",
"PA23",
"PA24",
"PA25",
"PB22",
"PB23",
"PA27",
"PA28",
"PA29",
"PA30",
"PA31",
"PB02",
"PB03",
]
# Dictionary keys: [board][pin] = list of pin names # Dictionary keys: [board][pin] = list of pin names
mapping = {} mapping = {}
@ -109,60 +145,195 @@ ALL_BUT_USB.remove("PA25")
# dictionary is [module][class] = [pins] # dictionary is [module][class] = [pins]
capabilities = { capabilities = {
"analogio": { "analogio": {
"AnalogIn" : ["PA02", "PA03", "PB08", "PB09", "PA04", "PA05", "PA06", "AnalogIn": [
"PA07", "PA08", "PA09", "PA10", "PA11", "PB02", "PB03"], "PA02",
"AnalogOut": ["PA02"] "PA03",
}, "PB08",
"audioio" : { "PB09",
"AudioOut": ["PA02"] "PA04",
}, "PA05",
"bitbangio": { "PA06",
"I2C": ALL_BUT_USB, "PA07",
"OneWire": ALL_BUT_USB, "PA08",
"SPI": ALL_BUT_USB "PA09",
"PA10",
"PA11",
"PB02",
"PB03",
],
"AnalogOut": ["PA02"],
}, },
"audioio": {"AudioOut": ["PA02"]},
"bitbangio": {"I2C": ALL_BUT_USB, "OneWire": ALL_BUT_USB, "SPI": ALL_BUT_USB},
"busio": { "busio": {
"I2C - SDA": ["PA00", "PB08", "PA08", "PA12", "PA16", "PA22", "PB02"], # SERCOM pad 0 "I2C - SDA": ["PA00", "PB08", "PA08", "PA12", "PA16", "PA22", "PB02"], # SERCOM pad 0
"I2C - SCL": ["PA01", "PB09", "PA09", "PA13", "PA17", "PA23", "PB03"], # SERCOM pad 1 "I2C - SCL": ["PA01", "PB09", "PA09", "PA13", "PA17", "PA23", "PB03"], # SERCOM pad 1
"OneWire": ALL_BUT_USB, "OneWire": ALL_BUT_USB,
"SPI - MISO": ["PA00", "PA01", "PB08", "PB09", "PA04", "PA05", "PA06", "SPI - MISO": [
"PA07", "PA08", "PA09", "PA10", "PA11", "PB10", "PB11", "PA00",
"PA12", "PA13", "PA14", "PA15", "PA16", "PA17", "PA18", "PA01",
"PA19", "PA20", "PA21", "PA22", "PA23", "PB22", "PB23", "PB08",
"PA30", "PA31", "PB02", "PB03"], # any SERCOM pad "PB09",
"SPI - MOSI": ["PA00", "PB08", "PA04", "PA06", "PA08", "PA10", "PA11", "PA04",
"PB10", "PB11", "PA14", "PA15", "PA16", "PA18", "PA19", "PA05",
"PA20", "PA21", "PA22", "PB22", "PB23", "PA30", "PA31", "PA06",
"PB02"], # any pad but 1 "PA07",
"SPI - SCK": ["PA01", "PB09", "PA05", "PA07", "PA09", "PA11", "PB11", "PA08",
"PA13", "PA15", "PA17", "PA19", "PA21", "PA23", "PB23", "PA09",
"PA31", "PB03"], # 1 or 3 "PA10",
"UART - RX": ["PA00", "PA01", "PB08", "PB09", "PA04", "PA05", "PA06", "PA11",
"PA07", "PA08", "PA09", "PA10", "PA11", "PB10", "PB11", "PB10",
"PA12", "PA13", "PA14", "PA15", "PA16", "PA17", "PA18", "PB11",
"PA19", "PA20", "PA21", "PA22", "PA23", "PB22", "PB23", "PA12",
"PA30", "PA31", "PB02", "PB03"], # any pad "PA13",
"UART - TX": ["PA00", "PB08", "PA04", "PA06", "PA08", "PA10", "PB10", "PA14",
"PA12", "PA14", "PA16", "PA18", "PA20", "PA22", "PB22", "PA15",
"PA30", "PB02"] # pad 0 or 2 "PA16",
}, "PA17",
"digitalio": { "PA18",
"DigitalInOut": ALL_BUT_USB "PA19",
"PA20",
"PA21",
"PA22",
"PA23",
"PB22",
"PB23",
"PA30",
"PA31",
"PB02",
"PB03",
], # any SERCOM pad
"SPI - MOSI": [
"PA00",
"PB08",
"PA04",
"PA06",
"PA08",
"PA10",
"PA11",
"PB10",
"PB11",
"PA14",
"PA15",
"PA16",
"PA18",
"PA19",
"PA20",
"PA21",
"PA22",
"PB22",
"PB23",
"PA30",
"PA31",
"PB02",
], # any pad but 1
"SPI - SCK": [
"PA01",
"PB09",
"PA05",
"PA07",
"PA09",
"PA11",
"PB11",
"PA13",
"PA15",
"PA17",
"PA19",
"PA21",
"PA23",
"PB23",
"PA31",
"PB03",
], # 1 or 3
"UART - RX": [
"PA00",
"PA01",
"PB08",
"PB09",
"PA04",
"PA05",
"PA06",
"PA07",
"PA08",
"PA09",
"PA10",
"PA11",
"PB10",
"PB11",
"PA12",
"PA13",
"PA14",
"PA15",
"PA16",
"PA17",
"PA18",
"PA19",
"PA20",
"PA21",
"PA22",
"PA23",
"PB22",
"PB23",
"PA30",
"PA31",
"PB02",
"PB03",
], # any pad
"UART - TX": [
"PA00",
"PB08",
"PA04",
"PA06",
"PA08",
"PA10",
"PB10",
"PA12",
"PA14",
"PA16",
"PA18",
"PA20",
"PA22",
"PB22",
"PA30",
"PB02",
], # pad 0 or 2
}, },
"digitalio": {"DigitalInOut": ALL_BUT_USB},
"pulseio": { "pulseio": {
"PulseIn": ALL_BUT_USB, "PulseIn": ALL_BUT_USB,
"PWMOut": ["PA01", "PB09", "PA04", "PA05", "PA06", "PA07", "PA08", "PWMOut": [
"PA09", "PA10", "PA11", "PB10", "PB11", "PA12", "PA13", "PA01",
"PA14", "PA15", "PA16", "PA17", "PA18", "PA19", "PA20", "PB09",
"PA21", "PA22", "PA23", "PA30", "PA31"] "PA04",
}, "PA05",
"ps2io": { "PA06",
"Ps2": ALL_BUT_USB, "PA07",
"PA08",
"PA09",
"PA10",
"PA11",
"PB10",
"PB11",
"PA12",
"PA13",
"PA14",
"PA15",
"PA16",
"PA17",
"PA18",
"PA19",
"PA20",
"PA21",
"PA22",
"PA23",
"PA30",
"PA31",
],
}, },
"ps2io": {"Ps2": ALL_BUT_USB},
"touchio": { "touchio": {
"TouchIn": ["PA02", "PA03", "PB08", "PB09", "PA04", "PA05", "PA06", "TouchIn": ["PA02", "PA03", "PB08", "PB09", "PA04", "PA05", "PA06", "PA07", "PB02", "PB03"]
"PA07", "PB02", "PB03"] },
}
} }
column_width = {} column_width = {}
@ -178,7 +349,7 @@ for module in capabilities:
module_width[module] -= 2 module_width[module] -= 2
if module_width[module] < (len(module) + 2): if module_width[module] < (len(module) + 2):
column_width[module + c] += (len(module) + 2 - module_width[module]) column_width[module + c] += len(module) + 2 - module_width[module]
module_width[module] = len(module) + 2 module_width[module] = len(module) + 2
first_column_width = len("`microcontroller.pin`") first_column_width = len("`microcontroller.pin`")

View File

@ -1,22 +1,27 @@
#!/usr/bin/python3 #!/usr/bin/python3
def defines(name, suffix): def defines(name, suffix):
print(f'mcu_pin_function_t {name} [] = {{') print(f"mcu_pin_function_t {name} [] = {{")
for instance in (0, 1): for instance in (0, 1):
for function in 'HI': for function in "HI":
for port in 'ABCD': for port in "ABCD":
for idx in range(32): for idx in range(32):
pin = f'P{port}{idx:02d}' pin = f"P{port}{idx:02d}"
pinmux = f'PINMUX_{pin}{function}_CAN{instance}_{suffix}' pinmux = f"PINMUX_{pin}{function}_CAN{instance}_{suffix}"
print(f'''\ print(
f"""\
#if defined({pinmux}) && ! defined(IGNORE_PIN_{pin}) #if defined({pinmux}) && ! defined(IGNORE_PIN_{pin})
{{&pin_{pin}, {instance}, PIN_{pin}, {pinmux} & 0xffff}}, {{&pin_{pin}, {instance}, PIN_{pin}, {pinmux} & 0xffff}},
#endif''') #endif"""
print(f'{{NULL, 0, 0}}') )
print(f'}};') print(f"{{NULL, 0, 0}}")
print(f"}};")
print() print()
print('''\
print(
"""\
#include <stdint.h> #include <stdint.h>
#include "py/obj.h" #include "py/obj.h"
#include "sam.h" #include "sam.h"
@ -25,7 +30,8 @@ print('''\
#include "atmel_start_pins.h" #include "atmel_start_pins.h"
#include "hal/include/hal_gpio.h" #include "hal/include/hal_gpio.h"
#include "common-hal/microcontroller/Pin.h" #include "common-hal/microcontroller/Pin.h"
''') """
)
defines('can_rx', 'RX') defines("can_rx", "RX")
defines('can_tx', 'TX') defines("can_tx", "TX")

View File

@ -1,21 +1,26 @@
#!/usr/bin/python3 #!/usr/bin/python3
def defines(name, function): def defines(name, function):
print(f'mcu_pin_function_t {name} [] = {{') print(f"mcu_pin_function_t {name} [] = {{")
for instance in (0, 1): for instance in (0, 1):
for port in 'ABCD': for port in "ABCD":
for idx in range(32): for idx in range(32):
pin = f'P{port}{idx:02d}' pin = f"P{port}{idx:02d}"
pinmux = f'PINMUX_{pin}I_SDHC{instance}_{function}' pinmux = f"PINMUX_{pin}I_SDHC{instance}_{function}"
print(f'''\ print(
f"""\
#if defined({pinmux}) && ! defined(IGNORE_PIN_{pin}) #if defined({pinmux}) && ! defined(IGNORE_PIN_{pin})
{{&pin_{pin}, {instance}, PIN_{pin}, {pinmux} & 0xffff}}, {{&pin_{pin}, {instance}, PIN_{pin}, {pinmux} & 0xffff}},
#endif''') #endif"""
print(f'{{NULL, 0, 0}}') )
print(f'}};') print(f"{{NULL, 0, 0}}")
print(f"}};")
print() print()
print('''\
print(
"""\
#include <stdint.h> #include <stdint.h>
#include "py/obj.h" #include "py/obj.h"
#include "sam.h" #include "sam.h"
@ -25,11 +30,12 @@ print('''\
#include "hal/include/hal_gpio.h" #include "hal/include/hal_gpio.h"
#include "common-hal/microcontroller/Pin.h" #include "common-hal/microcontroller/Pin.h"
''') """
)
defines('sdio_ck', 'SDCK') defines("sdio_ck", "SDCK")
defines('sdio_cmd', 'SDCMD') defines("sdio_cmd", "SDCMD")
defines('sdio_dat0', 'SDDAT0') defines("sdio_dat0", "SDDAT0")
defines('sdio_dat1', 'SDDAT1') defines("sdio_dat1", "SDDAT1")
defines('sdio_dat2', 'SDDAT2') defines("sdio_dat2", "SDDAT2")
defines('sdio_dat3', 'SDDAT3') defines("sdio_dat3", "SDDAT3")

View File

@ -11,7 +11,11 @@ for chip in ["samd21", "samd51"]:
if not os.path.isfile(filename): if not os.path.isfile(filename):
with open("tools/" + chip + ".json", "r") as project_json: with open("tools/" + chip + ".json", "r") as project_json:
headers = {"content-type": "text/plain"} headers = {"content-type": "text/plain"}
r = requests.post("http://start.atmel.com/api/v1/generate/?format=atzip&compilers=[make]&file_name_base=My%20Project", headers=headers, data=project_json) r = requests.post(
"http://start.atmel.com/api/v1/generate/?format=atzip&compilers=[make]&file_name_base=My%20Project",
headers=headers,
data=project_json,
)
if not r.ok: if not r.ok:
# Double check that the JSON is minified. If its not, you'll get a 404. # Double check that the JSON is minified. If its not, you'll get a 404.
print(r.text) print(r.text)
@ -40,7 +44,9 @@ for chip in ["samd21", "samd51"]:
for patch in os.listdir("asf4/patches/" + chip): for patch in os.listdir("asf4/patches/" + chip):
patch = "patches/" + chip + "/" + patch patch = "patches/" + chip + "/" + patch
print(patch) print(patch)
result = subprocess.run(["patch", "-l", "-F", "10", "-u", "-p", "1", "-d", tmp_dir, "-i", "../" + patch]) result = subprocess.run(
["patch", "-l", "-F", "10", "-u", "-p", "1", "-d", tmp_dir, "-i", "../" + patch]
)
ok = ok and result.returncode == 0 ok = ok and result.returncode == 0
print() print()

View File

@ -26,8 +26,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
void board_init(void) void board_init(void) {
{
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -27,6 +27,7 @@
#include <arch/chip/pin.h> #include <arch/chip/pin.h>
#include <nuttx/i2c/i2c_master.h> #include <nuttx/i2c/i2c_master.h>
#include <cxd56_i2c.h> #include <cxd56_i2c.h>
#include <cxd56_pinconfig.h>
#include "py/runtime.h" #include "py/runtime.h"
@ -49,6 +50,7 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, const mcu_pin_obj_t *
self->sda_pin = sda; self->sda_pin = sda;
self->frequency = frequency; self->frequency = frequency;
self->i2c_dev = cxd56_i2cbus_initialize(0); self->i2c_dev = cxd56_i2cbus_initialize(0);
CXD56_PIN_CONFIGS(PINCONFS_I2C0);
} }
void common_hal_busio_i2c_deinit(busio_i2c_obj_t *self) { void common_hal_busio_i2c_deinit(busio_i2c_obj_t *self) {

View File

@ -26,6 +26,7 @@
#include <arch/chip/pin.h> #include <arch/chip/pin.h>
#include <cxd56_spi.h> #include <cxd56_spi.h>
#include <cxd56_pinconfig.h>
#include "py/runtime.h" #include "py/runtime.h"
@ -39,10 +40,12 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, const mcu_pin_obj_t *
(mosi == NULL || mosi->number == PIN_SPI4_MOSI) && (mosi == NULL || mosi->number == PIN_SPI4_MOSI) &&
(miso == NULL || miso->number == PIN_SPI4_MISO)) { (miso == NULL || miso->number == PIN_SPI4_MISO)) {
port = 4; port = 4;
CXD56_PIN_CONFIGS(PINCONFS_SPI4);
} else if (clock->number == PIN_EMMC_CLK && } else if (clock->number == PIN_EMMC_CLK &&
(mosi == NULL || mosi->number == PIN_EMMC_DATA0) && (mosi == NULL || mosi->number == PIN_EMMC_DATA0) &&
(miso == NULL || miso->number == PIN_EMMC_DATA1)) { (miso == NULL || miso->number == PIN_EMMC_DATA1)) {
port = 5; port = 5;
CXD56_PIN_CONFIGS(PINCONFS_EMMCA_SPI5);
} }
if (port < 0) { if (port < 0) {

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