Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions locale/circuitpython.pot
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,6 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/espressif/common-hal/mii/RMII.c
#: ports/raspberrypi/common-hal/picodvi/Framebuffer_RP2350.c
#: ports/zephyr-cp/common-hal/busio/I2C.c
#: ports/zephyr-cp/common-hal/busio/SPI.c
Expand Down Expand Up @@ -1182,6 +1181,7 @@ msgid "Another send is already active"
msgstr ""

#: ports/atmel-samd/common-hal/sdioio/SDCard.c
#: ports/espressif/common-hal/mii/Ethernet.c
#: ports/espressif/common-hal/qspibus/QSPIBus.c shared-bindings/emmcio/EMMC.c
#: shared-bindings/socketpool/SocketPool.c
msgid "%q failure: %d"
Expand Down Expand Up @@ -1517,7 +1517,8 @@ msgid "%q must be 8, 16, 24, or 32"
msgstr ""

#: ports/espressif/common-hal/audiobusio/__init__.c
#: ports/espressif/common-hal/audioi2sin/I2SIn.c shared-bindings/emmcio/EMMC.c
#: ports/espressif/common-hal/audioi2sin/I2SIn.c
#: ports/espressif/common-hal/mii/Ethernet.c shared-bindings/emmcio/EMMC.c
msgid "Peripheral in use"
msgstr ""

Expand Down Expand Up @@ -1670,10 +1671,12 @@ msgstr ""

#: ports/espressif/common-hal/espidf/__init__.c
#: ports/espressif/common-hal/qspibus/QSPIBus.c
#: shared-module/_airlift/__init__.c
msgid "Operation timed out"
msgstr ""

#: ports/espressif/common-hal/espidf/__init__.c
#: shared-module/_airlift/__init__.c
msgid "Received response was invalid"
msgstr ""

Expand Down Expand Up @@ -1710,8 +1713,8 @@ msgstr ""
#: ports/raspberrypi/common-hal/usb_host/Port.c
#: shared-bindings/digitalio/DigitalInOut.c shared-bindings/emmcio/EMMC.c
#: shared-bindings/i2cioexpander/IOPin.c shared-bindings/microcontroller/Pin.c
#: shared-module/max3421e/Max3421E.c shared-module/usb/core/Device.c
#: shared-module/usb_host_audio/USBIn.c
#: shared-module/_airlift/__init__.c shared-module/max3421e/Max3421E.c
#: shared-module/usb/core/Device.c shared-module/usb_host_audio/USBIn.c
msgid "%q in use"
msgstr ""

Expand Down Expand Up @@ -2512,7 +2515,7 @@ msgid "%q must be >= %d"
msgstr ""

#: py/argcheck.c shared-bindings/gifio/GifWriter.c
#: shared-module/gifio/OnDiskGif.c
#: shared-module/_airlift/__init__.c shared-module/gifio/OnDiskGif.c
msgid "%q must be <= %d"
msgstr ""

Expand All @@ -2524,7 +2527,7 @@ msgstr ""
msgid "%q length must be >= %d"
msgstr ""

#: py/argcheck.c
#: py/argcheck.c shared-module/_airlift/__init__.c
msgid "%q length must be <= %d"
msgstr ""

Expand Down
9 changes: 9 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@
#include "shared-module/memorymonitor/__init__.h"
#endif

#if CIRCUITPY_AIRLIFT
#include "shared-module/_airlift/transport.h"
#endif

#if CIRCUITPY_SOCKETPOOL
#include "shared-bindings/socketpool/__init__.h"
#endif
Expand Down Expand Up @@ -433,6 +437,11 @@ static void cleanup_after_vm(mp_obj_t exception) {
socketpool_user_reset();
#endif

// Close sockets that user code left open on the ESP32 co-processor.
#if CIRCUITPY_AIRLIFT
airlift_user_reset();
#endif

// Turn off user initiated WiFi connections.
#if CIRCUITPY_WIFI
wifi_user_reset();
Expand Down
7 changes: 7 additions & 0 deletions ports/raspberrypi/boards/adafruit_fruit_jam/mpconfigboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@

#define CIRCUITPY_PSRAM_CHIP_SELECT (&pin_GPIO47)

// The ESP32-C6 running nina-fw, on board.SPI(). nina-fw raises ESP_IRQ when a
// socket has data, so web workflow polls only then.
#define CIRCUITPY_AIRLIFT_CS (&pin_GPIO46)
#define CIRCUITPY_AIRLIFT_BUSY (&pin_GPIO3)
#define CIRCUITPY_AIRLIFT_RESET (&pin_GPIO22)
#define CIRCUITPY_AIRLIFT_GPIO0 (&pin_GPIO23)

// #define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO44)
// #define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO45)

Expand Down
9 changes: 9 additions & 0 deletions ports/raspberrypi/boards/adafruit_fruit_jam/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,12 @@ CIRCUITPY_USB_HOST_BULK = 1

# USB microphones as audio sources. Needs the isochronous ring above.
CIRCUITPY_USB_HOST_AUDIO = 1

# The ESP32-C6 co-processor, shared by the core and ESP32SPI. The core uses it
# for web workflow. The flags are set one by one, because CIRCUITPY_NETWORK
# would also turn on ssl, ipaddress and so on.
CIRCUITPY_AIRLIFT = 1
CIRCUITPY_SOCKETPOOL = 1
CIRCUITPY_WEB_WORKFLOW = 1
CIRCUITPY_MDNS = 0
CIRCUITPY_SSL = 0
7 changes: 7 additions & 0 deletions ports/raspberrypi/common-hal/socketpool/Socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
//
// SPDX-License-Identifier: MIT

#include "py/mpconfig.h"

// With CIRCUITPY_AIRLIFT, shared-module/_airlift/socketpool.c is used instead.
#if !CIRCUITPY_AIRLIFT

#include "shared-bindings/socketpool/Socket.h"

#include "py/gc.h"
Expand Down Expand Up @@ -1338,3 +1343,5 @@ void socketpool_socket_reset(socketpool_socket_obj_t *self) {
self->pcb.tcp = NULL;
self->state = _ERR_BADF;
}

#endif // !CIRCUITPY_AIRLIFT
7 changes: 7 additions & 0 deletions ports/raspberrypi/common-hal/socketpool/Socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@

#include "common-hal/socketpool/SocketPool.h"

#if CIRCUITPY_AIRLIFT
// The sockets live on the ESP32 co-processor (nina-fw).
#include "shared-module/_airlift/socketpool.h"
#else

typedef struct _lwip_socket_obj_t {
mp_obj_base_t base;

Expand Down Expand Up @@ -59,3 +64,5 @@ typedef struct _lwip_socket_obj_t {
#define socketpool_socket_poll_resume(x)

void socket_user_reset(void);

#endif
7 changes: 7 additions & 0 deletions ports/raspberrypi/common-hal/socketpool/SocketPool.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
//
// SPDX-License-Identifier: MIT

#include "py/mpconfig.h"

// With CIRCUITPY_AIRLIFT, shared-module/_airlift/socketpool.c is used instead.
#if !CIRCUITPY_AIRLIFT

#include "shared-bindings/socketpool/SocketPool.h"
#include "common-hal/socketpool/__init__.h"
#include "common-hal/socketpool/Socket.h"
Expand Down Expand Up @@ -54,3 +59,5 @@ mp_obj_t common_hal_socketpool_getaddrinfo_raise(socketpool_socketpool_obj_t *se
tuple->items[4] = MP_OBJ_FROM_PTR(sockaddr);
return mp_obj_new_list(1, (mp_obj_t *)&tuple);
}

#endif // !CIRCUITPY_AIRLIFT
6 changes: 6 additions & 0 deletions ports/raspberrypi/common-hal/socketpool/SocketPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@

#include "py/obj.h"

#if CIRCUITPY_AIRLIFT
#include "shared-module/_airlift/socketpool.h"
#else

#include "lwip/ip_addr.h"

typedef struct {
mp_obj_base_t base;
} socketpool_socketpool_obj_t;

#endif
7 changes: 7 additions & 0 deletions ports/raspberrypi/common-hal/socketpool/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
//
// SPDX-License-Identifier: MIT

#include "py/mpconfig.h"

// With CIRCUITPY_AIRLIFT, shared-module/_airlift/socketpool.c is used instead.
#if !CIRCUITPY_AIRLIFT

#include "py/runtime.h"
#include "shared/runtime/interrupt_char.h"

Expand Down Expand Up @@ -79,3 +84,5 @@ void socketpool_resolve_host_raise(const char *host, ip_addr_t *addr) {
mp_raise_OSError(-result);
}
}

#endif // !CIRCUITPY_AIRLIFT
2 changes: 2 additions & 0 deletions ports/raspberrypi/common-hal/socketpool/__init__.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

#pragma once

#if !CIRCUITPY_AIRLIFT
#include "lwip/ip_addr.h"

mp_obj_t socketpool_ip_addr_to_str(const ip_addr_t *addr);
void socketpool_resolve_host_raise(const char *host, ip_addr_t *addr);
#endif
7 changes: 7 additions & 0 deletions py/circuitpy_defns.mk
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ endif
ifeq ($(CIRCUITPY_AESIO),1)
SRC_PATTERNS += aesio/%
endif
ifeq ($(CIRCUITPY_AIRLIFT),1)
SRC_PATTERNS += _airlift/%
endif
ifeq ($(CIRCUITPY_ALARM),1)
SRC_PATTERNS += alarm/__init__.c alarm/SleepMemory.c alarm/pin/% alarm/time/%
endif
Expand Down Expand Up @@ -732,6 +735,7 @@ SRC_BINDINGS_ENUMS += \
util.c

SRC_SHARED_MODULE_ALL = \
_airlift/__init__.c \
_bleio/Address.c \
_bleio/Attribute.c \
_bleio/ScanEntry.c \
Expand Down Expand Up @@ -1089,6 +1093,9 @@ endif
# All possible sources are listed here, and are filtered by SRC_PATTERNS.
SRC_SHARED_MODULE_INTERNAL = \
$(filter $(SRC_PATTERNS), \
_airlift/network.c \
_airlift/socketpool.c \
_airlift/transport.c \
displayio/bus_core.c \
displayio/display_core.c \
usb/utf16le.c \
Expand Down
5 changes: 5 additions & 0 deletions py/circuitpy_mpconfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ CFLAGS += -DMICROPY_PY_SELECT_SELECT=$(MICROPY_PY_SELECT_SELECT)
CIRCUITPY_AESIO ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_AESIO=$(CIRCUITPY_AESIO)

# An ESP32 co-processor running nina-fw, shared by the core and ESP32SPI (`_airlift`).
# Not part of CIRCUITPY_NETWORK, which would also turn on ssl, ipaddress and so on.
CIRCUITPY_AIRLIFT ?= 0
CFLAGS += -DCIRCUITPY_AIRLIFT=$(CIRCUITPY_AIRLIFT)

# TODO: CIRCUITPY_ALARM will gradually be added to as many ports as possible
# so make this 1 or CIRCUITPY_FULL_BUILD eventually
CIRCUITPY_ALARM ?= 0
Expand Down
Loading
Loading