Skip to content

Commit eef1099

Browse files
vanwinkeljannashif
authored andcommitted
samples: Added native posix board to cfb sample
Added support for native posix board to character framebuffer sample. Signed-off-by: Jan Van Winkel <[email protected]>
1 parent 6cb629c commit eef1099

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

samples/display/cfb/prj.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ CONFIG_HEAP_MEM_POOL_SIZE=16384
55
CONFIG_DISPLAY=y
66

77
CONFIG_LOG=y
8-
CONFIG_DISPLAY_LOG_LEVEL_DBG=y
98

109
CONFIG_CFB_LOG_LEVEL_DBG=y
1110
CONFIG_CHARACTER_FRAMEBUFFER=y
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CONFIG_HEAP_MEM_POOL_SIZE=16384
2+
3+
CONFIG_DISPLAY=y
4+
CONFIG_SDL_DISPLAY_DEV_NAME="DISPLAY"
5+
CONFIG_SDL_DISPLAY_X_RES=250
6+
CONFIG_SDL_DISPLAY_Y_RES=120
7+
8+
CONFIG_LOG=y
9+
10+
CONFIG_CFB_LOG_LEVEL_DBG=y
11+
CONFIG_CHARACTER_FRAMEBUFFER=y

samples/display/cfb/src/main.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
#define DISPLAY_DRIVER "SSD1306"
1818
#endif
1919

20+
#ifndef DISPLAY_DRIVER
21+
#define DISPLAY_DRIVER "DISPLAY"
22+
#endif
23+
2024
void main(void)
2125
{
2226
struct device *dev;
@@ -33,6 +37,11 @@ void main(void)
3337
return;
3438
}
3539

40+
if (display_set_pixel_format(dev, PIXEL_FORMAT_MONO10) != 0) {
41+
printf("Failed to set required pixel format\n");
42+
return;
43+
}
44+
3645
printf("initialized %s\n", DISPLAY_DRIVER);
3746

3847
if (cfb_framebuffer_init(dev)) {
@@ -43,6 +52,8 @@ void main(void)
4352
api = dev->driver_api;
4453
cfb_framebuffer_clear(dev, true);
4554

55+
display_blanking_off(dev);
56+
4657
rows = cfb_get_display_parameter(dev, CFB_DISPLAY_ROWS);
4758
ppt = cfb_get_display_parameter(dev, CFB_DISPLAY_PPT);
4859

@@ -73,6 +84,9 @@ void main(void)
7384
}
7485

7586
cfb_framebuffer_finalize(dev);
87+
#if defined(CONFIG_ARCH_POSIX)
88+
k_sleep(100);
89+
#endif
7690
}
7791
}
7892
}

0 commit comments

Comments
 (0)