Skip to content

Commit

Permalink
Merge pull request micropython#31 from adafruit/main
Browse files Browse the repository at this point in the history
Update from adafruit/main
  • Loading branch information
DavePutz authored Oct 14, 2020
2 parents f362a4a + 579e508 commit 5f3ef9f
Show file tree
Hide file tree
Showing 152 changed files with 3,668 additions and 1,495 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: CircuitPython version
run: |
git describe --dirty --tags
echo "::set-env name=CP_VERSION::$(git describe --dirty --tags)"
echo >>$GITHUB_ENV CP_VERSION=$(git describe --dirty --tags)
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:
- name: Install dependencies
run: |
brew install gettext awscli
echo "::set-env name=PATH::/usr/local/opt/gettext/bin:$PATH"
echo >>$GITHUB_PATH /usr/local/opt/gettext/bin
- name: Versions
run: |
gcc --version
Expand All @@ -146,7 +146,7 @@ jobs:
- name: CircuitPython version
run: |
git describe --dirty --tags
echo "::set-env name=CP_VERSION::$(git describe --dirty --tags)"
echo >>$GITHUB_ENV CP_VERSION=$(git describe --dirty --tags)
- name: Build mpy-cross
run: make -C mpy-cross -j2
- uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -180,6 +180,7 @@ jobs:
- "arduino_zero"
- "bast_pro_mini_m0"
- "bdmicro_vina_d21"
- "bdmicro_vina_d51"
- "bless_dev_board_multi_sensor"
- "blm_badge"
- "capablerobot_usbhub"
Expand Down Expand Up @@ -243,6 +244,7 @@ jobs:
- "metro_m0_express"
- "metro_m4_airlift_lite"
- "metro_m4_express"
- "metro_m7_1011"
- "metro_nrf52840_express"
- "mini_sam_m4"
- "monster_m4sk"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
- name: set PY
run: echo "::set-env name=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@v1
with:
path: ~/.cache/pre-commit
Expand Down
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@
[submodule "frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center"]
path = frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center
url = https://github.com/adafruit/Adafruit_CircuitPython_BLE_Apple_Notification_Center
[submodule "ports/esp32s2/esp-idf"]
path = ports/esp32s2/esp-idf
url = https://github.com/tannewt/esp-idf.git
[submodule "frozen/Adafruit_CircuitPython_RFM9x"]
path = frozen/Adafruit_CircuitPython_RFM9x
url = https://github.com/adafruit/Adafruit_CircuitPython_RFM9x.git
[submodule "frozen/Adafruit_CircuitPython_RFM69"]
path = frozen/Adafruit_CircuitPython_RFM69
url = https://github.com/adafruit/Adafruit_CircuitPython_RFM69.git
[submodule "ports/esp32s2/esp-idf"]
path = ports/esp32s2/esp-idf
url = https://github.com/espressif/esp-idf.git
2 changes: 1 addition & 1 deletion devices/ble_hci/common-hal/_bleio/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ bleio_adapter_obj_t *common_hal_bleio_allocate_adapter_or_raise(void) {

void common_hal_bleio_check_connected(uint16_t conn_handle) {
if (conn_handle == BLE_CONN_HANDLE_INVALID) {
mp_raise_bleio_ConnectionError(translate("Not connected"));
mp_raise_ConnectionError(translate("Not connected"));
}
}

Expand Down
37 changes: 25 additions & 12 deletions extmod/vfs_fat_diskio.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ DRESULT disk_write (

DRESULT disk_ioctl (
bdev_t pdrv, /* Physical drive nmuber (0..) */
BYTE cmd, /* Control code */
BYTE cmd, /* Control code */
void *buff /* Buffer to send/receive control data */
)
{
Expand All @@ -133,7 +133,7 @@ DRESULT disk_ioctl (
}

// First part: call the relevant method of the underlying block device
mp_obj_t ret = mp_const_none;
mp_int_t out_value = 0;
if (vfs->flags & FSUSER_HAVE_IOCTL) {
// new protocol with ioctl
static const uint8_t op_map[8] = {
Expand All @@ -144,9 +144,19 @@ DRESULT disk_ioctl (
};
uint8_t bp_op = op_map[cmd & 7];
if (bp_op != 0) {
vfs->u.ioctl[2] = MP_OBJ_NEW_SMALL_INT(bp_op);
vfs->u.ioctl[3] = MP_OBJ_NEW_SMALL_INT(0); // unused
ret = mp_call_method_n_kw(2, 0, vfs->u.ioctl);
if (vfs->flags & FSUSER_NATIVE) {
bool (*f)(size_t, mp_int_t*) = (void*)(uintptr_t)vfs->u.ioctl[2];
if (!f(bp_op, (mp_int_t*) &out_value)) {
return RES_ERROR;
}
} else {
vfs->u.ioctl[2] = MP_OBJ_NEW_SMALL_INT(bp_op);
vfs->u.ioctl[3] = MP_OBJ_NEW_SMALL_INT(0); // unused
mp_obj_t ret = mp_call_method_n_kw(2, 0, vfs->u.ioctl);
if (ret != mp_const_none) {
out_value = mp_obj_get_int(ret);
}
}
}
} else {
// old protocol with sync and count
Expand All @@ -157,10 +167,13 @@ DRESULT disk_ioctl (
}
break;

case GET_SECTOR_COUNT:
ret = mp_call_method_n_kw(0, 0, vfs->u.old.count);
case GET_SECTOR_COUNT: {
mp_obj_t ret = mp_call_method_n_kw(0, 0, vfs->u.old.count);
if (ret != mp_const_none) {
out_value = mp_obj_get_int(ret);
}
break;

}
case GET_SECTOR_SIZE:
// old protocol has fixed sector size of 512 bytes
break;
Expand All @@ -177,16 +190,16 @@ DRESULT disk_ioctl (
return RES_OK;

case GET_SECTOR_COUNT: {
*((DWORD*)buff) = mp_obj_get_int(ret);
*((DWORD*)buff) = out_value;
return RES_OK;
}

case GET_SECTOR_SIZE: {
if (ret == mp_const_none) {
if (out_value == 0) {
// Default sector size
*((WORD*)buff) = 512;
} else {
*((WORD*)buff) = mp_obj_get_int(ret);
*((WORD*)buff) = out_value;
}
#if _MAX_SS != _MIN_SS
// need to store ssize because we use it in disk_read/disk_write
Expand All @@ -202,7 +215,7 @@ DRESULT disk_ioctl (
case IOCTL_INIT:
case IOCTL_STATUS: {
DSTATUS stat;
if (ret != mp_const_none && MP_OBJ_SMALL_INT_VALUE(ret) != 0) {
if (out_value != 0) {
// error initialising
stat = STA_NOINIT;
} else if (vfs->writeblocks[0] == MP_OBJ_NULL) {
Expand Down
Loading

0 comments on commit 5f3ef9f

Please sign in to comment.