2019-02-15 20:32:32 -05:00
|
|
|
#
|
|
|
|
# This file is part of the MicroPython project, http://micropython.org/
|
|
|
|
#
|
|
|
|
# The MIT License (MIT)
|
|
|
|
#
|
2020-06-03 18:40:05 -04:00
|
|
|
# SPDX-FileCopyrightText: Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
2019-02-15 20:32:32 -05:00
|
|
|
#
|
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
# of this software and associated documentation files (the "Software"), to deal
|
|
|
|
# in the Software without restriction, including without limitation the rights
|
|
|
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
# copies of the Software, and to permit persons to whom the Software is
|
|
|
|
# furnished to do so, subject to the following conditions:
|
|
|
|
#
|
|
|
|
# The above copyright notice and this permission notice shall be included in
|
|
|
|
# all copies or substantial portions of the Software.
|
|
|
|
#
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
# THE SOFTWARE.
|
|
|
|
|
2020-04-20 09:44:16 -04:00
|
|
|
# Boards default to all modules enabled (with exceptions)
|
|
|
|
# Manually disable by overriding in #mpconfigboard.mk
|
2019-02-15 00:28:20 -05:00
|
|
|
|
2023-07-31 11:21:53 -04:00
|
|
|
# These Makefile variables are used to implement the "any" and "all" functions.
|
2023-07-31 11:44:06 -04:00
|
|
|
# Note that these only work when the arguments expand to "0" and/or "1" but not
|
|
|
|
# if they expand to other values like "yes", "/bin/sh", or "false".
|
|
|
|
#
|
2023-07-31 11:21:53 -04:00
|
|
|
# Make's "sort" will transform a mixed sequence of 0s and 1s to "0 1" (because
|
|
|
|
# it also eliminates duplicates), or a non-mixed sequence of "0" or "1" to just
|
|
|
|
# itself. Thus, if all the inputs are 1 then the first word will be 1; if any
|
|
|
|
# of the inputs are 1, then the last word will be 1.
|
2023-07-25 19:25:59 -04:00
|
|
|
enable-if-any=$(lastword $(sort $(1) 0))
|
|
|
|
enable-if-all=$(firstword $(sort $(1) 1))
|
|
|
|
|
2023-07-31 11:21:53 -04:00
|
|
|
# To use any/all, you "$(call)" it, with the values to test after a comma.
|
|
|
|
# Usually the values are other $(CIRCUITPY_foo) variables. The definition
|
|
|
|
# of CIRCUITPY_AUDIOCORE and CIRCUITPY_AUDIOMP3 below are typical of how
|
|
|
|
# any/all are expected to be used.
|
2023-07-25 19:25:59 -04:00
|
|
|
|
2022-10-04 19:22:18 -04:00
|
|
|
# Always on. Present here to help generate documentation module support matrix for "builtins".
|
|
|
|
CIRCUITPY = 1
|
|
|
|
CFLAGS += -DCIRCUITPY=$(CIRCUITPY)
|
|
|
|
|
2020-04-23 13:33:41 -04:00
|
|
|
# Smaller builds can be forced for resource constrained chips (typically SAMD21s
|
2020-04-29 23:31:34 -04:00
|
|
|
# without external flash) by setting CIRCUITPY_FULL_BUILD=0. Avoid using this
|
2020-04-23 13:33:41 -04:00
|
|
|
# for merely incomplete ports, as it changes settings in other files.
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_FULL_BUILD ?= 1
|
2019-12-05 22:45:53 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_FULL_BUILD=$(CIRCUITPY_FULL_BUILD)
|
2019-02-15 00:28:20 -05:00
|
|
|
|
2022-05-03 09:31:41 -04:00
|
|
|
# Reduce the size of in-flash properties. Requires support in the .ld linker
|
|
|
|
# file, so not enabled by default.
|
|
|
|
CIRCUITPY_OPTIMIZE_PROPERTY_FLASH_SIZE ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_OPTIMIZE_PROPERTY_FLASH_SIZE=$(CIRCUITPY_OPTIMIZE_PROPERTY_FLASH_SIZE)
|
|
|
|
|
2020-10-12 01:42:21 -04:00
|
|
|
# async/await language keyword support
|
2020-05-31 18:16:44 -04:00
|
|
|
MICROPY_PY_ASYNC_AWAIT ?= $(CIRCUITPY_FULL_BUILD)
|
|
|
|
CFLAGS += -DMICROPY_PY_ASYNC_AWAIT=$(MICROPY_PY_ASYNC_AWAIT)
|
2020-04-23 13:33:41 -04:00
|
|
|
|
2023-08-03 23:29:00 -04:00
|
|
|
# unused by CIRCUITPYTHON
|
|
|
|
MICROPY_ROM_TEXT_COMPRESSION = 0
|
|
|
|
|
2021-11-01 16:02:11 -04:00
|
|
|
# uasyncio
|
|
|
|
# By default, include uasyncio if async/await are available.
|
|
|
|
MICROPY_PY_UASYNCIO ?= $(MICROPY_PY_ASYNC_AWAIT)
|
|
|
|
CFLAGS += -DMICROPY_PY_UASYNCIO=$(MICROPY_PY_UASYNCIO)
|
|
|
|
|
|
|
|
# uasyncio normally needs select
|
|
|
|
MICROPY_PY_USELECT ?= $(MICROPY_PY_UASYNCIO)
|
|
|
|
CFLAGS += -DMICROPY_PY_USELECT=$(MICROPY_PY_USELECT)
|
|
|
|
|
|
|
|
# enable select.select if select is enabled.
|
|
|
|
MICROPY_PY_USELECT_SELECT ?= $(MICROPY_PY_USELECT)
|
|
|
|
CFLAGS += -DMICROPY_PY_USELECT_SELECT=$(MICROPY_PY_USELECT_SELECT)
|
|
|
|
|
2021-09-02 06:25:51 -04:00
|
|
|
CIRCUITPY_AESIO ?= $(CIRCUITPY_FULL_BUILD)
|
2020-04-13 23:18:45 -04:00
|
|
|
CFLAGS += -DCIRCUITPY_AESIO=$(CIRCUITPY_AESIO)
|
|
|
|
|
2022-05-26 11:52:58 -04:00
|
|
|
# TODO: CIRCUITPY_ALARM will gradually be added to as many ports as possible
|
2020-11-18 20:44:34 -05:00
|
|
|
# so make this 1 or CIRCUITPY_FULL_BUILD eventually
|
2020-09-24 01:29:04 -04:00
|
|
|
CIRCUITPY_ALARM ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_ALARM=$(CIRCUITPY_ALARM)
|
|
|
|
|
2022-09-05 12:11:49 -04:00
|
|
|
CIRCUITPY_ANALOGBUFIO ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_ANALOGBUFIO=$(CIRCUITPY_ANALOGBUFIO)
|
|
|
|
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_ANALOGIO ?= 1
|
2019-02-15 00:28:20 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_ANALOGIO=$(CIRCUITPY_ANALOGIO)
|
|
|
|
|
2022-10-04 19:22:18 -04:00
|
|
|
CIRCUITPY_ARRAY ?= 1
|
|
|
|
CFLAGS += -DCIRCUITPY_ARRAY=$(CIRCUITPY_ARRAY)
|
|
|
|
|
2021-08-01 04:31:40 -04:00
|
|
|
CIRCUITPY_ATEXIT ?= $(CIRCUITPY_FULL_BUILD)
|
2021-07-29 23:06:24 -04:00
|
|
|
CFLAGS += -DCIRCUITPY_ATEXIT=$(CIRCUITPY_ATEXIT)
|
|
|
|
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_AUDIOBUSIO ?= $(CIRCUITPY_FULL_BUILD)
|
2019-02-15 00:28:20 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_AUDIOBUSIO=$(CIRCUITPY_AUDIOBUSIO)
|
|
|
|
|
2020-07-26 21:27:32 -04:00
|
|
|
# Some boards have PDMIn but do not implement I2SOut.
|
|
|
|
CIRCUITPY_AUDIOBUSIO_I2SOUT ?= $(CIRCUITPY_AUDIOBUSIO)
|
|
|
|
CFLAGS += -DCIRCUITPY_AUDIOBUSIO_I2SOUT=$(CIRCUITPY_AUDIOBUSIO_I2SOUT)
|
|
|
|
|
2020-10-28 14:27:48 -04:00
|
|
|
# Likewise, some boards have I2SOut but do not implement PDMIn.
|
|
|
|
CIRCUITPY_AUDIOBUSIO_PDMIN ?= $(CIRCUITPY_AUDIOBUSIO)
|
|
|
|
CFLAGS += -DCIRCUITPY_AUDIOBUSIO_PDMIN=$(CIRCUITPY_AUDIOBUSIO_PDMIN)
|
|
|
|
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_AUDIOIO ?= $(CIRCUITPY_FULL_BUILD)
|
2019-02-15 00:28:20 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_AUDIOIO=$(CIRCUITPY_AUDIOIO)
|
|
|
|
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_AUDIOPWMIO ?= 0
|
2019-07-25 18:55:57 -04:00
|
|
|
CFLAGS += -DCIRCUITPY_AUDIOPWMIO=$(CIRCUITPY_AUDIOPWMIO)
|
|
|
|
|
2023-07-25 19:25:59 -04:00
|
|
|
CIRCUITPY_AUDIOCORE ?= $(call enable-if-any,$(CIRCUITPY_AUDIOPWMIO) $(CIRCUITPY_AUDIOIO) $(CIRCUITPY_AUDIOBUSIO))
|
2019-07-24 21:57:32 -04:00
|
|
|
CFLAGS += -DCIRCUITPY_AUDIOCORE=$(CIRCUITPY_AUDIOCORE)
|
|
|
|
|
2023-07-25 17:01:11 -04:00
|
|
|
CIRCUITPY_AUDIOMIXER ?= $(CIRCUITPY_AUDIOCORE)
|
2019-08-25 00:36:18 -04:00
|
|
|
CFLAGS += -DCIRCUITPY_AUDIOMIXER=$(CIRCUITPY_AUDIOMIXER)
|
|
|
|
|
2023-04-01 11:19:44 -04:00
|
|
|
ifndef CIRCUITPY_AUDIOCORE_DEBUG
|
|
|
|
CIRCUITPY_AUDIOCORE_DEBUG ?= 0
|
|
|
|
endif
|
|
|
|
CFLAGS += -DCIRCUITPY_AUDIOCORE_DEBUG=$(CIRCUITPY_AUDIOCORE_DEBUG)
|
|
|
|
|
2023-07-25 19:25:59 -04:00
|
|
|
CIRCUITPY_AUDIOMP3 ?= $(call enable-if-all,$(CIRCUITPY_FULL_BUILD) $(CIRCUITPY_AUDIOCORE))
|
2019-11-26 10:29:55 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_AUDIOMP3=$(CIRCUITPY_AUDIOMP3)
|
|
|
|
|
2021-01-24 22:49:28 -05:00
|
|
|
CIRCUITPY_BINASCII ?= $(CIRCUITPY_FULL_BUILD)
|
|
|
|
CFLAGS += -DCIRCUITPY_BINASCII=$(CIRCUITPY_BINASCII)
|
|
|
|
|
2021-02-04 19:23:40 -05:00
|
|
|
CIRCUITPY_BITBANG_APA102 ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_BITBANG_APA102=$(CIRCUITPY_BITBANG_APA102)
|
|
|
|
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_BITBANGIO ?= $(CIRCUITPY_FULL_BUILD)
|
2019-02-15 00:28:20 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_BITBANGIO=$(CIRCUITPY_BITBANGIO)
|
|
|
|
|
2021-02-19 15:30:27 -05:00
|
|
|
CIRCUITPY_BITOPS ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_BITOPS=$(CIRCUITPY_BITOPS)
|
|
|
|
|
2020-06-25 20:57:17 -04:00
|
|
|
# _bleio can be supported on most any board via HCI
|
2020-10-15 11:15:48 -04:00
|
|
|
CIRCUITPY_BLEIO_HCI ?= $(CIRCUITPY_FULL_BUILD)
|
2020-06-25 20:57:17 -04:00
|
|
|
CFLAGS += -DCIRCUITPY_BLEIO_HCI=$(CIRCUITPY_BLEIO_HCI)
|
|
|
|
|
2020-10-15 11:15:48 -04:00
|
|
|
# Explicitly enabled for boards that support _bleio.
|
|
|
|
CIRCUITPY_BLEIO ?= $(CIRCUITPY_BLEIO_HCI)
|
|
|
|
CFLAGS += -DCIRCUITPY_BLEIO=$(CIRCUITPY_BLEIO)
|
|
|
|
|
2021-02-04 19:23:40 -05:00
|
|
|
CIRCUITPY_BLE_FILE_SERVICE ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_BLE_FILE_SERVICE=$(CIRCUITPY_BLE_FILE_SERVICE)
|
|
|
|
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_BOARD ?= 1
|
2019-02-15 00:28:20 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_BOARD=$(CIRCUITPY_BOARD)
|
|
|
|
|
2021-01-16 15:18:46 -05:00
|
|
|
CIRCUITPY_BUSDEVICE ?= $(CIRCUITPY_FULL_BUILD)
|
2020-10-24 21:48:35 -04:00
|
|
|
CFLAGS += -DCIRCUITPY_BUSDEVICE=$(CIRCUITPY_BUSDEVICE)
|
|
|
|
|
2020-11-24 11:26:47 -05:00
|
|
|
CIRCUITPY_BUILTINS_POW3 ?= $(CIRCUITPY_FULL_BUILD)
|
|
|
|
CFLAGS += -DCIRCUITPY_BUILTINS_POW3=$(CIRCUITPY_BUILTINS_POW3)
|
|
|
|
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_BUSIO ?= 1
|
2019-02-15 00:28:20 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_BUSIO=$(CIRCUITPY_BUSIO)
|
|
|
|
|
2021-08-11 14:53:26 -04:00
|
|
|
# These two flags pretend to implement their class but raise a ValueError due to
|
|
|
|
# unsupported pins. This should be used sparingly on boards that don't break out
|
|
|
|
# generic IO but need parts of busio.
|
2021-05-14 21:52:54 -04:00
|
|
|
CIRCUITPY_BUSIO_SPI ?= 1
|
|
|
|
CFLAGS += -DCIRCUITPY_BUSIO_SPI=$(CIRCUITPY_BUSIO_SPI)
|
|
|
|
|
2021-08-11 14:53:26 -04:00
|
|
|
CIRCUITPY_BUSIO_UART ?= 1
|
|
|
|
CFLAGS += -DCIRCUITPY_BUSIO_UART=$(CIRCUITPY_BUSIO_UART)
|
|
|
|
|
2020-09-02 09:42:57 -04:00
|
|
|
CIRCUITPY_CAMERA ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_CAMERA=$(CIRCUITPY_CAMERA)
|
|
|
|
|
2020-08-20 12:08:00 -04:00
|
|
|
CIRCUITPY_CANIO ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_CANIO=$(CIRCUITPY_CANIO)
|
|
|
|
|
2022-10-04 19:22:18 -04:00
|
|
|
CIRCUITPY_COLLECTIONS ?= 1
|
|
|
|
CFLAGS += -DCIRCUITPY_COLLECTIONS=$(CIRCUITPY_COLLECTIONS)
|
2019-02-15 00:28:20 -05:00
|
|
|
|
2021-03-05 19:29:27 -05:00
|
|
|
CIRCUITPY_COMPUTED_GOTO_SAVE_SPACE ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_COMPUTED_GOTO_SAVE_SPACE=$(CIRCUITPY_COMPUTED_GOTO_SAVE_SPACE)
|
|
|
|
|
2022-10-04 19:22:18 -04:00
|
|
|
CIRCUITPY_CYW43 ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_CYW43=$(CIRCUITPY_CYW43)
|
2021-10-15 11:17:16 -04:00
|
|
|
|
2022-10-04 19:22:18 -04:00
|
|
|
CIRCUITPY_DIGITALIO ?= 1
|
|
|
|
CFLAGS += -DCIRCUITPY_DIGITALIO=$(CIRCUITPY_DIGITALIO)
|
2021-10-15 11:17:16 -04:00
|
|
|
|
2022-10-19 11:05:48 -04:00
|
|
|
CIRCUITPY_COPROC ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_COPROC=$(CIRCUITPY_COPROC)
|
|
|
|
|
2020-05-12 22:00:51 -04:00
|
|
|
CIRCUITPY_COUNTIO ?= $(CIRCUITPY_FULL_BUILD)
|
2020-05-05 01:23:38 -04:00
|
|
|
CFLAGS += -DCIRCUITPY_COUNTIO=$(CIRCUITPY_COUNTIO)
|
|
|
|
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_DISPLAYIO ?= $(CIRCUITPY_FULL_BUILD)
|
2019-02-15 00:28:20 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_DISPLAYIO=$(CIRCUITPY_DISPLAYIO)
|
|
|
|
|
2021-08-29 08:26:47 -04:00
|
|
|
ifeq ($(CIRCUITPY_DISPLAYIO),1)
|
|
|
|
CIRCUITPY_PARALLELDISPLAY ?= $(CIRCUITPY_FULL_BUILD)
|
|
|
|
else
|
|
|
|
CIRCUITPY_PARALLELDISPLAY = 0
|
|
|
|
endif
|
|
|
|
CFLAGS += -DCIRCUITPY_PARALLELDISPLAY=$(CIRCUITPY_PARALLELDISPLAY)
|
|
|
|
|
2021-05-05 12:35:12 -04:00
|
|
|
# bitmaptools and framebufferio rely on displayio
|
2023-07-25 19:25:59 -04:00
|
|
|
CIRCUITPY_BITMAPTOOLS ?= $(call enable-if-all,$(CIRCUITPY_FULL_BUILD) $(CIRCUITPY_DISPLAYIO))
|
|
|
|
CIRCUITPY_FRAMEBUFFERIO ?= $(call enable-if-all,$(CIRCUITPY_FULL_BUILD) $(CIRCUITPY_DISPLAYIO))
|
|
|
|
CIRCUITPY_VECTORIO ?= $(CIRCUITPY_DISPLAYIO)
|
2021-05-05 12:35:12 -04:00
|
|
|
CFLAGS += -DCIRCUITPY_BITMAPTOOLS=$(CIRCUITPY_BITMAPTOOLS)
|
|
|
|
CFLAGS += -DCIRCUITPY_FRAMEBUFFERIO=$(CIRCUITPY_FRAMEBUFFERIO)
|
|
|
|
CFLAGS += -DCIRCUITPY_VECTORIO=$(CIRCUITPY_VECTORIO)
|
|
|
|
|
2021-02-04 19:23:40 -05:00
|
|
|
CIRCUITPY_DUALBANK ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_DUALBANK=$(CIRCUITPY_DUALBANK)
|
|
|
|
|
|
|
|
# Enabled micropython.native decorator (experimental)
|
|
|
|
CIRCUITPY_ENABLE_MPY_NATIVE ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_ENABLE_MPY_NATIVE=$(CIRCUITPY_ENABLE_MPY_NATIVE)
|
|
|
|
|
2022-12-08 16:21:20 -05:00
|
|
|
CIRCUITPY_OS_GETENV ?= $(CIRCUITPY_FULL_BUILD)
|
|
|
|
CFLAGS += -DCIRCUITPY_OS_GETENV=$(CIRCUITPY_OS_GETENV)
|
2022-12-01 17:43:08 -05:00
|
|
|
|
2021-01-24 22:49:28 -05:00
|
|
|
CIRCUITPY_ERRNO ?= $(CIRCUITPY_FULL_BUILD)
|
|
|
|
CFLAGS += -DCIRCUITPY_ERRNO=$(CIRCUITPY_ERRNO)
|
|
|
|
|
2023-01-27 11:28:37 -05:00
|
|
|
# Espressif specific modules.
|
|
|
|
# Assume not an Espressif build.
|
2020-08-14 18:56:01 -04:00
|
|
|
CIRCUITPY_ESPIDF ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_ESPIDF=$(CIRCUITPY_ESPIDF)
|
|
|
|
|
2023-01-20 02:57:00 -05:00
|
|
|
CIRCUITPY_ESPNOW ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_ESPNOW=$(CIRCUITPY_ESPNOW)
|
|
|
|
|
2022-12-02 17:54:42 -05:00
|
|
|
CIRCUITPY_ESPULP ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_ESPULP=$(CIRCUITPY_ESPULP)
|
|
|
|
|
2023-01-27 11:28:37 -05:00
|
|
|
CIRCUITPY_ESPCAMERA ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_ESPCAMERA=$(CIRCUITPY_ESPCAMERA)
|
add esp32-camera
This uses the esp32-camera code instead of our own homebrewed camera code.
In theory it supports esp32, esp32-s2 and esp32-s3, as long as they have
PSRAM.
This is very basic and doesn't support changing any camera parameters,
including switching resolution or pixelformat.
This is tested on the Kaluga (ESP32-S2) and ESP32-S3-Eye boards.
First, reserve some PSRAM by putting this line in `CIRCUITPY/_env`:
```
CIRCUITPY_RESERVED_PSRAM=524288
```
and hard-reset the board for it to take effect.
Now, the following script will take a very low-resolution jpeg file and print
it in the REPL in escape coded form:
```python
import board
import esp32_camera
c = esp32_camera.Camera(
data_pins=board.CAMERA_DATA,
external_clock_pin=board.CAMERA_XCLK,
pixel_clock_pin=board.CAMERA_PCLK,
vsync_pin=board.CAMERA_VSYNC,
href_pin=board.CAMERA_HREF,
pixel_format=esp32_camera.PixelFormat.JPEG,
i2c=board.I2C(),
external_clock_frequency=20_000_000)
m = c.take()
if m is not None:
print(bytes(m))
```
Then on desktop open a python repl and run something like
```python
>>> with open("my.jpg", "wb") as f: f.write(<BIG PASTE FROM REPL>)
```
and open my.jpg in a viewer.
2022-08-04 16:11:50 -04:00
|
|
|
|
2021-05-28 23:00:07 -04:00
|
|
|
CIRCUITPY__EVE ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY__EVE=$(CIRCUITPY__EVE)
|
|
|
|
|
2022-01-04 18:26:25 -05:00
|
|
|
CIRCUITPY_FLOPPYIO ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_FLOPPYIO=$(CIRCUITPY_FLOPPYIO)
|
|
|
|
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_FREQUENCYIO ?= $(CIRCUITPY_FULL_BUILD)
|
2019-02-24 19:05:51 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_FREQUENCYIO=$(CIRCUITPY_FREQUENCYIO)
|
|
|
|
|
2022-03-04 14:07:38 -05:00
|
|
|
CIRCUITPY_FUTURE ?= 1
|
|
|
|
CFLAGS += -DCIRCUITPY_FUTURE=$(CIRCUITPY_FUTURE)
|
|
|
|
|
2021-08-11 17:47:35 -04:00
|
|
|
CIRCUITPY_GETPASS ?= $(CIRCUITPY_FULL_BUILD)
|
2021-08-08 05:45:15 -04:00
|
|
|
CFLAGS += -DCIRCUITPY_GETPASS=$(CIRCUITPY_GETPASS)
|
|
|
|
|
2023-07-26 09:54:02 -04:00
|
|
|
CIRCUITPY_GIFIO ?= $(CIRCUITPY_DISPLAYIO)
|
Implement gifio.GifWriter
This involves:
* Adding a new "L8" colorspace for colorconverters
* factoring out displayio_colorconverter_convert_pixel
* Making a minimal "colorspace only" version of displayio for the
unix port (testing purposes)
* fixing an error message
I only tested writing B&W animated images, with the following script:
```python
import displayio
import gifio
with gifio.GifWriter("foo.gif", 64, 64, displayio.Colorspace.L8) as g:
for i in range(0, 256, 14):
data = bytes([i, 255-i] * 32 + [255-i, i] * 32) * 32
print("add_frame")
g.add_frame(data)
# expected to raise an error, buffer is not big enough
with gifio.GifWriter("/dev/null", 64, 64, displayio.Colorspace.L8) as g:
g.add_frame(bytes([3,3,3]))
```
2021-10-21 12:45:11 -04:00
|
|
|
CFLAGS += -DCIRCUITPY_GIFIO=$(CIRCUITPY_GIFIO)
|
|
|
|
|
2020-06-16 14:39:56 -04:00
|
|
|
CIRCUITPY_GNSS ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_GNSS=$(CIRCUITPY_GNSS)
|
|
|
|
|
2022-07-01 19:57:10 -04:00
|
|
|
CIRCUITPY_HASHLIB ?= $(CIRCUITPY_WEB_WORKFLOW)
|
|
|
|
CFLAGS += -DCIRCUITPY_HASHLIB=$(CIRCUITPY_HASHLIB)
|
|
|
|
|
2022-08-09 13:06:18 -04:00
|
|
|
CIRCUITPY_I2CTARGET ?= $(CIRCUITPY_FULL_BUILD)
|
|
|
|
CFLAGS += -DCIRCUITPY_I2CTARGET=$(CIRCUITPY_I2CTARGET)
|
2019-02-15 00:28:20 -05:00
|
|
|
|
2021-08-12 13:47:14 -04:00
|
|
|
CIRCUITPY_IMAGECAPTURE ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_IMAGECAPTURE=$(CIRCUITPY_IMAGECAPTURE)
|
|
|
|
|
2022-10-04 19:22:18 -04:00
|
|
|
# io - needed by JSON support
|
|
|
|
CIRCUITPY_IO ?= $(CIRCUITPY_JSON)
|
|
|
|
CFLAGS += -DCIRCUITPY_IO=$(CIRCUITPY_IO)
|
|
|
|
|
2020-08-05 15:53:35 -04:00
|
|
|
CIRCUITPY_IPADDRESS ?= $(CIRCUITPY_WIFI)
|
|
|
|
CFLAGS += -DCIRCUITPY_IPADDRESS=$(CIRCUITPY_IPADDRESS)
|
|
|
|
|
2021-11-06 15:00:11 -04:00
|
|
|
CIRCUITPY_IS31FL3741 ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_IS31FL3741=$(CIRCUITPY_IS31FL3741)
|
|
|
|
|
2021-01-24 22:49:28 -05:00
|
|
|
CIRCUITPY_JSON ?= $(CIRCUITPY_FULL_BUILD)
|
|
|
|
CFLAGS += -DCIRCUITPY_JSON=$(CIRCUITPY_JSON)
|
|
|
|
|
2021-05-28 23:00:07 -04:00
|
|
|
CIRCUITPY_KEYPAD ?= $(CIRCUITPY_FULL_BUILD)
|
|
|
|
CFLAGS += -DCIRCUITPY_KEYPAD=$(CIRCUITPY_KEYPAD)
|
|
|
|
|
2023-04-01 20:22:52 -04:00
|
|
|
CIRCUITPY_KEYPAD_KEYS ?= $(CIRCUITPY_KEYPAD)
|
|
|
|
CFLAGS += -DCIRCUITPY_KEYPAD_KEYS=$(CIRCUITPY_KEYPAD_KEYS)
|
|
|
|
|
|
|
|
CIRCUITPY_KEYPAD_KEYMATRIX ?= $(CIRCUITPY_KEYPAD)
|
|
|
|
CFLAGS += -DCIRCUITPY_KEYPAD_KEYMATRIX=$(CIRCUITPY_KEYPAD_KEYMATRIX)
|
|
|
|
|
|
|
|
CIRCUITPY_KEYPAD_SHIFTREGISTERKEYS ?= $(CIRCUITPY_KEYPAD)
|
|
|
|
CFLAGS += -DCIRCUITPY_KEYPAD_SHIFTREGISTERKEYS=$(CIRCUITPY_KEYPAD_SHIFTREGISTERKEYS)
|
|
|
|
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_MATH ?= 1
|
2019-02-15 00:28:20 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_MATH=$(CIRCUITPY_MATH)
|
|
|
|
|
2022-12-02 17:54:42 -05:00
|
|
|
CIRCUITPY_MEMORYMAP ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_MEMORYMAP=$(CIRCUITPY_MEMORYMAP)
|
|
|
|
|
2020-07-15 20:58:38 -04:00
|
|
|
CIRCUITPY_MEMORYMONITOR ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_MEMORYMONITOR=$(CIRCUITPY_MEMORYMONITOR)
|
|
|
|
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_MICROCONTROLLER ?= 1
|
2019-02-15 00:28:20 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_MICROCONTROLLER=$(CIRCUITPY_MICROCONTROLLER)
|
|
|
|
|
2022-02-03 10:42:48 -05:00
|
|
|
CIRCUITPY_MDNS ?= $(CIRCUITPY_WIFI)
|
|
|
|
CFLAGS += -DCIRCUITPY_MDNS=$(CIRCUITPY_MDNS)
|
|
|
|
|
2021-02-04 19:23:40 -05:00
|
|
|
CIRCUITPY_MSGPACK ?= $(CIRCUITPY_FULL_BUILD)
|
|
|
|
CFLAGS += -DCIRCUITPY_MSGPACK=$(CIRCUITPY_MSGPACK)
|
|
|
|
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_NEOPIXEL_WRITE ?= 1
|
2019-02-15 00:28:20 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_NEOPIXEL_WRITE=$(CIRCUITPY_NEOPIXEL_WRITE)
|
|
|
|
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_NVM ?= 1
|
2019-02-15 00:28:20 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_NVM=$(CIRCUITPY_NVM)
|
|
|
|
|
2021-08-12 13:47:14 -04:00
|
|
|
CIRCUITPY_ONEWIREIO ?= $(CIRCUITPY_BUSIO)
|
|
|
|
CFLAGS += -DCIRCUITPY_ONEWIREIO=$(CIRCUITPY_ONEWIREIO)
|
|
|
|
|
2022-10-04 19:22:18 -04:00
|
|
|
CIRCUITPY_OPT_LOAD_ATTR_FAST_PATH ?= 1
|
|
|
|
CFLAGS += -DCIRCUITPY_OPT_LOAD_ATTR_FAST_PATH=$(CIRCUITPY_OPT_LOAD_ATTR_FAST_PATH)
|
|
|
|
|
|
|
|
CIRCUITPY_OPT_MAP_LOOKUP_CACHE ?= $(CIRCUITPY_FULL_BUILD)
|
|
|
|
CFLAGS += -DCIRCUITPY_OPT_MAP_LOOKUP_CACHE=$(CIRCUITPY_OPT_MAP_LOOKUP_CACHE)
|
|
|
|
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_OS ?= 1
|
2019-02-15 00:28:20 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_OS=$(CIRCUITPY_OS)
|
|
|
|
|
2021-02-04 19:23:40 -05:00
|
|
|
CIRCUITPY_PEW ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_PEW=$(CIRCUITPY_PEW)
|
2020-12-08 01:00:00 -05:00
|
|
|
|
2023-04-07 14:59:55 -04:00
|
|
|
# CIRCUITPY_PICODVI is handled in the raspberrypi tree.
|
|
|
|
# Only for RP2 chips. Assume not a raspberrypi build.
|
|
|
|
CIRCUITPY_PICODVI ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_PICODVI=$(CIRCUITPY_PICODVI)
|
|
|
|
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_PIXELBUF ?= $(CIRCUITPY_FULL_BUILD)
|
2019-02-15 00:28:20 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_PIXELBUF=$(CIRCUITPY_PIXELBUF)
|
|
|
|
|
Add adafruit_pixelmap.PixelMap
.. a fast helper for animations. It is similar to and inspired by the
PixelMap helper in Adafruit LED Animation library, but with an extremely
fast 'paste' method for setting a series of pixels. This is a common
operation for many animations, and can give a substantial speed improvement.
It's named `adafruit_pixelmap` so that we can package a compatible version
in pure Python for systems that can't fit it in C in flash, or for
Blinka.
This is a proof of concept and can make a very fast comet animation:
```python
import time
import adafruit_pixelbuf
import adafruti_pixelmap
import board
import neopixel
from supervisor import ticks_ms
from adafruit_led_animation.animation.solid import Solid
from adafruit_led_animation import color
pixel_pin = board.GP0
pixel_num = 96
pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=1, auto_write=False, pixel_order="RGB")
evens = adafruit_pixelmap.PixelMap(pixels, tuple(range(0, pixel_num, 2)))
odd_indices = tuple((i, i+2) for i in range(1, pixel_num, 4))
print(odd_indices)
odds = adafruit_pixelbuf.PixelMap(pixels, odd_indices)
assert len(odds) == len(odd_indices)
comet_length = 16
comet1 = [color.calculate_intensity(color.GREEN, ((1+i) / comet_length) ** 2.4)
for i in range(comet_length)]
comet2 = [color.calculate_intensity(color.PURPLE, ((1+i) / comet_length) ** 2.4)
for i in range(comet_length)]
pos1 = 0
pos2 = 96//4
while True:
evens.paste(comet1, pos1, wrap=True, reverse=False, others=0)
pos1 = (pos1 + 1) % len(evens)
odds.paste(comet2, pos2, wrap=True, reverse=True, others=0)
pos2 = (pos2 - 1) % len(odds)
pixels.show()
m = ticks_ms()
if m % 2000 > 1000:
time.sleep(.02)
```
2022-11-10 12:02:31 -05:00
|
|
|
CIRCUITPY_PIXELMAP ?= $(CIRCUITPY_PIXELBUF)
|
|
|
|
CFLAGS += -DCIRCUITPY_PIXELMAP=$(CIRCUITPY_PIXELMAP)
|
|
|
|
|
2020-08-18 16:08:33 -04:00
|
|
|
# Only for SAMD boards for the moment
|
|
|
|
CIRCUITPY_PS2IO ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_PS2IO=$(CIRCUITPY_PS2IO)
|
2020-03-10 14:12:01 -04:00
|
|
|
|
2021-04-30 23:13:32 -04:00
|
|
|
CIRCUITPY_PULSEIO ?= $(CIRCUITPY_FULL_BUILD)
|
2019-02-15 00:28:20 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_PULSEIO=$(CIRCUITPY_PULSEIO)
|
|
|
|
|
2021-04-30 23:13:32 -04:00
|
|
|
CIRCUITPY_PWMIO ?= 1
|
2020-08-18 16:08:33 -04:00
|
|
|
CFLAGS += -DCIRCUITPY_PWMIO=$(CIRCUITPY_PWMIO)
|
2019-05-15 22:29:34 -04:00
|
|
|
|
2021-08-03 09:42:53 -04:00
|
|
|
CIRCUITPY_QRIO ?= $(CIRCUITPY_IMAGECAPTURE)
|
|
|
|
CFLAGS += -DCIRCUITPY_QRIO=$(CIRCUITPY_QRIO)
|
|
|
|
|
2021-07-12 14:40:01 -04:00
|
|
|
CIRCUITPY_RAINBOWIO ?= 1
|
|
|
|
CFLAGS += -DCIRCUITPY_RAINBOWIO=$(CIRCUITPY_RAINBOWIO)
|
2021-07-08 15:55:13 -04:00
|
|
|
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_RANDOM ?= 1
|
2019-02-15 00:28:20 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_RANDOM=$(CIRCUITPY_RANDOM)
|
|
|
|
|
2021-01-24 22:49:28 -05:00
|
|
|
CIRCUITPY_RE ?= $(CIRCUITPY_FULL_BUILD)
|
|
|
|
CFLAGS += -DCIRCUITPY_RE=$(CIRCUITPY_RE)
|
|
|
|
|
2021-02-04 19:23:40 -05:00
|
|
|
# Should busio.I2C() check for pullups?
|
|
|
|
# Some boards in combination with certain peripherals may not want this.
|
|
|
|
CIRCUITPY_REQUIRE_I2C_PULLUPS ?= 1
|
|
|
|
CFLAGS += -DCIRCUITPY_REQUIRE_I2C_PULLUPS=$(CIRCUITPY_REQUIRE_I2C_PULLUPS)
|
|
|
|
|
2021-01-20 19:47:18 -05:00
|
|
|
# CIRCUITPY_RP2PIO is handled in the raspberrypi tree.
|
|
|
|
# Only for rp2 chips.
|
|
|
|
# Assume not a rp2 build.
|
|
|
|
CIRCUITPY_RP2PIO ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_RP2PIO=$(CIRCUITPY_RP2PIO)
|
|
|
|
|
2020-08-18 16:08:33 -04:00
|
|
|
CIRCUITPY_RGBMATRIX ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_RGBMATRIX=$(CIRCUITPY_RGBMATRIX)
|
2023-06-05 11:36:31 -04:00
|
|
|
CIRCUITPY_RGBMATRIX_USES_SUPERVISOR_ALLOCATION ?= 1
|
|
|
|
CFLAGS += -DCIRCUITPY_RGBMATRIX_USES_SUPERVISOR_ALLOCATION=$(CIRCUITPY_RGBMATRIX_USES_SUPERVISOR_ALLOCATION)
|
2020-08-18 16:08:33 -04:00
|
|
|
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_ROTARYIO ?= 1
|
2019-02-15 00:28:20 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_ROTARYIO=$(CIRCUITPY_ROTARYIO)
|
|
|
|
|
2021-04-08 17:25:47 -04:00
|
|
|
CIRCUITPY_ROTARYIO_SOFTENCODER ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_ROTARYIO_SOFTENCODER=$(CIRCUITPY_ROTARYIO_SOFTENCODER)
|
|
|
|
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_RTC ?= 1
|
2019-02-15 00:28:20 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_RTC=$(CIRCUITPY_RTC)
|
|
|
|
|
2023-02-11 23:50:20 -05:00
|
|
|
# Enable support for safemode.py
|
|
|
|
CIRCUITPY_SAFEMODE_PY ?= 1
|
|
|
|
CFLAGS += -DCIRCUITPY_SAFEMODE_PY=$(CIRCUITPY_SAFEMODE_PY)
|
|
|
|
|
2019-02-17 23:48:08 -05:00
|
|
|
# CIRCUITPY_SAMD is handled in the atmel-samd tree.
|
2019-02-15 00:28:20 -05:00
|
|
|
# Only for SAMD chips.
|
2019-02-17 23:48:08 -05:00
|
|
|
# Assume not a SAMD build.
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_SAMD ?= 0
|
2019-02-15 09:52:45 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_SAMD=$(CIRCUITPY_SAMD)
|
2019-02-15 00:28:20 -05:00
|
|
|
|
2020-05-06 12:04:53 -04:00
|
|
|
CIRCUITPY_SDCARDIO ?= $(CIRCUITPY_FULL_BUILD)
|
|
|
|
CFLAGS += -DCIRCUITPY_SDCARDIO=$(CIRCUITPY_SDCARDIO)
|
|
|
|
|
2020-06-26 11:10:39 -04:00
|
|
|
CIRCUITPY_SDIOIO ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_SDIOIO=$(CIRCUITPY_SDIOIO)
|
|
|
|
|
2021-06-25 17:58:32 -04:00
|
|
|
CIRCUITPY_SERIAL_BLE ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_SERIAL_BLE=$(CIRCUITPY_SERIAL_BLE)
|
|
|
|
|
2022-04-14 06:45:16 -04:00
|
|
|
CIRCUITPY_SETTABLE_PROCESSOR_FREQUENCY?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_SETTABLE_PROCESSOR_FREQUENCY=$(CIRCUITPY_SETTABLE_PROCESSOR_FREQUENCY)
|
|
|
|
|
2020-08-06 17:03:31 -04:00
|
|
|
CIRCUITPY_SHARPDISPLAY ?= $(CIRCUITPY_FRAMEBUFFERIO)
|
|
|
|
CFLAGS += -DCIRCUITPY_SHARPDISPLAY=$(CIRCUITPY_SHARPDISPLAY)
|
|
|
|
|
2023-01-28 14:31:59 -05:00
|
|
|
# Disable the safe mode blink at boot. Speeds up boot time, but makes it
|
|
|
|
# impossible to enter safe mode by pressing buttons on boot.
|
|
|
|
CIRCUITPY_SKIP_SAFE_MODE_WAIT ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_SKIP_SAFE_MODE_WAIT=$(CIRCUITPY_SKIP_SAFE_MODE_WAIT)
|
|
|
|
|
2020-08-11 19:04:55 -04:00
|
|
|
CIRCUITPY_SOCKETPOOL ?= $(CIRCUITPY_WIFI)
|
2020-08-10 20:56:49 -04:00
|
|
|
CFLAGS += -DCIRCUITPY_SOCKETPOOL=$(CIRCUITPY_SOCKETPOOL)
|
|
|
|
|
2020-08-13 19:55:49 -04:00
|
|
|
CIRCUITPY_SSL ?= $(CIRCUITPY_WIFI)
|
|
|
|
CFLAGS += -DCIRCUITPY_SSL=$(CIRCUITPY_SSL)
|
|
|
|
|
2022-09-29 10:08:28 -04:00
|
|
|
CIRCUITPY_SSL_MBEDTLS ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_SSL_MBEDTLS=$(CIRCUITPY_SSL_MBEDTLS)
|
|
|
|
|
|
|
|
# Currently always off.
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_STAGE ?= 0
|
2019-02-15 00:28:20 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_STAGE=$(CIRCUITPY_STAGE)
|
|
|
|
|
2022-08-03 15:13:27 -04:00
|
|
|
CIRCUITPY_STATUS_BAR ?= 1
|
2022-07-08 15:27:00 -04:00
|
|
|
CFLAGS += -DCIRCUITPY_STATUS_BAR=$(CIRCUITPY_STATUS_BAR)
|
|
|
|
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_STORAGE ?= 1
|
2019-02-15 00:28:20 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_STORAGE=$(CIRCUITPY_STORAGE)
|
|
|
|
|
2022-10-04 07:56:28 -04:00
|
|
|
CIRCUITPY_STORAGE_EXTEND ?= $(CIRCUITPY_DUALBANK)
|
|
|
|
CFLAGS += -DCIRCUITPY_STORAGE_EXTEND=$(CIRCUITPY_STORAGE_EXTEND)
|
|
|
|
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_STRUCT ?= 1
|
2019-02-15 00:28:20 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_STRUCT=$(CIRCUITPY_STRUCT)
|
|
|
|
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_SUPERVISOR ?= 1
|
2019-02-15 00:28:20 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_SUPERVISOR=$(CIRCUITPY_SUPERVISOR)
|
|
|
|
|
2021-03-19 18:22:00 -04:00
|
|
|
CIRCUITPY_SYNTHIO ?= $(CIRCUITPY_AUDIOCORE)
|
|
|
|
CFLAGS += -DCIRCUITPY_SYNTHIO=$(CIRCUITPY_SYNTHIO)
|
|
|
|
|
2023-03-31 11:51:03 -04:00
|
|
|
CIRCUITPY_SYNTHIO_MAX_CHANNELS ?= 2
|
|
|
|
CFLAGS += -DCIRCUITPY_SYNTHIO_MAX_CHANNELS=$(CIRCUITPY_SYNTHIO_MAX_CHANNELS)
|
|
|
|
|
|
|
|
|
2022-10-04 19:22:18 -04:00
|
|
|
CIRCUITPY_SYS ?= 1
|
|
|
|
CFLAGS += -DCIRCUITPY_SYS=$(CIRCUITPY_SYS)
|
|
|
|
|
2020-08-17 20:17:59 -04:00
|
|
|
CIRCUITPY_TERMINALIO ?= $(CIRCUITPY_DISPLAYIO)
|
|
|
|
CFLAGS += -DCIRCUITPY_TERMINALIO=$(CIRCUITPY_TERMINALIO)
|
|
|
|
|
2023-07-25 19:25:59 -04:00
|
|
|
CIRCUITPY_FONTIO ?= $(call enable-if-all,$(CIRCUITPY_DISPLAYIO) $(CIRCUITPY_TERMINALIO))
|
2022-09-11 09:09:14 -04:00
|
|
|
CFLAGS += -DCIRCUITPY_FONTIO=$(CIRCUITPY_FONTIO)
|
|
|
|
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_TIME ?= 1
|
2019-02-15 00:28:20 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_TIME=$(CIRCUITPY_TIME)
|
|
|
|
|
2019-08-18 08:44:10 -04:00
|
|
|
# touchio might be native or generic. See circuitpy_defns.mk.
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_TOUCHIO_USE_NATIVE ?= 0
|
2019-08-18 08:44:10 -04:00
|
|
|
CFLAGS += -DCIRCUITPY_TOUCHIO_USE_NATIVE=$(CIRCUITPY_TOUCHIO_USE_NATIVE)
|
|
|
|
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_TOUCHIO ?= 1
|
2019-02-15 00:28:20 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_TOUCHIO=$(CIRCUITPY_TOUCHIO)
|
|
|
|
|
2021-08-11 17:47:35 -04:00
|
|
|
CIRCUITPY_TRACEBACK ?= $(CIRCUITPY_FULL_BUILD)
|
2021-07-27 14:30:01 -04:00
|
|
|
CFLAGS += -DCIRCUITPY_TRACEBACK=$(CIRCUITPY_TRACEBACK)
|
|
|
|
|
2019-02-15 00:28:20 -05:00
|
|
|
# For debugging.
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_UHEAP ?= 0
|
2019-02-15 00:28:20 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_UHEAP=$(CIRCUITPY_UHEAP)
|
|
|
|
|
2021-04-16 10:59:11 -04:00
|
|
|
CIRCUITPY_USB ?= 1
|
|
|
|
CFLAGS += -DCIRCUITPY_USB=$(CIRCUITPY_USB)
|
|
|
|
|
2021-05-13 21:49:04 -04:00
|
|
|
# Compute these value once, so the shell command is not reinvoked many times.
|
|
|
|
USB_NUM_ENDPOINT_PAIRS_5_OR_GREATER := $(shell expr $(USB_NUM_ENDPOINT_PAIRS) '>=' 5)
|
|
|
|
USB_NUM_ENDPOINT_PAIRS_8_OR_GREATER := $(shell expr $(USB_NUM_ENDPOINT_PAIRS) '>=' 8)
|
|
|
|
|
|
|
|
# Some chips may not support the same number of IN or OUT endpoints as pairs.
|
|
|
|
# For instance, the ESP32-S2 only supports 5 IN endpoints at once, even though
|
|
|
|
# it has 7 endpoint pairs.
|
|
|
|
USB_NUM_IN_ENDPOINTS ?= $(USB_NUM_ENDPOINT_PAIRS)
|
|
|
|
CFLAGS += -DUSB_NUM_IN_ENDPOINTS=$(USB_NUM_IN_ENDPOINTS)
|
|
|
|
|
|
|
|
USB_NUM_OUT_ENDPOINTS ?= $(USB_NUM_ENDPOINT_PAIRS)
|
|
|
|
CFLAGS += -DUSB_NUM_OUT_ENDPOINTS=$(USB_NUM_OUT_ENDPOINTS)
|
2021-04-25 23:17:41 -04:00
|
|
|
|
2021-07-08 22:11:05 -04:00
|
|
|
CIRCUITPY_USB_CDC ?= $(CIRCUITPY_USB)
|
2021-02-12 19:01:14 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_USB_CDC=$(CIRCUITPY_USB_CDC)
|
2021-05-03 22:22:29 -04:00
|
|
|
CIRCUITPY_USB_CDC_CONSOLE_ENABLED_DEFAULT ?= 1
|
|
|
|
CFLAGS += -DCIRCUITPY_USB_CDC_CONSOLE_ENABLED_DEFAULT=$(CIRCUITPY_USB_CDC_CONSOLE_ENABLED_DEFAULT)
|
2021-04-27 23:53:23 -04:00
|
|
|
CIRCUITPY_USB_CDC_DATA_ENABLED_DEFAULT ?= 0
|
2021-04-25 23:17:41 -04:00
|
|
|
CFLAGS += -DCIRCUITPY_USB_CDC_DATA_ENABLED_DEFAULT=$(CIRCUITPY_USB_CDC_DATA_ENABLED_DEFAULT)
|
2021-02-12 19:01:14 -05:00
|
|
|
|
2021-05-13 21:49:04 -04:00
|
|
|
# HID is available by default, but is not turned on if there are fewer than 5 endpoints.
|
2021-07-08 22:11:05 -04:00
|
|
|
CIRCUITPY_USB_HID ?= $(CIRCUITPY_USB)
|
2019-02-15 00:28:20 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_USB_HID=$(CIRCUITPY_USB_HID)
|
2021-05-13 21:49:04 -04:00
|
|
|
CIRCUITPY_USB_HID_ENABLED_DEFAULT ?= $(USB_NUM_ENDPOINT_PAIRS_5_OR_GREATER)
|
2021-04-25 23:17:41 -04:00
|
|
|
CFLAGS += -DCIRCUITPY_USB_HID_ENABLED_DEFAULT=$(CIRCUITPY_USB_HID_ENABLED_DEFAULT)
|
2019-02-15 00:28:20 -05:00
|
|
|
|
2022-02-18 20:57:54 -05:00
|
|
|
CIRCUITPY_USB_HOST ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_USB_HOST=$(CIRCUITPY_USB_HOST)
|
|
|
|
|
2022-09-20 14:32:38 -04:00
|
|
|
CIRCUITPY_USB_IDENTIFICATION ?= $(CIRCUITPY_USB)
|
|
|
|
CFLAGS += -DCIRCUITPY_USB_IDENTIFICATION=$(CIRCUITPY_USB_IDENTIFICATION)
|
|
|
|
|
2023-05-02 15:13:54 -04:00
|
|
|
CIRCUITPY_USB_KEYBOARD_WORKFLOW ?= $(CIRCUITPY_USB_HOST)
|
|
|
|
CFLAGS += -DCIRCUITPY_USB_KEYBOARD_WORKFLOW=$(CIRCUITPY_USB_KEYBOARD_WORKFLOW)
|
|
|
|
|
2021-05-13 21:49:04 -04:00
|
|
|
# MIDI is available by default, but is not turned on if there are fewer than 8 endpoints.
|
2021-07-08 22:11:05 -04:00
|
|
|
CIRCUITPY_USB_MIDI ?= $(CIRCUITPY_USB)
|
2021-02-04 19:23:40 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_USB_MIDI=$(CIRCUITPY_USB_MIDI)
|
2021-05-13 21:49:04 -04:00
|
|
|
CIRCUITPY_USB_MIDI_ENABLED_DEFAULT ?= $(USB_NUM_ENDPOINT_PAIRS_8_OR_GREATER)
|
2021-04-25 23:17:41 -04:00
|
|
|
CFLAGS += -DCIRCUITPY_USB_MIDI_ENABLED_DEFAULT=$(CIRCUITPY_USB_MIDI_ENABLED_DEFAULT)
|
2020-02-20 15:15:56 -05:00
|
|
|
|
2021-07-08 22:11:05 -04:00
|
|
|
CIRCUITPY_USB_MSC ?= $(CIRCUITPY_USB)
|
2021-02-04 19:23:40 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_USB_MSC=$(CIRCUITPY_USB_MSC)
|
2021-05-12 15:53:52 -04:00
|
|
|
CIRCUITPY_USB_MSC_ENABLED_DEFAULT ?= $(CIRCUITPY_USB_MSC)
|
2021-04-25 23:17:41 -04:00
|
|
|
CFLAGS += -DCIRCUITPY_USB_MSC_ENABLED_DEFAULT=$(CIRCUITPY_USB_MSC_ENABLED_DEFAULT)
|
2021-02-04 19:23:40 -05:00
|
|
|
|
2021-01-26 19:18:39 -05:00
|
|
|
# Defaulting this to OFF initially because it has only been tested on a
|
|
|
|
# limited number of platforms, and the other platforms do not have this
|
|
|
|
# setting in their mpconfigport.mk and/or mpconfigboard.mk files yet.
|
|
|
|
CIRCUITPY_USB_VENDOR ?= 0
|
2021-01-25 21:37:58 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_USB_VENDOR=$(CIRCUITPY_USB_VENDOR)
|
2021-02-04 19:23:40 -05:00
|
|
|
|
2021-05-13 21:49:04 -04:00
|
|
|
ifndef USB_NUM_ENDPOINT_PAIRS
|
|
|
|
$(error "USB_NUM_ENDPOINT_PAIRS (number of USB endpoint pairs)must be defined")
|
2021-02-04 19:23:40 -05:00
|
|
|
endif
|
2021-05-13 21:49:04 -04:00
|
|
|
CFLAGS += -DUSB_NUM_ENDPOINT_PAIRS=$(USB_NUM_ENDPOINT_PAIRS)
|
2021-02-04 19:23:40 -05:00
|
|
|
|
|
|
|
# For debugging.
|
|
|
|
CIRCUITPY_USTACK ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_USTACK=$(CIRCUITPY_USTACK)
|
2019-10-29 13:11:19 -04:00
|
|
|
|
2023-03-18 11:17:02 -04:00
|
|
|
# for decompressing utilities
|
2022-06-13 18:36:15 -04:00
|
|
|
CIRCUITPY_ZLIB ?= $(CIRCUITPY_FULL_BUILD)
|
2022-02-20 16:32:44 -05:00
|
|
|
CFLAGS += -DCIRCUITPY_ZLIB=$(CIRCUITPY_ZLIB)
|
2022-02-19 11:41:42 -05:00
|
|
|
|
2020-03-09 16:54:21 -04:00
|
|
|
# ulab numerics library
|
2020-04-29 23:31:34 -04:00
|
|
|
CIRCUITPY_ULAB ?= $(CIRCUITPY_FULL_BUILD)
|
2020-04-23 17:12:55 -04:00
|
|
|
CFLAGS += -DCIRCUITPY_ULAB=$(CIRCUITPY_ULAB)
|
2020-03-09 16:54:21 -04:00
|
|
|
|
2023-07-25 10:35:49 -04:00
|
|
|
# whether to use -Os optimization on files in ulab
|
|
|
|
CIRCUITPY_ULAB_OPTIMIZE_SIZE ?= 0
|
|
|
|
|
2021-08-04 19:27:54 -04:00
|
|
|
# CIRCUITPY_VIDEOCORE is handled in the broadcom tree.
|
|
|
|
# Only for Broadcom chips.
|
|
|
|
# Assume not a Broadcom build.
|
|
|
|
CIRCUITPY_VIDEOCORE ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_VIDEOCORE=$(CIRCUITPY_VIDEOCORE)
|
|
|
|
|
2020-05-20 08:08:07 -04:00
|
|
|
# watchdog hardware support
|
2020-05-21 01:47:23 -04:00
|
|
|
CIRCUITPY_WATCHDOG ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_WATCHDOG=$(CIRCUITPY_WATCHDOG)
|
2020-05-20 08:08:07 -04:00
|
|
|
|
2020-07-28 21:23:33 -04:00
|
|
|
CIRCUITPY_WIFI ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_WIFI=$(CIRCUITPY_WIFI)
|
2021-12-27 11:21:47 -05:00
|
|
|
|
2022-06-06 19:54:02 -04:00
|
|
|
CIRCUITPY_WEB_WORKFLOW ?= $(CIRCUITPY_WIFI)
|
|
|
|
CFLAGS += -DCIRCUITPY_WEB_WORKFLOW=$(CIRCUITPY_WEB_WORKFLOW)
|
|
|
|
|
2023-01-02 11:45:58 -05:00
|
|
|
CIRCUITPY_WIFI_RADIO_SETTABLE_MAC_ADDRESS?= 1
|
|
|
|
CFLAGS += -DCIRCUITPY_WIFI_RADIO_SETTABLE_MAC_ADDRESS=$(CIRCUITPY_WIFI_RADIO_SETTABLE_MAC_ADDRESS)
|
|
|
|
|
2022-01-05 13:28:07 -05:00
|
|
|
# tinyusb port tailored configuration
|
|
|
|
CIRCUITPY_TUSB_MEM_ALIGN ?= 4
|
|
|
|
CFLAGS += -DCIRCUITPY_TUSB_MEM_ALIGN=$(CIRCUITPY_TUSB_MEM_ALIGN)
|
|
|
|
|
|
|
|
CIRCUITPY_TUSB_ATTR_USBRAM ?= ".bss.usbram"
|
|
|
|
CFLAGS += -DCIRCUITPY_TUSB_ATTR_USBRAM=$(CIRCUITPY_TUSB_ATTR_USBRAM)
|
|
|
|
|
2023-02-28 18:07:35 -05:00
|
|
|
# Output function trace information from the ARM ITM.
|
|
|
|
CIRCUITPY_SWO_TRACE ?= 0
|
|
|
|
CFLAGS += -DCIRCUITPY_SWO_TRACE=$(CIRCUITPY_SWO_TRACE)
|
|
|
|
|
2021-12-27 11:21:47 -05:00
|
|
|
# Define an equivalent for MICROPY_LONGINT_IMPL, to pass to $(MPY-TOOL) in py/mkrules.mk
|
|
|
|
# $(MPY-TOOL) needs to know what kind of longint to use (if any) to freeze long integers.
|
|
|
|
# This should correspond to the MICROPY_LONGINT_IMPL definition in mpconfigport.h.
|
|
|
|
#
|
|
|
|
# Also propagate longint choice from .mk to C. There's no easy string comparison
|
|
|
|
# in cpp conditionals, so we #define separate names for each.
|
|
|
|
|
|
|
|
ifeq ($(LONGINT_IMPL),NONE)
|
|
|
|
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=none
|
|
|
|
CFLAGS += -DLONGINT_IMPL_NONE
|
|
|
|
else ifeq ($(LONGINT_IMPL),MPZ)
|
|
|
|
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz
|
|
|
|
CFLAGS += -DLONGINT_IMPL_MPZ
|
|
|
|
else ifeq ($(LONGINT_IMPL),LONGLONG)
|
|
|
|
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=longlong
|
|
|
|
CFLAGS += -DLONGINT_IMPL_LONGLONG
|
|
|
|
else
|
|
|
|
$(error LONGINT_IMPL set to surprising value: "$(LONGINT_IMPL)")
|
|
|
|
endif
|
2022-02-16 16:33:54 -05:00
|
|
|
MPY_TOOL_FLAGS += $(MPY_TOOL_LONGINT_IMPL)
|
2021-12-27 11:21:47 -05:00
|
|
|
|
|
|
|
###
|
|
|
|
ifeq ($(LONGINT_IMPL),NONE)
|
|
|
|
else ifeq ($(LONGINT_IMPL),MPZ)
|
|
|
|
else ifeq ($(LONGINT_IMPL),LONGLONG)
|
|
|
|
else
|
|
|
|
$(error LONGINT_IMPL set to surprising value: "$(LONGINT_IMPL)")
|
|
|
|
endif
|
2022-02-16 16:33:54 -05:00
|
|
|
|
|
|
|
PREPROCESS_FROZEN_MODULES = PYTHONPATH=$(TOP)/tools/python-semver $(TOP)/tools/preprocess_frozen_modules.py
|
|
|
|
ifneq ($(FROZEN_MPY_DIRS),)
|
|
|
|
$(BUILD)/frozen_mpy: $(FROZEN_MPY_DIRS)
|
|
|
|
$(ECHO) FREEZE $(FROZEN_MPY_DIRS)
|
|
|
|
$(Q)$(MKDIR) -p $@
|
|
|
|
$(Q)$(PREPROCESS_FROZEN_MODULES) -o $@ $(FROZEN_MPY_DIRS)
|
|
|
|
|
|
|
|
$(BUILD)/manifest.py: $(BUILD)/frozen_mpy | $(TOP)/py/circuitpy_mpconfig.mk mpconfigport.mk boards/$(BOARD)/mpconfigboard.mk
|
|
|
|
$(ECHO) MKMANIFEST $(FROZEN_MPY_DIRS)
|
2023-08-12 17:28:32 -04:00
|
|
|
$(Q)(cd $(BUILD)/frozen_mpy && find * -name \*.py -exec printf 'freeze_as_mpy("frozen_mpy", "%s")\n' {} \; )> $@.tmp && mv -f $@.tmp $@
|
2022-02-16 16:33:54 -05:00
|
|
|
FROZEN_MANIFEST=$(BUILD)/manifest.py
|
|
|
|
endif
|