Merge pull request #2842 from hierophect/stm32-h7-displayio
STM32: Add displayio to F7/H7
This commit is contained in:
commit
c311b5c002
@ -12,8 +12,8 @@ MEMORY
|
|||||||
{
|
{
|
||||||
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048K
|
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048K
|
||||||
FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 128K /* sector 0, 128K */
|
FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 128K /* sector 0, 128K */
|
||||||
FLASH_FS (r) : ORIGIN = 0x08020000, LENGTH = 128K /* sector 1, 128K */
|
FLASH_FS (r) : ORIGIN = 0x08020000, LENGTH = 384K /* sector 1-3, 128K */
|
||||||
FLASH_FIRMWARE (rx) : ORIGIN = 0x08040000, LENGTH = 1792K /* sectors 6*128 + 8*128 */
|
FLASH_FIRMWARE (rx) : ORIGIN = 0x08080000, LENGTH = 1536K /* sectors 4*128 + 8*128 */
|
||||||
DTCM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
|
DTCM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
|
||||||
RAM (xrw) : ORIGIN = 0x24000000, LENGTH = 512K /* AXI SRAM */
|
RAM (xrw) : ORIGIN = 0x24000000, LENGTH = 512K /* AXI SRAM */
|
||||||
SRAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 288K /* AHB1 SRAM */
|
SRAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 288K /* AHB1 SRAM */
|
||||||
|
@ -22,7 +22,6 @@ ifeq ($(MCU_SERIES),H7)
|
|||||||
CIRCUITPY_ANALOGIO = 0
|
CIRCUITPY_ANALOGIO = 0
|
||||||
CIRCUITPY_NEOPIXEL_WRITE = 0
|
CIRCUITPY_NEOPIXEL_WRITE = 0
|
||||||
CIRCUITPY_PULSEIO = 0
|
CIRCUITPY_PULSEIO = 0
|
||||||
CIRCUITPY_OS = 1
|
|
||||||
CIRCUITPY_NVM = 0
|
CIRCUITPY_NVM = 0
|
||||||
CIRCUITPY_AUDIOBUSIO = 0
|
CIRCUITPY_AUDIOBUSIO = 0
|
||||||
CIRCUITPY_AUDIOIO = 0
|
CIRCUITPY_AUDIOIO = 0
|
||||||
@ -30,18 +29,12 @@ ifeq ($(MCU_SERIES),H7)
|
|||||||
CIRCUITPY_RTC = 0
|
CIRCUITPY_RTC = 0
|
||||||
CIRCUITPY_FREQUENCYIO = 0
|
CIRCUITPY_FREQUENCYIO = 0
|
||||||
CIRCUITPY_I2CSLAVE = 0
|
CIRCUITPY_I2CSLAVE = 0
|
||||||
# shared-module modules that still need prerequisites filled
|
|
||||||
CIRCUITPY_DISPLAYIO = 0 # Requires SPI, PulseIO, and common-hal module (stub ok)
|
|
||||||
CIRCUITPY_RANDOM = 0 # Requires OS
|
|
||||||
CIRCUITPY_STORAGE = 0 # Requires OS, filesystem
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(MCU_SERIES),F7)
|
ifeq ($(MCU_SERIES),F7)
|
||||||
# Not yet implemented common-hal modules:
|
# Not yet implemented common-hal modules:
|
||||||
CIRCUITPY_ANALOGIO = 0
|
CIRCUITPY_ANALOGIO = 0
|
||||||
CIRCUITPY_NEOPIXEL_WRITE = 0
|
CIRCUITPY_NEOPIXEL_WRITE = 0
|
||||||
CIRCUITPY_PULSEIO = 1
|
|
||||||
CIRCUITPY_OS = 1
|
|
||||||
CIRCUITPY_NVM = 0
|
CIRCUITPY_NVM = 0
|
||||||
CIRCUITPY_AUDIOBUSIO = 0
|
CIRCUITPY_AUDIOBUSIO = 0
|
||||||
CIRCUITPY_AUDIOIO = 0
|
CIRCUITPY_AUDIOIO = 0
|
||||||
@ -49,8 +42,4 @@ ifeq ($(MCU_SERIES),F7)
|
|||||||
CIRCUITPY_RTC = 0
|
CIRCUITPY_RTC = 0
|
||||||
CIRCUITPY_FREQUENCYIO = 0
|
CIRCUITPY_FREQUENCYIO = 0
|
||||||
CIRCUITPY_I2CSLAVE = 0
|
CIRCUITPY_I2CSLAVE = 0
|
||||||
# shared-module modules that still need prerequisites filled
|
|
||||||
CIRCUITPY_DISPLAYIO = 0 # Requires SPI, PulseIO, and common-hal module (stub ok)
|
|
||||||
CIRCUITPY_RANDOM = 0 # Requires OS
|
|
||||||
CIRCUITPY_STORAGE = 0 # Requires OS, filesystem
|
|
||||||
endif
|
endif
|
||||||
|
@ -83,7 +83,7 @@
|
|||||||
|
|
||||||
#ifdef STM32H743xx
|
#ifdef STM32H743xx
|
||||||
#define STM32_FLASH_SIZE 0x200000 //2MB
|
#define STM32_FLASH_SIZE 0x200000 //2MB
|
||||||
#define INTERNAL_FLASH_FILESYSTEM_SIZE 0x20000 //128KiB
|
#define INTERNAL_FLASH_FILESYSTEM_SIZE 0x60000 //384KiB
|
||||||
#define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x08020000
|
#define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x08020000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -109,6 +109,8 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
|
|||||||
// Always set the backlight type in case we're reusing memory.
|
// Always set the backlight type in case we're reusing memory.
|
||||||
self->backlight_inout.base.type = &mp_type_NoneType;
|
self->backlight_inout.base.type = &mp_type_NoneType;
|
||||||
if (backlight_pin != NULL && common_hal_mcu_pin_is_free(backlight_pin)) {
|
if (backlight_pin != NULL && common_hal_mcu_pin_is_free(backlight_pin)) {
|
||||||
|
// Avoid PWM types and functions when the module isn't enabled
|
||||||
|
#if (CIRCUITPY_PULSEIO)
|
||||||
pwmout_result_t result = common_hal_pulseio_pwmout_construct(&self->backlight_pwm, backlight_pin, 0, 50000, false);
|
pwmout_result_t result = common_hal_pulseio_pwmout_construct(&self->backlight_pwm, backlight_pin, 0, 50000, false);
|
||||||
if (result != PWMOUT_OK) {
|
if (result != PWMOUT_OK) {
|
||||||
self->backlight_inout.base.type = &digitalio_digitalinout_type;
|
self->backlight_inout.base.type = &digitalio_digitalinout_type;
|
||||||
@ -118,6 +120,12 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
|
|||||||
self->backlight_pwm.base.type = &pulseio_pwmout_type;
|
self->backlight_pwm.base.type = &pulseio_pwmout_type;
|
||||||
common_hal_pulseio_pwmout_never_reset(&self->backlight_pwm);
|
common_hal_pulseio_pwmout_never_reset(&self->backlight_pwm);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
// Otherwise default to digital
|
||||||
|
self->backlight_inout.base.type = &digitalio_digitalinout_type;
|
||||||
|
common_hal_digitalio_digitalinout_construct(&self->backlight_inout, backlight_pin);
|
||||||
|
common_hal_never_reset_pin(backlight_pin);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (!self->auto_brightness && (self->backlight_inout.base.type != &mp_type_NoneType ||
|
if (!self->auto_brightness && (self->backlight_inout.base.type != &mp_type_NoneType ||
|
||||||
brightness_command != NO_BRIGHTNESS_COMMAND)) {
|
brightness_command != NO_BRIGHTNESS_COMMAND)) {
|
||||||
@ -162,9 +170,21 @@ bool common_hal_displayio_display_set_brightness(displayio_display_obj_t* self,
|
|||||||
brightness = 1.0-brightness;
|
brightness = 1.0-brightness;
|
||||||
}
|
}
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
if (self->backlight_pwm.base.type == &pulseio_pwmout_type) {
|
|
||||||
|
// Avoid PWM types and functions when the module isn't enabled
|
||||||
|
#if (CIRCUITPY_PULSEIO)
|
||||||
|
bool ispwm = (self->backlight_pwm.base.type == &pulseio_pwmout_type) ? true : false;
|
||||||
|
#else
|
||||||
|
bool ispwm = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (ispwm) {
|
||||||
|
#if (CIRCUITPY_PULSEIO)
|
||||||
common_hal_pulseio_pwmout_set_duty_cycle(&self->backlight_pwm, (uint16_t) (0xffff * brightness));
|
common_hal_pulseio_pwmout_set_duty_cycle(&self->backlight_pwm, (uint16_t) (0xffff * brightness));
|
||||||
ok = true;
|
ok = true;
|
||||||
|
#else
|
||||||
|
ok = false;
|
||||||
|
#endif
|
||||||
} else if (self->backlight_inout.base.type == &digitalio_digitalinout_type) {
|
} else if (self->backlight_inout.base.type == &digitalio_digitalinout_type) {
|
||||||
common_hal_digitalio_digitalinout_set_value(&self->backlight_inout, brightness > 0.99);
|
common_hal_digitalio_digitalinout_set_value(&self->backlight_inout, brightness > 0.99);
|
||||||
ok = true;
|
ok = true;
|
||||||
@ -390,12 +410,16 @@ void displayio_display_background(displayio_display_obj_t* self) {
|
|||||||
|
|
||||||
void release_display(displayio_display_obj_t* self) {
|
void release_display(displayio_display_obj_t* self) {
|
||||||
release_display_core(&self->core);
|
release_display_core(&self->core);
|
||||||
|
#if (CIRCUITPY_PULSEIO)
|
||||||
if (self->backlight_pwm.base.type == &pulseio_pwmout_type) {
|
if (self->backlight_pwm.base.type == &pulseio_pwmout_type) {
|
||||||
common_hal_pulseio_pwmout_reset_ok(&self->backlight_pwm);
|
common_hal_pulseio_pwmout_reset_ok(&self->backlight_pwm);
|
||||||
common_hal_pulseio_pwmout_deinit(&self->backlight_pwm);
|
common_hal_pulseio_pwmout_deinit(&self->backlight_pwm);
|
||||||
} else if (self->backlight_inout.base.type == &digitalio_digitalinout_type) {
|
} else if (self->backlight_inout.base.type == &digitalio_digitalinout_type) {
|
||||||
common_hal_digitalio_digitalinout_deinit(&self->backlight_inout);
|
common_hal_digitalio_digitalinout_deinit(&self->backlight_inout);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
common_hal_digitalio_digitalinout_deinit(&self->backlight_inout);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset_display(displayio_display_obj_t* self) {
|
void reset_display(displayio_display_obj_t* self) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user