Merge remote-tracking branch 'adafruit/main' into nrf-usb-compliance-test
This commit is contained in:
commit
ec067ae728
1
.github/workflows/build.yml
vendored
1
.github/workflows/build.yml
vendored
@ -523,6 +523,7 @@ jobs:
|
||||
- "gravitech_cucumber_r"
|
||||
- "gravitech_cucumber_rs"
|
||||
- "lilygo_ttgo_t8_s2_st7789"
|
||||
- "lolin_s2_mini"
|
||||
- "microdev_micro_s2"
|
||||
- "morpheans_morphesp-240"
|
||||
- "muselab_nanoesp32_s2_wroom"
|
||||
|
@ -71,7 +71,7 @@ shared-bindings/displayio/Group.rst shared-bindings/displayio/#displayio.Group
|
||||
shared-bindings/displayio/I2CDisplay.rst shared-bindings/displayio/#displayio.I2CDisplay
|
||||
shared-bindings/displayio/OnDiskBitmap.rst shared-bindings/displayio/#displayio.OnDiskBitmap
|
||||
shared-bindings/displayio/Palette.rst shared-bindings/displayio/#displayio.Palette
|
||||
shared-bindings/displayio/ParallelBus.rst shared-bindings/displayio/#displayio.ParallelBus
|
||||
shared-bindings/paralleldisplay/ParallelBus.rst shared-bindings/paralleldisplay/#paralleldisplay.ParallelBus
|
||||
shared-bindings/displayio/Shape.rst shared-bindings/displayio/#displayio.Shape
|
||||
shared-bindings/displayio/TileGrid.rst shared-bindings/displayio/#displayio.TileGrid
|
||||
shared-bindings/displayio/__init__.rst shared-bindings/displayio/
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 275c03e340c3853ab1c53fc15b6df07ceb672bdc
|
||||
Subproject commit d0f1c46d7f879cd60562ee69900d619499d4d206
|
@ -650,7 +650,21 @@ friendly_repl_reset:
|
||||
}
|
||||
|
||||
vstr_reset(&line);
|
||||
int ret = readline(&line, ">>> ");
|
||||
|
||||
nlr_buf_t nlr;
|
||||
nlr.ret_val = NULL;
|
||||
int ret = 0;
|
||||
if (nlr_push(&nlr) == 0) {
|
||||
ret = readline(&line, ">>> ");
|
||||
} else {
|
||||
// Uncaught exception
|
||||
mp_handle_pending(false); // clear any pending exceptions (and run any callbacks)
|
||||
|
||||
// Print exceptions but stay in the REPL. There are very few delayed
|
||||
// exceptions. The WatchDogTimer can raise one though.
|
||||
mp_hal_stdout_tx_str("\r\n");
|
||||
mp_obj_print_exception(&mp_plat_print, MP_OBJ_FROM_PTR(nlr.ret_val));
|
||||
}
|
||||
mp_parse_input_kind_t parse_input_kind = MP_PARSE_SINGLE_INPUT;
|
||||
|
||||
if (ret == CHAR_CTRL_A) {
|
||||
|
@ -3939,6 +3939,7 @@ msgstr ""
|
||||
#: ports/esp32s2/boards/gravitech_cucumber_r/mpconfigboard.h
|
||||
#: ports/esp32s2/boards/gravitech_cucumber_rs/mpconfigboard.h
|
||||
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
|
||||
#: ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.h
|
||||
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
|
||||
#: ports/esp32s2/boards/morpheans_morphesp-240/mpconfigboard.h
|
||||
#: ports/esp32s2/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.h
|
||||
|
@ -20,6 +20,7 @@ CIRCUITPY_USB_MIDI = 0
|
||||
# So not all of displayio, sorry!
|
||||
CIRCUITPY_VECTORIO = 0
|
||||
CIRCUITPY_BITMAPTOOLS = 0
|
||||
CIRCUITPY_PARALLELDISPLAY = 0
|
||||
|
||||
# Include these Python libraries in firmware.
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground
|
||||
|
@ -20,6 +20,7 @@ CIRCUITPY_BITBANG_APA102 = 0
|
||||
CIRCUITPY_FREQUENCYIO = 0
|
||||
CIRCUITPY_I2CPERIPHERAL = 0
|
||||
CIRCUITPY_NEOPIXEL_WRITE = 0
|
||||
CIRCUITPY_PARALLELDISPLAY = 0
|
||||
CIRCUITPY_PIXELBUF = 0
|
||||
CIRCUITPY_PS2IO = 0
|
||||
CIRCUITPY_PULSEIO = 0
|
||||
|
@ -61,9 +61,9 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_parallelbus_obj_t *bus = &displays[0].parallel_bus;
|
||||
bus->base.type = &displayio_parallelbus_type;
|
||||
common_hal_displayio_parallelbus_construct(bus,
|
||||
paralleldisplay_parallelbus_obj_t *bus = &displays[0].parallel_bus;
|
||||
bus->base.type = ¶lleldisplay_parallelbus_type;
|
||||
common_hal_paralleldisplay_parallelbus_construct(bus,
|
||||
&pin_PA16, // Data0
|
||||
&pin_PB05, // Command or data
|
||||
&pin_PB06, // Chip select
|
||||
|
@ -78,9 +78,9 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_parallelbus_obj_t *bus = &displays[0].parallel_bus;
|
||||
bus->base.type = &displayio_parallelbus_type;
|
||||
common_hal_displayio_parallelbus_construct(bus,
|
||||
paralleldisplay_parallelbus_obj_t *bus = &displays[0].parallel_bus;
|
||||
bus->base.type = ¶lleldisplay_parallelbus_type;
|
||||
common_hal_paralleldisplay_parallelbus_construct(bus,
|
||||
&pin_PA16, // Data0
|
||||
&pin_PB05, // Command or data
|
||||
&pin_PB06, // Chip select
|
||||
|
@ -24,6 +24,7 @@ CIRCUITPY_BITMAPTOOLS = 0
|
||||
CIRCUITPY_FREQUENCYIO = 0
|
||||
CIRCUITPY_I2CPERIPHERAL = 0
|
||||
CIRCUITPY_NEOPIXEL_WRITE = 0
|
||||
CIRCUITPY_PARALLELDISPLAY = 0
|
||||
CIRCUITPY_PIXELBUF = 0
|
||||
CIRCUITPY_RTC = 0
|
||||
CIRCUITPY_TOUCHIO = 0
|
||||
|
@ -24,7 +24,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "shared-bindings/displayio/ParallelBus.h"
|
||||
#include "shared-bindings/paralleldisplay/ParallelBus.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
#include "shared-bindings/digitalio/DigitalInOut.h"
|
||||
#include "shared-bindings/microcontroller/__init__.h"
|
||||
|
||||
void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *self,
|
||||
void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_parallelbus_obj_t *self,
|
||||
const mcu_pin_obj_t *data0, const mcu_pin_obj_t *command, const mcu_pin_obj_t *chip_select,
|
||||
const mcu_pin_obj_t *write, const mcu_pin_obj_t *read, const mcu_pin_obj_t *reset, uint32_t frequency) {
|
||||
|
||||
@ -83,7 +83,7 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *sel
|
||||
common_hal_digitalio_digitalinout_construct(&self->reset, reset);
|
||||
common_hal_digitalio_digitalinout_switch_to_output(&self->reset, true, DRIVE_MODE_PUSH_PULL);
|
||||
never_reset_pin_number(reset->number);
|
||||
common_hal_displayio_parallelbus_reset(self);
|
||||
common_hal_paralleldisplay_parallelbus_reset(self);
|
||||
}
|
||||
|
||||
never_reset_pin_number(command->number);
|
||||
@ -95,7 +95,7 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *sel
|
||||
}
|
||||
}
|
||||
|
||||
void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t *self) {
|
||||
void common_hal_paralleldisplay_parallelbus_deinit(paralleldisplay_parallelbus_obj_t *self) {
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
reset_pin_number(self->data0_pin + i);
|
||||
}
|
||||
@ -107,8 +107,8 @@ void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t *self)
|
||||
reset_pin_number(self->reset.pin->number);
|
||||
}
|
||||
|
||||
bool common_hal_displayio_parallelbus_reset(mp_obj_t obj) {
|
||||
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
bool common_hal_paralleldisplay_parallelbus_reset(mp_obj_t obj) {
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
if (self->reset.base.type == &mp_type_NoneType) {
|
||||
return false;
|
||||
}
|
||||
@ -119,19 +119,19 @@ bool common_hal_displayio_parallelbus_reset(mp_obj_t obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool common_hal_displayio_parallelbus_bus_free(mp_obj_t obj) {
|
||||
bool common_hal_paralleldisplay_parallelbus_bus_free(mp_obj_t obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) {
|
||||
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
bool common_hal_paralleldisplay_parallelbus_begin_transaction(mp_obj_t obj) {
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
common_hal_digitalio_digitalinout_set_value(&self->chip_select, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type,
|
||||
void common_hal_paralleldisplay_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type,
|
||||
display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) {
|
||||
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
common_hal_digitalio_digitalinout_set_value(&self->command, byte_type == DISPLAY_DATA);
|
||||
uint32_t *clear_write = (uint32_t *)&self->write_group->OUTCLR.reg;
|
||||
uint32_t *set_write = (uint32_t *)&self->write_group->OUTSET.reg;
|
||||
@ -143,7 +143,7 @@ void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byt
|
||||
}
|
||||
}
|
||||
|
||||
void common_hal_displayio_parallelbus_end_transaction(mp_obj_t obj) {
|
||||
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
void common_hal_paralleldisplay_parallelbus_end_transaction(mp_obj_t obj) {
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
common_hal_digitalio_digitalinout_set_value(&self->chip_select, true);
|
||||
}
|
@ -24,8 +24,8 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
|
||||
#define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
|
||||
#ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
|
||||
#define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
|
||||
|
||||
#include "common-hal/digitalio/DigitalInOut.h"
|
||||
|
||||
@ -40,6 +40,6 @@ typedef struct {
|
||||
uint8_t data0_pin;
|
||||
PortGroup *write_group;
|
||||
uint32_t write_mask;
|
||||
} displayio_parallelbus_obj_t;
|
||||
} paralleldisplay_parallelbus_obj_t;
|
||||
|
||||
#endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
|
||||
#endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
|
@ -61,6 +61,9 @@
|
||||
|
||||
#define MICROPY_FATFS_EXFAT 0
|
||||
|
||||
// Only support simpler HID descriptors on SAMD21.
|
||||
#define CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR (1)
|
||||
|
||||
#endif // SAMD21
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
61
ports/esp32s2/boards/lolin_s2_mini/board.c
Normal file
61
ports/esp32s2/boards/lolin_s2_mini/board.c
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "supervisor/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
|
||||
void board_init(void) {
|
||||
// USB
|
||||
common_hal_never_reset_pin(&pin_GPIO19);
|
||||
common_hal_never_reset_pin(&pin_GPIO20);
|
||||
|
||||
// Debug UART
|
||||
#ifdef DEBUG
|
||||
common_hal_never_reset_pin(&pin_GPIO43);
|
||||
common_hal_never_reset_pin(&pin_GPIO44);
|
||||
#endif /* DEBUG */
|
||||
|
||||
// SPI Flash and RAM
|
||||
common_hal_never_reset_pin(&pin_GPIO26);
|
||||
common_hal_never_reset_pin(&pin_GPIO27);
|
||||
common_hal_never_reset_pin(&pin_GPIO28);
|
||||
common_hal_never_reset_pin(&pin_GPIO29);
|
||||
common_hal_never_reset_pin(&pin_GPIO30);
|
||||
common_hal_never_reset_pin(&pin_GPIO31);
|
||||
common_hal_never_reset_pin(&pin_GPIO32);
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void reset_board(void) {
|
||||
|
||||
}
|
||||
|
||||
void board_deinit(void) {
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 Artur Pacholec
|
||||
* Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -24,13 +24,24 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_MIMXRT10XX_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
|
||||
#define MICROPY_INCLUDED_MIMXRT10XX_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
|
||||
// Micropython setup
|
||||
|
||||
#include "common-hal/digitalio/DigitalInOut.h"
|
||||
#define MICROPY_HW_BOARD_NAME "S2Mini"
|
||||
#define MICROPY_HW_MCU_NAME "ESP32S2"
|
||||
|
||||
typedef struct {
|
||||
mp_obj_base_t base;
|
||||
} displayio_parallelbus_obj_t;
|
||||
#define MICROPY_HW_NEOPIXEL (&pin_GPIO1)
|
||||
#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO15)
|
||||
#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0)
|
||||
#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n")
|
||||
|
||||
#endif // MICROPY_INCLUDED_MIMXRT10XX_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
|
||||
#define AUTORESET_DELAY_MS 500
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO9)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO8)
|
||||
|
||||
#define DEFAULT_SPI_BUS_SCK (&pin_GPIO37)
|
||||
#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35)
|
||||
#define DEFAULT_SPI_BUS_MISO (&pin_GPIO36)
|
||||
|
||||
#define DEFAULT_UART_BUS_RX (&pin_GPIO44)
|
||||
#define DEFAULT_UART_BUS_TX (&pin_GPIO43)
|
20
ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.mk
Normal file
20
ports/esp32s2/boards/lolin_s2_mini/mpconfigboard.mk
Normal file
@ -0,0 +1,20 @@
|
||||
USB_VID = 0x303A
|
||||
USB_PID = 0x80C3
|
||||
USB_PRODUCT = "S2 Mini"
|
||||
USB_MANUFACTURER = "Lolin"
|
||||
|
||||
INTERNAL_FLASH_FILESYSTEM = 1
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
# The default queue depth of 16 overflows on release builds,
|
||||
# so increase it to 32.
|
||||
CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
|
||||
|
||||
CIRCUITPY_ESP_FLASH_MODE=qio
|
||||
CIRCUITPY_ESP_FLASH_FREQ=80m
|
||||
CIRCUITPY_ESP_FLASH_SIZE=4MB
|
||||
|
||||
CIRCUITPY_BITBANG_NEOPIXEL = 1
|
||||
|
||||
# Include these Python libraries in firmware.
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
|
83
ports/esp32s2/boards/lolin_s2_mini/pins.c
Normal file
83
ports/esp32s2/boards/lolin_s2_mini/pins.c
Normal file
@ -0,0 +1,83 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
// S2 Mini Board bottom, right, top-bottom
|
||||
// GPIO0-GPIO14: broken out as a bloc on ESP32-S2FN4R2 SoC
|
||||
// mpconfigboard.h: GPIO0: CIRCUITPY_BOOT_BUTTON
|
||||
{ MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, // RTC_GPIO0,GPIO0
|
||||
// mpconfigboard.h: GPIO1: MICROPY_HW_NEOPIXEL - left to user to solder on
|
||||
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO1) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, // RTC_GPIO1,GPIO1,TOUCH1,ADC1_CH0
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO2) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, // RTC_GPIO2,GPIO2,TOUCH2,ADC1_CH1
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, // RTC_GPIO3,GPIO3,TOUCH3,ADC1_CH2
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, // RTC_GPIO4,GPIO4,TOUCH4,ADC1_CH3
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, // RTC_GPIO5,GPIO5,TOUCH5,ADC1_CH4
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, // RTC_GPIO6,GPIO6,TOUCH6,ADC1_CH5
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, // RTC_GPIO7,GPIO7,TOUCH7,ADC1_CH6
|
||||
|
||||
// mpconfigboard.h: GPIO8/GPIO9: SCL/SDA I2C0
|
||||
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO8) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, // RTC_GPIO8,GPIO8,TOUCH8,ADC1_CH7
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO9) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, // RTC_GPIO9,GPIO9,TOUCH9,ADC1_CH8,FSPIHD
|
||||
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) },// RTC_GPIO10,GPIO10,TOUCH10,ADC1_CH9,FSPICS0,FSPIIO4
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) },// RTC_GPIO11,GPIO11,TOUCH11,ADC2_CH0,FSPID,FSPIIO5
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) },// RTC_GPIO12,GPIO12,TOUCH12,ADC2_CH1,FSPICLK,FSPIIO6
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) },// RTC_GPIO13,GPIO13,TOUCH13,ADC2_CH2,FSPIQ,FSPIIO7
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) },// RTC_GPIO14,GPIO14,TOUCH14,ADC2_CH3,FSPIWP,FSPIDQS
|
||||
|
||||
// S2 Mini Board bottom, left, bottom-top
|
||||
// mpconfigboard.h: GPIO15: CIRCUITPY_STATUS_LED_POWER
|
||||
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) },// XTAL_32K_P: RTC_GPIO15,GPIO15,U0RTS,ADC2_CH4,XTAL_32K_P
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) },// XTAL_32K_N: RTC_GPIO16,GPIO16,U0CTS,ADC2_CH5,XTAL_32K_N
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) },// DAC_1: RTC_GPIO17,GPIO17,U1TXD,ADC2_CH6,DAC_1
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) },// DAC_2: RTC_GPIO18,GPIO18,U1RXD,ADC2_CH7,DAC_2,CLK_OUT3
|
||||
// skip GPIO19-GPIO20: USB_D-/USB_D+
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) },// RTC_GPIO21,GPIO21
|
||||
|
||||
// skip GPIO22-GPIO25: not broken out on ESP32-S2FN4R2 SoC
|
||||
// skip GPIO26-GPIO32: SPI Flash & RAM, not broken out on S2 Mini (internal to ESP32-S2FN4R2 SoC?)
|
||||
|
||||
// GPIO33-GPIO40: broken out as a bloc on ESP32-S2FN4R2 SoC, last 2 half of JTAG
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO33), MP_ROM_PTR(&pin_GPIO33) },// SPIIO4,GPIO33,FSPIHD
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO34), MP_ROM_PTR(&pin_GPIO34) },// SPIIO5,GPIO34,FSPICS0
|
||||
|
||||
// mpconfigboard.h: GPIO35/GPIO36/GPIO37: MOSI/MESO/SCK SPI
|
||||
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) },// SPIIO6,GPIO35,FSPID
|
||||
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO36) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) },// SPIIO7,GPIO36,FSPICLK
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO37) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) },// SPIDQS,GPIO37,FSPIQ
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) },// GPIO38,FSPIWP
|
||||
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) },// MTCK,GPIO39,CLK_OUT3
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) },// MTDO,GPIO40,CLK_OUT2
|
||||
|
||||
// S2 Mini - not broken out on board
|
||||
/*
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) },// MTDI,GPIO41,CLK_OUT1
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) },// MTMS,GPIO42
|
||||
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, // U0TXD,GPIO43,CLK_OUT1
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) },//
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, // U0RXD,GPIO44,CLK_OUT2
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) },// GPIO45
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) },// GPIO46
|
||||
*/
|
||||
};
|
||||
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
|
39
ports/esp32s2/boards/lolin_s2_mini/sdkconfig
Normal file
39
ports/esp32s2/boards/lolin_s2_mini/sdkconfig
Normal file
@ -0,0 +1,39 @@
|
||||
CONFIG_ESP32S2_SPIRAM_SUPPORT=y
|
||||
|
||||
#
|
||||
# SPI RAM config
|
||||
#
|
||||
# CONFIG_SPIRAM_TYPE_AUTO=y
|
||||
CONFIG_SPIRAM_TYPE_ESPPSRAM16=y
|
||||
# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set
|
||||
# CONFIG_SPIRAM_TYPE_ESPPSRAM64=y
|
||||
CONFIG_SPIRAM_SIZE=2097152
|
||||
|
||||
#
|
||||
# PSRAM clock and cs IO for ESP32S2
|
||||
#
|
||||
CONFIG_DEFAULT_PSRAM_CLK_IO=30
|
||||
CONFIG_DEFAULT_PSRAM_CS_IO=26
|
||||
# end of PSRAM clock and cs IO for ESP32S2
|
||||
|
||||
# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set
|
||||
# CONFIG_SPIRAM_RODATA is not set
|
||||
# CONFIG_SPIRAM_SPEED_80M=y
|
||||
CONFIG_SPIRAM_SPEED_40M=y
|
||||
# CONFIG_SPIRAM_SPEED_26M is not set
|
||||
# CONFIG_SPIRAM_SPEED_20M is not set
|
||||
CONFIG_SPIRAM=y
|
||||
CONFIG_SPIRAM_BOOT_INIT=y
|
||||
# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set
|
||||
CONFIG_SPIRAM_USE_MEMMAP=y
|
||||
# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set
|
||||
# CONFIG_SPIRAM_USE_MALLOC is not set
|
||||
CONFIG_SPIRAM_MEMTEST=y
|
||||
# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set
|
||||
# end of SPI RAM config
|
||||
|
||||
#
|
||||
# LWIP
|
||||
#
|
||||
CONFIG_LWIP_LOCAL_HOSTNAME="LS2Mini"
|
||||
# end of LWIP
|
@ -24,7 +24,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "shared-bindings/displayio/ParallelBus.h"
|
||||
#include "shared-bindings/paralleldisplay/ParallelBus.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
* - data0 pin must be byte aligned
|
||||
*/
|
||||
|
||||
void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *self,
|
||||
void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_parallelbus_obj_t *self,
|
||||
const mcu_pin_obj_t *data0, const mcu_pin_obj_t *command, const mcu_pin_obj_t *chip_select,
|
||||
const mcu_pin_obj_t *write, const mcu_pin_obj_t *read, const mcu_pin_obj_t *reset, uint32_t frequency) {
|
||||
|
||||
@ -120,7 +120,7 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *sel
|
||||
common_hal_digitalio_digitalinout_construct(&self->reset, reset);
|
||||
common_hal_digitalio_digitalinout_switch_to_output(&self->reset, true, DRIVE_MODE_PUSH_PULL);
|
||||
never_reset_pin_number(reset->number);
|
||||
common_hal_displayio_parallelbus_reset(self);
|
||||
common_hal_paralleldisplay_parallelbus_reset(self);
|
||||
}
|
||||
|
||||
never_reset_pin_number(command->number);
|
||||
@ -133,7 +133,7 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *sel
|
||||
|
||||
}
|
||||
|
||||
void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t *self) {
|
||||
void common_hal_paralleldisplay_parallelbus_deinit(paralleldisplay_parallelbus_obj_t *self) {
|
||||
/* SNIP - same as from SAMD and NRF ports */
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
reset_pin_number(self->data0_pin + i);
|
||||
@ -146,9 +146,9 @@ void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t *self)
|
||||
reset_pin_number(self->reset.pin->number);
|
||||
}
|
||||
|
||||
bool common_hal_displayio_parallelbus_reset(mp_obj_t obj) {
|
||||
bool common_hal_paralleldisplay_parallelbus_reset(mp_obj_t obj) {
|
||||
/* SNIP - same as from SAMD and NRF ports */
|
||||
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
if (self->reset.base.type == &mp_type_NoneType) {
|
||||
return false;
|
||||
}
|
||||
@ -160,21 +160,21 @@ bool common_hal_displayio_parallelbus_reset(mp_obj_t obj) {
|
||||
|
||||
}
|
||||
|
||||
bool common_hal_displayio_parallelbus_bus_free(mp_obj_t obj) {
|
||||
bool common_hal_paralleldisplay_parallelbus_bus_free(mp_obj_t obj) {
|
||||
/* SNIP - same as from SAMD and NRF ports */
|
||||
return true;
|
||||
}
|
||||
|
||||
bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) {
|
||||
bool common_hal_paralleldisplay_parallelbus_begin_transaction(mp_obj_t obj) {
|
||||
/* SNIP - same as from SAMD and NRF ports */
|
||||
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
common_hal_digitalio_digitalinout_set_value(&self->chip_select, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type,
|
||||
void common_hal_paralleldisplay_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type,
|
||||
display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) {
|
||||
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
common_hal_digitalio_digitalinout_set_value(&self->command, byte_type == DISPLAY_DATA);
|
||||
|
||||
uint32_t *clear_write = self->write_clear_register;
|
||||
@ -220,8 +220,8 @@ void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byt
|
||||
|
||||
}
|
||||
|
||||
void common_hal_displayio_parallelbus_end_transaction(mp_obj_t obj) {
|
||||
void common_hal_paralleldisplay_parallelbus_end_transaction(mp_obj_t obj) {
|
||||
/* SNIP - same as from SAMD and NRF ports */
|
||||
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
common_hal_digitalio_digitalinout_set_value(&self->chip_select, true);
|
||||
}
|
@ -24,8 +24,8 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
|
||||
#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
|
||||
#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
|
||||
#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
|
||||
|
||||
#include "common-hal/digitalio/DigitalInOut.h"
|
||||
|
||||
@ -42,6 +42,6 @@ typedef struct {
|
||||
uint32_t *write_set_register; // pointer to the write group for setting the write bit to latch the data on the LCD
|
||||
uint32_t *write_clear_register; // pointer to the write group for clearing the write bit to latch the data on the LCD
|
||||
uint32_t write_mask; // bit mask for the single bit for the write pin register
|
||||
} displayio_parallelbus_obj_t;
|
||||
} paralleldisplay_parallelbus_obj_t;
|
||||
|
||||
#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
|
||||
#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
|
@ -1,67 +0,0 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 Artur Pacholec
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "shared-bindings/displayio/ParallelBus.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "common-hal/microcontroller/Pin.h"
|
||||
#include "py/runtime.h"
|
||||
#include "shared-bindings/digitalio/DigitalInOut.h"
|
||||
#include "shared-bindings/microcontroller/__init__.h"
|
||||
|
||||
void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *self,
|
||||
const mcu_pin_obj_t *data0, const mcu_pin_obj_t *command, const mcu_pin_obj_t *chip_select,
|
||||
const mcu_pin_obj_t *write, const mcu_pin_obj_t *read, const mcu_pin_obj_t *reset, uint32_t frequency) {
|
||||
|
||||
mp_raise_NotImplementedError(translate("ParallelBus not yet supported"));
|
||||
}
|
||||
|
||||
void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t *self) {
|
||||
|
||||
}
|
||||
|
||||
bool common_hal_displayio_parallelbus_reset(mp_obj_t obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool common_hal_displayio_parallelbus_bus_free(mp_obj_t obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type,
|
||||
display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) {
|
||||
|
||||
}
|
||||
|
||||
void common_hal_displayio_parallelbus_end_transaction(mp_obj_t obj) {
|
||||
|
||||
}
|
@ -28,6 +28,7 @@ CIRCUITPY_COUNTIO = 0
|
||||
CIRCUITPY_FREQUENCYIO = 0
|
||||
CIRCUITPY_I2CPERIPHERAL = 0
|
||||
CIRCUITPY_NVM = 0
|
||||
CIRCUITPY_PARALLELDISPLAY = 0
|
||||
CIRCUITPY_PULSEIO = 0
|
||||
CIRCUITPY_ROTARYIO = 0
|
||||
CIRCUITPY_USB_MIDI = 1
|
||||
|
@ -147,7 +147,7 @@ STATIC void _setup_sleep_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t
|
||||
// TODO: this handles all possible types of wakeup, which is redundant with main.
|
||||
// revise to extract all parts essential to enabling sleep wakeup, but leave the
|
||||
// alarm/non-alarm sorting to the existing main loop.
|
||||
void system_on_idle_until_alarm(int64_t timediff_ms, uint32_t prescaler) {
|
||||
void system_on_idle_until_alarm(int64_t timediff_ms, bool wake_from_serial, uint32_t prescaler) {
|
||||
bool have_timeout = false;
|
||||
uint64_t start_tick = 0, end_tick = 0;
|
||||
int64_t tickdiff;
|
||||
@ -179,7 +179,7 @@ void system_on_idle_until_alarm(int64_t timediff_ms, uint32_t prescaler) {
|
||||
if (mp_hal_is_interrupted()) {
|
||||
break;
|
||||
}
|
||||
if (serial_connected() && serial_bytes_available()) {
|
||||
if (wake_from_serial && serial_connected() && serial_bytes_available()) {
|
||||
break;
|
||||
}
|
||||
RUN_BACKGROUND_TASKS;
|
||||
@ -220,7 +220,7 @@ mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj
|
||||
#endif
|
||||
|
||||
int64_t timediff_ms = alarm_time_timealarm_get_wakeup_timediff_ms();
|
||||
system_on_idle_until_alarm(timediff_ms, 0);
|
||||
system_on_idle_until_alarm(timediff_ms, false, 0);
|
||||
|
||||
if (mp_hal_is_interrupted()) {
|
||||
wake_alarm = mp_const_none;
|
||||
@ -262,7 +262,7 @@ void NORETURN common_hal_alarm_enter_deep_sleep(void) {
|
||||
#endif
|
||||
int64_t timediff_ms = alarm_time_timealarm_get_wakeup_timediff_ms();
|
||||
tick_set_prescaler(PRESCALER_VALUE_IN_DEEP_SLEEP - 1);
|
||||
system_on_idle_until_alarm(timediff_ms, PRESCALER_VALUE_IN_DEEP_SLEEP);
|
||||
system_on_idle_until_alarm(timediff_ms, false, PRESCALER_VALUE_IN_DEEP_SLEEP);
|
||||
|
||||
#ifdef NRF_DEBUG_PRINT
|
||||
mp_printf(&mp_plat_print, "RESET...\r\n\r\n");
|
||||
@ -285,7 +285,7 @@ void common_hal_alarm_pretending_deep_sleep(void) {
|
||||
#endif
|
||||
|
||||
int64_t timediff_ms = alarm_time_timealarm_get_wakeup_timediff_ms();
|
||||
system_on_idle_until_alarm(timediff_ms, 0);
|
||||
system_on_idle_until_alarm(timediff_ms, true, 0);
|
||||
|
||||
alarm_reset();
|
||||
}
|
||||
|
@ -141,14 +141,6 @@ void alarm_pin_pinalarm_reset(void) {
|
||||
}
|
||||
|
||||
static void configure_pins_for_sleep(void) {
|
||||
nrfx_err_t err;
|
||||
if (nrfx_gpiote_is_init()) {
|
||||
nrfx_gpiote_uninit();
|
||||
}
|
||||
err = nrfx_gpiote_init(NRFX_GPIOTE_CONFIG_IRQ_PRIORITY);
|
||||
assert(err == NRFX_SUCCESS);
|
||||
(void)err; // to suppress unused warning
|
||||
|
||||
_pinhandler_gpiote_count = 0;
|
||||
|
||||
nrfx_gpiote_in_config_t cfg = {
|
||||
@ -176,9 +168,10 @@ static void configure_pins_for_sleep(void) {
|
||||
cfg.sense = NRF_GPIOTE_POLARITY_TOGGLE;
|
||||
cfg.pull = NRF_GPIO_PIN_NOPULL;
|
||||
}
|
||||
err = nrfx_gpiote_in_init((nrfx_gpiote_pin_t)i, &cfg,
|
||||
nrfx_err_t err = nrfx_gpiote_in_init((nrfx_gpiote_pin_t)i, &cfg,
|
||||
pinalarm_gpiote_handler);
|
||||
assert(err == NRFX_SUCCESS);
|
||||
(void)err; // In case the assert doesn't use err.
|
||||
nrfx_gpiote_in_event_enable((nrfx_gpiote_pin_t)i, true);
|
||||
if (((high_alarms & mask) != 0) && ((low_alarms & mask) == 0)) {
|
||||
nrf_gpio_cfg_sense_set((uint32_t)i, NRF_GPIO_PIN_SENSE_HIGH);
|
||||
|
@ -1,5 +1,8 @@
|
||||
|
||||
#include "common-hal/countio/Counter.h"
|
||||
|
||||
#include "py/runtime.h"
|
||||
|
||||
#include "nrfx_gpiote.h"
|
||||
|
||||
// obj array to map pin number -> self since nrfx hide the mapping
|
||||
@ -29,11 +32,14 @@ void common_hal_countio_counter_construct(countio_counter_obj_t *self,
|
||||
.skip_gpio_setup = false
|
||||
};
|
||||
|
||||
nrfx_gpiote_in_init(self->pin_a, &cfg, _intr_handler);
|
||||
|
||||
nrfx_err_t err = nrfx_gpiote_in_init(self->pin_a, &cfg, _intr_handler);
|
||||
if (err != NRFX_SUCCESS) {
|
||||
mp_raise_RuntimeError(translate("All channels in use"));
|
||||
}
|
||||
nrfx_gpiote_in_event_enable(self->pin_a, true);
|
||||
|
||||
claim_pin(pin_a);
|
||||
|
||||
}
|
||||
|
||||
bool common_hal_countio_counter_deinited(countio_counter_obj_t *self) {
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include "py/runtime.h"
|
||||
|
||||
#include "common-hal/microcontroller/Processor.h"
|
||||
|
||||
#include "common-hal/alarm/__init__.h"
|
||||
#include "shared-bindings/microcontroller/ResetReason.h"
|
||||
#include "supervisor/shared/translate.h"
|
||||
|
||||
@ -136,6 +138,14 @@ mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void) {
|
||||
r = RESET_REASON_WATCHDOG;
|
||||
} else if (reset_reason_saved & POWER_RESETREAS_SREQ_Msk) {
|
||||
r = RESET_REASON_SOFTWARE;
|
||||
#if CIRCUITPY_ALARM
|
||||
// Our "deep sleep" is still actually light sleep followed by a software
|
||||
// reset. Adding this check here ensures we treat it as-if we're waking
|
||||
// from deep sleep.
|
||||
if (sleepmem_wakeup_event != SLEEPMEM_WAKEUP_BY_NONE) {
|
||||
r = RESET_REASON_DEEP_SLEEP_ALARM;
|
||||
}
|
||||
#endif
|
||||
} else if ((reset_reason_saved & POWER_RESETREAS_OFF_Msk) ||
|
||||
(reset_reason_saved & POWER_RESETREAS_LPCOMP_Msk) ||
|
||||
(reset_reason_saved & POWER_RESETREAS_NFC_Msk) ||
|
||||
|
@ -24,7 +24,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "shared-bindings/displayio/ParallelBus.h"
|
||||
#include "shared-bindings/paralleldisplay/ParallelBus.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
#include "shared-bindings/digitalio/DigitalInOut.h"
|
||||
#include "shared-bindings/microcontroller/__init__.h"
|
||||
|
||||
void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *self,
|
||||
void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_parallelbus_obj_t *self,
|
||||
const mcu_pin_obj_t *data0, const mcu_pin_obj_t *command, const mcu_pin_obj_t *chip_select,
|
||||
const mcu_pin_obj_t *write, const mcu_pin_obj_t *read, const mcu_pin_obj_t *reset, uint32_t frequency) {
|
||||
|
||||
@ -94,7 +94,7 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *sel
|
||||
common_hal_digitalio_digitalinout_construct(&self->reset, reset);
|
||||
common_hal_digitalio_digitalinout_switch_to_output(&self->reset, true, DRIVE_MODE_PUSH_PULL);
|
||||
never_reset_pin_number(reset->number);
|
||||
common_hal_displayio_parallelbus_reset(self);
|
||||
common_hal_paralleldisplay_parallelbus_reset(self);
|
||||
}
|
||||
|
||||
never_reset_pin_number(command->number);
|
||||
@ -106,7 +106,7 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *sel
|
||||
}
|
||||
}
|
||||
|
||||
void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t *self) {
|
||||
void common_hal_paralleldisplay_parallelbus_deinit(paralleldisplay_parallelbus_obj_t *self) {
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
reset_pin_number(self->data0_pin + i);
|
||||
}
|
||||
@ -118,8 +118,8 @@ void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t *self)
|
||||
reset_pin_number(self->reset.pin->number);
|
||||
}
|
||||
|
||||
bool common_hal_displayio_parallelbus_reset(mp_obj_t obj) {
|
||||
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
bool common_hal_paralleldisplay_parallelbus_reset(mp_obj_t obj) {
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
if (self->reset.base.type == &mp_type_NoneType) {
|
||||
return false;
|
||||
}
|
||||
@ -130,20 +130,20 @@ bool common_hal_displayio_parallelbus_reset(mp_obj_t obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool common_hal_displayio_parallelbus_bus_free(mp_obj_t obj) {
|
||||
bool common_hal_paralleldisplay_parallelbus_bus_free(mp_obj_t obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) {
|
||||
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
bool common_hal_paralleldisplay_parallelbus_begin_transaction(mp_obj_t obj) {
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
common_hal_digitalio_digitalinout_set_value(&self->chip_select, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
// This ignores chip_select behaviour because data is clocked in by the write line toggling.
|
||||
void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type,
|
||||
void common_hal_paralleldisplay_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type,
|
||||
display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) {
|
||||
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
common_hal_digitalio_digitalinout_set_value(&self->command, byte_type == DISPLAY_DATA);
|
||||
uint32_t *clear_write = (uint32_t *)&self->write_group->OUTCLR;
|
||||
uint32_t *set_write = (uint32_t *)&self->write_group->OUTSET;
|
||||
@ -155,7 +155,7 @@ void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byt
|
||||
}
|
||||
}
|
||||
|
||||
void common_hal_displayio_parallelbus_end_transaction(mp_obj_t obj) {
|
||||
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
void common_hal_paralleldisplay_parallelbus_end_transaction(mp_obj_t obj) {
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
common_hal_digitalio_digitalinout_set_value(&self->chip_select, true);
|
||||
}
|
@ -24,8 +24,8 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_NRF_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
|
||||
#define MICROPY_INCLUDED_NRF_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
|
||||
#ifndef MICROPY_INCLUDED_NRF_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
|
||||
#define MICROPY_INCLUDED_NRF_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
|
||||
|
||||
#include "common-hal/digitalio/DigitalInOut.h"
|
||||
|
||||
@ -40,6 +40,6 @@ typedef struct {
|
||||
uint8_t data0_pin;
|
||||
NRF_GPIO_Type *write_group;
|
||||
uint32_t write_mask;
|
||||
} displayio_parallelbus_obj_t;
|
||||
} paralleldisplay_parallelbus_obj_t;
|
||||
|
||||
#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
|
||||
#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
|
@ -112,11 +112,6 @@ static void _pulsein_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action
|
||||
}
|
||||
|
||||
void pulsein_reset(void) {
|
||||
if (nrfx_gpiote_is_init()) {
|
||||
nrfx_gpiote_uninit();
|
||||
}
|
||||
nrfx_gpiote_init(NRFX_GPIOTE_CONFIG_IRQ_PRIORITY);
|
||||
|
||||
if (timer != NULL) {
|
||||
nrf_peripherals_free_timer(timer);
|
||||
}
|
||||
@ -178,7 +173,10 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, const mcu
|
||||
.hi_accuracy = true,
|
||||
.skip_gpio_setup = false
|
||||
};
|
||||
nrfx_gpiote_in_init(self->pin, &cfg, _pulsein_handler);
|
||||
nrfx_err_t err = nrfx_gpiote_in_init(self->pin, &cfg, _pulsein_handler);
|
||||
if (err != NRFX_SUCCESS) {
|
||||
mp_raise_RuntimeError(translate("All channels in use"));
|
||||
}
|
||||
nrfx_gpiote_in_event_enable(self->pin, true);
|
||||
}
|
||||
|
||||
|
@ -64,8 +64,15 @@ void common_hal_rotaryio_incrementalencoder_construct(rotaryio_incrementalencode
|
||||
.hi_accuracy = true,
|
||||
.skip_gpio_setup = false
|
||||
};
|
||||
nrfx_gpiote_in_init(self->pin_a, &cfg, _intr_handler);
|
||||
nrfx_gpiote_in_init(self->pin_b, &cfg, _intr_handler);
|
||||
nrfx_err_t err = nrfx_gpiote_in_init(self->pin_a, &cfg, _intr_handler);
|
||||
if (err != NRFX_SUCCESS) {
|
||||
mp_raise_RuntimeError(translate("All channels in use"));
|
||||
}
|
||||
err = nrfx_gpiote_in_init(self->pin_b, &cfg, _intr_handler);
|
||||
if (err != NRFX_SUCCESS) {
|
||||
nrfx_gpiote_in_uninit(self->pin_a);
|
||||
mp_raise_RuntimeError(translate("All channels in use"));
|
||||
}
|
||||
nrfx_gpiote_in_event_enable(self->pin_a, true);
|
||||
nrfx_gpiote_in_event_enable(self->pin_b, true);
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "py/gc.h"
|
||||
#include "py/obj.h"
|
||||
#include "py/objproperty.h"
|
||||
#include "py/runtime.h"
|
||||
@ -94,7 +95,11 @@ void common_hal_watchdog_feed(watchdog_watchdogtimer_obj_t *self) {
|
||||
|
||||
void common_hal_watchdog_deinit(watchdog_watchdogtimer_obj_t *self) {
|
||||
if (self->mode == WATCHDOGMODE_RESET) {
|
||||
mp_raise_NotImplementedError(translate("WatchDogTimer cannot be deinitialized once mode is set to RESET"));
|
||||
if (gc_alloc_possible()) {
|
||||
mp_raise_NotImplementedError(translate("WatchDogTimer cannot be deinitialized once mode is set to RESET"));
|
||||
}
|
||||
// Don't change anything because RESET cannot be undone.
|
||||
return;
|
||||
}
|
||||
if (timer) {
|
||||
timer_free();
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
#include "nrfx/hal/nrf_clock.h"
|
||||
#include "nrfx/hal/nrf_power.h"
|
||||
#include "nrfx/drivers/include/nrfx_gpiote.h"
|
||||
#include "nrfx/drivers/include/nrfx_power.h"
|
||||
#include "nrfx/drivers/include/nrfx_rtc.h"
|
||||
|
||||
@ -252,6 +253,12 @@ void reset_port(void) {
|
||||
watchdog_reset();
|
||||
#endif
|
||||
|
||||
// Always reset GPIOTE because it is shared.
|
||||
if (nrfx_gpiote_is_init()) {
|
||||
nrfx_gpiote_uninit();
|
||||
}
|
||||
nrfx_gpiote_init(NRFX_GPIOTE_CONFIG_IRQ_PRIORITY);
|
||||
|
||||
reset_all_pins();
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "shared-bindings/displayio/ParallelBus.h"
|
||||
#include "shared-bindings/paralleldisplay/ParallelBus.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@ -43,7 +43,7 @@ static const uint16_t parallel_program[] = {
|
||||
// .wrap
|
||||
};
|
||||
|
||||
void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *self,
|
||||
void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_parallelbus_obj_t *self,
|
||||
const mcu_pin_obj_t *data0, const mcu_pin_obj_t *command, const mcu_pin_obj_t *chip_select,
|
||||
const mcu_pin_obj_t *write, const mcu_pin_obj_t *read, const mcu_pin_obj_t *reset, uint32_t frequency) {
|
||||
|
||||
@ -80,7 +80,7 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *sel
|
||||
common_hal_digitalio_digitalinout_construct(&self->reset, reset);
|
||||
common_hal_digitalio_digitalinout_switch_to_output(&self->reset, true, DRIVE_MODE_PUSH_PULL);
|
||||
never_reset_pin_number(reset->number);
|
||||
common_hal_displayio_parallelbus_reset(self);
|
||||
common_hal_paralleldisplay_parallelbus_reset(self);
|
||||
}
|
||||
|
||||
never_reset_pin_number(command->number);
|
||||
@ -110,7 +110,7 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *sel
|
||||
common_hal_rp2pio_statemachine_never_reset(&self->state_machine);
|
||||
}
|
||||
|
||||
void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t *self) {
|
||||
void common_hal_paralleldisplay_parallelbus_deinit(paralleldisplay_parallelbus_obj_t *self) {
|
||||
common_hal_rp2pio_statemachine_deinit(&self->state_machine);
|
||||
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
@ -124,8 +124,8 @@ void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t *self)
|
||||
reset_pin_number(self->reset.pin->number);
|
||||
}
|
||||
|
||||
bool common_hal_displayio_parallelbus_reset(mp_obj_t obj) {
|
||||
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
bool common_hal_paralleldisplay_parallelbus_reset(mp_obj_t obj) {
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
if (self->reset.base.type == &mp_type_NoneType) {
|
||||
return false;
|
||||
}
|
||||
@ -136,26 +136,26 @@ bool common_hal_displayio_parallelbus_reset(mp_obj_t obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool common_hal_displayio_parallelbus_bus_free(mp_obj_t obj) {
|
||||
bool common_hal_paralleldisplay_parallelbus_bus_free(mp_obj_t obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) {
|
||||
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
bool common_hal_paralleldisplay_parallelbus_begin_transaction(mp_obj_t obj) {
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
common_hal_digitalio_digitalinout_set_value(&self->chip_select, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type,
|
||||
void common_hal_paralleldisplay_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type,
|
||||
display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) {
|
||||
|
||||
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
|
||||
common_hal_digitalio_digitalinout_set_value(&self->command, byte_type == DISPLAY_DATA);
|
||||
common_hal_rp2pio_statemachine_write(&self->state_machine, data, data_length, 1);
|
||||
}
|
||||
|
||||
void common_hal_displayio_parallelbus_end_transaction(mp_obj_t obj) {
|
||||
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
void common_hal_paralleldisplay_parallelbus_end_transaction(mp_obj_t obj) {
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
common_hal_digitalio_digitalinout_set_value(&self->chip_select, true);
|
||||
}
|
@ -24,8 +24,8 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
|
||||
#define MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
|
||||
#ifndef MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
|
||||
#define MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
|
||||
|
||||
#include "common-hal/digitalio/DigitalInOut.h"
|
||||
#include "bindings/rp2pio/StateMachine.h"
|
||||
@ -40,6 +40,6 @@ typedef struct {
|
||||
uint8_t write;
|
||||
uint8_t data0_pin;
|
||||
rp2pio_statemachine_obj_t state_machine;
|
||||
} displayio_parallelbus_obj_t;
|
||||
} paralleldisplay_parallelbus_obj_t;
|
||||
|
||||
#endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
|
||||
#endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
|
@ -53,7 +53,7 @@ uint8_t display_init_sequence[] = {
|
||||
0xc4, 2, 0x8a, 0xee,
|
||||
0xc5, 1, 0x0e, // _VMCTR1 VCOMH = 4V, VOML = -1.1V
|
||||
0x20, 0, // _INVOFF //MISMATCh 0x2a vs 0x20
|
||||
0x36, 1, 0x18, // _MADCTL bottom to top refresh
|
||||
0x36, 1, 0x60, // _MADCTL bottom to top refresh
|
||||
// 1 clk cycle nonoverlap, 2 cycle gate rise, 3 sycle osc equalie,
|
||||
// fix on VTL
|
||||
0x3a, 1, 0x05, // COLMOD - 16bit color
|
||||
@ -90,7 +90,7 @@ void board_init(void) {
|
||||
128, // Height
|
||||
0, // column start
|
||||
0, // row start
|
||||
90, // rotation
|
||||
0, // rotation
|
||||
16, // Color depth
|
||||
false, // Grayscale
|
||||
false, // Pixels in a byte share a row. Only used for depth < 8
|
||||
|
@ -22,3 +22,6 @@ LD_FILE = boards/STM32F401xe_boot.ld
|
||||
|
||||
CIRCUITPY_BLEIO_HCI = 0
|
||||
CIRCUITPY_ULAB = 0
|
||||
CIRCUITPY_STAGE = 1
|
||||
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/meowbit
|
||||
|
@ -1,67 +0,0 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Lucian Copeland for Adafruit Industries
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "shared-bindings/displayio/ParallelBus.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "common-hal/microcontroller/Pin.h"
|
||||
#include "py/runtime.h"
|
||||
#include "shared-bindings/digitalio/DigitalInOut.h"
|
||||
#include "shared-bindings/microcontroller/__init__.h"
|
||||
|
||||
void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *self,
|
||||
const mcu_pin_obj_t *data0, const mcu_pin_obj_t *command, const mcu_pin_obj_t *chip_select,
|
||||
const mcu_pin_obj_t *write, const mcu_pin_obj_t *read, const mcu_pin_obj_t *reset, uint32_t frequency) {
|
||||
|
||||
mp_raise_NotImplementedError(translate("ParallelBus not yet supported"));
|
||||
}
|
||||
|
||||
void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t *self) {
|
||||
|
||||
}
|
||||
|
||||
bool common_hal_displayio_parallelbus_reset(mp_obj_t obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool common_hal_displayio_parallelbus_bus_free(mp_obj_t obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type,
|
||||
display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) {
|
||||
|
||||
}
|
||||
|
||||
void common_hal_displayio_parallelbus_end_transaction(mp_obj_t obj) {
|
||||
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Lucian Copeland for Adafruit Industries
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_STM32F4_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
|
||||
#define MICROPY_INCLUDED_STM32F4_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
|
||||
|
||||
#include "common-hal/digitalio/DigitalInOut.h"
|
||||
|
||||
typedef struct {
|
||||
mp_obj_base_t base;
|
||||
} displayio_parallelbus_obj_t;
|
||||
|
||||
#endif // MICROPY_INCLUDED_STM32F4_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
|
@ -61,3 +61,5 @@ ifeq ($(MCU_SERIES),F7)
|
||||
|
||||
USB_NUM_ENDPOINT_PAIRS = 6
|
||||
endif
|
||||
|
||||
CIRCUITPY_PARALLELDISPLAY := 0
|
||||
|
@ -213,7 +213,7 @@ ifeq ($(HASCPP17), 1)
|
||||
else
|
||||
CXXFLAGS += -std=c++11
|
||||
endif
|
||||
CXXFLAGS += $(filter-out -Wmissing-prototypes -Wold-style-definition -std=gnu99,$(CFLAGS) $(CXXFLAGS_MOD))
|
||||
CXXFLAGS += $(filter-out -Wmissing-prototypes -Wold-style-definition -std=gnu99 -std=gnu11,$(CFLAGS) $(CXXFLAGS_MOD))
|
||||
|
||||
ifeq ($(MICROPY_FORCE_32BIT),1)
|
||||
RUN_TESTS_MPY_CROSS_FLAGS = --mpy-cross-flags='-mcache-lookup-bc -march=x86'
|
||||
|
@ -22,7 +22,6 @@ FROZEN_DIR=variants/coverage/frzstr
|
||||
FROZEN_MPY_DIR=variants/coverage/frzmpy
|
||||
|
||||
SRC_QRIO := $(patsubst ../../%,%,$(wildcard ../../shared-bindings/qrio/*.c ../../shared-module/qrio/*.c ../../lib/quirc/lib/*.c))
|
||||
$(info SRC_QRIO = $(SRC_QRIO))
|
||||
SRC_C += $(SRC_QRIO)
|
||||
|
||||
CFLAGS += -DCIRCUITPY_QRIO=1
|
||||
|
@ -175,6 +175,9 @@ endif
|
||||
ifeq ($(CIRCUITPY_DISPLAYIO),1)
|
||||
SRC_PATTERNS += displayio/%
|
||||
endif
|
||||
ifeq ($(CIRCUITPY_PARALLELDISPLAY),1)
|
||||
SRC_PATTERNS += paralleldisplay/%
|
||||
endif
|
||||
ifeq ($(CIRCUITPY_VECTORIO),1)
|
||||
SRC_PATTERNS += vectorio/%
|
||||
endif
|
||||
@ -385,7 +388,6 @@ SRC_COMMON_HAL_ALL = \
|
||||
countio/__init__.c \
|
||||
digitalio/DigitalInOut.c \
|
||||
digitalio/__init__.c \
|
||||
displayio/ParallelBus.c \
|
||||
dualbank/__init__.c \
|
||||
frequencyio/FrequencyIn.c \
|
||||
frequencyio/__init__.c \
|
||||
@ -404,6 +406,7 @@ SRC_COMMON_HAL_ALL = \
|
||||
nvm/ByteArray.c \
|
||||
nvm/__init__.c \
|
||||
os/__init__.c \
|
||||
paralleldisplay/ParallelBus.c \
|
||||
ps2io/Ps2.c \
|
||||
ps2io/__init__.c \
|
||||
pulseio/PulseIn.c \
|
||||
|
@ -330,6 +330,7 @@ extern const struct _mp_obj_module_t canio_module;
|
||||
// CIRCUITPY_COUNTIO uses MP_REGISTER_MODULE
|
||||
// CIRCUITPY_DIGITALIO uses MP_REGISTER_MODULE
|
||||
// CIRCUITPY_DISPLAYIO uses MP_REGISTER_MODULE
|
||||
// CIRCUITPY_PARALLELDISPLAY uses MP_REGISTER_MODULE
|
||||
// CIRCUITPY_TERMINALIO uses MP_REGISTER_MODULE
|
||||
// CIRCUITPY_FONTIO uses MP_REGISTER_MODULE
|
||||
|
||||
@ -373,13 +374,7 @@ extern const struct _mp_obj_module_t _eve_module;
|
||||
#endif
|
||||
|
||||
// CIRCUITPY_FRAMEBUFFERIO uses MP_REGISTER_MODULE
|
||||
|
||||
#if CIRCUITPY_VECTORIO
|
||||
extern const struct _mp_obj_module_t vectorio_module;
|
||||
#define VECTORIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_vectorio), (mp_obj_t)&vectorio_module },
|
||||
#else
|
||||
#define VECTORIO_MODULE
|
||||
#endif
|
||||
// CIRCUITPY_VECTORIO uses MP_REGISTER_MODULE
|
||||
|
||||
// CIRCUITPY_FREQUENCYIO uses MP_REGISTER_MODULE
|
||||
// CIRCUITPY_GAMEPADSHIFT uses MP_REGISTER_MODULE
|
||||
@ -455,25 +450,14 @@ extern const struct _mp_obj_module_t memorymonitor_module;
|
||||
#endif
|
||||
|
||||
// CIRCUITPY_MICROCONTROLLER uses MP_REGISTER_MODULE
|
||||
|
||||
#if CIRCUITPY_NEOPIXEL_WRITE
|
||||
extern const struct _mp_obj_module_t neopixel_write_module;
|
||||
#define NEOPIXEL_WRITE_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_neopixel_write),(mp_obj_t)&neopixel_write_module },
|
||||
#else
|
||||
#define NEOPIXEL_WRITE_MODULE
|
||||
#endif
|
||||
// CIRCUITPY_NEOPIXEL_WRITE uses MP_REGISTER_MODULE
|
||||
|
||||
// This is not a top-level module; it's microcontroller.nvm.
|
||||
#if CIRCUITPY_NVM
|
||||
extern const struct _mp_obj_module_t nvm_module;
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_ONEWIREIO
|
||||
extern const struct _mp_obj_module_t onewireio_module;
|
||||
#define ONEWIREIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_onewireio), (mp_obj_t)&onewireio_module },
|
||||
#else
|
||||
#define ONEWIREIO_MODULE
|
||||
#endif
|
||||
// CIRCUITPY_ONEWIREIO_WRITE uses MP_REGISTER_MODULE
|
||||
|
||||
#if CIRCUITPY_OS
|
||||
extern const struct _mp_obj_module_t os_module;
|
||||
@ -492,43 +476,12 @@ extern const struct _mp_obj_module_t pew_module;
|
||||
#endif
|
||||
|
||||
// CIRCUITPY_PIXELBUF (pixelbuf_module) uses MP_REGISTER_MODULE
|
||||
|
||||
#if CIRCUITPY_PS2IO
|
||||
extern const struct _mp_obj_module_t ps2io_module;
|
||||
#define PS2IO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_ps2io), (mp_obj_t)&ps2io_module },
|
||||
#else
|
||||
#define PS2IO_MODULE
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_PULSEIO
|
||||
extern const struct _mp_obj_module_t pulseio_module;
|
||||
#define PULSEIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_pulseio), (mp_obj_t)&pulseio_module },
|
||||
#else
|
||||
#define PULSEIO_MODULE
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_PWMIO
|
||||
extern const struct _mp_obj_module_t pwmio_module;
|
||||
#define PWMIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_pwmio), (mp_obj_t)&pwmio_module },
|
||||
#else
|
||||
#define PWMIO_MODULE
|
||||
#endif
|
||||
|
||||
// CIRCUITPY_PS2IO uses MP_REGISTER_MODULE
|
||||
// CIRCUITPY_PULSEIO uses MP_REGISTER_MODULE
|
||||
// CIRCUITPY_PWMIO uses MP_REGISTER_MODULE
|
||||
// CIRCUITPY_QRIO uses MP_REGISTER_MODULE
|
||||
|
||||
#if CIRCUITPY_RAINBOWIO
|
||||
extern const struct _mp_obj_module_t rainbowio_module;
|
||||
#define RAINBOWIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_rainbowio), (mp_obj_t)&rainbowio_module },
|
||||
#else
|
||||
#define RAINBOWIO_MODULE
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_RANDOM
|
||||
extern const struct _mp_obj_module_t random_module;
|
||||
#define RANDOM_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_random), (mp_obj_t)&random_module },
|
||||
#else
|
||||
#define RANDOM_MODULE
|
||||
#endif
|
||||
// CIRCUITPY_RAINBOWIO uses MP_REGISTER_MODULE
|
||||
// CIRCUITPY_RANDOM uses MP_REGISTER_MODULE
|
||||
|
||||
#if CIRCUITPY_RE
|
||||
#define MICROPY_PY_URE (1)
|
||||
@ -537,19 +490,8 @@ extern const struct _mp_obj_module_t random_module;
|
||||
#define RE_MODULE
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_RGBMATRIX
|
||||
extern const struct _mp_obj_module_t rgbmatrix_module;
|
||||
#define RGBMATRIX_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_rgbmatrix),(mp_obj_t)&rgbmatrix_module },
|
||||
#else
|
||||
#define RGBMATRIX_MODULE
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_ROTARYIO
|
||||
extern const struct _mp_obj_module_t rotaryio_module;
|
||||
#define ROTARYIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_rotaryio), (mp_obj_t)&rotaryio_module },
|
||||
#else
|
||||
#define ROTARYIO_MODULE
|
||||
#endif
|
||||
// CIRCUITPY_RGBMATRIX uses MP_REGISTER_MODULE
|
||||
// CIRCUITPY_ROTARYIO uses MP_REGISTER_MODULE
|
||||
|
||||
#if CIRCUITPY_RP2PIO
|
||||
extern const struct _mp_obj_module_t rp2pio_module;
|
||||
@ -558,12 +500,7 @@ extern const struct _mp_obj_module_t rp2pio_module;
|
||||
#define RP2PIO_MODULE
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_RTC
|
||||
extern const struct _mp_obj_module_t rtc_module;
|
||||
#define RTC_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_rtc), (mp_obj_t)&rtc_module },
|
||||
#else
|
||||
#define RTC_MODULE
|
||||
#endif
|
||||
// CIRCUITPY_RTC uses MP_REGISTER_MODULE
|
||||
|
||||
#if CIRCUITPY_SAMD
|
||||
extern const struct _mp_obj_module_t samd_module;
|
||||
@ -572,12 +509,7 @@ extern const struct _mp_obj_module_t samd_module;
|
||||
#define SAMD_MODULE
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_SDCARDIO
|
||||
extern const struct _mp_obj_module_t sdcardio_module;
|
||||
#define SDCARDIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_sdcardio), (mp_obj_t)&sdcardio_module },
|
||||
#else
|
||||
#define SDCARDIO_MODULE
|
||||
#endif
|
||||
// CIRCUITPY_SDCARDIO uses MP_REGISTER_MODULE
|
||||
|
||||
#if CIRCUITPY_SDIOIO
|
||||
extern const struct _mp_obj_module_t sdioio_module;
|
||||
@ -586,12 +518,7 @@ extern const struct _mp_obj_module_t sdioio_module;
|
||||
#define SDIOIO_MODULE
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_SHARPDISPLAY
|
||||
extern const struct _mp_obj_module_t sharpdisplay_module;
|
||||
#define SHARPDISPLAY_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_sharpdisplay),(mp_obj_t)&sharpdisplay_module },
|
||||
#else
|
||||
#define SHARPDISPLAY_MODULE
|
||||
#endif
|
||||
// CIRCUITPY_SHARPDISPLAY uses MP_REGISTER_MODULE
|
||||
|
||||
#if CIRCUITPY_SOCKETPOOL
|
||||
extern const struct _mp_obj_module_t socketpool_module;
|
||||
@ -607,40 +534,11 @@ extern const struct _mp_obj_module_t ssl_module;
|
||||
#define SSL_MODULE
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_STAGE
|
||||
extern const struct _mp_obj_module_t stage_module;
|
||||
#define STAGE_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR__stage), (mp_obj_t)&stage_module },
|
||||
#else
|
||||
#define STAGE_MODULE
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_STORAGE
|
||||
extern const struct _mp_obj_module_t storage_module;
|
||||
#define STORAGE_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_storage), (mp_obj_t)&storage_module },
|
||||
#else
|
||||
#define STORAGE_MODULE
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_STRUCT
|
||||
extern const struct _mp_obj_module_t struct_module;
|
||||
#define STRUCT_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_struct), (mp_obj_t)&struct_module },
|
||||
#else
|
||||
#define STRUCT_MODULE
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_SUPERVISOR
|
||||
extern const struct _mp_obj_module_t supervisor_module;
|
||||
#define SUPERVISOR_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_supervisor), (mp_obj_t)&supervisor_module },
|
||||
#else
|
||||
#define SUPERVISOR_MODULE
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_SYNTHIO
|
||||
#define SYNTHIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_synthio), (mp_obj_t)&synthio_module },
|
||||
extern const struct _mp_obj_module_t synthio_module;
|
||||
#else
|
||||
#define SYNTHIO_MODULE
|
||||
#endif
|
||||
// CIRCUITPY_STAGE uses MP_REGISTER_MODULE
|
||||
// CIRCUITPY_STORAGE uses MP_REGISTER_MODULE
|
||||
// CIRCUITPY_STRUCT uses MP_REGISTER_MODULE
|
||||
// CIRCUITPY_SUPERVISOR uses MP_REGISTER_MODULE
|
||||
// CIRCUITPY_SYNTHIO uses MP_REGISTER_MODULE
|
||||
|
||||
#if CIRCUITPY_TIME
|
||||
extern const struct _mp_obj_module_t time_module;
|
||||
@ -651,19 +549,8 @@ extern const struct _mp_obj_module_t time_module;
|
||||
#define TIME_MODULE_ALT_NAME
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_TOUCHIO
|
||||
extern const struct _mp_obj_module_t touchio_module;
|
||||
#define TOUCHIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_touchio), (mp_obj_t)&touchio_module },
|
||||
#else
|
||||
#define TOUCHIO_MODULE
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_TRACEBACK
|
||||
extern const struct _mp_obj_module_t traceback_module;
|
||||
#define TRACEBACK_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_traceback), (mp_obj_t)&traceback_module },
|
||||
#else
|
||||
#define TRACEBACK_MODULE
|
||||
#endif
|
||||
// CIRCUITPY_TOUCHIO uses MP_REGISTER_MODULE
|
||||
// CIRCUITPY_TRACEBACK uses MP_REGISTER_MODULE
|
||||
|
||||
#if CIRCUITPY_UHEAP
|
||||
extern const struct _mp_obj_module_t uheap_module;
|
||||
@ -672,26 +559,9 @@ extern const struct _mp_obj_module_t uheap_module;
|
||||
#define UHEAP_MODULE
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_USB_CDC
|
||||
extern const struct _mp_obj_module_t usb_cdc_module;
|
||||
#define USB_CDC_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_usb_cdc),(mp_obj_t)&usb_cdc_module },
|
||||
#else
|
||||
#define USB_CDC_MODULE
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_USB_HID
|
||||
extern const struct _mp_obj_module_t usb_hid_module;
|
||||
#define USB_HID_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_usb_hid),(mp_obj_t)&usb_hid_module },
|
||||
#else
|
||||
#define USB_HID_MODULE
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_USB_MIDI
|
||||
extern const struct _mp_obj_module_t usb_midi_module;
|
||||
#define USB_MIDI_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_usb_midi),(mp_obj_t)&usb_midi_module },
|
||||
#else
|
||||
#define USB_MIDI_MODULE
|
||||
#endif
|
||||
// CIRCUITPY_USB_CDC uses MP_REGISTER_MODULE
|
||||
// CIRCUITPY_USB_HID uses MP_REGISTER_MODULE
|
||||
// CIRCUITPY_USB_MIDI uses MP_REGISTER_MODULE
|
||||
|
||||
#if CIRCUITPY_USTACK
|
||||
extern const struct _mp_obj_module_t ustack_module;
|
||||
@ -755,7 +625,6 @@ extern const struct _mp_obj_module_t wifi_module;
|
||||
CAMERA_MODULE \
|
||||
CANIO_MODULE \
|
||||
DUALBANK_MODULE \
|
||||
VECTORIO_MODULE \
|
||||
ERRNO_MODULE \
|
||||
ESPIDF_MODULE \
|
||||
_EVE_MODULE \
|
||||
@ -765,36 +634,14 @@ extern const struct _mp_obj_module_t wifi_module;
|
||||
IMAGECAPTURE_MODULE \
|
||||
JSON_MODULE \
|
||||
MEMORYMONITOR_MODULE \
|
||||
NEOPIXEL_WRITE_MODULE \
|
||||
ONEWIREIO_MODULE \
|
||||
PEW_MODULE \
|
||||
PS2IO_MODULE \
|
||||
PULSEIO_MODULE \
|
||||
PWMIO_MODULE \
|
||||
RAINBOWIO_MODULE \
|
||||
RANDOM_MODULE \
|
||||
RE_MODULE \
|
||||
RGBMATRIX_MODULE \
|
||||
ROTARYIO_MODULE \
|
||||
RP2PIO_MODULE \
|
||||
RTC_MODULE \
|
||||
SAMD_MODULE \
|
||||
SDCARDIO_MODULE \
|
||||
SDIOIO_MODULE \
|
||||
SHARPDISPLAY_MODULE \
|
||||
SOCKETPOOL_MODULE \
|
||||
SSL_MODULE \
|
||||
STAGE_MODULE \
|
||||
STORAGE_MODULE \
|
||||
STRUCT_MODULE \
|
||||
SUPERVISOR_MODULE \
|
||||
SYNTHIO_MODULE \
|
||||
TOUCHIO_MODULE \
|
||||
TRACEBACK_MODULE \
|
||||
UHEAP_MODULE \
|
||||
USB_CDC_MODULE \
|
||||
USB_HID_MODULE \
|
||||
USB_MIDI_MODULE \
|
||||
USTACK_MODULE \
|
||||
WATCHDOG_MODULE \
|
||||
WIFI_MODULE \
|
||||
@ -870,6 +717,13 @@ void supervisor_run_background_tasks_if_tick(void);
|
||||
|
||||
#define CIRCUITPY_VERBOSE_BLE 0
|
||||
|
||||
// This trades ~1k flash space (1) for that much in RAM plus the cost to compute
|
||||
// the values once on init (0). Only turn it off, when you really need the flash
|
||||
// space and are willing to trade the RAM.
|
||||
#ifndef CIRCUITPY_PRECOMPUTE_QSTR_ATTR
|
||||
#define CIRCUITPY_PRECOMPUTE_QSTR_ATTR (1)
|
||||
#endif
|
||||
|
||||
// USB settings
|
||||
|
||||
// If the port requires certain USB endpoint numbers, define these in mpconfigport.h.
|
||||
@ -914,6 +768,16 @@ void supervisor_run_background_tasks_if_tick(void);
|
||||
#define USB_HID_EP_NUM_IN (0)
|
||||
#endif
|
||||
|
||||
// The most complicated device currently known of is the head and eye tracker, which requires 5
|
||||
// report ids.
|
||||
// https://usb.org/sites/default/files/hutrr74_-_usage_page_for_head_and_eye_trackers_0.pdf
|
||||
// The default descriptors only use 1, so that is the minimum.
|
||||
#ifndef CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR
|
||||
#define CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR (6)
|
||||
#elif CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR < 1
|
||||
#error "CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR must be at least 1"
|
||||
#endif
|
||||
|
||||
#ifndef USB_MIDI_EP_NUM_OUT
|
||||
#define USB_MIDI_EP_NUM_OUT (0)
|
||||
#endif
|
||||
|
@ -154,6 +154,13 @@ CFLAGS += -DCIRCUITPY_COUNTIO=$(CIRCUITPY_COUNTIO)
|
||||
CIRCUITPY_DISPLAYIO ?= $(CIRCUITPY_FULL_BUILD)
|
||||
CFLAGS += -DCIRCUITPY_DISPLAYIO=$(CIRCUITPY_DISPLAYIO)
|
||||
|
||||
ifeq ($(CIRCUITPY_DISPLAYIO),1)
|
||||
CIRCUITPY_PARALLELDISPLAY ?= $(CIRCUITPY_FULL_BUILD)
|
||||
else
|
||||
CIRCUITPY_PARALLELDISPLAY = 0
|
||||
endif
|
||||
CFLAGS += -DCIRCUITPY_PARALLELDISPLAY=$(CIRCUITPY_PARALLELDISPLAY)
|
||||
|
||||
# bitmaptools and framebufferio rely on displayio
|
||||
ifeq ($(CIRCUITPY_DISPLAYIO),1)
|
||||
CIRCUITPY_BITMAPTOOLS ?= $(CIRCUITPY_FULL_BUILD)
|
||||
|
@ -65,7 +65,7 @@ vpath %.cpp . $(TOP) $(USER_C_MODULES)
|
||||
$(BUILD)/%.o: %.cpp
|
||||
$(call compile_cxx)
|
||||
|
||||
QSTR_GEN_EXTRA_CFLAGS += -DNO_QSTR
|
||||
QSTR_GEN_EXTRA_CFLAGS += -DNO_QSTR -x c
|
||||
|
||||
# frozen.c and frozen_mpy.c are created in $(BUILD), so use our rule
|
||||
# for those as well.
|
||||
|
@ -545,7 +545,12 @@ int mp_vprintf(const mp_print_t *print, const char *fmt, va_list args) {
|
||||
case 'p':
|
||||
case 'P': // don't bother to handle upcase for 'P'
|
||||
// Use unsigned long int to work on both ILP32 and LP64 systems
|
||||
chrs += mp_print_int(print, va_arg(args, unsigned long int), 0, 16, 'a', flags, fill, width);
|
||||
#if SUPPORT_INT_BASE_PREFIX
|
||||
chrs += mp_print_int(print, va_arg(args, unsigned long int), 0, 16, 'a', flags | PF_FLAG_SHOW_PREFIX, fill, width);
|
||||
#else
|
||||
print->print_strn(print->data, "0x", 2);
|
||||
chrs += mp_print_int(print, va_arg(args, unsigned long int), 0, 16, 'a', flags, fill, width) + 2;
|
||||
#endif
|
||||
break;
|
||||
#if MICROPY_PY_BUILTINS_FLOAT
|
||||
case 'e':
|
||||
|
@ -182,7 +182,7 @@ qstr mp_obj_fun_get_name(mp_const_obj_t fun_in) {
|
||||
STATIC void fun_bc_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
|
||||
(void)kind;
|
||||
mp_obj_fun_bc_t *o = MP_OBJ_TO_PTR(o_in);
|
||||
mp_printf(print, "<function %q at 0x%p>", mp_obj_fun_get_name(o_in), o);
|
||||
mp_printf(print, "<function %q at %p>", mp_obj_fun_get_name(o_in), o);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -68,7 +68,7 @@ STATIC void code_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t k
|
||||
const mp_raw_code_t *rc = o->rc;
|
||||
const mp_bytecode_prelude_t *prelude = &rc->prelude;
|
||||
mp_printf(print,
|
||||
"<code object %q at 0x%p, file \"%q\", line %d>",
|
||||
"<code object %q at %p, file \"%q\", line %d>",
|
||||
prelude->qstr_block_name,
|
||||
o,
|
||||
prelude->qstr_source_file,
|
||||
@ -202,7 +202,7 @@ STATIC void frame_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t
|
||||
const mp_raw_code_t *rc = code->rc;
|
||||
const mp_bytecode_prelude_t *prelude = &rc->prelude;
|
||||
mp_printf(print,
|
||||
"<frame at 0x%p, file '%q', line %d, code %q>",
|
||||
"<frame at %p, file '%q', line %d, code %q>",
|
||||
frame,
|
||||
prelude->qstr_source_file,
|
||||
frame->lineno,
|
||||
@ -950,7 +950,7 @@ void mp_prof_print_instr(const byte *ip, mp_code_state_t *code_state) {
|
||||
|
||||
/* long path */ if (1) {
|
||||
mp_printf(&mp_plat_print,
|
||||
"@0x%p:%q:%q+0x%04x:%d",
|
||||
"@%p:%q:%q+0x%04x:%d",
|
||||
ip,
|
||||
prelude->qstr_source_file,
|
||||
prelude->qstr_block_name,
|
||||
|
20
py/qstr.c
20
py/qstr.c
@ -76,8 +76,11 @@ mp_uint_t qstr_compute_hash(const byte *data, size_t len) {
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
const qstr_attr_t mp_qstr_const_attr[] = {
|
||||
#ifndef CIRCUITPY_PRECOMPUTE_QSTR_ATTR
|
||||
#define CIRCUITPY_PRECOMPUTE_QSTR_ATTR (1)
|
||||
#endif
|
||||
#if CIRCUITPY_PRECOMPUTE_QSTR_ATTR == 1
|
||||
const qstr_attr_t mp_qstr_const_attr[MP_QSTRnumber_of] = {
|
||||
#ifndef NO_QSTR
|
||||
#define QDEF(id, hash, len, str) { hash, len },
|
||||
#define TRANSLATION(id, length, compressed ...)
|
||||
@ -86,6 +89,9 @@ const qstr_attr_t mp_qstr_const_attr[] = {
|
||||
#undef QDEF
|
||||
#endif
|
||||
};
|
||||
#else
|
||||
qstr_attr_t mp_qstr_const_attr[MP_QSTRnumber_of];
|
||||
#endif
|
||||
|
||||
const qstr_pool_t mp_qstr_const_pool = {
|
||||
NULL, // no previous pool
|
||||
@ -115,6 +121,16 @@ void qstr_init(void) {
|
||||
MP_STATE_VM(last_pool) = (qstr_pool_t *)&CONST_POOL; // we won't modify the const_pool since it has no allocated room left
|
||||
MP_STATE_VM(qstr_last_chunk) = NULL;
|
||||
|
||||
#if CIRCUITPY_PRECOMPUTE_QSTR_ATTR == 0
|
||||
if (mp_qstr_const_attr[MP_QSTR_circuitpython].len == 0) {
|
||||
for (size_t i = 0; i < mp_qstr_const_pool.len; i++) {
|
||||
size_t len = strlen(mp_qstr_const_pool.qstrs[i]);
|
||||
mp_qstr_const_attr[i].hash = qstr_compute_hash((const byte *)mp_qstr_const_pool.qstrs[i], len);
|
||||
mp_qstr_const_attr[i].len = len;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if MICROPY_PY_THREAD && !MICROPY_PY_THREAD_GIL
|
||||
mp_thread_mutex_init(&MP_STATE_VM(qstr_mutex));
|
||||
#endif
|
||||
|
@ -111,3 +111,5 @@ const mp_obj_module_t stage_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)&stage_module_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR__stage, stage_module, CIRCUITPY_STAGE);
|
||||
|
@ -39,8 +39,8 @@
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "supervisor/shared/translate.h"
|
||||
|
||||
//| _DisplayBus = Union['FourWire', 'ParallelBus', 'I2CDisplay']
|
||||
//| """:py:class:`FourWire`, :py:class:`ParallelBus` or :py:class:`I2CDisplay`"""
|
||||
//| _DisplayBus = Union['FourWire', 'paralleldisplay.ParallelBus', 'I2CDisplay']
|
||||
//| """:py:class:`FourWire`, :py:class:`paralleldisplay.ParallelBus` or :py:class:`I2CDisplay`"""
|
||||
//|
|
||||
|
||||
//|
|
||||
|
@ -64,7 +64,7 @@
|
||||
//| busy_pin: Optional[microcontroller.Pin] = None, busy_state: bool = True,
|
||||
//| seconds_per_frame: float = 180, always_toggle_chip_select: bool = False,
|
||||
//| grayscale: bool = False) -> None:
|
||||
//| """Create a EPaperDisplay object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`).
|
||||
//| """Create a EPaperDisplay object on the given display bus (`displayio.FourWire` or `paralleldisplay.ParallelBus`).
|
||||
//|
|
||||
//| The ``start_sequence`` and ``stop_sequence`` are bitpacked to minimize the ram impact. Every
|
||||
//| command begins with a command byte followed by a byte to determine the parameter count and
|
||||
@ -75,7 +75,7 @@
|
||||
//| extra long 500 ms delay instead of 255 ms. The next byte will begin a new command definition.
|
||||
//|
|
||||
//| :param display_bus: The bus that the display is connected to
|
||||
//| :type _DisplayBus: displayio.FourWire or displayio.ParallelBus
|
||||
//| :type _DisplayBus: displayio.FourWire or paralleldisplay.ParallelBus
|
||||
//| :param ~_typing.ReadableBuffer start_sequence: Byte-packed initialization sequence.
|
||||
//| :param ~_typing.ReadableBuffer stop_sequence: Byte-packed initialization sequence.
|
||||
//| :param int width: Width in pixels
|
||||
|
@ -40,7 +40,9 @@
|
||||
#include "shared-bindings/displayio/I2CDisplay.h"
|
||||
#include "shared-bindings/displayio/OnDiskBitmap.h"
|
||||
#include "shared-bindings/displayio/Palette.h"
|
||||
#include "shared-bindings/displayio/ParallelBus.h"
|
||||
#if CIRCUITPY_PARALLELDISPLAY
|
||||
#include "shared-bindings/paralleldisplay/ParallelBus.h"
|
||||
#endif
|
||||
#include "shared-bindings/displayio/Shape.h"
|
||||
#include "shared-bindings/displayio/TileGrid.h"
|
||||
|
||||
@ -50,6 +52,8 @@
|
||||
//| including synchronizing with refresh rates and partial updating."""
|
||||
//|
|
||||
|
||||
//| import paralleldisplay
|
||||
|
||||
//| def release_displays() -> None:
|
||||
//| """Releases any actively used displays so their busses and pins can be used again. This will also
|
||||
//| release the builtin display on boards that have one. You will need to reinitialize it yourself
|
||||
@ -125,7 +129,9 @@ STATIC const mp_rom_map_elem_t displayio_module_globals_table[] = {
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_FourWire), MP_ROM_PTR(&displayio_fourwire_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_I2CDisplay), MP_ROM_PTR(&displayio_i2cdisplay_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_ParallelBus), MP_ROM_PTR(&displayio_parallelbus_type) },
|
||||
#if CIRCUITPY_PARALLELDISPLAY
|
||||
{ MP_ROM_QSTR(MP_QSTR_ParallelBus), MP_ROM_PTR(¶lleldisplay_parallelbus_type) },
|
||||
#endif
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_release_displays), MP_ROM_PTR(&displayio_release_displays_obj) },
|
||||
};
|
||||
|
@ -81,3 +81,5 @@ const mp_obj_module_t neopixel_write_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)&neopixel_write_module_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_neopixel_write, neopixel_write_module, CIRCUITPY_NEOPIXEL_WRITE);
|
||||
|
@ -51,3 +51,5 @@ const mp_obj_module_t onewireio_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)&onewireio_module_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_onewireio, onewireio_module, CIRCUITPY_ONEWIREIO);
|
||||
|
@ -24,7 +24,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "shared-bindings/displayio/ParallelBus.h"
|
||||
#include "shared-bindings/paralleldisplay/ParallelBus.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
//| :param microcontroller.Pin reset: Reset pin"""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t displayio_parallelbus_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
STATIC mp_obj_t paralleldisplay_parallelbus_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_data0, ARG_command, ARG_chip_select, ARG_write, ARG_read, ARG_reset, ARG_frequency };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_data0, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED },
|
||||
@ -80,10 +80,10 @@ STATIC mp_obj_t displayio_parallelbus_make_new(const mp_obj_type_t *type, size_t
|
||||
mcu_pin_obj_t *read = validate_obj_is_free_pin(args[ARG_read].u_obj);
|
||||
mcu_pin_obj_t *reset = validate_obj_is_free_pin(args[ARG_reset].u_obj);
|
||||
|
||||
displayio_parallelbus_obj_t *self = &allocate_display_bus_or_raise()->parallel_bus;
|
||||
self->base.type = &displayio_parallelbus_type;
|
||||
paralleldisplay_parallelbus_obj_t *self = &allocate_display_bus_or_raise()->parallel_bus;
|
||||
self->base.type = ¶lleldisplay_parallelbus_type;
|
||||
|
||||
common_hal_displayio_parallelbus_construct(self, data0, command, chip_select, write, read, reset, args[ARG_frequency].u_int);
|
||||
common_hal_paralleldisplay_parallelbus_construct(self, data0, command, chip_select, write, read, reset, args[ARG_frequency].u_int);
|
||||
return self;
|
||||
}
|
||||
|
||||
@ -93,22 +93,22 @@ STATIC mp_obj_t displayio_parallelbus_make_new(const mp_obj_type_t *type, size_t
|
||||
//| ...
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t displayio_parallelbus_obj_reset(mp_obj_t self_in) {
|
||||
displayio_parallelbus_obj_t *self = self_in;
|
||||
STATIC mp_obj_t paralleldisplay_parallelbus_obj_reset(mp_obj_t self_in) {
|
||||
paralleldisplay_parallelbus_obj_t *self = self_in;
|
||||
|
||||
if (!common_hal_displayio_parallelbus_reset(self)) {
|
||||
if (!common_hal_paralleldisplay_parallelbus_reset(self)) {
|
||||
mp_raise_RuntimeError(translate("no reset pin available"));
|
||||
}
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(displayio_parallelbus_reset_obj, displayio_parallelbus_obj_reset);
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(paralleldisplay_parallelbus_reset_obj, paralleldisplay_parallelbus_obj_reset);
|
||||
|
||||
//| def send(self, command: int, data: ReadableBuffer) -> None:
|
||||
//| """Sends the given command value followed by the full set of data. Display state, such as
|
||||
//| vertical scroll, set via ``send`` may or may not be reset once the code is done."""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t displayio_parallelbus_obj_send(mp_obj_t self, mp_obj_t command_obj, mp_obj_t data_obj) {
|
||||
STATIC mp_obj_t paralleldisplay_parallelbus_obj_send(mp_obj_t self, mp_obj_t command_obj, mp_obj_t data_obj) {
|
||||
mp_int_t command_int = MP_OBJ_SMALL_INT_VALUE(command_obj);
|
||||
if (!mp_obj_is_small_int(command_obj) || command_int > 255 || command_int < 0) {
|
||||
mp_raise_ValueError(translate("Command must be an int between 0 and 255"));
|
||||
@ -118,26 +118,26 @@ STATIC mp_obj_t displayio_parallelbus_obj_send(mp_obj_t self, mp_obj_t command_o
|
||||
mp_get_buffer_raise(data_obj, &bufinfo, MP_BUFFER_READ);
|
||||
|
||||
// Wait for display bus to be available.
|
||||
while (!common_hal_displayio_parallelbus_begin_transaction(self)) {
|
||||
while (!common_hal_paralleldisplay_parallelbus_begin_transaction(self)) {
|
||||
RUN_BACKGROUND_TASKS;
|
||||
}
|
||||
common_hal_displayio_parallelbus_send(self, DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, &command, 1);
|
||||
common_hal_displayio_parallelbus_send(self, DISPLAY_DATA, CHIP_SELECT_UNTOUCHED, ((uint8_t *)bufinfo.buf), bufinfo.len);
|
||||
common_hal_displayio_parallelbus_end_transaction(self);
|
||||
common_hal_paralleldisplay_parallelbus_send(self, DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, &command, 1);
|
||||
common_hal_paralleldisplay_parallelbus_send(self, DISPLAY_DATA, CHIP_SELECT_UNTOUCHED, ((uint8_t *)bufinfo.buf), bufinfo.len);
|
||||
common_hal_paralleldisplay_parallelbus_end_transaction(self);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_3(displayio_parallelbus_send_obj, displayio_parallelbus_obj_send);
|
||||
MP_DEFINE_CONST_FUN_OBJ_3(paralleldisplay_parallelbus_send_obj, paralleldisplay_parallelbus_obj_send);
|
||||
|
||||
STATIC const mp_rom_map_elem_t displayio_parallelbus_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&displayio_parallelbus_reset_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&displayio_parallelbus_send_obj) },
|
||||
STATIC const mp_rom_map_elem_t paralleldisplay_parallelbus_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(¶lleldisplay_parallelbus_reset_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(¶lleldisplay_parallelbus_send_obj) },
|
||||
};
|
||||
STATIC MP_DEFINE_CONST_DICT(displayio_parallelbus_locals_dict, displayio_parallelbus_locals_dict_table);
|
||||
STATIC MP_DEFINE_CONST_DICT(paralleldisplay_parallelbus_locals_dict, paralleldisplay_parallelbus_locals_dict_table);
|
||||
|
||||
const mp_obj_type_t displayio_parallelbus_type = {
|
||||
const mp_obj_type_t paralleldisplay_parallelbus_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_ParallelBus,
|
||||
.make_new = displayio_parallelbus_make_new,
|
||||
.locals_dict = (mp_obj_dict_t *)&displayio_parallelbus_locals_dict,
|
||||
.make_new = paralleldisplay_parallelbus_make_new,
|
||||
.locals_dict = (mp_obj_dict_t *)¶lleldisplay_parallelbus_locals_dict,
|
||||
};
|
@ -24,31 +24,28 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYBUSIO_PARALLELBUS_H
|
||||
#define MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYBUSIO_PARALLELBUS_H
|
||||
#pragma once
|
||||
|
||||
#include "common-hal/displayio/ParallelBus.h"
|
||||
#include "common-hal/paralleldisplay/ParallelBus.h"
|
||||
|
||||
#include "common-hal/microcontroller/Pin.h"
|
||||
#include "shared-bindings/displayio/__init__.h"
|
||||
#include "shared-module/displayio/Group.h"
|
||||
|
||||
extern const mp_obj_type_t displayio_parallelbus_type;
|
||||
extern const mp_obj_type_t paralleldisplay_parallelbus_type;
|
||||
|
||||
void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *self,
|
||||
void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_parallelbus_obj_t *self,
|
||||
const mcu_pin_obj_t *data0, const mcu_pin_obj_t *command, const mcu_pin_obj_t *chip_select,
|
||||
const mcu_pin_obj_t *write, const mcu_pin_obj_t *read, const mcu_pin_obj_t *reset, uint32_t frequency);
|
||||
|
||||
void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t *self);
|
||||
void common_hal_paralleldisplay_parallelbus_deinit(paralleldisplay_parallelbus_obj_t *self);
|
||||
|
||||
bool common_hal_displayio_parallelbus_reset(mp_obj_t self);
|
||||
bool common_hal_displayio_parallelbus_bus_free(mp_obj_t self);
|
||||
bool common_hal_paralleldisplay_parallelbus_reset(mp_obj_t self);
|
||||
bool common_hal_paralleldisplay_parallelbus_bus_free(mp_obj_t self);
|
||||
|
||||
bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t self);
|
||||
bool common_hal_paralleldisplay_parallelbus_begin_transaction(mp_obj_t self);
|
||||
|
||||
void common_hal_displayio_parallelbus_send(mp_obj_t self, display_byte_type_t byte_type,
|
||||
void common_hal_paralleldisplay_parallelbus_send(mp_obj_t self, display_byte_type_t byte_type,
|
||||
display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length);
|
||||
|
||||
void common_hal_displayio_parallelbus_end_transaction(mp_obj_t self);
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYBUSIO_PARALLELBUS_H
|
||||
void common_hal_paralleldisplay_parallelbus_end_transaction(mp_obj_t self);
|
51
shared-bindings/paralleldisplay/__init__.h
Normal file
51
shared-bindings/paralleldisplay/__init__.h
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "py/enum.h"
|
||||
#include "py/obj.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
#include "shared-bindings/paralleldisplay/__init__.h"
|
||||
#include "shared-bindings/paralleldisplay/ParallelBus.h"
|
||||
|
||||
//| """Native helpers for driving parallel displays"""
|
||||
|
||||
|
||||
STATIC const mp_rom_map_elem_t paralleldisplay_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_paralleldisplay) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_ParallelBus), MP_ROM_PTR(¶lleldisplay_parallelbus_type) },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(paralleldisplay_module_globals, paralleldisplay_module_globals_table);
|
||||
|
||||
const mp_obj_module_t paralleldisplay_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)¶lleldisplay_module_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_paralleldisplay, paralleldisplay_module, CIRCUITPY_PARALLELDISPLAY);
|
@ -59,3 +59,5 @@ const mp_obj_module_t ps2io_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)&ps2io_module_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_ps2io, ps2io_module, CIRCUITPY_PS2IO);
|
||||
|
@ -58,3 +58,5 @@ const mp_obj_module_t pulseio_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)&pulseio_module_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_pulseio, pulseio_module, CIRCUITPY_PULSEIO);
|
||||
|
@ -71,3 +71,5 @@ const mp_obj_module_t pwmio_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)&pwmio_module_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_pwmio, pwmio_module, CIRCUITPY_PWMIO);
|
||||
|
@ -52,3 +52,5 @@ const mp_obj_module_t rainbowio_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)&rainbowio_module_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_rainbowio, rainbowio_module, CIRCUITPY_RAINBOWIO);
|
||||
|
@ -184,3 +184,5 @@ const mp_obj_module_t random_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)&mp_module_random_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_random, random_module, CIRCUITPY_RANDOM);
|
||||
|
@ -45,3 +45,5 @@ const mp_obj_module_t rgbmatrix_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)&rgbmatrix_module_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_rgbmatrix, rgbmatrix_module, CIRCUITPY_RGBMATRIX);
|
||||
|
@ -56,3 +56,5 @@ const mp_obj_module_t rotaryio_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)&rotaryio_module_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_rotaryio, rotaryio_module, CIRCUITPY_ROTARYIO);
|
||||
|
@ -86,3 +86,5 @@ const mp_obj_module_t rtc_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)&rtc_module_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_rtc, rtc_module, CIRCUITPY_RTC);
|
||||
|
@ -45,3 +45,5 @@ const mp_obj_module_t sdcardio_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)&sdcardio_module_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_sdcardio, sdcardio_module, CIRCUITPY_SDCARDIO);
|
||||
|
@ -45,3 +45,5 @@ const mp_obj_module_t sharpdisplay_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)&sharpdisplay_module_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_sharpdisplay, sharpdisplay_module, CIRCUITPY_SHARPDISPLAY);
|
||||
|
@ -270,3 +270,5 @@ const mp_obj_module_t storage_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)&storage_module_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_storage, storage_module, CIRCUITPY_STORAGE);
|
||||
|
@ -179,3 +179,5 @@ const mp_obj_module_t struct_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)&mp_module_struct_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_struct, struct_module, CIRCUITPY_STRUCT);
|
||||
|
@ -320,3 +320,5 @@ const mp_obj_module_t supervisor_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)&supervisor_module_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_supervisor, supervisor_module, CIRCUITPY_SUPERVISOR);
|
||||
|
@ -134,3 +134,5 @@ const mp_obj_module_t synthio_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)&synthio_module_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_synthio, synthio_module, CIRCUITPY_SYNTHIO);
|
||||
|
@ -68,3 +68,5 @@ const mp_obj_module_t touchio_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)&touchio_module_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_touchio, touchio_module, CIRCUITPY_TOUCHIO);
|
||||
|
@ -170,3 +170,5 @@ const mp_obj_module_t traceback_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)&traceback_module_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_traceback, traceback_module, CIRCUITPY_TRACEBACK);
|
||||
|
@ -139,3 +139,5 @@ void usb_cdc_set_console(mp_obj_t serial_obj) {
|
||||
void usb_cdc_set_data(mp_obj_t serial_obj) {
|
||||
set_module_dict_entry(MP_ROM_QSTR(MP_QSTR_data), serial_obj);
|
||||
}
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_usb_cdc, usb_cdc_module, CIRCUITPY_USB_CDC);
|
||||
|
@ -116,3 +116,5 @@ void usb_hid_set_devices(mp_obj_t devices) {
|
||||
elem->value = devices;
|
||||
}
|
||||
}
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_usb_hid, usb_hid_module, CIRCUITPY_USB_HID);
|
||||
|
@ -94,3 +94,5 @@ const mp_obj_module_t usb_midi_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)&usb_midi_module_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_usb_midi, usb_midi_module, CIRCUITPY_USB_MIDI);
|
||||
|
@ -23,3 +23,5 @@ const mp_obj_module_t vectorio_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)&vectorio_module_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_vectorio, vectorio_module, CIRCUITPY_VECTORIO);
|
||||
|
@ -29,7 +29,9 @@
|
||||
#include "py/runtime.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/displayio/I2CDisplay.h"
|
||||
#include "shared-bindings/displayio/ParallelBus.h"
|
||||
#if CIRCUITPY_PARALLELDISPLAY
|
||||
#include "shared-bindings/paralleldisplay/ParallelBus.h"
|
||||
#endif
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-bindings/time/__init__.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
|
@ -31,7 +31,9 @@
|
||||
#include "shared-bindings/displayio/ColorConverter.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/displayio/I2CDisplay.h"
|
||||
#include "shared-bindings/displayio/ParallelBus.h"
|
||||
#if CIRCUITPY_PARALLELDISPLAY
|
||||
#include "shared-bindings/paralleldisplay/ParallelBus.h"
|
||||
#endif
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-bindings/time/__init__.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
|
@ -109,8 +109,10 @@ void common_hal_displayio_release_displays(void) {
|
||||
common_hal_displayio_fourwire_deinit(&displays[i].fourwire_bus);
|
||||
} else if (bus_type == &displayio_i2cdisplay_type) {
|
||||
common_hal_displayio_i2cdisplay_deinit(&displays[i].i2cdisplay_bus);
|
||||
} else if (bus_type == &displayio_parallelbus_type) {
|
||||
common_hal_displayio_parallelbus_deinit(&displays[i].parallel_bus);
|
||||
#if CIRCUITPY_PARALLELDISPLAY
|
||||
} else if (bus_type == ¶lleldisplay_parallelbus_type) {
|
||||
common_hal_paralleldisplay_parallelbus_deinit(&displays[i].parallel_bus);
|
||||
#endif
|
||||
#if CIRCUITPY_RGBMATRIX
|
||||
} else if (bus_type == &rgbmatrix_RGBMatrix_type) {
|
||||
common_hal_rgbmatrix_rgbmatrix_deinit(&displays[i].rgbmatrix);
|
||||
|
@ -35,7 +35,9 @@
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/displayio/Group.h"
|
||||
#include "shared-bindings/displayio/I2CDisplay.h"
|
||||
#include "shared-bindings/displayio/ParallelBus.h"
|
||||
#if CIRCUITPY_PARALLELDISPLAY
|
||||
#include "shared-bindings/paralleldisplay/ParallelBus.h"
|
||||
#endif
|
||||
#if CIRCUITPY_RGBMATRIX
|
||||
#include "shared-bindings/rgbmatrix/RGBMatrix.h"
|
||||
#endif
|
||||
@ -48,7 +50,9 @@ typedef struct {
|
||||
mp_obj_base_t bus_base;
|
||||
displayio_fourwire_obj_t fourwire_bus;
|
||||
displayio_i2cdisplay_obj_t i2cdisplay_bus;
|
||||
displayio_parallelbus_obj_t parallel_bus;
|
||||
#if CIRCUITPY_PARALLELDISPLAY
|
||||
paralleldisplay_parallelbus_obj_t parallel_bus;
|
||||
#endif
|
||||
#if CIRCUITPY_RGBMATRIX
|
||||
rgbmatrix_rgbmatrix_obj_t rgbmatrix;
|
||||
#endif
|
||||
|
@ -30,7 +30,9 @@
|
||||
#include "py/runtime.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/displayio/I2CDisplay.h"
|
||||
#include "shared-bindings/displayio/ParallelBus.h"
|
||||
#if CIRCUITPY_PARALLELDISPLAY
|
||||
#include "shared-bindings/paralleldisplay/ParallelBus.h"
|
||||
#endif
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-bindings/time/__init__.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
@ -61,13 +63,16 @@ void displayio_display_core_construct(displayio_display_core_t *self,
|
||||
|
||||
// (framebufferdisplay already validated its 'bus' is a buffer-protocol object)
|
||||
if (bus) {
|
||||
if (mp_obj_is_type(bus, &displayio_parallelbus_type)) {
|
||||
self->bus_reset = common_hal_displayio_parallelbus_reset;
|
||||
self->bus_free = common_hal_displayio_parallelbus_bus_free;
|
||||
self->begin_transaction = common_hal_displayio_parallelbus_begin_transaction;
|
||||
self->send = common_hal_displayio_parallelbus_send;
|
||||
self->end_transaction = common_hal_displayio_parallelbus_end_transaction;
|
||||
} else if (mp_obj_is_type(bus, &displayio_fourwire_type)) {
|
||||
#if CIRCUITPY_PARALLELDISPLAY
|
||||
if (mp_obj_is_type(bus, ¶lleldisplay_parallelbus_type)) {
|
||||
self->bus_reset = common_hal_paralleldisplay_parallelbus_reset;
|
||||
self->bus_free = common_hal_paralleldisplay_parallelbus_bus_free;
|
||||
self->begin_transaction = common_hal_paralleldisplay_parallelbus_begin_transaction;
|
||||
self->send = common_hal_paralleldisplay_parallelbus_send;
|
||||
self->end_transaction = common_hal_paralleldisplay_parallelbus_end_transaction;
|
||||
} else
|
||||
#endif
|
||||
if (mp_obj_is_type(bus, &displayio_fourwire_type)) {
|
||||
self->bus_reset = common_hal_displayio_fourwire_reset;
|
||||
self->bus_free = common_hal_displayio_fourwire_bus_free;
|
||||
self->begin_transaction = common_hal_displayio_fourwire_begin_transaction;
|
||||
|
@ -81,7 +81,7 @@ const usb_hid_device_obj_t usb_hid_device_keyboard_obj = {
|
||||
.usage = 0x06,
|
||||
.num_report_ids = 1,
|
||||
.report_ids = { 0x01, },
|
||||
.in_report_lengths = { 8, 0, 0, 0, 0, 0, },
|
||||
.in_report_lengths = { 8, },
|
||||
.out_report_lengths = { 1, },
|
||||
};
|
||||
|
||||
@ -131,7 +131,7 @@ const usb_hid_device_obj_t usb_hid_device_mouse_obj = {
|
||||
.usage = 0x02,
|
||||
.num_report_ids = 1,
|
||||
.report_ids = { 0x02, },
|
||||
.in_report_lengths = { 4, 0, 0, 0, 0, 0, },
|
||||
.in_report_lengths = { 4, },
|
||||
.out_report_lengths = { 0, },
|
||||
};
|
||||
|
||||
@ -160,7 +160,7 @@ const usb_hid_device_obj_t usb_hid_device_consumer_control_obj = {
|
||||
.usage = 0x01,
|
||||
.num_report_ids = 1,
|
||||
.report_ids = { 0x03 },
|
||||
.in_report_lengths = { 2, 0, 0, 0, 0, 0, },
|
||||
.in_report_lengths = { 2, },
|
||||
.out_report_lengths = { 0, },
|
||||
};
|
||||
|
||||
@ -170,7 +170,7 @@ STATIC size_t get_report_id_idx(usb_hid_device_obj_t *self, size_t report_id) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return MAX_REPORT_IDS_PER_DESCRIPTOR;
|
||||
return CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR;
|
||||
}
|
||||
|
||||
// See if report_id is used by this device. If it is -1, then return the sole report id used by this device,
|
||||
@ -180,16 +180,16 @@ uint8_t common_hal_usb_hid_device_validate_report_id(usb_hid_device_obj_t *self,
|
||||
return self->report_ids[0];
|
||||
}
|
||||
if (!(report_id_arg >= 0 &&
|
||||
get_report_id_idx(self, (size_t)report_id_arg) < MAX_REPORT_IDS_PER_DESCRIPTOR)) {
|
||||
get_report_id_idx(self, (size_t)report_id_arg) < CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR)) {
|
||||
mp_raise_ValueError_varg(translate("Invalid %q"), MP_QSTR_report_id);
|
||||
}
|
||||
return (uint8_t)report_id_arg;
|
||||
}
|
||||
|
||||
void common_hal_usb_hid_device_construct(usb_hid_device_obj_t *self, mp_obj_t report_descriptor, uint8_t usage_page, uint8_t usage, size_t num_report_ids, uint8_t *report_ids, uint8_t *in_report_lengths, uint8_t *out_report_lengths) {
|
||||
if (num_report_ids > MAX_REPORT_IDS_PER_DESCRIPTOR) {
|
||||
if (num_report_ids > CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR) {
|
||||
mp_raise_ValueError_varg(translate("More than %d report ids not supported"),
|
||||
MAX_REPORT_IDS_PER_DESCRIPTOR);
|
||||
CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR);
|
||||
}
|
||||
|
||||
// report buffer pointers are NULL at start, and are created when USB is initialized.
|
||||
|
@ -32,21 +32,16 @@
|
||||
|
||||
#include "py/obj.h"
|
||||
|
||||
// The most complicated device currently known of is the head and eye tracker, which requires 5
|
||||
// report ids.
|
||||
// https://usb.org/sites/default/files/hutrr74_-_usage_page_for_head_and_eye_trackers_0.pdf
|
||||
#define MAX_REPORT_IDS_PER_DESCRIPTOR (6)
|
||||
|
||||
typedef struct {
|
||||
mp_obj_base_t base;
|
||||
// Python buffer object whose contents are the descriptor.
|
||||
const uint8_t *report_descriptor;
|
||||
uint8_t *in_report_buffers[MAX_REPORT_IDS_PER_DESCRIPTOR];
|
||||
uint8_t *out_report_buffers[MAX_REPORT_IDS_PER_DESCRIPTOR];
|
||||
uint8_t *in_report_buffers[CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR];
|
||||
uint8_t *out_report_buffers[CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR];
|
||||
uint16_t report_descriptor_length;
|
||||
uint8_t report_ids[MAX_REPORT_IDS_PER_DESCRIPTOR];
|
||||
uint8_t in_report_lengths[MAX_REPORT_IDS_PER_DESCRIPTOR];
|
||||
uint8_t out_report_lengths[MAX_REPORT_IDS_PER_DESCRIPTOR];
|
||||
uint8_t report_ids[CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR];
|
||||
uint8_t in_report_lengths[CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR];
|
||||
uint8_t out_report_lengths[CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR];
|
||||
uint8_t usage_page;
|
||||
uint8_t usage;
|
||||
uint8_t num_report_ids;
|
||||
|
@ -79,7 +79,7 @@ const uint8_t private_advertising_data[] = { 0x02, 0x01, 0x06, // 0-2 Flags
|
||||
uint8_t circuitpython_scan_response_data[] = {
|
||||
0x0a, 0x09, 0x43, 0x49, 0x52, 0x50, 0x59, 0x00, 0x00, 0x00, 0x00,
|
||||
#if CIRCUITPY_SERIAL_BLE
|
||||
0x11, 0x06, 0x9e, 0xca, 0xdc, 0x24, 0x0e, 0xe5, 0xa9, 0xe0, 0x93, 0xf3, 0xa3, 0xb5, 0x01, 0x00, 0x40, 0x6e,
|
||||
0x11, 0x06, 0x6e, 0x68, 0x74, 0x79, 0x50, 0x74, 0x69, 0x75, 0x63, 0x72, 0x69, 0x43, 0x01, 0x00, 0xaf, 0xad
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -404,7 +404,7 @@ STATIC uint8_t _process_delete(const uint8_t *raw_buf, size_t command_len) {
|
||||
FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs;
|
||||
char *path = (char *)((uint8_t *)command) + header_size;
|
||||
path[command->path_length] = '\0';
|
||||
FRESULT result;
|
||||
FRESULT result = FR_OK;
|
||||
FILINFO file;
|
||||
if (f_stat(fs, path, &file) == FR_OK) {
|
||||
if ((file.fattrib & AM_DIR) != 0) {
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "genhdr/mpversion.h"
|
||||
#include "shared-bindings/_bleio/__init__.h"
|
||||
#include "shared-bindings/_bleio/Adapter.h"
|
||||
#include "shared-bindings/_bleio/Characteristic.h"
|
||||
@ -39,15 +40,17 @@
|
||||
|
||||
#include "py/mpstate.h"
|
||||
|
||||
STATIC bleio_service_obj_t supervisor_ble_serial_service;
|
||||
STATIC bleio_uuid_obj_t supervisor_ble_serial_service_uuid;
|
||||
STATIC bleio_characteristic_obj_t supervisor_ble_rx_characteristic;
|
||||
STATIC bleio_uuid_obj_t supervisor_ble_rx_uuid;
|
||||
STATIC bleio_characteristic_obj_t supervisor_ble_tx_characteristic;
|
||||
STATIC bleio_uuid_obj_t supervisor_ble_tx_uuid;
|
||||
STATIC bleio_service_obj_t supervisor_ble_circuitpython_service;
|
||||
STATIC bleio_uuid_obj_t supervisor_ble_circuitpython_service_uuid;
|
||||
STATIC bleio_characteristic_obj_t supervisor_ble_circuitpython_rx_characteristic;
|
||||
STATIC bleio_uuid_obj_t supervisor_ble_circuitpython_rx_uuid;
|
||||
STATIC bleio_characteristic_obj_t supervisor_ble_circuitpython_tx_characteristic;
|
||||
STATIC bleio_uuid_obj_t supervisor_ble_circuitpython_tx_uuid;
|
||||
STATIC bleio_characteristic_obj_t supervisor_ble_circuitpython_version_characteristic;
|
||||
STATIC bleio_uuid_obj_t supervisor_ble_circuitpython_version_uuid;
|
||||
|
||||
// This is the base UUID for the nordic uart service.
|
||||
const uint8_t nordic_uart_base_uuid[16] = {0x9e, 0xca, 0xdc, 0x24, 0x0e, 0xe5, 0xa9, 0xe0, 0x93, 0xf3, 0xa3, 0xb5, 0x00, 0x00, 0x40, 0x6e };
|
||||
// This is the base UUID for the CircuitPython service.
|
||||
const uint8_t circuitpython_base_uuid[16] = {0x6e, 0x68, 0x74, 0x79, 0x50, 0x74, 0x69, 0x75, 0x63, 0x72, 0x69, 0x43, 0x00, 0x00, 0xaf, 0xad };
|
||||
|
||||
STATIC mp_obj_list_t characteristic_list;
|
||||
STATIC mp_obj_t characteristic_list_items[2];
|
||||
@ -64,8 +67,8 @@ STATIC bleio_characteristic_buffer_obj_t _rx_buffer;
|
||||
STATIC bool _enabled;
|
||||
|
||||
void supervisor_start_bluetooth_serial(void) {
|
||||
supervisor_ble_serial_service_uuid.base.type = &bleio_uuid_type;
|
||||
common_hal_bleio_uuid_construct(&supervisor_ble_serial_service_uuid, 0x0001, nordic_uart_base_uuid);
|
||||
supervisor_ble_circuitpython_service_uuid.base.type = &bleio_uuid_type;
|
||||
common_hal_bleio_uuid_construct(&supervisor_ble_circuitpython_service_uuid, 0x0001, circuitpython_base_uuid);
|
||||
|
||||
// We know we'll only be N characteristics so we can statically allocate it.
|
||||
characteristic_list.base.type = &mp_type_list;
|
||||
@ -74,50 +77,72 @@ void supervisor_start_bluetooth_serial(void) {
|
||||
characteristic_list.items = characteristic_list_items;
|
||||
mp_seq_clear(characteristic_list.items, 0, characteristic_list.alloc, sizeof(*characteristic_list.items));
|
||||
|
||||
supervisor_ble_serial_service.base.type = &bleio_service_type;
|
||||
_common_hal_bleio_service_construct(&supervisor_ble_serial_service, &supervisor_ble_serial_service_uuid, false /* is secondary */, &characteristic_list);
|
||||
supervisor_ble_circuitpython_service.base.type = &bleio_service_type;
|
||||
_common_hal_bleio_service_construct(&supervisor_ble_circuitpython_service, &supervisor_ble_circuitpython_service_uuid, false /* is secondary */, &characteristic_list);
|
||||
|
||||
// RX
|
||||
supervisor_ble_rx_uuid.base.type = &bleio_uuid_type;
|
||||
common_hal_bleio_uuid_construct(&supervisor_ble_rx_uuid, 0x0002, nordic_uart_base_uuid);
|
||||
common_hal_bleio_characteristic_construct(&supervisor_ble_rx_characteristic,
|
||||
&supervisor_ble_serial_service,
|
||||
supervisor_ble_circuitpython_rx_uuid.base.type = &bleio_uuid_type;
|
||||
common_hal_bleio_uuid_construct(&supervisor_ble_circuitpython_rx_uuid, 0x0002, circuitpython_base_uuid);
|
||||
common_hal_bleio_characteristic_construct(&supervisor_ble_circuitpython_rx_characteristic,
|
||||
&supervisor_ble_circuitpython_service,
|
||||
0, // handle (for remote only)
|
||||
&supervisor_ble_rx_uuid,
|
||||
&supervisor_ble_circuitpython_rx_uuid,
|
||||
CHAR_PROP_WRITE | CHAR_PROP_WRITE_NO_RESPONSE,
|
||||
SECURITY_MODE_NO_ACCESS,
|
||||
SECURITY_MODE_ENC_NO_MITM,
|
||||
BLE_GATTS_VAR_ATTR_LEN_MAX, // max length
|
||||
false, // fixed length
|
||||
NULL, // no initial value
|
||||
"CircuitPython Serial");
|
||||
NULL);
|
||||
|
||||
// TX
|
||||
supervisor_ble_tx_uuid.base.type = &bleio_uuid_type;
|
||||
common_hal_bleio_uuid_construct(&supervisor_ble_tx_uuid, 0x0003, nordic_uart_base_uuid);
|
||||
common_hal_bleio_characteristic_construct(&supervisor_ble_tx_characteristic,
|
||||
&supervisor_ble_serial_service,
|
||||
supervisor_ble_circuitpython_tx_uuid.base.type = &bleio_uuid_type;
|
||||
common_hal_bleio_uuid_construct(&supervisor_ble_circuitpython_tx_uuid, 0x0003, circuitpython_base_uuid);
|
||||
common_hal_bleio_characteristic_construct(&supervisor_ble_circuitpython_tx_characteristic,
|
||||
&supervisor_ble_circuitpython_service,
|
||||
0, // handle (for remote only)
|
||||
&supervisor_ble_tx_uuid,
|
||||
&supervisor_ble_circuitpython_tx_uuid,
|
||||
CHAR_PROP_NOTIFY,
|
||||
SECURITY_MODE_ENC_NO_MITM,
|
||||
SECURITY_MODE_NO_ACCESS,
|
||||
BLE_GATTS_VAR_ATTR_LEN_MAX, // max length
|
||||
false, // fixed length
|
||||
NULL, // no initial value
|
||||
"CircuitPython Serial");
|
||||
NULL);
|
||||
|
||||
// Version number
|
||||
const char *version = MICROPY_GIT_TAG;
|
||||
mp_buffer_info_t bufinfo;
|
||||
bufinfo.buf = (uint8_t *)version;
|
||||
bufinfo.len = strlen(version);
|
||||
|
||||
supervisor_ble_circuitpython_version_uuid.base.type = &bleio_uuid_type;
|
||||
common_hal_bleio_uuid_construct(&supervisor_ble_circuitpython_version_uuid, 0x0100, circuitpython_base_uuid);
|
||||
common_hal_bleio_characteristic_construct(&supervisor_ble_circuitpython_version_characteristic,
|
||||
&supervisor_ble_circuitpython_service,
|
||||
0, // handle (for remote only)
|
||||
&supervisor_ble_circuitpython_version_uuid,
|
||||
CHAR_PROP_READ,
|
||||
SECURITY_MODE_OPEN,
|
||||
SECURITY_MODE_NO_ACCESS,
|
||||
bufinfo.len, // max length
|
||||
true, // fixed length
|
||||
NULL, // no initial value
|
||||
NULL); // no description
|
||||
|
||||
common_hal_bleio_characteristic_set_value(&supervisor_ble_circuitpython_version_characteristic, &bufinfo);
|
||||
|
||||
// Use a PacketBuffer to transmit so that we glom characters to transmit
|
||||
// together and save BLE overhead.
|
||||
_common_hal_bleio_packet_buffer_construct(
|
||||
&_tx_packet_buffer, &supervisor_ble_tx_characteristic,
|
||||
&_tx_packet_buffer, &supervisor_ble_circuitpython_tx_characteristic,
|
||||
NULL, 0,
|
||||
_outgoing1, _outgoing2, BLE_GATTS_VAR_ATTR_LEN_MAX,
|
||||
&tx_static_handler_entry);
|
||||
|
||||
// Use a CharacteristicBuffer for rx so we can read a single character at a time.
|
||||
_common_hal_bleio_characteristic_buffer_construct(&_rx_buffer,
|
||||
&supervisor_ble_rx_characteristic,
|
||||
&supervisor_ble_circuitpython_rx_characteristic,
|
||||
0.1f,
|
||||
(uint8_t *)_incoming, sizeof(_incoming) * sizeof(uint32_t),
|
||||
&rx_static_handler_entry);
|
||||
|
@ -66,6 +66,9 @@ safe_mode_t wait_for_safe_mode_reset(void) {
|
||||
reset_reason != RESET_REASON_SOFTWARE) {
|
||||
return NO_SAFE_MODE;
|
||||
}
|
||||
#ifdef CIRCUITPY_SKIP_SAFE_MODE_WAIT
|
||||
return NO_SAFE_MODE;
|
||||
#endif
|
||||
port_set_saved_word(SAFE_MODE_DATA_GUARD | (MANUAL_SAFE_MODE << 8));
|
||||
// Wait for a while to allow for reset.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<struct STRUCT 0>
|
||||
<struct ERROR 0>
|
||||
<struct ARRAY 0>
|
||||
<struct PTR 0>
|
||||
<struct STRUCT 0x0>
|
||||
<struct ERROR 0x0>
|
||||
<struct ARRAY 0x0>
|
||||
<struct PTR 0x0>
|
||||
|
@ -6,7 +6,7 @@ mem: total=\\d\+, current=\\d\+, peak=\\d\+
|
||||
stack: \\d\+ out of \\d\+
|
||||
GC: total: \\d\+, used: \\d\+, free: \\d\+
|
||||
No. of 1-blocks: \\d\+, 2-blocks: \\d\+, max blk sz: \\d\+, max free sz: \\d\+
|
||||
GC memory layout; from \[0-9a-f\]\+:
|
||||
GC memory layout; from 0x\[0-9a-f\]\+:
|
||||
########
|
||||
qstr pool: n_pool=1, n_qstr=\\d, n_str_data_bytes=\\d\+, n_total_bytes=\\d\+
|
||||
qstr pool: n_pool=1, n_qstr=\\d, n_str_data_bytes=\\d\+, n_total_bytes=\\d\+
|
||||
|
@ -15,8 +15,8 @@ false true
|
||||
abc
|
||||
%
|
||||
# GC
|
||||
0
|
||||
0
|
||||
0x0
|
||||
0x0
|
||||
# vstr
|
||||
tests
|
||||
sts
|
||||
|
@ -13,7 +13,7 @@ sys.path.insert(0, "../../tools/bitmap_font")
|
||||
|
||||
from adafruit_bitmap_font import bitmap_font
|
||||
|
||||
parser = argparse.ArgumentParser(description="Generate USB descriptors.")
|
||||
parser = argparse.ArgumentParser(description="Generate displayio resources.")
|
||||
parser.add_argument("--font", type=str, help="Font path", required=True)
|
||||
parser.add_argument("--extra_characters", type=str, help="Unicode string of extra characters")
|
||||
parser.add_argument(
|
||||
@ -49,7 +49,7 @@ if args.sample_file:
|
||||
|
||||
# Merge visible ascii, sample characters and extra characters.
|
||||
visible_ascii = bytes(range(0x20, 0x7F)).decode("utf-8")
|
||||
all_characters = visible_ascii
|
||||
all_characters = list(visible_ascii)
|
||||
for c in sample_characters:
|
||||
if c not in all_characters:
|
||||
all_characters += c
|
||||
|
Loading…
Reference in New Issue
Block a user