From c37531339ed53ae19ab815fe96ae4ef82db3f2e3 Mon Sep 17 00:00:00 2001 From: Jan Van Winkel Date: Sat, 20 Oct 2018 23:48:57 +0200 Subject: [PATCH] samples: Added native posix board to cfb sample Added support for native posix board to character framebuffer sample. Signed-off-by: Jan Van Winkel --- samples/display/cfb/prj.conf | 1 - samples/display/cfb/prj_native_posix.conf | 11 +++++++++++ samples/display/cfb/src/main.c | 14 ++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 samples/display/cfb/prj_native_posix.conf diff --git a/samples/display/cfb/prj.conf b/samples/display/cfb/prj.conf index a0065e664fa550..79d9eef37359dc 100644 --- a/samples/display/cfb/prj.conf +++ b/samples/display/cfb/prj.conf @@ -5,7 +5,6 @@ CONFIG_HEAP_MEM_POOL_SIZE=16384 CONFIG_DISPLAY=y CONFIG_LOG=y -CONFIG_DISPLAY_LOG_LEVEL_DBG=y CONFIG_CFB_LOG_LEVEL_DBG=y CONFIG_CHARACTER_FRAMEBUFFER=y diff --git a/samples/display/cfb/prj_native_posix.conf b/samples/display/cfb/prj_native_posix.conf new file mode 100644 index 00000000000000..72307ce90fd435 --- /dev/null +++ b/samples/display/cfb/prj_native_posix.conf @@ -0,0 +1,11 @@ +CONFIG_HEAP_MEM_POOL_SIZE=16384 + +CONFIG_DISPLAY=y +CONFIG_SDL_DISPLAY_DEV_NAME="DISPLAY" +CONFIG_SDL_DISPLAY_X_RES=250 +CONFIG_SDL_DISPLAY_Y_RES=120 + +CONFIG_LOG=y + +CONFIG_CFB_LOG_LEVEL_DBG=y +CONFIG_CHARACTER_FRAMEBUFFER=y diff --git a/samples/display/cfb/src/main.c b/samples/display/cfb/src/main.c index f7c548deb543cb..c4e74cbd278fd3 100644 --- a/samples/display/cfb/src/main.c +++ b/samples/display/cfb/src/main.c @@ -17,6 +17,10 @@ #define DISPLAY_DRIVER "SSD1306" #endif +#ifndef DISPLAY_DRIVER +#define DISPLAY_DRIVER "DISPLAY" +#endif + void main(void) { struct device *dev; @@ -33,6 +37,11 @@ void main(void) return; } + if (display_set_pixel_format(dev, PIXEL_FORMAT_MONO10) != 0) { + printf("Failed to set required pixel format\n"); + return; + } + printf("initialized %s\n", DISPLAY_DRIVER); if (cfb_framebuffer_init(dev)) { @@ -43,6 +52,8 @@ void main(void) api = dev->driver_api; cfb_framebuffer_clear(dev, true); + display_blanking_off(dev); + rows = cfb_get_display_parameter(dev, CFB_DISPLAY_ROWS); ppt = cfb_get_display_parameter(dev, CFB_DISPLAY_PPT); @@ -73,6 +84,9 @@ void main(void) } cfb_framebuffer_finalize(dev); +#if defined(CONFIG_ARCH_POSIX) + k_sleep(100); +#endif } } }