Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: 4DGL MODSERIAL mbed mbos
Fork of CDU_Mbed_21 by
Revision 11:d60c746c097c, committed 2014-07-21
- Comitter:
- WillemBraat
- Date:
- Mon Jul 21 14:24:15 2014 +0000
- Parent:
- 10:7e350a27f936
- Commit message:
- screen_handler.cpp
; Added external flag S_Exec in procedure . Inhibits screen updates when 1. S_Exec is declared in line 77 of FS2CDU_data_5.cpp
;
; keyboard2.cpp
; Line 40. Added Key_led=0
;
; keyboard2.cpp "
; Added switch value in CDU_SET_BGL_INTENSIT...
Changed in this revision
--- a/FS2CDU_data_5.cpp Sun Jul 20 20:11:24 2014 +0000 +++ b/FS2CDU_data_5.cpp Mon Jul 21 14:24:15 2014 +0000 @@ -74,6 +74,10 @@ int Text_Line_Update = 0; // : equal to line number whose text was updated, must be reset to 0 when text has been read int Key_Maintext_Update = -1; // : equal to keynumber whose main text line was updated, must be reset to -1 (!) when text has been read int Key_Subtext_Update = -1; // : equal to keynumber whose sub text line was updated, must be reset to -1 (!) when text has been read + int S_Exec = 0; // WB 20-07-14 if 1 then S+EXEC is pressed together to enter setup mode + // -->No screen updates allowed + // -->No key messages sent to FS + // Setup is exited by pressing EXEC //------------- debug only --------------------------- extern MODSERIAL SERIAL_DEBUG; // : debug serial port
--- a/display.cpp Sun Jul 20 20:11:24 2014 +0000
+++ b/display.cpp Mon Jul 21 14:24:15 2014 +0000
@@ -116,6 +116,7 @@
nStart = nCharWidth*( nChars - cString.size());
return nStart;
}
+
int nFontSize( int nfont_number )
{
int nFontWidth = 24;
--- a/keyboard2.cpp Sun Jul 20 20:11:24 2014 +0000
+++ b/keyboard2.cpp Mon Jul 21 14:24:15 2014 +0000
@@ -37,7 +37,7 @@
void CDU_KB_COMM_INIT()
{ //initialize communication with TCA84818
char cmd[2];
-
+ Key_led = 0;
cmd[0] = REG_CFG; //pointer byte to CFG register
cmd[1] = 0x01; //data for CFG register KE_IEN set to 1
if ( CDU_I2C.write(CDU_KB_ADRS,cmd, 2) == I2C_ACK ) //initiate write cycle and check for ACK
@@ -158,19 +158,29 @@
//switch off backlighting
BGL_LED = 0.0 ;
LightOn = 0;
+ FullBright = 0;
break;
}
case 100:
{
- //switch on backlighting
+ //switch on backlighting to normal
BGL_LED = BGL_POT;
LightOn = 1;
+ FullBright = 0;
break;
}
+
+ case 128:
+ {
+ //switch backlighting to MAX
+ BGL_LED= 1;
+ FullBright = 1;
+ }
+
case 255:
{
//calculate percentage from potmeter value
- if ( LightOn == 1)
+ if ( ( LightOn == 1) && (FullBright== 0) )
{
if ( BGL_POT < 0.01 )
{
@@ -181,6 +191,11 @@
BGL_LED = BGL_POT;
}
}
+ else if ( ( LightOn == 1) && (FullBright== 1) )
+ {
+ BGL_LED = 1;
+
+ }
}
}
}
\ No newline at end of file
--- a/screen_handler.cpp Sun Jul 20 20:11:24 2014 +0000
+++ b/screen_handler.cpp Mon Jul 21 14:24:15 2014 +0000
@@ -17,12 +17,18 @@
extern DigitalOut DSPY;
extern DigitalOut MSG;
extern DigitalOut OFST;
+
+//VGA control lines
+extern DigitalOut VGA_SOURCE;
+extern DigitalOut VGA_SELECT;
+
extern void CDU_SET_BGL_INTENSITY( int nVal ); //Prototype of function controlling CDU backlight (declared in keyboard.cpp)
extern int nFontSize( int nfont_number ); //Prototype of function for fontselection (declared in display.cpp)
extern int nFontWidth (int nfont_number ); //Prototype of function to retrieve font width (declared in display.cpp)
extern int nLine2Pixel( int nLine ); //Prototype of function to calculate vertical pixelposition from line number (declared in display.cpp)
extern int LeftOrRight( int nTextLine, string cString, int nChars, int nCharWidth ); //declared in display.cpp
extern int cRGB( char cRED, char cGREEN, char cBLUE ); //Prototype of function for assembly color word (declared in display.cpp)
+
// FS_data_update_ID:
// These global flags indicate what data has been updated.
// Should be tested when FS_DATA_EVENT occurs.
@@ -32,6 +38,7 @@
extern int Text_Line_Update ; // equal to line number whose text was updated, must be reset to 0 when text has been read
extern int Key_Maintext_Update ; // equal to keynumber whose main text line was updated, must be reset to -1 (!)when text has been read
extern int Key_Subtext_Update ; // equal to keynumber whose sub text line was updated, must be reset to -1 (!) when text has been read
+extern int S_Exec ; // setup flag
// --------------------------------------------------------------------------------------------------
void CDU_DSP_CSS()
@@ -42,9 +49,12 @@
Text_Line_Update ; // : equal to line number whose text was updated, must be reset to 0 when text has been read
Key_Maintext_Update ; // : equal to keynumber whose main text line was updated, must be reset to -1 (!)when text has been read
Key_Subtext_Update ; // : equal to keynumber whose sub text line was updated, must be reset to -1 (!) when text has been read
+S_Exec ; // : when set do not update screen
*/
{
+if (!S_Exec )
+{
int nLine = 1; //default line number
int nCharsLine = 24; //characters per line
//check common flag
@@ -101,15 +111,7 @@
cRGB( SELKEY_MAINTEXT[Key_Maintext_Update].text_RED ,SELKEY_MAINTEXT[Key_Maintext_Update].text_GREEN ,SELKEY_MAINTEXT[Key_Maintext_Update].text_BLUE ),
1, 1 );
- /*
- display.graphic_string( SELKEY_MAINTEXT[Key_Maintext_Update].text , //Text to display
- 12*24 , //Horizontal position
- nLine2Pixel( nLine ), //Vertical position
- SELKEY_MAINTEXT[Key_Maintext_Update].font_size, //Font
- cRGB( SELKEY_MAINTEXT[Key_Maintext_Update].text_RED ,SELKEY_MAINTEXT[Key_Maintext_Update].text_GREEN ,SELKEY_MAINTEXT[Key_Maintext_Update].text_BLUE ),
- 1, 1 );
- */
-
+
Key_Maintext_Update = -1;
}
@@ -170,11 +172,31 @@
if ( CDU_Status_Update == 1 )
{
-/*
- CDU_STATUS.stby_mode; // : 0 = operational mode, 1 = standby mode
-*/
+
+ if ( CDU_STATUS.stby_mode == 1 ) // : 0 = operational mode, 1 = standby mode
+ {
+ VGA_SELECT = 1; // : switch VGA off
+ CDU_SET_BGL_INTENSITY( 0 ); // : backlighting off
+ MSG = 0; // : indicators off
+ EXEC = 0;
+ FAIL = 0;
+ DSPY = 0;
+ OFST = 0;
+
+ }
+ else
+ {
+ VGA_SELECT = 0; // : switch VGA on
+ CDU_SET_BGL_INTENSITY( 100 ); // : backlighting on
+ MSG = CDU_STATUS.msg_indicator; // : restore indicators
+ EXEC = CDU_STATUS.exec_indicator;
+ FAIL = CDU_STATUS.fail_indicator;
+ DSPY = CDU_STATUS.dspy_indicator;
+ OFST = CDU_STATUS.ofst_indicator;
+ }
- if ( CDU_STATUS.backlight ) // Backlight control
+
+ if ( (CDU_STATUS.backlight) && (!CDU_STATUS.stby_mode) ) // Backlight control
{
CDU_SET_BGL_INTENSITY( 100 );
}
@@ -182,12 +204,13 @@
{
CDU_SET_BGL_INTENSITY( 0 );
}
+
// Set CDU indicators
- MSG = CDU_STATUS.msg_indicator;
- EXEC = CDU_STATUS.exec_indicator;
- FAIL = CDU_STATUS.fail_indicator;
- DSPY = CDU_STATUS.dspy_indicator;
- OFST = CDU_STATUS.ofst_indicator;
+ //MSG = CDU_STATUS.msg_indicator;
+ //EXEC = CDU_STATUS.exec_indicator;
+ //FAIL = CDU_STATUS.fail_indicator;
+ //DSPY = CDU_STATUS.dspy_indicator;
+ //OFST = CDU_STATUS.ofst_indicator;
CDU_Status_Update =0;
}
@@ -198,5 +221,5 @@
}
FSdata_received_flag = false; // : reset commomn FS data update flag = all updates ready <-------- !!!!
-
+}
}
\ No newline at end of file
