diff options
| author | Ryan T. Hamilton <astrobokonon@gmail.com> | 2020-09-28 16:50:02 -0700 |
|---|---|---|
| committer | Ryan T. Hamilton <astrobokonon@gmail.com> | 2020-09-28 16:50:02 -0700 |
| commit | 7b7ef8edde2f7769b03776135b590ec7337cfa70 (patch) | |
| tree | b325029a597d6dc4b6c482263f244d83692beaad | |
| parent | 66d55738c1315b223d3e5ed6bc710f8b1e443836 (diff) | |
| parent | 6bfcb01ee79d49f470a1a8ca5e693ba92fadf307 (diff) | |
Merge branch 'main' of https://github.com/adafruit/circuitpython into esp32s2-morenet
| -rw-r--r-- | docs/design_guide.rst | 13 | ||||
| m--------- | lib/tinyusb | 0 | ||||
| -rw-r--r-- | ports/atmel-samd/boards/seeeduino_wio_terminal/board.c | 23 | ||||
| -rw-r--r-- | ports/atmel-samd/boards/seeeduino_wio_terminal/mpconfigboard.h | 4 | ||||
| -rw-r--r-- | shared-module/displayio/FourWire.c | 4 |
5 files changed, 42 insertions, 2 deletions
diff --git a/docs/design_guide.rst b/docs/design_guide.rst index 2d52e988b..cc2a3b296 100644 --- a/docs/design_guide.rst +++ b/docs/design_guide.rst @@ -485,6 +485,19 @@ struct.pack Use `struct.pack_into` instead of `struct.pack`. +Use of MicroPython ``const()`` +-------------------------------------------------------------------------------- +The MicroPython ``const()`` feature, as discussed in `this forum post +<https://forum.micropython.org/viewtopic.php?t=450>`_, and in `this issue thread +<https://github.com/micropython/micropython/issues/573>`_, provides some +optimizations that can be useful on smaller, memory constrained devices. However, +when using ``const()``, keep in mind these general guide lines: + +- Always use via an import, ex: ``from micropython import const`` +- Limit use to global (module level) variables only. +- If user will not need access to variable, prefix name with a leading + underscore, ex: ``_SOME_CONST``. + Sensor properties and units -------------------------------------------------------------------------------- diff --git a/lib/tinyusb b/lib/tinyusb -Subproject e90cf7a676eddcbd9c35d2d99a0a9cd14686e2c +Subproject 8b2c82255750488232eae72f3d5dcbacfd6227f diff --git a/ports/atmel-samd/boards/seeeduino_wio_terminal/board.c b/ports/atmel-samd/boards/seeeduino_wio_terminal/board.c index b7fc736eb..f6b1e0dd1 100644 --- a/ports/atmel-samd/boards/seeeduino_wio_terminal/board.c +++ b/ports/atmel-samd/boards/seeeduino_wio_terminal/board.c @@ -31,8 +31,12 @@ #include "shared-bindings/displayio/FourWire.h" #include "shared-module/displayio/__init__.h" #include "shared-module/displayio/mipi_constants.h" +#include "shared-bindings/digitalio/DigitalInOut.h" displayio_fourwire_obj_t board_display_obj; +digitalio_digitalinout_obj_t CTR_5V; +digitalio_digitalinout_obj_t CTR_3V3; +digitalio_digitalinout_obj_t USB_HOST_ENABLE; uint8_t display_init_sequence[] = { 0x01, 0x80, 0x80, // Software reset then delay 0x80 (128ms) @@ -106,6 +110,25 @@ void board_init(void) { true, // auto_refresh 60, // native_frames_per_second true); // backlight_on_high + + // Enabling the Power of the 40-pin at the back + CTR_5V.base.type = &digitalio_digitalinout_type; + CTR_3V3.base.type = &digitalio_digitalinout_type; + USB_HOST_ENABLE.base.type = &digitalio_digitalinout_type; + + common_hal_digitalio_digitalinout_construct(&CTR_5V, PIN_CTR_5V); + common_hal_digitalio_digitalinout_construct(&CTR_3V3, PIN_CTR_3V3); + common_hal_digitalio_digitalinout_construct(&USB_HOST_ENABLE, PIN_USB_HOST_ENABLE); + + common_hal_digitalio_digitalinout_set_value(&CTR_5V, true); + common_hal_digitalio_digitalinout_set_value(&CTR_3V3, false); + common_hal_digitalio_digitalinout_set_value(&USB_HOST_ENABLE, false); + + // Never reset + common_hal_digitalio_digitalinout_never_reset(&CTR_5V); + common_hal_digitalio_digitalinout_never_reset(&CTR_3V3); + common_hal_digitalio_digitalinout_never_reset(&USB_HOST_ENABLE); + } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/seeeduino_wio_terminal/mpconfigboard.h b/ports/atmel-samd/boards/seeeduino_wio_terminal/mpconfigboard.h index f7d0448df..c87ca46d8 100644 --- a/ports/atmel-samd/boards/seeeduino_wio_terminal/mpconfigboard.h +++ b/ports/atmel-samd/boards/seeeduino_wio_terminal/mpconfigboard.h @@ -27,6 +27,10 @@ #define DEFAULT_UART_BUS_RX (&pin_PB27) #define DEFAULT_UART_BUS_TX (&pin_PB26) +#define PIN_CTR_5V (&pin_PC14) +#define PIN_CTR_3V3 (&pin_PC15) +#define PIN_USB_HOST_ENABLE (&pin_PA27) + // USB is always used internally so skip the pin objects for it. #define IGNORE_PIN_PA24 1 #define IGNORE_PIN_PA25 1 diff --git a/shared-module/displayio/FourWire.c b/shared-module/displayio/FourWire.c index 726116208..8c56d7ab6 100644 --- a/shared-module/displayio/FourWire.c +++ b/shared-module/displayio/FourWire.c @@ -87,9 +87,9 @@ bool common_hal_displayio_fourwire_reset(mp_obj_t obj) { return false; } common_hal_digitalio_digitalinout_set_value(&self->reset, false); - common_hal_time_delay_ms(1); + common_hal_mcu_delay_us(1000); common_hal_digitalio_digitalinout_set_value(&self->reset, true); - common_hal_time_delay_ms(1); + common_hal_mcu_delay_us(1000); return true; } |
