Merge pull request #9627 from RetiredWizard/cydrotate

Use settings.toml  for sunton 2432S028 display rotation
This commit is contained in:
Scott Shawcroft 2024-09-17 09:45:47 -07:00 committed by GitHub
commit 14ef8379ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -12,7 +12,7 @@
#include "shared-module/displayio/mipi_constants.h"
#include "driver/gpio.h"
#include "common-hal/microcontroller/Pin.h"
#include "shared-module/os/__init__.h"
uint8_t display_init_sequence[] = {
0x01, 0x80, 0x80, // # Software reset then delay 0x80 (128ms)
@ -43,6 +43,7 @@ uint8_t display_init_sequence[] = {
static void display_init(void) {
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
busio_spi_obj_t *spi = &bus->inline_bus;
mp_int_t rotation;
common_hal_busio_spi_construct(spi, &pin_GPIO14, &pin_GPIO13, &pin_GPIO12, false);
common_hal_busio_spi_never_reset(spi);
@ -58,13 +59,18 @@ static void display_init(void) {
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
display->base.type = &busdisplay_busdisplay_type;
os_getenv_err_t result = common_hal_os_getenv_int("CIRCUITPY_DISPLAY_ROTATION", &rotation);
if (result != GETENV_OK) {
rotation = 0;
}
common_hal_busdisplay_busdisplay_construct(display,
bus,
320, // Width
240, // Height
0, // column start
0, // row start
270, // rotation
rotation, // rotation
16, // Color depth
false, // Grayscale
false, // pixels in a byte share a row. Only valid for depths < 8