replaces CDU_Mbed_26
Dependencies: 4DGL MODSERIAL mbed mbos
Fork of CDU_Mbed_26 by
Revision 9:1e117310b481, committed 2014-07-20
- Comitter:
- LvdK
- Date:
- Sun Jul 20 18:48:19 2014 +0000
- Parent:
- 8:422544d24df3
- Commit message:
- 3 commands addes
Changed in this revision
--- a/FS2CDU_data_5.cpp Sun Jul 20 16:33:53 2014 +0000 +++ b/FS2CDU_data_5.cpp Sun Jul 20 18:48:19 2014 +0000 @@ -146,6 +146,10 @@ CDU_STATUS.exec_indicator = 0; CDU_STATUS.backlight = 0; CDU_STATUS.stby_mode = 0; + CDU_STATUS.fail_indicator = 0; + CDU_STATUS.dspy_indicator = 0; + CDU_STATUS.ofst_indicator = 0; + } void read_datafields(int command_number) { @@ -157,8 +161,7 @@ char ch; modified = false; - //CDU_OS.LockResource(FS_DATA_RESOURCE); // : lock FS database <<--- !! - + switch ( command_number ) { case 0: { // 0 is no valid commandnumber, do nothing @@ -524,12 +527,44 @@ break; } + case 10: // FAI command, FAIL indicator control CDU + { + // Get indicator status: + char_pntr = comma[1] + 1; // : set char pointer to char after comma 1 + if (string_received[char_pntr] == '0' || string_received[char_pntr] == '1') + { CDU_STATUS.fail_indicator = atoi(&string_received[char_pntr]); + CDU_Status_Update = 1; + } + break; + } + + case 11: // DPY command, DSPY indicator control CDU + { + // Get indicator status: + char_pntr = comma[1] + 1; // : set char pointer to char after comma 1 + if (string_received[char_pntr] == '0' || string_received[char_pntr] == '1') + { CDU_STATUS.dspy_indicator = atoi(&string_received[char_pntr]); + CDU_Status_Update = 1; + } + break; + } + + case 12: // OFS command, OFST indicator control CDU + { + // Get indicator status: + char_pntr = comma[1] + 1; // : set char pointer to char after comma 1 + if (string_received[char_pntr] == '0' || string_received[char_pntr] == '1') + { CDU_STATUS.ofst_indicator = atoi(&string_received[char_pntr]); + CDU_Status_Update = 1; + } + break; + } + default: { // unknown commandnumber ! break; } - } CDU_OS.SetEvent(FS_DATA_EVENT,CDU_DSP_CSS_TASK_ID); // : set event for CDU screen update task
--- a/USB_receive_5.cpp Sun Jul 20 16:33:53 2014 +0000 +++ b/USB_receive_5.cpp Sun Jul 20 18:48:19 2014 +0000 @@ -23,7 +23,7 @@ #define max_commas 10 // : max. nr of possible field separating commas in a valid message string to CDU int comma[max_commas]; // : array with positions of all found commas in string_receved[] -#define max_nr_of_commands 10 // : max nr of possible FS-to-CDU commands +#define max_nr_of_commands 13 // : max nr of possible FS-to-CDU commands // Define array of pointers to possible FS-to-CDU commands with 3 characters: const char *command[max_nr_of_commands] = { "123", // : no valid CDU command nr. 0 , used for debugging only @@ -36,6 +36,9 @@ "WTX", // : command nr. 7 "ETX", // : command nr. 8 "KTX", // : command nr. 9 + "FAI", // : command nr.10 + "DPY", // : command nr.11 + "OFS", // : command nr.12 }; void collect_FSdata() {
--- a/keyboard2.cpp Sun Jul 20 16:33:53 2014 +0000 +++ b/keyboard2.cpp Sun Jul 20 18:48:19 2014 +0000 @@ -1,6 +1,6 @@ /* File: keyboard2.cpp W. Braat */ /* Keyboard chip TCA8418 control */ - + #include "mbed.h" #include "MODSERIAL.h" #include "keyboard.h" @@ -29,7 +29,7 @@ //CDU background lighting AnalogIn BGL_POT( p16 ); //background light control potmeter PwmOut BGL_LED( p21 ); //PWM output background lighting - + // ---- added by LvdK : ----------------------------------------------------------- DigitalOut Key_led(LED2); // : LED 2 on Mbed board toggles when CDU key is pressed // -------------------------------------------------------------------------------- @@ -131,13 +131,13 @@ // set KEY_EVENT to wakeup SEND_KEYMESSAGE_TASK : CDU_OS.SetEvent(KEY_EVENT,SEND_KEYMESSAGE_TASK_ID ); } - + void CDU_KB_INT_START() { CDU_KB_INT.mode( PullUp ); //Keyboard chip pulls this line to 0 on a keypress CDU_KB_INT.fall(&SET_KEY_EVENT); //Bind function to handle interrupt } - + void CDU_SET_BGL_INTENSITY( int nVal=255 ) { //This routine must be called 5-10x per second. Manual test to see what is pleasant to see @@ -148,30 +148,37 @@ //nVal = 0 --> switch off backlight //nVal = 100 --> switch on backlight max + static int LightOn = 1; + switch (nVal) { case 0: { //switch off backlighting - BGL_LED.pulsewidth( 0.0 ); + BGL_LED = 0.0 ; + LightOn = 0; break; } case 100: { //switch on backlighting - BGL_LED.pulsewidth( 100.0 ); + BGL_LED = BGL_POT; + LightOn = 1; break; } case 255: { //calculate percentage from potmeter value - if ( BGL_POT < 0.01 ) + if ( LightOn == 1) { - BGL_LED = 0.0; //prevents flickering when low intensity - } - else - { - BGL_LED = BGL_POT; + if ( BGL_POT < 0.01 ) + { + BGL_LED = 0.0; //prevents flickering when low intensity + } + else + { + BGL_LED = BGL_POT; + } } } }