dev: fbcon: Function updates
Base on the latest requirement. The fbcon need to do the below
changes:
1. Update unlock title color from cyan to red
2. Add functions to get screen's width and height
3. Set the max character number shown per line
Change-Id: I65c94371d42e3ae62b142633fb0f5ee6cee1883f
diff --git a/dev/fbcon/fbcon.c b/dev/fbcon/fbcon.c
index c9d0df6..cc5e09e 100644
--- a/dev/fbcon/fbcon.c
+++ b/dev/fbcon/fbcon.c
@@ -88,7 +88,7 @@
static struct fb_color *fb_color_formats;
static struct fb_color fb_color_formats_555[] = {
[FBCON_COMMON_MSG] = {RGB565_WHITE, RGB565_BLACK},
- [FBCON_UNLOCK_TITLE_MSG] = {RGB565_CYAN, RGB565_BLACK},
+ [FBCON_UNLOCK_TITLE_MSG] = {RGB565_RED, RGB565_BLACK},
[FBCON_TITLE_MSG] = {RGB565_WHITE, RGB565_BLACK},
[FBCON_SUBTITLE_MSG] = {RGB565_SILVER, RGB565_BLACK},
[FBCON_YELLOW_MSG] = {RGB565_YELLOW, RGB565_BLACK},
@@ -99,7 +99,7 @@
static struct fb_color fb_color_formats_888[] = {
[FBCON_COMMON_MSG] = {RGB888_WHITE, RGB888_BLACK},
- [FBCON_UNLOCK_TITLE_MSG] = {RGB888_CYAN, RGB888_BLACK},
+ [FBCON_UNLOCK_TITLE_MSG] = {RGB888_RED, RGB888_BLACK},
[FBCON_TITLE_MSG] = {RGB888_WHITE, RGB888_BLACK},
[FBCON_SUBTITLE_MSG] = {RGB888_SILVER, RGB888_BLACK},
[FBCON_YELLOW_MSG] = {RGB888_YELLOW, RGB888_BLACK},
@@ -403,6 +403,22 @@
return max_pos.x;
}
+uint32_t fbcon_get_width(void)
+{
+ if (config)
+ return config->width;
+ else
+ return 0;
+}
+
+uint32_t fbcon_get_height(void)
+{
+ if (config)
+ return config->height;
+ else
+ return 0;
+}
+
uint32_t fbcon_get_current_bg(void)
{
return BGCOLOR;
diff --git a/include/dev/fbcon.h b/include/dev/fbcon.h
index c77f02e..2a5abab 100644
--- a/include/dev/fbcon.h
+++ b/include/dev/fbcon.h
@@ -37,6 +37,23 @@
#define LOGO_IMG_MAGIC_SIZE sizeof(LOGO_IMG_MAGIC) - 1
#define LOGO_IMG_HEADER_SIZE 512
+/* 45 characters per line for portrait orientation
+ * "720 (W) 1280(H)" -- 720 /(8*2) = 45
+ * "1080(W) 1920(H)" -- 1080/(8*3) = 45
+ * "1440(W) 2560(H)" -- 1440/(8*4) = 45
+ * "2160(W) 3840(H)" -- 2160/(8*6) = 45
+ */
+#define CHAR_NUM_PERROW_POR 45
+
+/* 80 characters per line for horizontal orientation
+ * "480 (H) 640 (W)" -- 640 /(8*1) = 80
+ * "720 (H) 1280(W)" -- 1280/(8*2) = 80
+ * "1080(H) 1920(W)" -- 1920/(8*3) = 80
+ * "1440(H) 2560(W)" -- 2560/(8*4) = 80
+ * "2160(H) 3840(W)" -- 3840/(8*6) = 80
+ */
+#define CHAR_NUM_PERROW_HOR 80
+
enum fbcon_msg_type {
/* type for menu */
FBCON_COMMON_MSG = 0,
@@ -98,4 +115,6 @@
uint32_t fbcon_get_current_line(void);
uint32_t fbcon_get_current_bg(void);
uint32_t fbcon_get_max_x(void);
+uint32_t fbcon_get_width(void);
+uint32_t fbcon_get_height(void);
#endif /* __DEV_FBCON_H */