12
12
#include "shared-bindings/framebufferio/FramebufferDisplay.h"
13
13
#include "shared-bindings/microcontroller/Pin.h"
14
14
#include "shared-module/displayio/__init__.h"
15
+ #include "shared-module/os/__init__.h"
15
16
16
17
static const mcu_pin_obj_t * blue_pins [] = {
17
18
& pin_GPIO8 ,
@@ -37,6 +38,7 @@ static const mcu_pin_obj_t *red_pins[] = {
37
38
};
38
39
39
40
static void display_init (void ) {
41
+ mp_int_t frequency ;
40
42
41
43
// Turn on backlight
42
44
gpio_set_direction (2 , GPIO_MODE_DEF_OUTPUT );
@@ -45,6 +47,10 @@ static void display_init(void) {
45
47
46
48
dotclockframebuffer_framebuffer_obj_t * framebuffer = & allocate_display_bus_or_raise ()-> dotclock ;
47
49
framebuffer -> base .type = & dotclockframebuffer_framebuffer_type ;
50
+ os_getenv_err_t result = common_hal_os_getenv_int ("CIRCUITPY_DISPLAY_FREQUENCY" , & frequency );
51
+ if (result != GETENV_OK ) {
52
+ frequency = 12500000 ;
53
+ }
48
54
49
55
common_hal_dotclockframebuffer_framebuffer_construct (
50
56
framebuffer ,
@@ -55,7 +61,7 @@ static void display_init(void) {
55
61
red_pins , MP_ARRAY_SIZE (red_pins ),
56
62
green_pins , MP_ARRAY_SIZE (green_pins ),
57
63
blue_pins , MP_ARRAY_SIZE (blue_pins ),
58
- 12500000 , // Frequency
64
+ frequency , // Frequency
59
65
800 , // width
60
66
480 , // height
61
67
4 , 8 , 8 , true, // horiz: pulse, back porch, front porch, idle low
0 commit comments