changeset 243:35474f3a1782

FCBM: beginning of display output
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 03 May 2021 04:43:06 +0000
parents da5857b13d02
children 96784b8974eb
files components/fcbm src/cs/services/fcbm/fcbm_charging.c src/cs/services/fcbm/fcbm_display_ctrl.c src/cs/services/fcbm/fcbm_func_i.h src/cs/services/fcbm/fcbm_textout.c
diffstat 5 files changed, 50 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/components/fcbm	Mon May 03 03:00:54 2021 +0000
+++ b/components/fcbm	Mon May 03 04:43:06 2021 +0000
@@ -57,3 +57,4 @@
 cfile_plain $SRCDIR/fcbm_powerkey_if.c
 cfile_plain $SRCDIR/fcbm_send_msg.c
 cfile_plain $SRCDIR/fcbm_task.c
+cfile_plain $SRCDIR/fcbm_textout.c
--- a/src/cs/services/fcbm/fcbm_charging.c	Mon May 03 03:00:54 2021 +0000
+++ b/src/cs/services/fcbm/fcbm_charging.c	Mon May 03 04:43:06 2021 +0000
@@ -11,9 +11,16 @@
 #include "fcbm/fcbm_life_cycle.h"
 #include "fcbm/fcbm_timer_i.h"
 #include "fchg/fchg_api.h"
+#include "r2d/r2d.h"
 #include "r2d/r2d_blrr_api.h"
 #include "abb/abb.h"
 
+#ifdef LSCREEN
+char fcbm_prod_banner_string[] = "FreeCalypso Handset";
+#else
+char fcbm_prod_banner_string[] = "FreeCalypso Lite";
+#endif
+
 void fcbm_process_msg_chg_mode(void)
 {
 	if (fcbm_life_cycle_state != FCBM_STATE_INACTIVE) {
@@ -26,7 +33,10 @@
 			RV_TRACE_LEVEL_DEBUG_HIGH, FCBM_USE_ID);
 	fcbm_subscribe_kpd();
 	fcbm_setup_long_pwon();
-	/* TODO: display charging boot mode info on the LCD */
+	fcbm_display_init();
+	fcbm_display_line(0, fcbm_prod_banner_string);
+	fcbm_display_line(1, "Charge boot mode");
+	r2d_flush();
 	blrr_display_ctrl(BLRR_DISPLAY_CHG_BOOT);
 	rvf_start_timer(FCBM_TIMER_DSPL_OFF,
 			RVF_SECS_TO_TICKS(FCBM_DISPLAY_SECS), FALSE);
@@ -49,9 +59,10 @@
 		return;
 	rvf_send_trace("Charger unplug, powering off", 28, NULL_PARAM,
 			RV_TRACE_LEVEL_DEBUG_HIGH, FCBM_USE_ID);
-	/* TODO: display appropriate message on the LCD */
+	fcbm_display_line(3, "Charger unplug");
+	r2d_flush();
 	blrr_display_ctrl(BLRR_DISPLAY_CHG_BOOT);
-	rvf_delay(RVF_MS_TO_TICKS(50));
+	rvf_delay(RVF_MS_TO_TICKS(1500));
 	ABB_Power_Off();
 }
 
--- a/src/cs/services/fcbm/fcbm_display_ctrl.c	Mon May 03 03:00:54 2021 +0000
+++ b/src/cs/services/fcbm/fcbm_display_ctrl.c	Mon May 03 04:43:06 2021 +0000
@@ -33,6 +33,7 @@
 	}
 	switch (msg->key_info.state) {
 	case KPD_KEY_PRESSED:
+		rvf_stop_timer(FCBM_TIMER_DSPL_OFF);
 		blrr_display_ctrl(BLRR_DISPLAY_CHG_BOOT);
 		return;
 	case KPD_KEY_RELEASED:
--- a/src/cs/services/fcbm/fcbm_func_i.h	Mon May 03 03:00:54 2021 +0000
+++ b/src/cs/services/fcbm/fcbm_func_i.h	Mon May 03 04:43:06 2021 +0000
@@ -21,4 +21,7 @@
 
 void fcbm_process_kpd_msg(T_KPD_KEY_EVENT_MSG *msg);
 
+void fcbm_display_init(void);
+void fcbm_display_line(UINT16 row, char *text);
+
 #endif	/* include guard */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/cs/services/fcbm/fcbm_textout.c	Mon May 03 04:43:06 2021 +0000
@@ -0,0 +1,31 @@
+/*
+ * In this module we are going to implement functions for
+ * displaying FCBM text strings on the LCD, abstracting
+ * the messy Condat display driver for our purposes.
+ */
+
+#include "rv/rv_general.h"
+#include "fcbm/fcbm_func_i.h"
+#include "typedefs.h"
+#include "dspl.h"
+
+#ifdef LSCREEN
+  #define	FONT_HEIGHT	16
+  #define	FAR_END_X	175
+#else
+  #define	FONT_HEIGHT	8
+  #define	FAR_END_X	95
+#endif
+
+void fcbm_display_init(void)
+{
+	dspl_Init();
+	dspl_set_char_type(DSPL_TYPE_ASCII);
+}
+
+void fcbm_display_line(UINT16 row, char *text)
+{
+	dspl_Clear(0, row * FONT_HEIGHT, FAR_END_X,
+		   (row + 1) * FONT_HEIGHT - 1);
+	dspl_ScrText(0, row * FONT_HEIGHT, text, TXT_STYLE_NORMAL);
+}