Skip to content

Commit 6fb7590

Browse files
committed
Merge remote-tracking branch 'adafruit/master' into bleio-rev
2 parents 1763ffe + 292737f commit 6fb7590

11 files changed

Lines changed: 87 additions & 77 deletions

File tree

docs/drivers.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Motion relating sensing including ``acceleration``, ``magnetic``, ``gyro``, and
122122
FXAS21002C Gyroscope <https://circuitpython.readthedocs.io/projects/fxas21002c/en/latest/>
123123
FXOS8700 Accelerometer <https://circuitpython.readthedocs.io/projects/fxos8700/en/latest/>
124124
GPS Global Position <https://circuitpython.readthedocs.io/projects/gps/en/latest/>
125-
L3GD20 Gyroscope <https://circuitpython.readthedocs.io/projects/sd/l3gd20/latest/>
125+
L3GD20 Gyroscope <https://circuitpython.readthedocs.io/projects/l3gd20/latest/>
126126
LIS3DH Accelerometer <https://circuitpython.readthedocs.io/projects/lis3dh/en/latest/>
127127
LSM303 Accelerometer and Magnetometer <https://circuitpython.readthedocs.io/projects/lsm303/en/latest/>
128128
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
147147
CCS811 Air Quality <https://circuitpython.readthedocs.io/projects/ccs811/en/latest/>
148148
DHT Temperature and Humidity <https://circuitpython.readthedocs.io/projects/dht/en/latest/>
149149
DS18x20 Temperature <https://circuitpython.readthedocs.io/projects/ds18x20/en/latest/>
150-
HTU21D Temperature and Humidity <https://circuitpython.readthedocs.io/projects/htu21d/en/latest>
150+
HTU21D Temperature and Humidity <https://circuitpython.readthedocs.io/projects/htu21d/en/latest/>
151151
MAX31865 Thermocouple Amplifier, Temperature <https://circuitpython.readthedocs.io/projects/max31865/en/latest/>
152152
MAX31855 Thermocouple Amplifier, Temperature <https://circuitpython.readthedocs.io/projects/max31855/en/latest/>
153153
MAX31856 Thermocouple Amplifier, Temperature <https://circuitpython.readthedocs.io/projects/max31856/en/latest/>
154154
MCP9808 Temperature <https://circuitpython.readthedocs.io/projects/mcp9808/en/latest/>
155155
MP115A2 Barometric Pressure, Temperature <https://circuitpython.readthedocs.io/projects/mpl115a2/en/latest/>
156156
MPL3115A2 Barometric Pressure, Altitude and Temperature Sensor <https://circuitpython.readthedocs.io/projects/mpl3115a2/en/latest/>
157-
MPRLS Ported Absolute Pressure <https://circuitpython.readthedocs.io/projects/mprls/en/latest>
157+
MPRLS Ported Absolute Pressure <https://circuitpython.readthedocs.io/projects/mprls/en/latest/>
158158
SGP30 Air Quality <https://circuitpython.readthedocs.io/projects/sgp30/en/latest/>
159159
SHT31-D Temperature and Humidity <https://circuitpython.readthedocs.io/projects/sht31d/en/latest/>
160160
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
186186

187187
.. toctree::
188188

189-
Garmin LIDARLite I2C <https://circuitpython.readthedocs.io/projects/lidarlite/en/latest>
190-
TFmini IR Time of Flight ~30cm - 12m <https://circuitpython.readthedocs.io/projects/tfmini/en/latest>
189+
Garmin LIDARLite I2C <https://circuitpython.readthedocs.io/projects/lidarlite/en/latest/>
190+
TFmini IR Time of Flight ~30cm - 12m <https://circuitpython.readthedocs.io/projects/tfmini/en/latest/>
191191
VL6180x 5 - 100 mm <https://circuitpython.readthedocs.io/projects/vl6180x/en/latest/>
192192
VL53L0x ~30 - 1000 mm <https://circuitpython.readthedocs.io/projects/vl53l0x/en/latest/>
193193
HC-SR04 Ultrasonic Range Sensors <https://circuitpython.readthedocs.io/projects/hcsr04/en/latest/>
@@ -234,7 +234,7 @@ Miscellaneous
234234
Si4713 Stereo FM Transmitter <https://circuitpython.readthedocs.io/projects/si4713/en/latest/>
235235
AMG88xx Grid-Eye IR Camera <https://circuitpython.readthedocs.io/projects/amg88xx/en/latest/>
236236
Trellis 4x4 Keypad <https://circuitpython.readthedocs.io/projects/trellis/en/latest/>
237-
NeoTrellis 4x4 Keypad <https://circuitpython.readthedocs.io/projects/neotrellis/en/latest>
237+
NeoTrellis 4x4 Keypad <https://circuitpython.readthedocs.io/projects/neotrellis/en/latest/>
238238
NeoTrellis M4 4x8 Keypad <https://circuitpython.readthedocs.io/projects/trellism4/en/latest/>
239239
DRV2605 Haptic Motor Controller <https://circuitpython.readthedocs.io/projects/drv2605/en/latest/>
240240
MAX9744 Audio Amplifier <https://circuitpython.readthedocs.io/projects/max9744/en/latest/>
@@ -247,3 +247,4 @@ Miscellaneous
247247
Matrix Keypad <https://circuitpython.readthedocs.io/projects/matrixkeypad/en/latest/>
248248
VS1053 Audio Codec <https://circuitpython.readthedocs.io/projects/vs1053/en/latest/>
249249
FRAM Non-Volatile Memory <https://circuitpython.readthedocs.io/projects/fram/en/latest/>
250+
74HC595 Shift Register <https://circuitpython.readthedocs.io/projects/74hc595/en/latest/>

lib/tinyusb

Submodule tinyusb updated 182 files

ports/atmel-samd/Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,13 @@ BASE_CFLAGS = \
6161
-Wno-endif-labels \
6262
-Wstrict-prototypes \
6363
-Werror-implicit-function-declaration \
64-
-Wpointer-arith \
6564
-Wfloat-equal \
6665
-Wundef \
6766
-Wshadow \
6867
-Wwrite-strings \
6968
-Wsign-compare \
7069
-Wmissing-format-attribute \
7170
-Wno-deprecated-declarations \
72-
-Wpacked \
7371
-Wnested-externs \
7472
-Wunreachable-code \
7573
-Wcast-align \
@@ -265,8 +263,8 @@ SRC_C = \
265263
lib/oofatfs/ff.c \
266264
lib/oofatfs/option/ccsbcs.c \
267265
lib/timeutils/timeutils.c \
268-
lib/tinyusb/src/portable/microchip/$(CHIP_FAMILY)/dcd.c \
269-
lib/tinyusb/src/portable/microchip/$(CHIP_FAMILY)/hal.c \
266+
lib/tinyusb/src/portable/microchip/$(CHIP_FAMILY)/dcd_$(CHIP_FAMILY).c \
267+
lib/tinyusb/src/portable/microchip/$(CHIP_FAMILY)/hal_$(CHIP_FAMILY).c \
270268
lib/utils/buffer_helper.c \
271269
lib/utils/context_manager_helpers.c \
272270
lib/utils/interrupt_char.c \

ports/nrf/Makefile

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,7 @@ ifeq ($(MCU_SUB_VARIANT),nrf52840)
217217

218218
SRC_C += \
219219
lib/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c \
220-
lib/tinyusb/src/portable/nordic/nrf5x/hal_nrf5x.c \
221-
lib/tinyusb/src/common/tusb_fifo.c \
222-
lib/tinyusb/src/device/control.c \
223-
lib/tinyusb/src/device/usbd.c \
224-
lib/tinyusb/src/class/msc/msc_device.c \
225-
lib/tinyusb/src/class/cdc/cdc_device.c \
226-
lib/tinyusb/src/class/hid/hid_device.c \
227-
lib/tinyusb/src/tusb.c \
220+
lib/tinyusb/src/portable/nordic/nrf5x/hal_nrf5x.c
228221

229222
SRC_SHARED_MODULE += \
230223
usb_hid/__init__.c \

ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,23 @@
3333
#define MICROPY_HW_MCU_NAME "nRF52840"
3434
#define MICROPY_PY_SYS_PLATFORM "Feather52840Express"
3535

36-
#define MICROPY_HW_NEOPIXEL (&pin_P0_13)
36+
#define MICROPY_HW_NEOPIXEL (&pin_P0_16)
3737

38-
#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(1, 9)
39-
#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 11)
40-
#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 12)
41-
#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(0, 14)
42-
#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(0, 8)
43-
#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(1, 8)
38+
#ifdef QSPI_FLASH_FILESYSTEM
39+
#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 17)
40+
#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 22)
41+
#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 23)
42+
#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(0, 21)
43+
#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(0, 19)
44+
#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 20)
45+
#endif
46+
47+
#ifdef SPI_FLASH_FILESYSTEM
48+
#define SPI_FLASH_MOSI_PIN &pin_P0_17
49+
#define SPI_FLASH_MISO_PIN &pin_P0_22
50+
#define SPI_FLASH_SCK_PIN &pin_P0_19
51+
#define SPI_FLASH_CS_PIN &pin_P0_20
52+
#endif
4453

4554
#define CIRCUITPY_AUTORELOAD_DELAY_MS 500
4655

@@ -51,16 +60,14 @@
5160

5261
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE)
5362

54-
#define EXTERNAL_FLASH_QSPI_DUAL (1)
55-
5663
#define BOARD_HAS_CRYSTAL 1
5764

58-
#define DEFAULT_I2C_BUS_SCL (&pin_P1_11)
59-
#define DEFAULT_I2C_BUS_SDA (&pin_P1_12)
65+
#define DEFAULT_I2C_BUS_SCL (&pin_P0_11)
66+
#define DEFAULT_I2C_BUS_SDA (&pin_P0_12)
6067

61-
#define DEFAULT_SPI_BUS_SCK (&pin_P0_20)
62-
#define DEFAULT_SPI_BUS_MOSI (&pin_P0_23)
63-
#define DEFAULT_SPI_BUS_MISO (&pin_P0_22)
68+
#define DEFAULT_SPI_BUS_SCK (&pin_P0_14)
69+
#define DEFAULT_SPI_BUS_MOSI (&pin_P0_13)
70+
#define DEFAULT_SPI_BUS_MISO (&pin_P0_15)
6471

65-
#define DEFAULT_UART_BUS_RX (&pin_P1_00)
66-
#define DEFAULT_UART_BUS_TX (&pin_P0_24)
72+
#define DEFAULT_UART_BUS_RX (&pin_P0_24)
73+
#define DEFAULT_UART_BUS_TX (&pin_P0_25)

ports/nrf/boards/feather_nrf52840_express/mpconfigboard.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ endif
2020

2121
NRF_DEFINES += -DNRF52840_XXAA -DNRF52840
2222

23-
QSPI_FLASH_FILESYSTEM = 1
23+
SPI_FLASH_FILESYSTEM = 1
2424
EXTERNAL_FLASH_DEVICE_COUNT = 1
25-
EXTERNAL_FLASH_DEVICES = "GD25Q64C"
25+
EXTERNAL_FLASH_DEVICES = "GD25Q16C"

ports/nrf/boards/feather_nrf52840_express/pins.c

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,47 @@
33
#include "board_busses.h"
44

55
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
6-
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_30) },
7-
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_28) },
8-
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_P0_31) },
9-
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_P0_02) },
10-
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_P0_29) },
6+
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_04) },
7+
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_05) },
8+
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_P0_30) },
9+
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_P0_28) },
10+
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_P0_02) },
1111
{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_P0_03) },
1212

13-
{ MP_ROM_QSTR(MP_QSTR_AREF), MP_ROM_PTR(&pin_P0_04) },
14-
{ MP_ROM_QSTR(MP_QSTR_VDIV), MP_ROM_PTR(&pin_P0_05) },
13+
{ MP_ROM_QSTR(MP_QSTR_AREF), MP_ROM_PTR(&pin_P0_31) },
1514

16-
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_P1_13) },
17-
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_P1_14) },
18-
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_P1_15) },
15+
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_P0_29) },
16+
{ MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_P0_29) },
17+
18+
{ MP_ROM_QSTR(MP_QSTR_SWITCH), MP_ROM_PTR(&pin_P1_02) },
19+
20+
{ MP_ROM_QSTR(MP_QSTR_NFC1), MP_ROM_PTR(&pin_P0_09) },
21+
{ MP_ROM_QSTR(MP_QSTR_NFC2), MP_ROM_PTR(&pin_P0_10) },
22+
23+
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_P0_10) },
24+
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_P1_08) },
25+
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_P0_07) },
26+
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_P0_26) },
1927
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_P0_27) },
20-
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_P0_26) },
21-
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_P0_06) },
22-
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_P0_07) },
23-
{ MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_P0_07) },
28+
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_P0_06) },
29+
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_P0_08) },
30+
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_P1_09) },
2431

25-
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_P0_13) },
32+
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_P0_16) },
2633

27-
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_20) },
28-
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_23) },
29-
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_22) },
34+
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_14) },
35+
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_13) },
36+
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_15) },
3037

31-
{ MP_ROM_QSTR(MP_QSTR_TXD), MP_ROM_PTR(&pin_P0_24) },
32-
{ MP_ROM_QSTR(MP_QSTR_RXD), MP_ROM_PTR(&pin_P1_00) },
38+
{ MP_ROM_QSTR(MP_QSTR_TXD), MP_ROM_PTR(&pin_P0_25) },
39+
{ MP_ROM_QSTR(MP_QSTR_RXD), MP_ROM_PTR(&pin_P0_24) },
3340

34-
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P1_11) },
35-
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P1_12) },
41+
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_11) },
42+
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_12) },
3643

37-
{ MP_ROM_QSTR(MP_QSTR_LED_RED), MP_ROM_PTR(&pin_P1_02) },
38-
{ MP_ROM_QSTR(MP_QSTR_LED_BLUE), MP_ROM_PTR(&pin_P1_10) },
44+
{ MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_P1_15) },
45+
{ MP_ROM_QSTR(MP_QSTR_RED_LED), MP_ROM_PTR(&pin_P1_15) },
46+
{ MP_ROM_QSTR(MP_QSTR_BLUE_LED), MP_ROM_PTR(&pin_P1_10) },
3947
};
4048

4149
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);

ports/nrf/common-hal/microcontroller/Pin.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ STATIC uint32_t claimed_pins[GPIO_COUNT];
4848
STATIC uint32_t never_reset_pins[GPIO_COUNT];
4949

5050
void reset_all_pins(void) {
51-
return;
5251
for (size_t i = 0; i < GPIO_COUNT; i++) {
5352
claimed_pins[i] = never_reset_pins[i];
5453
}
@@ -77,7 +76,6 @@ void reset_all_pins(void) {
7776

7877
// Mark pin as free and return it to a quiescent state.
7978
void reset_pin_number(uint8_t pin_number) {
80-
return;
8179
if (pin_number == NO_PIN) {
8280
return;
8381
}

ports/nrf/common-hal/neopixel_write/__init__.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,21 @@ void common_hal_neopixel_write (const digitalio_digitalinout_obj_t* digitalinout
108108
// using DWT
109109
uint32_t pattern_size = numBytes * 8 * sizeof(uint16_t) + 2 * sizeof(uint16_t);
110110
uint16_t* pixels_pattern = NULL;
111+
bool pattern_on_heap = false;
112+
113+
// Use the stack to store 1 pixels worth of PWM data for the status led. uint32_t to ensure alignment.
114+
uint32_t one_pixel[8 * sizeof(uint16_t) + 1];
111115

112116
NRF_PWM_Type* pwm = find_free_pwm();
113117

114118
// only malloc if there is PWM device available
115119
if ( pwm != NULL ) {
116-
pixels_pattern = (uint16_t *) m_malloc(pattern_size, false);
120+
if (numBytes == 4) {
121+
pixels_pattern = (uint16_t *) one_pixel;
122+
} else {
123+
pixels_pattern = (uint16_t *) m_malloc_maybe(pattern_size, false);
124+
pattern_on_heap = true;
125+
}
117126
}
118127

119128
// Use the identified device to choose the implementation
@@ -193,7 +202,10 @@ void common_hal_neopixel_write (const digitalio_digitalinout_obj_t* digitalinout
193202
nrf_pwm_disable(pwm);
194203
nrf_pwm_pins_set(pwm, (uint32_t[]) {0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL} );
195204

196-
m_free(pixels_pattern);
205+
if (pattern_on_heap) {
206+
m_free(pixels_pattern);
207+
}
208+
197209
} // End of DMA implementation
198210
// ---------------------------------------------------------------------
199211
else {

supervisor/shared/usb/usb_msc_flash.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,10 @@ int32_t tud_msc_scsi_cb (uint8_t lun, const uint8_t scsi_cmd[16], void* buffer,
133133
return resplen;
134134
}
135135

136-
bool tud_lun_capacity_cb(uint8_t lun, uint32_t* last_valid_sector, uint16_t* sector_size) {
137-
fs_user_mount_t * vfs = get_vfs(lun);
138-
if (vfs == NULL ||
139-
disk_ioctl(vfs, GET_SECTOR_COUNT, last_valid_sector) != RES_OK ||
140-
disk_ioctl(vfs, GET_SECTOR_SIZE, sector_size) != RES_OK) {
141-
return false;
142-
}
143-
// Subtract one from the sector count to get the last valid sector.
144-
(*last_valid_sector)--;
145-
146-
return true;
136+
void tud_msc_capacity_cb(uint8_t lun, uint32_t* block_count, uint16_t* block_size) {
137+
fs_user_mount_t * vfs = get_vfs(lun);
138+
disk_ioctl(vfs, GET_SECTOR_COUNT, block_count);
139+
disk_ioctl(vfs, GET_SECTOR_SIZE, block_size);
147140
}
148141

149142
bool tud_msc_is_writable_cb(uint8_t lun) {

0 commit comments

Comments
 (0)