Modifications in 4DGL library. Added CDU_hw_sw.h for version info. Added pins.h for hardware pin remapping
Dependencies: 4DGL-UC MODSERIAL mbed mbos
Fork of CDU_Mbed_30 by
CDU_Maintenance.cpp@21:f348e6f0f7d4, 2014-10-10 (annotated)
- Committer:
- WillemBraat
- Date:
- Fri Oct 10 18:23:36 2014 +0000
- Revision:
- 21:f348e6f0f7d4
Additional files: CDU_Maintenance.cpp / mbps_def3.h
; Rewrite of main() function for power checks
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
WillemBraat | 21:f348e6f0f7d4 | 1 | /****************************************************************************/ |
WillemBraat | 21:f348e6f0f7d4 | 2 | /* This file contains entry points to setup and test procedures for the CDU */ |
WillemBraat | 21:f348e6f0f7d4 | 3 | /* Prerequisitions: */ |
WillemBraat | 21:f348e6f0f7d4 | 4 | /* 1. S-EXEC flag must be set to avoid interference from fs communications */ |
WillemBraat | 21:f348e6f0f7d4 | 5 | /* 2. Keyboard interrupt routine must be redefined */ |
WillemBraat | 21:f348e6f0f7d4 | 6 | /****************************************************************************/ |
WillemBraat | 21:f348e6f0f7d4 | 7 | |
WillemBraat | 21:f348e6f0f7d4 | 8 | #include "mbed.h" |
WillemBraat | 21:f348e6f0f7d4 | 9 | #include "TFT_4DGL.h" |
WillemBraat | 21:f348e6f0f7d4 | 10 | #include "display.h" |
WillemBraat | 21:f348e6f0f7d4 | 11 | |
WillemBraat | 21:f348e6f0f7d4 | 12 | #include <string> |
WillemBraat | 21:f348e6f0f7d4 | 13 | using namespace std; |
WillemBraat | 21:f348e6f0f7d4 | 14 | |
WillemBraat | 21:f348e6f0f7d4 | 15 | void CDU_ScreenAlign(); |
WillemBraat | 21:f348e6f0f7d4 | 16 | void CDU_displayclear(); |
WillemBraat | 21:f348e6f0f7d4 | 17 | void ExitKey( string cTitleText ); |
WillemBraat | 21:f348e6f0f7d4 | 18 | |
WillemBraat | 21:f348e6f0f7d4 | 19 | extern TFT_4DGL display; |
WillemBraat | 21:f348e6f0f7d4 | 20 | //extern void CDU_KB_INT_DISABLE(); //disable keyhandler and start internal keyhandler |
WillemBraat | 21:f348e6f0f7d4 | 21 | extern int key_hit_ID; |
WillemBraat | 21:f348e6f0f7d4 | 22 | |
WillemBraat | 21:f348e6f0f7d4 | 23 | //int righttext( string cString, int nChars, int nCharWidth ) |
WillemBraat | 21:f348e6f0f7d4 | 24 | //int centertext( string cString, int nChars, int nCharWidth ) |
WillemBraat | 21:f348e6f0f7d4 | 25 | extern char* str2char( string cString ); |
WillemBraat | 21:f348e6f0f7d4 | 26 | extern int righttext( string cString, int nChars, int nCharWidth ); |
WillemBraat | 21:f348e6f0f7d4 | 27 | extern int centertext( string cString, int nChars, int nCharWidth ); |
WillemBraat | 21:f348e6f0f7d4 | 28 | |
WillemBraat | 21:f348e6f0f7d4 | 29 | |
WillemBraat | 21:f348e6f0f7d4 | 30 | void CDU_Maint() |
WillemBraat | 21:f348e6f0f7d4 | 31 | // Main selection screen SETUP and MAINT |
WillemBraat | 21:f348e6f0f7d4 | 32 | { |
WillemBraat | 21:f348e6f0f7d4 | 33 | ExitKey( "CDU MAINTENANCE"); |
WillemBraat | 21:f348e6f0f7d4 | 34 | display.graphic_string( str2char( "< SETUP" ), 0, LINE3, FONT_24X34, WHITE, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 35 | display.graphic_string( str2char( "LIGHT TEST >" ), righttext( "LIGHT TEST >", 24,24) , LINE3, FONT_24X34, WHITE, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 36 | display.graphic_string( str2char( "KEYBOARD TEST >" ), righttext( "KEYBOARD TEST >", 24,24) , LINE5, FONT_24X34, WHITE, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 37 | display.graphic_string( str2char( "FIRMWARE >" ), righttext( "FIRMWARE >", 24,24) , LINE9, FONT_24X34, WHITE, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 38 | } |
WillemBraat | 21:f348e6f0f7d4 | 39 | |
WillemBraat | 21:f348e6f0f7d4 | 40 | //Setup screens |
WillemBraat | 21:f348e6f0f7d4 | 41 | void CDU_Setup() |
WillemBraat | 21:f348e6f0f7d4 | 42 | { |
WillemBraat | 21:f348e6f0f7d4 | 43 | ExitKey( "CDU SETUP" ); |
WillemBraat | 21:f348e6f0f7d4 | 44 | display.graphic_string( str2char( "< USB" ), 0, LINE3, FONT_24X34, WHITE, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 45 | display.graphic_string( str2char( "< ETHERNET" ), 0, LINE5, FONT_24X34, WHITE, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 46 | display.graphic_string( str2char( "DISPLAY SOURCE >" ), righttext( "DISPLAY SOURCE >", 24,24) , LINE9, FONT_24X34, WHITE, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 47 | } |
WillemBraat | 21:f348e6f0f7d4 | 48 | |
WillemBraat | 21:f348e6f0f7d4 | 49 | |
WillemBraat | 21:f348e6f0f7d4 | 50 | void CDU_USB_Setup() |
WillemBraat | 21:f348e6f0f7d4 | 51 | { |
WillemBraat | 21:f348e6f0f7d4 | 52 | ExitKey( "CDU USB SETUP" ); |
WillemBraat | 21:f348e6f0f7d4 | 53 | display.graphic_string( str2char( "< BAUDRATE" ), 0, LINE3, FONT_24X34, WHITE, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 54 | display.graphic_string( str2char( "< DATABITS" ), 0, LINE5, FONT_24X34, WHITE, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 55 | display.graphic_string( str2char( "< PARITY" ), 0, LINE7, FONT_24X34, WHITE, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 56 | display.graphic_string( str2char( "< STOPBITS" ), 0, LINE9, FONT_24X34, WHITE, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 57 | } |
WillemBraat | 21:f348e6f0f7d4 | 58 | |
WillemBraat | 21:f348e6f0f7d4 | 59 | void CDU_Ethernet_Setup() |
WillemBraat | 21:f348e6f0f7d4 | 60 | { |
WillemBraat | 21:f348e6f0f7d4 | 61 | ExitKey( "CDU ETHERNET SETUP" ); |
WillemBraat | 21:f348e6f0f7d4 | 62 | display.graphic_string( str2char( "< AUTO IP" ), 0, LINE3, FONT_24X34, WHITE, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 63 | display.graphic_string( str2char( "< IP ADDRESS" ), 0, LINE5, FONT_24X34, WHITE, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 64 | display.graphic_string( str2char( "< GATEWAY" ), 0, LINE7, FONT_24X34, WHITE, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 65 | display.graphic_string( str2char( "< MAC ADDRESS" ), 0, LINE9, FONT_24X34, WHITE, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 66 | |
WillemBraat | 21:f348e6f0f7d4 | 67 | } |
WillemBraat | 21:f348e6f0f7d4 | 68 | |
WillemBraat | 21:f348e6f0f7d4 | 69 | |
WillemBraat | 21:f348e6f0f7d4 | 70 | void CDU_Source_Setup() |
WillemBraat | 21:f348e6f0f7d4 | 71 | { |
WillemBraat | 21:f348e6f0f7d4 | 72 | ExitKey( "CDU VIDEO SOURCE" ); |
WillemBraat | 21:f348e6f0f7d4 | 73 | display.graphic_string( str2char( "< INTERNAL" ), 0, LINE3, FONT_24X34, WHITE, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 74 | display.graphic_string( str2char( "EXTERNAL >" ), righttext( "EXTERNAL >", 24,24) , LINE3, FONT_24X34, WHITE, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 75 | } |
WillemBraat | 21:f348e6f0f7d4 | 76 | |
WillemBraat | 21:f348e6f0f7d4 | 77 | |
WillemBraat | 21:f348e6f0f7d4 | 78 | |
WillemBraat | 21:f348e6f0f7d4 | 79 | //Maintenance screens |
WillemBraat | 21:f348e6f0f7d4 | 80 | |
WillemBraat | 21:f348e6f0f7d4 | 81 | void CDU_FW_Update() |
WillemBraat | 21:f348e6f0f7d4 | 82 | { |
WillemBraat | 21:f348e6f0f7d4 | 83 | ExitKey( "FIRMWARE UPDATE" ); |
WillemBraat | 21:f348e6f0f7d4 | 84 | display.graphic_string( str2char( "REBOOT CDU >" ), righttext( "REBOOT CDU >", 24,24) , LINE3, FONT_24X34, WHITE, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 85 | } |
WillemBraat | 21:f348e6f0f7d4 | 86 | |
WillemBraat | 21:f348e6f0f7d4 | 87 | void CDU_LightTest() |
WillemBraat | 21:f348e6f0f7d4 | 88 | { |
WillemBraat | 21:f348e6f0f7d4 | 89 | ExitKey( "CDU LIGHT TEST" ); |
WillemBraat | 21:f348e6f0f7d4 | 90 | display.graphic_string( str2char( "< BACKLIGHT" ), 0, LINE3, FONT_24X34, WHITE, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 91 | display.graphic_string( str2char( "*=ON" ), centertext( "*=ON", 24, 24 ), LINE2, FONT_24X34, WHITE, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 92 | display.graphic_string( str2char( "----ANNUNCIATOR TEST----" ), 0, LINE4, FONT_24X34, WHITE, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 93 | |
WillemBraat | 21:f348e6f0f7d4 | 94 | display.graphic_string( str2char( "< DSP" ), 0, LINE7, FONT_24X34, RED, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 95 | display.graphic_string( str2char( "< FAIL" ), 0, LINE9, FONT_24X34, RED, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 96 | |
WillemBraat | 21:f348e6f0f7d4 | 97 | display.graphic_string( str2char( "EXEC >" ), righttext( "EXEC >", 24,24) , LINE5, FONT_24X34, GREEN, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 98 | display.graphic_string( str2char( "MSG >" ), righttext( "MSG >", 24,24) , LINE7, FONT_24X34, YELLOW, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 99 | display.graphic_string( str2char( "OFST >" ), righttext( "OFST >", 24,24) , LINE9, FONT_24X34, YELLOW, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 100 | } |
WillemBraat | 21:f348e6f0f7d4 | 101 | |
WillemBraat | 21:f348e6f0f7d4 | 102 | void CDU_KeyboardTest() |
WillemBraat | 21:f348e6f0f7d4 | 103 | { |
WillemBraat | 21:f348e6f0f7d4 | 104 | ExitKey( "CDU KEYBOARD TEST"); |
WillemBraat | 21:f348e6f0f7d4 | 105 | display.graphic_string( str2char( "KEYSCAN CODE: " ), 0, LINE6, FONT_24X34, WHITE, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 106 | display.graphic_string( str2char( "FS KEY VALUE: " ), 0, LINE7, FONT_24X34, WHITE, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 107 | display.graphic_string( str2char( "PRESS 2x [EXEC]" ), 6, LINE12, FONT_24X34, WHITE, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 108 | } |
WillemBraat | 21:f348e6f0f7d4 | 109 | |
WillemBraat | 21:f348e6f0f7d4 | 110 | void ExitKey( string cTitleText ) |
WillemBraat | 21:f348e6f0f7d4 | 111 | { |
WillemBraat | 21:f348e6f0f7d4 | 112 | //clear screen and place exit text |
WillemBraat | 21:f348e6f0f7d4 | 113 | CDU_displayclear(); |
WillemBraat | 21:f348e6f0f7d4 | 114 | display.graphic_string( str2char( cTitleText ), centertext( cTitleText, 24, 24 ), LINE1, FONT_24X34, WHITE, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 115 | display.graphic_string( str2char( "< EXIT" ), 0, LINE13, FONT_24X34, WHITE, 2, 2 ); |
WillemBraat | 21:f348e6f0f7d4 | 116 | } |
WillemBraat | 21:f348e6f0f7d4 | 117 | |
WillemBraat | 21:f348e6f0f7d4 | 118 | //Show all setup screens |
WillemBraat | 21:f348e6f0f7d4 | 119 | |
WillemBraat | 21:f348e6f0f7d4 | 120 | void CDU_Screens() |
WillemBraat | 21:f348e6f0f7d4 | 121 | { |
WillemBraat | 21:f348e6f0f7d4 | 122 | CDU_Maint(); |
WillemBraat | 21:f348e6f0f7d4 | 123 | wait_ms( 4000 ); |
WillemBraat | 21:f348e6f0f7d4 | 124 | |
WillemBraat | 21:f348e6f0f7d4 | 125 | CDU_Setup(); |
WillemBraat | 21:f348e6f0f7d4 | 126 | wait_ms( 4000 ); |
WillemBraat | 21:f348e6f0f7d4 | 127 | |
WillemBraat | 21:f348e6f0f7d4 | 128 | CDU_USB_Setup(); |
WillemBraat | 21:f348e6f0f7d4 | 129 | wait_ms( 4000 ); |
WillemBraat | 21:f348e6f0f7d4 | 130 | |
WillemBraat | 21:f348e6f0f7d4 | 131 | CDU_Ethernet_Setup(); |
WillemBraat | 21:f348e6f0f7d4 | 132 | wait_ms( 4000 ); |
WillemBraat | 21:f348e6f0f7d4 | 133 | |
WillemBraat | 21:f348e6f0f7d4 | 134 | CDU_Source_Setup(); |
WillemBraat | 21:f348e6f0f7d4 | 135 | wait_ms( 4000 ); |
WillemBraat | 21:f348e6f0f7d4 | 136 | |
WillemBraat | 21:f348e6f0f7d4 | 137 | CDU_LightTest(); |
WillemBraat | 21:f348e6f0f7d4 | 138 | wait_ms( 4000); |
WillemBraat | 21:f348e6f0f7d4 | 139 | |
WillemBraat | 21:f348e6f0f7d4 | 140 | CDU_KeyboardTest(); |
WillemBraat | 21:f348e6f0f7d4 | 141 | wait_ms( 4000 ); |
WillemBraat | 21:f348e6f0f7d4 | 142 | |
WillemBraat | 21:f348e6f0f7d4 | 143 | CDU_FW_Update(); |
WillemBraat | 21:f348e6f0f7d4 | 144 | wait_ms( 4000 ); |
WillemBraat | 21:f348e6f0f7d4 | 145 | |
WillemBraat | 21:f348e6f0f7d4 | 146 | } |