Skip to content

Commit 14ef837

Browse files
authored
Merge pull request #9627 from RetiredWizard/cydrotate
Use settings.toml for sunton 2432S028 display rotation
2 parents 8969ddc + 80188a9 commit 14ef837

File tree

1 file changed

+8
-2
lines changed
  • ports/espressif/boards/sunton_esp32_2432S028

1 file changed

+8
-2
lines changed

ports/espressif/boards/sunton_esp32_2432S028/board.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "shared-module/displayio/mipi_constants.h"
1313
#include "driver/gpio.h"
1414
#include "common-hal/microcontroller/Pin.h"
15-
15+
#include "shared-module/os/__init__.h"
1616

1717
uint8_t display_init_sequence[] = {
1818
0x01, 0x80, 0x80, // # Software reset then delay 0x80 (128ms)
@@ -43,6 +43,7 @@ uint8_t display_init_sequence[] = {
4343
static void display_init(void) {
4444
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
4545
busio_spi_obj_t *spi = &bus->inline_bus;
46+
mp_int_t rotation;
4647
common_hal_busio_spi_construct(spi, &pin_GPIO14, &pin_GPIO13, &pin_GPIO12, false);
4748
common_hal_busio_spi_never_reset(spi);
4849

@@ -58,13 +59,18 @@ static void display_init(void) {
5859

5960
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
6061
display->base.type = &busdisplay_busdisplay_type;
62+
os_getenv_err_t result = common_hal_os_getenv_int("CIRCUITPY_DISPLAY_ROTATION", &rotation);
63+
if (result != GETENV_OK) {
64+
rotation = 0;
65+
}
66+
6167
common_hal_busdisplay_busdisplay_construct(display,
6268
bus,
6369
320, // Width
6470
240, // Height
6571
0, // column start
6672
0, // row start
67-
270, // rotation
73+
rotation, // rotation
6874
16, // Color depth
6975
false, // Grayscale
7076
false, // pixels in a byte share a row. Only valid for depths < 8

0 commit comments

Comments
 (0)