12
12
#include "shared-module/displayio/mipi_constants.h"
13
13
#include "driver/gpio.h"
14
14
#include "common-hal/microcontroller/Pin.h"
15
-
15
+ #include "shared-module/os/__init__.h"
16
16
17
17
uint8_t display_init_sequence [] = {
18
18
0x01 , 0x80 , 0x80 , // # Software reset then delay 0x80 (128ms)
@@ -43,6 +43,7 @@ uint8_t display_init_sequence[] = {
43
43
static void display_init (void ) {
44
44
fourwire_fourwire_obj_t * bus = & allocate_display_bus ()-> fourwire_bus ;
45
45
busio_spi_obj_t * spi = & bus -> inline_bus ;
46
+ mp_int_t rotation ;
46
47
common_hal_busio_spi_construct (spi , & pin_GPIO14 , & pin_GPIO13 , & pin_GPIO12 , false);
47
48
common_hal_busio_spi_never_reset (spi );
48
49
@@ -58,13 +59,18 @@ static void display_init(void) {
58
59
59
60
busdisplay_busdisplay_obj_t * display = & allocate_display ()-> display ;
60
61
display -> base .type = & busdisplay_busdisplay_type ;
62
+ os_getenv_err_t result = common_hal_os_getenv_int ("CIRCUITPY_DISP_ROTATION" , & rotation );
63
+ if (result != GETENV_OK ) {
64
+ rotation = 0 ;
65
+ }
66
+
61
67
common_hal_busdisplay_busdisplay_construct (display ,
62
68
bus ,
63
69
320 , // Width
64
70
240 , // Height
65
71
0 , // column start
66
72
0 , // row start
67
- 270 , // rotation
73
+ rotation , // rotation
68
74
16 , // Color depth
69
75
false, // Grayscale
70
76
false, // pixels in a byte share a row. Only valid for depths < 8
@@ -102,4 +108,4 @@ bool espressif_board_reset_pin_number(gpio_num_t pin_number) {
102
108
return false;
103
109
}
104
110
105
- // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.
111
+ // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.
0 commit comments