replaces CDU_Mbed_26

Dependencies:   4DGL MODSERIAL mbed mbos

Fork of CDU_Mbed_26 by Engravity-CDU

Files at this revision

API Documentation at this revision

Comitter:
WillemBraat
Date:
Tue Aug 26 14:18:39 2014 +0000
Parent:
16:3c251cf29501
Commit message:
All pin-definitions are driven by pins.h

Changed in this revision

display.cpp Show annotated file Show diff for this revision Revisions of this file
keyboard2.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
pins.h Show annotated file Show diff for this revision Revisions of this file
--- a/display.cpp	Tue Aug 26 14:02:48 2014 +0000
+++ b/display.cpp	Tue Aug 26 14:18:39 2014 +0000
@@ -3,9 +3,11 @@
 #include "TFT_4DGL.h"
 #include "display.h"
 #include <string>
+#include "pins.h"
 using namespace std;
-DigitalOut VGA_SOURCE( p7 ); //control line for video switch between INT and EXT video
-DigitalOut VGA_SELECT( p8 ); //control line to select/deselect video switch
+
+DigitalOut VGA_SOURCE( VGA_SOURCE_SELECT ); //control line for video switch between INT and EXT video
+DigitalOut VGA_SELECT( VGA_ON_OFF ); //control line to select/deselect video switch
 /*
 =====================================================
 SGC (Serial Graphics Controller) PLATFORM OUTPUT FILE
@@ -86,8 +88,10 @@
  Maximum length is 24 characters, minimum length is 1 character for font F0
 Maximum length is 48 characters, minumum length is 1 character for font F1.
 */
+
 //Control lines for VGA driver board
-TFT_4DGL display(p13,p14,p15); // serial tx, serial rx, reset pin
+TFT_4DGL display(VGA_TX,VGA_RX,VGA_RESET); // serial tx, serial rx, reset pin
+
 //Character & String functions
 char* str2char( string cString ) //convert a string to a character array
     {
--- a/keyboard2.cpp	Tue Aug 26 14:02:48 2014 +0000
+++ b/keyboard2.cpp	Tue Aug 26 14:18:39 2014 +0000
@@ -6,6 +6,7 @@
 #include "keyboard.h"
 #include "mbos.h"
 #include "mbos_def2.h"
+#include "pins.h"
  
 const int CDU_KB_ADRS  = 0x68;  //Base address TCA8418 keypad scanner
 const int I2C_ACK  = 0x00;
@@ -16,22 +17,22 @@
 extern MODSERIAL SERIAL_DEBUG;
  
 //CDU Keyboard communications KEYBOARD_INT
-InterruptIn CDU_KB_INT( p5 );  //Set CDU keyboard interrupt line
-I2C CDU_I2C(p28, p27);         //I2C bus for keyboard/temp chip.
+InterruptIn CDU_KB_INT( KBD_INT );  //Set CDU keyboard interrupt line
+I2C CDU_I2C(I2C_SDA, I2C_SCL);         //I2C bus for keyboard/temp chip.
  
 //CDU Keyboard LEDS
-DigitalOut EXEC( p12 );
-DigitalOut FAIL( p17 );
-DigitalOut DSPY( p18 ); 
-DigitalOut  MSG( p19 );
-DigitalOut OFST( p20 );
+DigitalOut EXEC( LED_EXEC );
+DigitalOut FAIL( LED_FAIL );
+DigitalOut DSPY( LED_DSPY ); 
+DigitalOut  MSG( LED_MSG  );
+DigitalOut OFST( LED_OFST );
  
 //CDU background lighting
-AnalogIn BGL_POT( p16 ); //background light control potmeter
-PwmOut BGL_LED( p21 );   //PWM output background lighting
+AnalogIn BGL_POT( BACKLIGHT_SET ); //background light control potmeter
+PwmOut BGL_LED( BACKLIGHT_DRIVE );   //PWM output background lighting
 
 // ---- added by LvdK : -----------------------------------------------------------
-DigitalOut Key_led(LED2); // : LED 2 on Mbed board toggles when CDU key is pressed
+DigitalOut Key_led( KEY_PRESSED ); // : LED 2 on Mbed board toggles when CDU key is pressed
 // --------------------------------------------------------------------------------
  
 void CDU_KB_COMM_INIT()
--- a/main.cpp	Tue Aug 26 14:02:48 2014 +0000
+++ b/main.cpp	Tue Aug 26 14:18:39 2014 +0000
@@ -7,17 +7,18 @@
 #include "MODSERIAL.h"
 #include "mbos.h"
 #include "mbos_def2.h"   // : Mbos tasks, timer and resource definitions
+#include "pins.h"
 
 // Setup USB communication defined by Mbed USB TX and RX lines
 // with TX and RX ringbuffers :
 MODSERIAL USB(USBTX, USBRX, 256, 1024);
-DigitalOut alive_led(LED1); // : LED 1 on Mbed board toggles when CDU is alive
+DigitalOut alive_led( HEARTBEAT ); // : LED 1 on Mbed board toggles when CDU is alive
 
 //void test_update_flags(); // << for testing only << !!!!!!!
 
 // --- Debug only ----------------------------------------
 // extra serial port to show debug info :
-  MODSERIAL SERIAL_DEBUG(p9, p10, 512, 64);  //: tx, rx
+  MODSERIAL SERIAL_DEBUG(MODSERIAL_TX, MODSERIAL_RX, 512, 64);  //: tx, rx
 // -------------------------------------------------------
 
 int CDU_FS_interface = 0;   // : defines interface to FS: 0 = USB, 1 = Ethernet
--- a/pins.h	Tue Aug 26 14:02:48 2014 +0000
+++ b/pins.h	Tue Aug 26 14:18:39 2014 +0000
@@ -1,3 +1,7 @@
+#define HW_VERSION_1
+
+
+
 #ifdef HW_VERSION_1
     //NOTE: THESE PIN DEFINITIONS ARE FOR HARDWARE VERSION 1.0
     //
@@ -6,7 +10,7 @@
     //*********************************
     //MODSERIAL SERIAL_DEBUG(p9, p10, 512, 64);  //: tx, rx
     #define MODSERIAL_TX        p9
-    #define MODESERIAL_RX       p10
+    #define MODSERIAL_RX       p10
     //DigitalOut alive_led(LED1); // : LED 1 on Mbed board toggles when CDU is alive
     #define HEARTBEAT           LED1
 
@@ -31,8 +35,8 @@
     //InterruptIn CDU_KB_INT( p5 );  //Set CDU keyboard interrupt line
     //I2C CDU_I2C(p28, p27);         //I2C bus for keyboard/temp chip.
     #define KBD_INT             p5
-    #define KBD_TMP_SDA         p28
-    #define KBD_TMP_SCL         p27
+    #define I2C_SDA             p28
+    #define I2C_SCL             p27
 
     //CDU Keyboard LEDS
     #define LED_EXEC            p12