summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2018-11-26 10:16:29 -0500
committerDan Halbert <halbert@halwitz.org>2018-11-26 10:16:29 -0500
commit6fb75902804dc5cd90ebdf8d6bc04c569cf40fca (patch)
treedd5cf23eb9ebadefe7a6ef7f7abf9b2a772706fe
parent1763ffe2450fa07c74db225cc5ef3a6e2feb669b (diff)
parent292737fa2b3c18d18ccefe9b8cf6eef5e158fdd0 (diff)
Merge remote-tracking branch 'adafruit/master' into bleio-rev
-rw-r--r--docs/drivers.rst13
m---------lib/tinyusb0
-rw-r--r--ports/atmel-samd/Makefile6
-rwxr-xr-xports/nrf/Makefile9
-rw-r--r--ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h39
-rw-r--r--ports/nrf/boards/feather_nrf52840_express/mpconfigboard.mk4
-rw-r--r--ports/nrf/boards/feather_nrf52840_express/pins.c56
-rw-r--r--ports/nrf/common-hal/microcontroller/Pin.c2
-rw-r--r--ports/nrf/common-hal/neopixel_write/__init__.c16
-rw-r--r--supervisor/shared/usb/usb_msc_flash.c15
-rw-r--r--supervisor/supervisor.mk2
11 files changed, 86 insertions, 76 deletions
diff --git a/docs/drivers.rst b/docs/drivers.rst
index ff67fcbfb..119706d33 100644
--- a/docs/drivers.rst
+++ b/docs/drivers.rst
@@ -122,7 +122,7 @@ Motion relating sensing including ``acceleration``, ``magnetic``, ``gyro``, and
FXAS21002C Gyroscope <https://circuitpython.readthedocs.io/projects/fxas21002c/en/latest/>
FXOS8700 Accelerometer <https://circuitpython.readthedocs.io/projects/fxos8700/en/latest/>
GPS Global Position <https://circuitpython.readthedocs.io/projects/gps/en/latest/>
- L3GD20 Gyroscope <https://circuitpython.readthedocs.io/projects/sd/l3gd20/latest/>
+ L3GD20 Gyroscope <https://circuitpython.readthedocs.io/projects/l3gd20/latest/>
LIS3DH Accelerometer <https://circuitpython.readthedocs.io/projects/lis3dh/en/latest/>
LSM303 Accelerometer and Magnetometer <https://circuitpython.readthedocs.io/projects/lsm303/en/latest/>
LSM9DS0 Accelerometer, Magnetometer, Gyroscope and Temperature <https://circuitpython.readthedocs.io/projects/lsm9ds0/en/latest/>
@@ -147,14 +147,14 @@ equivalent carbon dioxide (``eco2`` / ``eCO2``), and total volatile organic comp
CCS811 Air Quality <https://circuitpython.readthedocs.io/projects/ccs811/en/latest/>
DHT Temperature and Humidity <https://circuitpython.readthedocs.io/projects/dht/en/latest/>
DS18x20 Temperature <https://circuitpython.readthedocs.io/projects/ds18x20/en/latest/>
- HTU21D Temperature and Humidity <https://circuitpython.readthedocs.io/projects/htu21d/en/latest>
+ HTU21D Temperature and Humidity <https://circuitpython.readthedocs.io/projects/htu21d/en/latest/>
MAX31865 Thermocouple Amplifier, Temperature <https://circuitpython.readthedocs.io/projects/max31865/en/latest/>
MAX31855 Thermocouple Amplifier, Temperature <https://circuitpython.readthedocs.io/projects/max31855/en/latest/>
MAX31856 Thermocouple Amplifier, Temperature <https://circuitpython.readthedocs.io/projects/max31856/en/latest/>
MCP9808 Temperature <https://circuitpython.readthedocs.io/projects/mcp9808/en/latest/>
MP115A2 Barometric Pressure, Temperature <https://circuitpython.readthedocs.io/projects/mpl115a2/en/latest/>
MPL3115A2 Barometric Pressure, Altitude and Temperature Sensor <https://circuitpython.readthedocs.io/projects/mpl3115a2/en/latest/>
- MPRLS Ported Absolute Pressure <https://circuitpython.readthedocs.io/projects/mprls/en/latest>
+ MPRLS Ported Absolute Pressure <https://circuitpython.readthedocs.io/projects/mprls/en/latest/>
SGP30 Air Quality <https://circuitpython.readthedocs.io/projects/sgp30/en/latest/>
SHT31-D Temperature and Humidity <https://circuitpython.readthedocs.io/projects/sht31d/en/latest/>
Si7021 Temperature and Humidity <https://circuitpython.readthedocs.io/projects/si7021/en/latest/>
@@ -186,8 +186,8 @@ These sensors measure the ``distance`` to another object and may also measure li
.. toctree::
- Garmin LIDARLite I2C <https://circuitpython.readthedocs.io/projects/lidarlite/en/latest>
- TFmini IR Time of Flight ~30cm - 12m <https://circuitpython.readthedocs.io/projects/tfmini/en/latest>
+ Garmin LIDARLite I2C <https://circuitpython.readthedocs.io/projects/lidarlite/en/latest/>
+ TFmini IR Time of Flight ~30cm - 12m <https://circuitpython.readthedocs.io/projects/tfmini/en/latest/>
VL6180x 5 - 100 mm <https://circuitpython.readthedocs.io/projects/vl6180x/en/latest/>
VL53L0x ~30 - 1000 mm <https://circuitpython.readthedocs.io/projects/vl53l0x/en/latest/>
HC-SR04 Ultrasonic Range Sensors <https://circuitpython.readthedocs.io/projects/hcsr04/en/latest/>
@@ -234,7 +234,7 @@ Miscellaneous
Si4713 Stereo FM Transmitter <https://circuitpython.readthedocs.io/projects/si4713/en/latest/>
AMG88xx Grid-Eye IR Camera <https://circuitpython.readthedocs.io/projects/amg88xx/en/latest/>
Trellis 4x4 Keypad <https://circuitpython.readthedocs.io/projects/trellis/en/latest/>
- NeoTrellis 4x4 Keypad <https://circuitpython.readthedocs.io/projects/neotrellis/en/latest>
+ NeoTrellis 4x4 Keypad <https://circuitpython.readthedocs.io/projects/neotrellis/en/latest/>
NeoTrellis M4 4x8 Keypad <https://circuitpython.readthedocs.io/projects/trellism4/en/latest/>
DRV2605 Haptic Motor Controller <https://circuitpython.readthedocs.io/projects/drv2605/en/latest/>
MAX9744 Audio Amplifier <https://circuitpython.readthedocs.io/projects/max9744/en/latest/>
@@ -247,3 +247,4 @@ Miscellaneous
Matrix Keypad <https://circuitpython.readthedocs.io/projects/matrixkeypad/en/latest/>
VS1053 Audio Codec <https://circuitpython.readthedocs.io/projects/vs1053/en/latest/>
FRAM Non-Volatile Memory <https://circuitpython.readthedocs.io/projects/fram/en/latest/>
+ 74HC595 Shift Register <https://circuitpython.readthedocs.io/projects/74hc595/en/latest/>
diff --git a/lib/tinyusb b/lib/tinyusb
-Subproject c62d9a1fefa76bf59d43ff56ce6ca1e138a69c7
+Subproject 47fabe42edaae4a5da6aa0d48c664a918457875
diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile
index 23fb39779..99b8842c6 100644
--- a/ports/atmel-samd/Makefile
+++ b/ports/atmel-samd/Makefile
@@ -61,7 +61,6 @@ BASE_CFLAGS = \
-Wno-endif-labels \
-Wstrict-prototypes \
-Werror-implicit-function-declaration \
- -Wpointer-arith \
-Wfloat-equal \
-Wundef \
-Wshadow \
@@ -69,7 +68,6 @@ BASE_CFLAGS = \
-Wsign-compare \
-Wmissing-format-attribute \
-Wno-deprecated-declarations \
- -Wpacked \
-Wnested-externs \
-Wunreachable-code \
-Wcast-align \
@@ -265,8 +263,8 @@ SRC_C = \
lib/oofatfs/ff.c \
lib/oofatfs/option/ccsbcs.c \
lib/timeutils/timeutils.c \
- lib/tinyusb/src/portable/microchip/$(CHIP_FAMILY)/dcd.c \
- lib/tinyusb/src/portable/microchip/$(CHIP_FAMILY)/hal.c \
+ lib/tinyusb/src/portable/microchip/$(CHIP_FAMILY)/dcd_$(CHIP_FAMILY).c \
+ lib/tinyusb/src/portable/microchip/$(CHIP_FAMILY)/hal_$(CHIP_FAMILY).c \
lib/utils/buffer_helper.c \
lib/utils/context_manager_helpers.c \
lib/utils/interrupt_char.c \
diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile
index a622522a4..cbc180c4b 100755
--- a/ports/nrf/Makefile
+++ b/ports/nrf/Makefile
@@ -217,14 +217,7 @@ ifeq ($(MCU_SUB_VARIANT),nrf52840)
SRC_C += \
lib/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c \
- lib/tinyusb/src/portable/nordic/nrf5x/hal_nrf5x.c \
- lib/tinyusb/src/common/tusb_fifo.c \
- lib/tinyusb/src/device/control.c \
- lib/tinyusb/src/device/usbd.c \
- lib/tinyusb/src/class/msc/msc_device.c \
- lib/tinyusb/src/class/cdc/cdc_device.c \
- lib/tinyusb/src/class/hid/hid_device.c \
- lib/tinyusb/src/tusb.c \
+ lib/tinyusb/src/portable/nordic/nrf5x/hal_nrf5x.c
SRC_SHARED_MODULE += \
usb_hid/__init__.c \
diff --git a/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h b/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h
index 68914c626..bd1cad504 100644
--- a/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h
+++ b/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h
@@ -33,14 +33,23 @@
#define MICROPY_HW_MCU_NAME "nRF52840"
#define MICROPY_PY_SYS_PLATFORM "Feather52840Express"
-#define MICROPY_HW_NEOPIXEL (&pin_P0_13)
+#define MICROPY_HW_NEOPIXEL (&pin_P0_16)
-#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(1, 9)
-#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 11)
-#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 12)
-#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(0, 14)
-#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(0, 8)
-#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(1, 8)
+#ifdef QSPI_FLASH_FILESYSTEM
+#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 17)
+#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 22)
+#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 23)
+#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(0, 21)
+#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(0, 19)
+#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 20)
+#endif
+
+#ifdef SPI_FLASH_FILESYSTEM
+#define SPI_FLASH_MOSI_PIN &pin_P0_17
+#define SPI_FLASH_MISO_PIN &pin_P0_22
+#define SPI_FLASH_SCK_PIN &pin_P0_19
+#define SPI_FLASH_CS_PIN &pin_P0_20
+#endif
#define CIRCUITPY_AUTORELOAD_DELAY_MS 500
@@ -51,16 +60,14 @@
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE)
-#define EXTERNAL_FLASH_QSPI_DUAL (1)
-
#define BOARD_HAS_CRYSTAL 1
-#define DEFAULT_I2C_BUS_SCL (&pin_P1_11)
-#define DEFAULT_I2C_BUS_SDA (&pin_P1_12)
+#define DEFAULT_I2C_BUS_SCL (&pin_P0_11)
+#define DEFAULT_I2C_BUS_SDA (&pin_P0_12)
-#define DEFAULT_SPI_BUS_SCK (&pin_P0_20)
-#define DEFAULT_SPI_BUS_MOSI (&pin_P0_23)
-#define DEFAULT_SPI_BUS_MISO (&pin_P0_22)
+#define DEFAULT_SPI_BUS_SCK (&pin_P0_14)
+#define DEFAULT_SPI_BUS_MOSI (&pin_P0_13)
+#define DEFAULT_SPI_BUS_MISO (&pin_P0_15)
-#define DEFAULT_UART_BUS_RX (&pin_P1_00)
-#define DEFAULT_UART_BUS_TX (&pin_P0_24)
+#define DEFAULT_UART_BUS_RX (&pin_P0_24)
+#define DEFAULT_UART_BUS_TX (&pin_P0_25)
diff --git a/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.mk b/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.mk
index f03109319..bc511e150 100644
--- a/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.mk
+++ b/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.mk
@@ -20,6 +20,6 @@ endif
NRF_DEFINES += -DNRF52840_XXAA -DNRF52840
-QSPI_FLASH_FILESYSTEM = 1
+SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 1
-EXTERNAL_FLASH_DEVICES = "GD25Q64C"
+EXTERNAL_FLASH_DEVICES = "GD25Q16C"
diff --git a/ports/nrf/boards/feather_nrf52840_express/pins.c b/ports/nrf/boards/feather_nrf52840_express/pins.c
index 0f5eab31d..b85b72af0 100644
--- a/ports/nrf/boards/feather_nrf52840_express/pins.c
+++ b/ports/nrf/boards/feather_nrf52840_express/pins.c
@@ -3,39 +3,47 @@
#include "board_busses.h"
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
- { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_30) },
- { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_28) },
- { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_P0_31) },
- { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_P0_02) },
- { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_P0_29) },
+ { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_04) },
+ { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_05) },
+ { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_P0_30) },
+ { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_P0_28) },
+ { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_P0_02) },
{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_P0_03) },
- { MP_ROM_QSTR(MP_QSTR_AREF), MP_ROM_PTR(&pin_P0_04) },
- { MP_ROM_QSTR(MP_QSTR_VDIV), MP_ROM_PTR(&pin_P0_05) },
+ { MP_ROM_QSTR(MP_QSTR_AREF), MP_ROM_PTR(&pin_P0_31) },
- { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_P1_13) },
- { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_P1_14) },
- { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_P1_15) },
+ { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_P0_29) },
+ { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_P0_29) },
+
+ { MP_ROM_QSTR(MP_QSTR_SWITCH), MP_ROM_PTR(&pin_P1_02) },
+
+ { MP_ROM_QSTR(MP_QSTR_NFC1), MP_ROM_PTR(&pin_P0_09) },
+ { MP_ROM_QSTR(MP_QSTR_NFC2), MP_ROM_PTR(&pin_P0_10) },
+
+ { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_P0_10) },
+ { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_P1_08) },
+ { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_P0_07) },
+ { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_P0_26) },
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_P0_27) },
- { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_P0_26) },
- { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_P0_06) },
- { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_P0_07) },
- { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_P0_07) },
+ { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_P0_06) },
+ { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_P0_08) },
+ { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_P1_09) },
- { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_P0_13) },
+ { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_P0_16) },
- { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_20) },
- { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_23) },
- { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_22) },
+ { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_14) },
+ { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_13) },
+ { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_15) },
- { MP_ROM_QSTR(MP_QSTR_TXD), MP_ROM_PTR(&pin_P0_24) },
- { MP_ROM_QSTR(MP_QSTR_RXD), MP_ROM_PTR(&pin_P1_00) },
+ { MP_ROM_QSTR(MP_QSTR_TXD), MP_ROM_PTR(&pin_P0_25) },
+ { MP_ROM_QSTR(MP_QSTR_RXD), MP_ROM_PTR(&pin_P0_24) },
- { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P1_11) },
- { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P1_12) },
+ { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_11) },
+ { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_12) },
- { MP_ROM_QSTR(MP_QSTR_LED_RED), MP_ROM_PTR(&pin_P1_02) },
- { MP_ROM_QSTR(MP_QSTR_LED_BLUE), MP_ROM_PTR(&pin_P1_10) },
+ { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_P1_15) },
+ { MP_ROM_QSTR(MP_QSTR_RED_LED), MP_ROM_PTR(&pin_P1_15) },
+ { MP_ROM_QSTR(MP_QSTR_BLUE_LED), MP_ROM_PTR(&pin_P1_10) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
diff --git a/ports/nrf/common-hal/microcontroller/Pin.c b/ports/nrf/common-hal/microcontroller/Pin.c
index 0522bfef3..02847e150 100644
--- a/ports/nrf/common-hal/microcontroller/Pin.c
+++ b/ports/nrf/common-hal/microcontroller/Pin.c
@@ -48,7 +48,6 @@ STATIC uint32_t claimed_pins[GPIO_COUNT];
STATIC uint32_t never_reset_pins[GPIO_COUNT];
void reset_all_pins(void) {
- return;
for (size_t i = 0; i < GPIO_COUNT; i++) {
claimed_pins[i] = never_reset_pins[i];
}
@@ -77,7 +76,6 @@ void reset_all_pins(void) {
// Mark pin as free and return it to a quiescent state.
void reset_pin_number(uint8_t pin_number) {
- return;
if (pin_number == NO_PIN) {
return;
}
diff --git a/ports/nrf/common-hal/neopixel_write/__init__.c b/ports/nrf/common-hal/neopixel_write/__init__.c
index ef5e8beb1..c4cb194f3 100644
--- a/ports/nrf/common-hal/neopixel_write/__init__.c
+++ b/ports/nrf/common-hal/neopixel_write/__init__.c
@@ -108,12 +108,21 @@ void common_hal_neopixel_write (const digitalio_digitalinout_obj_t* digitalinout
// using DWT
uint32_t pattern_size = numBytes * 8 * sizeof(uint16_t) + 2 * sizeof(uint16_t);
uint16_t* pixels_pattern = NULL;
+ bool pattern_on_heap = false;
+
+ // Use the stack to store 1 pixels worth of PWM data for the status led. uint32_t to ensure alignment.
+ uint32_t one_pixel[8 * sizeof(uint16_t) + 1];
NRF_PWM_Type* pwm = find_free_pwm();
// only malloc if there is PWM device available
if ( pwm != NULL ) {
- pixels_pattern = (uint16_t *) m_malloc(pattern_size, false);
+ if (numBytes == 4) {
+ pixels_pattern = (uint16_t *) one_pixel;
+ } else {
+ pixels_pattern = (uint16_t *) m_malloc_maybe(pattern_size, false);
+ pattern_on_heap = true;
+ }
}
// Use the identified device to choose the implementation
@@ -193,7 +202,10 @@ void common_hal_neopixel_write (const digitalio_digitalinout_obj_t* digitalinout
nrf_pwm_disable(pwm);
nrf_pwm_pins_set(pwm, (uint32_t[]) {0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL} );
- m_free(pixels_pattern);
+ if (pattern_on_heap) {
+ m_free(pixels_pattern);
+ }
+
} // End of DMA implementation
// ---------------------------------------------------------------------
else {
diff --git a/supervisor/shared/usb/usb_msc_flash.c b/supervisor/shared/usb/usb_msc_flash.c
index 13b5c3966..658aab0d8 100644
--- a/supervisor/shared/usb/usb_msc_flash.c
+++ b/supervisor/shared/usb/usb_msc_flash.c
@@ -133,17 +133,10 @@ int32_t tud_msc_scsi_cb (uint8_t lun, const uint8_t scsi_cmd[16], void* buffer,
return resplen;
}
-bool tud_lun_capacity_cb(uint8_t lun, uint32_t* last_valid_sector, uint16_t* sector_size) {
- fs_user_mount_t * vfs = get_vfs(lun);
- if (vfs == NULL ||
- disk_ioctl(vfs, GET_SECTOR_COUNT, last_valid_sector) != RES_OK ||
- disk_ioctl(vfs, GET_SECTOR_SIZE, sector_size) != RES_OK) {
- return false;
- }
- // Subtract one from the sector count to get the last valid sector.
- (*last_valid_sector)--;
-
- return true;
+void tud_msc_capacity_cb(uint8_t lun, uint32_t* block_count, uint16_t* block_size) {
+ fs_user_mount_t * vfs = get_vfs(lun);
+ disk_ioctl(vfs, GET_SECTOR_COUNT, block_count);
+ disk_ioctl(vfs, GET_SECTOR_SIZE, block_size);
}
bool tud_msc_is_writable_cb(uint8_t lun) {
diff --git a/supervisor/supervisor.mk b/supervisor/supervisor.mk
index ac982d277..73c76ebb7 100644
--- a/supervisor/supervisor.mk
+++ b/supervisor/supervisor.mk
@@ -43,8 +43,8 @@ ifeq ($(USB),FALSE)
endif
else
SRC_SUPERVISOR += lib/tinyusb/src/common/tusb_fifo.c \
- lib/tinyusb/src/device/control.c \
lib/tinyusb/src/device/usbd.c \
+ lib/tinyusb/src/device/usbd_control.c \
lib/tinyusb/src/class/msc/msc_device.c \
lib/tinyusb/src/class/cdc/cdc_device.c \
lib/tinyusb/src/class/hid/hid_device.c \