changeset 45:c905daaff834

implemented 96x64 BW framebuffer config, compiles
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 17 Oct 2020 21:30:59 +0000
parents 1821e301a65b
children 09cdd5bf04e4
files configs/smallbw src/cs/drivers/drv_app/r2d/lcds/96x64/R2D_96x64bw_fb_defs.h src/cs/drivers/drv_app/r2d/lcds/luna/colormap.h src/cs/drivers/drv_app/r2d/lcds/luna/r2d_task_i.c src/cs/drivers/drv_app/r2d/lcds/luna/r2d_task_i_96x64.c src/cs/drivers/drv_app/r2d/lcds/luna/r2d_task_i_bw.c src/cs/drivers/drv_app/r2d/lcds/luna/r2d_task_init_i.c src/cs/drivers/drv_app/r2d/r2d_config.h src/cs/drivers/drv_app/r2d/r2d_fonts.c src/cs/drivers/drv_app/r2d/r2d_lcds.c src/cs/drivers/drv_app/r2d/r2d_refresh.c
diffstat 11 files changed, 149 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configs/smallbw	Sat Oct 17 21:30:59 2020 +0000
@@ -0,0 +1,11 @@
+# modem services config: voice only
+GPRS=0
+SRVC=0
+
+# this is a phone handset config
+MMI=2
+R2D_STATE=1
+
+# small B&W UI version on 96x64 pixel B&W R2D framebuffer
+R2D_EMBEDDED_LCD=10
+UI_CONFIG=smallbw
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/cs/drivers/drv_app/r2d/lcds/96x64/R2D_96x64bw_fb_defs.h	Sat Oct 17 21:30:59 2020 +0000
@@ -0,0 +1,42 @@
+/*******************************
+
+   LCD DESCRIPTION
+
+*******************************/
+
+
+// Size of the LCD in pixels
+#define R2D_WIDTH 96
+#define R2D_HEIGHT 64
+
+// Dithering ON/OFF
+
+#define R2D_DITHERING R2D_ON
+
+// Kind of display
+#define R2D_LCD_DISPLAY R2D_MONOCHROME
+
+// Refresh mode of LCD
+#define R2D_REFRESH R2D_HORIZONTAL
+
+// Mirrorred mode
+//#define R2D_MIRRORED_X
+//#define R2D_MIRRORED_Y
+
+// ln2 of the number of bits to code a pixel value
+// (color depth)
+#define R2D_PIXEL_DEPTH 1 
+
+// ln2 of previous value
+#define R2D_PIXEL_POS_TO_BIT_POS 0
+
+
+
+// ln2 of the number of pixels in one memory word
+// (Number of pixels MUST BE A POWER OF TWO 
+// for optimization reasons since to compute the address of a pixel
+// in memory one would like to avoid division and would prefer
+// to use shifts)
+// 2^0 = 1 pixel
+#define R2D_PIXELS_PER_MEMORY_WORD 5
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/cs/drivers/drv_app/r2d/lcds/luna/colormap.h	Sat Oct 17 21:30:59 2020 +0000
@@ -0,0 +1,12 @@
+/*
+ * We have configurations that display B&W logical framebuffers
+ * on our physical 16-bit color LCD.  We have a 176x220 pix B&W
+ * framebuffer config, which only requires black and white pixels
+ * to be defined, and a 96x64 pix B&W framebuffer config which also
+ * requires a border pixel color in order to visually delineate
+ * the logical LCD inside the physical one.
+ */
+
+#define	LCD16_COLOR_BLACK	0x0000
+#define	LCD16_COLOR_WHITE	0xFFFF
+#define	LCD16_COLOR_BORDER	0x3807
--- a/src/cs/drivers/drv_app/r2d/lcds/luna/r2d_task_i.c	Sat Oct 17 19:45:18 2020 +0000
+++ b/src/cs/drivers/drv_app/r2d/lcds/luna/r2d_task_i.c	Sat Oct 17 21:30:59 2020 +0000
@@ -1,4 +1,4 @@
-#include "r2d/lcds/luna/r2d_luna_lcd.h" 
+#include "r2d/lcds/luna/r2d_luna_lcd.h"
 
 void r2d_lcd_power_on(void)
 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/cs/drivers/drv_app/r2d/lcds/luna/r2d_task_i_96x64.c	Sat Oct 17 21:30:59 2020 +0000
@@ -0,0 +1,55 @@
+#include "r2d/lcds/luna/r2d_luna_lcd.h"
+#include "r2d/lcds/luna/colormap.h"
+
+void r2d_lcd_power_on(void)
+{
+}
+
+void r2d_lcd_power_off(void)
+{
+}
+
+void r2d_refresh(void)
+{
+	UINT16 i, j, k;
+	UINT32 v;
+	UINT32 *p;
+	INT16 y1, y2;
+
+	p=r2d_g_framebuffer->p_memory_words;
+    
+	y1=r2d_update_ul_y; //0
+	y2=r2d_update_br_y; //63
+
+	/* set window area */
+	LCD_REG_WR(0x36, 135);
+	LCD_REG_WR(0x37, 40);
+	LCD_REG_WR(0x38, y2 + 78);
+	LCD_REG_WR(0x39, y1 + 78);
+	/* set current write address */
+	LCD_REG_WR(0x20, 40);
+	LCD_REG_WR(0x21, y1 + 78);
+	/* set up for GRAM write */
+	LCD_IR = 0x22;
+
+	p=p+y1*R2D_MWWIDTH;
+
+	for (i=y1;i<=y2;i++)
+	{
+		for (j = 0; j < R2D_MWWIDTH-1; j++)
+		{
+			v=*p++;
+			for (k=0;k<32;k++)
+			{
+				if (v&1)
+					LCD_DR = LCD16_COLOR_BLACK;
+				else
+					LCD_DR = LCD16_COLOR_WHITE;
+				v=v>>1;
+			}
+		}	    
+		p++;
+	} 
+
+	r2d_reinit_update_region();
+}
--- a/src/cs/drivers/drv_app/r2d/lcds/luna/r2d_task_i_bw.c	Sat Oct 17 19:45:18 2020 +0000
+++ b/src/cs/drivers/drv_app/r2d/lcds/luna/r2d_task_i_bw.c	Sat Oct 17 21:30:59 2020 +0000
@@ -1,4 +1,5 @@
-#include "r2d/lcds/luna/r2d_luna_lcd.h" 
+#include "r2d/lcds/luna/r2d_luna_lcd.h"
+#include "r2d/lcds/luna/colormap.h"
 
 void r2d_lcd_power_on(void)
 {
@@ -41,9 +42,9 @@
 			for (k=0;k<32;k++)
 			{
 				if (v&1)
-					LCD_DR = 0x0000;
+					LCD_DR = LCD16_COLOR_BLACK;
 				else
-					LCD_DR = 0xFFFF;
+					LCD_DR = LCD16_COLOR_WHITE;
 				v=v>>1;
 			}
 		}	    
@@ -51,9 +52,9 @@
 		for (k=0;k<16;k++)
 		{
 			if (v&1)
-				LCD_DR = 0x0000;
+				LCD_DR = LCD16_COLOR_BLACK;
 			else
-				LCD_DR = 0xFFFF;
+				LCD_DR = LCD16_COLOR_WHITE;
 			v=v>>1;
 		}
 	} 
--- a/src/cs/drivers/drv_app/r2d/lcds/luna/r2d_task_init_i.c	Sat Oct 17 19:45:18 2020 +0000
+++ b/src/cs/drivers/drv_app/r2d/lcds/luna/r2d_task_init_i.c	Sat Oct 17 21:30:59 2020 +0000
@@ -1,7 +1,14 @@
 #include "r2d/lcds/luna/r2d_luna_lcd.h"
+#include "r2d/lcds/luna/colormap.h"
 
 #define R2D_MB_PRIM_SIZE	(4000)
 
+#if (R2D_EMBEDDED_LCD == R2D_FB_96x64_BW)
+	#define	INIT_FILL_COLOR	LCD16_COLOR_BORDER
+#else
+	#define	INIT_FILL_COLOR	LCD16_COLOR_WHITE
+#endif
+
 static void r2d_refresh_task_init(void)
 {
 	/* reset pulse */
@@ -59,7 +66,7 @@
 	LCD_REG_WR(0x21, 0);
 	LCD_IR = 0x22;
 	for (i = 0; i < 176*220; i++)
-		LCD_DR = 0xFFFF;	/* white color */
+		LCD_DR = INIT_FILL_COLOR;
 }
 
 static void r2d_refresh_task_kill(void)
--- a/src/cs/drivers/drv_app/r2d/r2d_config.h	Sat Oct 17 19:45:18 2020 +0000
+++ b/src/cs/drivers/drv_app/r2d/r2d_config.h	Sat Oct 17 21:30:59 2020 +0000
@@ -54,6 +54,7 @@
 #define R2D_BOARD_DSAMPLE 7
 #define R2D_BOARD_BW_DSAMPLE 8
 #define R2D_BOARD_ESAMPLE 9
+#define R2D_FB_96x64_BW 10
 #define R2D_PC_CSAMPLE 108
 #define R2D_PC_DSAMPLE 109
 
@@ -154,6 +155,10 @@
 #include "r2d/lcds/BW_D_Sample/R2D_board_bw_dsample_i.h"
 #endif
 
+#if (R2D_EMBEDDED_LCD == R2D_FB_96x64_BW)
+#include "r2d/lcds/96x64/R2D_96x64bw_fb_defs.h"
+#endif
+
 #if (R2D_EMBEDDED_LCD == R2D_PC_COLOR_LCD)
 #ifdef R2D_ASM
 #undef R2D_ASM
--- a/src/cs/drivers/drv_app/r2d/r2d_fonts.c	Sat Oct 17 19:45:18 2020 +0000
+++ b/src/cs/drivers/drv_app/r2d/r2d_fonts.c	Sat Oct 17 21:30:59 2020 +0000
@@ -176,3 +176,6 @@
 #include "lcds/BW_D_Sample/r2d_font_init_i.c"
 #endif
 
+#if (R2D_EMBEDDED_LCD == R2D_FB_96x64_BW)
+#include "lcds/BW_D_Sample/r2d_font_init_i.c"
+#endif
--- a/src/cs/drivers/drv_app/r2d/r2d_lcds.c	Sat Oct 17 19:45:18 2020 +0000
+++ b/src/cs/drivers/drv_app/r2d/r2d_lcds.c	Sat Oct 17 21:30:59 2020 +0000
@@ -82,3 +82,7 @@
 #if (R2D_EMBEDDED_LCD == R2D_BOARD_BW_DSAMPLE)
   #include "lcds/BW_D_Sample/R2D_board_bw_dsample_lcd_i.c"
 #endif
+
+#if (R2D_EMBEDDED_LCD == R2D_FB_96x64_BW)
+  #include "lcds/BW_D_Sample/R2D_board_bw_dsample_lcd_i.c"
+#endif
--- a/src/cs/drivers/drv_app/r2d/r2d_refresh.c	Sat Oct 17 19:45:18 2020 +0000
+++ b/src/cs/drivers/drv_app/r2d/r2d_refresh.c	Sat Oct 17 21:30:59 2020 +0000
@@ -71,6 +71,8 @@
   #include "lcds/luna/r2d_task_i.c"
 #elif defined(CONFIG_TARGET_LUNA) && (R2D_EMBEDDED_LCD == R2D_BOARD_BW_DSAMPLE)
   #include "lcds/luna/r2d_task_i_bw.c"
+#elif defined(CONFIG_TARGET_LUNA) && (R2D_EMBEDDED_LCD == R2D_FB_96x64_BW)
+  #include "lcds/luna/r2d_task_i_96x64.c"
 #else
   #error "R2D refresh selection: unsupported combination"
 #endif