Skip to content

Use settings.toml for sunton 2432S028 display rotation #9627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions ports/espressif/boards/sunton_esp32_2432S028/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);

Expand All @@ -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
Expand Down