kopia lustrzana https://github.com/pimoroni/pimoroni-pico
Merge pull request #250 from pimoroni/patch_glitch_fixes
Fix display buffer being trampled for #89pull/254/head
commit
9ea59fc528
|
@ -86,7 +86,7 @@ namespace pimoroni {
|
|||
pwm_set_wrap(pwm_gpio_to_slice_num(bl), 65535);
|
||||
pwm_init(pwm_gpio_to_slice_num(bl), &cfg, true);
|
||||
gpio_set_function(bl, GPIO_FUNC_PWM);
|
||||
set_backlight(255); // Turn backlight on by default to avoid nasty surprises
|
||||
set_backlight(0); // Turn backlight off initially to avoid nasty surprises
|
||||
}
|
||||
|
||||
// if auto_init_sequence then send initialisation sequence
|
||||
|
@ -176,6 +176,12 @@ namespace pimoroni {
|
|||
command(reg::CASET, 4, (char *)caset);
|
||||
command(reg::RASET, 4, (char *)raset);
|
||||
command(reg::MADCTL, 1, (char *)&madctl);
|
||||
|
||||
if(bl != PIN_UNUSED) {
|
||||
update(); // Send the new buffer to the display to clear any previous content
|
||||
sleep_ms(50); // Wait for the update to apply
|
||||
set_backlight(255); // Turn backlight on now surprises have passed
|
||||
}
|
||||
}
|
||||
|
||||
// the dma transfer works but without vsync it's not that useful as you could
|
||||
|
|
|
@ -20,9 +20,16 @@ mp_obj_t picodisplay_init(mp_obj_t buf_obj) {
|
|||
mp_buffer_info_t bufinfo;
|
||||
mp_get_buffer_raise(buf_obj, &bufinfo, MP_BUFFER_RW);
|
||||
picodisplay_buf_obj = buf_obj;
|
||||
if(display == nullptr)
|
||||
display = new PicoDisplay((uint16_t *)bufinfo.buf);
|
||||
|
||||
// If a display already exists, delete it
|
||||
if(display != nullptr) {
|
||||
delete display;
|
||||
}
|
||||
|
||||
// Create a new display pointing to the newly provided buffer
|
||||
display = new PicoDisplay((uint16_t *)bufinfo.buf);
|
||||
display->init();
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,9 +20,16 @@ mp_obj_t picodisplay2_init(mp_obj_t buf_obj) {
|
|||
mp_buffer_info_t bufinfo;
|
||||
mp_get_buffer_raise(buf_obj, &bufinfo, MP_BUFFER_RW);
|
||||
picodisplay2_buf_obj = buf_obj;
|
||||
if(display2 == nullptr)
|
||||
display2 = new PicoDisplay2((uint16_t *)bufinfo.buf);
|
||||
|
||||
// If a display already exists, delete it
|
||||
if(display2 != nullptr) {
|
||||
delete display2;
|
||||
}
|
||||
|
||||
// Create a new display pointing to the newly provided buffer
|
||||
display2 = new PicoDisplay2((uint16_t *)bufinfo.buf);
|
||||
display2->init();
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,9 +20,16 @@ mp_obj_t picoexplorer_init(mp_obj_t buf_obj) {
|
|||
mp_buffer_info_t bufinfo;
|
||||
mp_get_buffer_raise(buf_obj, &bufinfo, MP_BUFFER_RW);
|
||||
picoexplorer_buf_obj = buf_obj;
|
||||
if(explorer == nullptr)
|
||||
explorer = new PicoExplorer((uint16_t *)bufinfo.buf);
|
||||
|
||||
// If a display already exists, delete it
|
||||
if(explorer != nullptr) {
|
||||
delete explorer;
|
||||
}
|
||||
|
||||
// Create a new display pointing to the newly provided buffer
|
||||
explorer = new PicoExplorer((uint16_t *)bufinfo.buf);
|
||||
explorer->init();
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue