Now you can use NC as InterruptIn

Dependencies:   X_NUCLEO_COMMON

Fork of X_NUCLEO_6180XA1 by ST

Revision:
33:1573db91352c
Parent:
28:7c9031e96c22
Child:
34:5bcffb4c5b47
diff -r ef97c377d27b -r 1573db91352c Components/Display/Display_class.h
--- a/Components/Display/Display_class.h	Tue Nov 10 10:46:15 2015 +0000
+++ b/Components/Display/Display_class.h	Tue Nov 17 17:15:47 2015 +0100
@@ -47,7 +47,11 @@
 extern "C" {
 #endif
 
-#define FAST_DISPLAY
+#define DISPLAY_USING_STMPE1600  	
+	
+#ifndef DISPLAY_USING_STMPE1600
+#define FAST_DISPLAY   // fast quick and dirty display to speed up
+#endif	
 
 #define DP  (1<<7)
 #define NOT_7_NO_DP( ... ) (uint8_t) ~( __VA_ARGS__ + DP )
@@ -155,7 +159,8 @@
 /* Classes -------------------------------------------------------------------*/
 /** Class representing Display
  */ 
- 
+#ifndef DISPLAY_USING_STMPE1600
+
 class Display
 {
  public:
@@ -356,6 +361,82 @@
     DevI2C &dev_i2c; 		
 };
 
+#else  // defined DISPLAY_USING_STMPE1600
+
+class Display
+{
+ public:
+ 
+ Display(STMPE1600 &stmpe_1600) : stmpe1600(stmpe_1600) {
+	 stmpe1600.setGPIOdir (GPIO_7,  OUTPUT);  // Digit1	 
+	 stmpe1600.setGPIOdir (GPIO_8,  OUTPUT);  // Digit2	 
+	 stmpe1600.setGPIOdir (GPIO_9,  OUTPUT);  // Digit3	 
+	 stmpe1600.setGPIOdir (GPIO_10, OUTPUT);  // Digit4	 	 
+	 
+	 stmpe1600.setGPIOdir (GPIO_0,  OUTPUT);  // Digit4	 	 	 
+	 stmpe1600.setGPIOdir (GPIO_1,  OUTPUT);  // Digit4	 	 	 	 
+	 stmpe1600.setGPIOdir (GPIO_2,  OUTPUT);  // Digit4	 	 	 
+	 stmpe1600.setGPIOdir (GPIO_3,  OUTPUT);  // Digit4	 	 	 
+	 stmpe1600.setGPIOdir (GPIO_4,  OUTPUT);  // Digit4	 	 	 
+	 stmpe1600.setGPIOdir (GPIO_5,  OUTPUT);  // Digit4	 	 	 
+	 stmpe1600.setGPIOdir (GPIO_6,  OUTPUT);  // Digit4	 	 	 
+	 	 
+ }
+
+     void DisplayString (char str[4], char strlen)
+    {
+       int i, dgt;
+       const char *pc;
+       uint8_t data[2];
+       uint16_t *pdata = (uint16_t*)data;				
+			
+       for(i=0, dgt=4-strlen, pc=str; i<strlen && *pc!=0; i++, pc++, dgt++)
+       {
+          _V2_Set7Segment( ascii_to_display_lut[(uint8_t)*pc], dgt);
+          if( *(pc+1)== '.')
+          {
+             pc++;
+          }
+          wait_ms(DISPLAY_DELAY);					
+					stmpe1600.read16bitReg(GPSR_0_7, pdata);
+          *pdata = *pdata | (uint16_t)0x0780;				// all digits off
+					stmpe1600.write16bitReg(GPSR_0_7, pdata);
+       }						
+			
+		}
+ 
+    void _V2_Set7Segment( int Leds, int digit )
+    {
+       //Digits_off();
+       uint16_t dgt;
+       dgt = 1<<digit;
+       dgt = ((uint16_t)dgt)<<7;
+       dgt = ~dgt;	
+       uint8_t data[2];
+       uint16_t *pdata = (uint16_t*)data;			 
+
+		 
+       /* set the exppinname state to lvl */
+			 stmpe1600.read16bitReg(GPSR_0_7, pdata);
+       *pdata = *pdata  | (uint16_t)0x007F;      // 7 segments off
+			 stmpe1600.write16bitReg(GPSR_0_7, pdata);
+		 
+       int mask=1;
+       for (int i=0; i<7; i++) 
+       { 
+          if (Leds & mask) *pdata = *pdata & ~(uint16_t)mask;  
+          mask = mask<<1;
+       }		 
+       *pdata = *pdata & dgt;
+			 stmpe1600.write16bitReg(GPSR_0_7, pdata);
+   }		
+		
+  private:
+		STMPE1600 &stmpe1600;
+ 
+};
+#endif
+
 #ifdef __cplusplus
 }
 #endif