Merge branch 'main' of https://github.com/adafruit/circuitpython into esp32s2-morenet

This commit is contained in:
Ryan T. Hamilton 2020-09-28 16:50:02 -07:00
commit 7b7ef8edde
5 changed files with 43 additions and 3 deletions

View File

@ -485,6 +485,19 @@ struct.pack
Use `struct.pack_into` instead of `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 Sensor properties and units
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

@ -1 +1 @@
Subproject commit e90cf7a676eddcbd9c35d2d99a0a9cd14686e2ce Subproject commit 8b2c82255750488232eae72f3d5dcbacfd6227f3

View File

@ -31,8 +31,12 @@
#include "shared-bindings/displayio/FourWire.h" #include "shared-bindings/displayio/FourWire.h"
#include "shared-module/displayio/__init__.h" #include "shared-module/displayio/__init__.h"
#include "shared-module/displayio/mipi_constants.h" #include "shared-module/displayio/mipi_constants.h"
#include "shared-bindings/digitalio/DigitalInOut.h"
displayio_fourwire_obj_t board_display_obj; 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[] = { uint8_t display_init_sequence[] = {
0x01, 0x80, 0x80, // Software reset then delay 0x80 (128ms) 0x01, 0x80, 0x80, // Software reset then delay 0x80 (128ms)
@ -106,6 +110,25 @@ void board_init(void) {
true, // auto_refresh true, // auto_refresh
60, // native_frames_per_second 60, // native_frames_per_second
true); // backlight_on_high 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) { bool board_requests_safe_mode(void) {

View File

@ -27,6 +27,10 @@
#define DEFAULT_UART_BUS_RX (&pin_PB27) #define DEFAULT_UART_BUS_RX (&pin_PB27)
#define DEFAULT_UART_BUS_TX (&pin_PB26) #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. // USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA24 1 #define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1 #define IGNORE_PIN_PA25 1

View File

@ -87,9 +87,9 @@ bool common_hal_displayio_fourwire_reset(mp_obj_t obj) {
return false; return false;
} }
common_hal_digitalio_digitalinout_set_value(&self->reset, 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_digitalio_digitalinout_set_value(&self->reset, true);
common_hal_time_delay_ms(1); common_hal_mcu_delay_us(1000);
return true; return true;
} }