Skip to content

Commit 089ded7

Browse files
authored
Merge pull request #9911 from RetiredWizard/sunton8048
Sunton 8048S050: Configure display frequency in settings.toml
2 parents d9ea4ab + ae3aa28 commit 089ded7

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

docs/environment.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,13 @@ If the CIRCUITPY_DISPLAY_ROTATION parameter is set the display will be initializ
119119
during power up with the selected rotation, otherwise the display will be initialized with
120120
a rotation of 0. Attempting to initialize the screen with a rotation other than 0,
121121
90, 180 or 270 is not supported and will result in an unexpected screen rotation.
122+
123+
`Sunton ESP32-8048S050 <https://circuitpython.org/board/sunton_esp32_8048S050/>`_
124+
125+
CIRCUITPY_DISPLAY_FREQUENCY
126+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
127+
Allows the entry of a display frequency used during the "dotclock" framebuffer construction.
128+
If a valid frequency is not defined the board will initialize the framebuffer with a
129+
frequency of 12500000hz (12.5Mhz). The value should be entered as an integer in hertz
130+
i.e. CIRCUITPY_DISPLAY_FREQUENCY=16000000 will override the default value with a 16Mhz
131+
display frequency.

ports/espressif/boards/sunton_esp32_8048S050/board.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "shared-bindings/framebufferio/FramebufferDisplay.h"
1313
#include "shared-bindings/microcontroller/Pin.h"
1414
#include "shared-module/displayio/__init__.h"
15+
#include "shared-module/os/__init__.h"
1516

1617
static const mcu_pin_obj_t *blue_pins[] = {
1718
&pin_GPIO8,
@@ -37,6 +38,7 @@ static const mcu_pin_obj_t *red_pins[] = {
3738
};
3839

3940
static void display_init(void) {
41+
mp_int_t frequency;
4042

4143
// Turn on backlight
4244
gpio_set_direction(2, GPIO_MODE_DEF_OUTPUT);
@@ -45,6 +47,10 @@ static void display_init(void) {
4547

4648
dotclockframebuffer_framebuffer_obj_t *framebuffer = &allocate_display_bus_or_raise()->dotclock;
4749
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+
}
4854

4955
common_hal_dotclockframebuffer_framebuffer_construct(
5056
framebuffer,
@@ -55,7 +61,7 @@ static void display_init(void) {
5561
red_pins, MP_ARRAY_SIZE(red_pins),
5662
green_pins, MP_ARRAY_SIZE(green_pins),
5763
blue_pins, MP_ARRAY_SIZE(blue_pins),
58-
12500000, // Frequency
64+
frequency, // Frequency
5965
800, // width
6066
480, // height
6167
4, 8, 8, true, // horiz: pulse, back porch, front porch, idle low

0 commit comments

Comments
 (0)