a

Dependencies:   BSP_DISCO_F429ZI LCD_DISCO_F429ZI TS_DISCO_F429ZI mbed

Files at this revision

API Documentation at this revision

Comitter:
pbl96
Date:
Mon Apr 24 15:30:35 2017 +0000
Commit message:
aa

Changed in this revision

BSP_DISCO_F429ZI.lib Show annotated file Show diff for this revision Revisions of this file
Keyboard_TS.cpp Show annotated file Show diff for this revision Revisions of this file
Keyboard_TS.h Show annotated file Show diff for this revision Revisions of this file
LCD_DISCO_F429ZI.lib Show annotated file Show diff for this revision Revisions of this file
Led_Lcd.cpp Show annotated file Show diff for this revision Revisions of this file
Led_Lcd.h Show annotated file Show diff for this revision Revisions of this file
TS_DISCO_F429ZI.lib 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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 3f46be5ac38a BSP_DISCO_F429ZI.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BSP_DISCO_F429ZI.lib	Mon Apr 24 15:30:35 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/teams/ST/code/BSP_DISCO_F429ZI/#de9280158372
diff -r 000000000000 -r 3f46be5ac38a Keyboard_TS.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Keyboard_TS.cpp	Mon Apr 24 15:30:35 2017 +0000
@@ -0,0 +1,31 @@
+#include "TS_DISCO_F429ZI.h"
+#include "Keyboard_TS.h"
+
+TS_DISCO_F429ZI ts;
+
+
+KeyboardTs::KeyboardTs() {
+    ts.Init(240,320);  
+    }
+    
+ enum KeyboardState KeyboardTs::eRead(void){
+    TS_StateTypeDef TS_State;
+    ts.GetState(&TS_State);
+    
+    if (TS_State.TouchDetected && TS_State.X<80 &&  TS_State.Y <80){
+        return BUTTON_0;
+    }
+    else if(TS_State.TouchDetected && TS_State.X<80 && TS_State.Y>=80 && TS_State.Y <160){
+        return BUTTON_1;
+    }
+    else if (TS_State.TouchDetected && TS_State.X<80 && TS_State.Y>=160 && TS_State.Y <240){
+        return BUTTON_2;
+    }
+    else if (TS_State.TouchDetected && TS_State.X<80 && TS_State.Y>=240 && TS_State.Y <320){
+        return BUTTON_3;
+    }
+    else{
+        return RELASED;
+    }
+}
+   
\ No newline at end of file
diff -r 000000000000 -r 3f46be5ac38a Keyboard_TS.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Keyboard_TS.h	Mon Apr 24 15:30:35 2017 +0000
@@ -0,0 +1,19 @@
+#ifndef KEYBOARD_TS_H
+#define KEYBOARD_TS_H
+
+
+enum KeyboardState{
+    RELASED,
+    BUTTON_0,
+    BUTTON_1,
+    BUTTON_2,
+    BUTTON_3};
+    
+class KeyboardTs{    
+public:
+    enum KeyboardState eRead();  
+    KeyboardTs();
+
+};
+    
+#endif
\ No newline at end of file
diff -r 000000000000 -r 3f46be5ac38a LCD_DISCO_F429ZI.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LCD_DISCO_F429ZI.lib	Mon Apr 24 15:30:35 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/teams/ST/code/LCD_DISCO_F429ZI/#dc55a068bc1a
diff -r 000000000000 -r 3f46be5ac38a Led_Lcd.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Led_Lcd.cpp	Mon Apr 24 15:30:35 2017 +0000
@@ -0,0 +1,57 @@
+#include "mbed.h"
+#include "Led_Lcd.h"
+
+LCD_DISCO_F429ZI lcd;
+
+void LedLcd::ButtonNoPushed(uint16_t x_pos,uint16_t y_pos, uint16_t width, uint16_t height){
+    lcd.SetTextColor(LCD_COLOR_GREEN);
+    lcd.DrawRect(x_pos,y_pos,width,height);
+    lcd.SetTextColor(LCD_COLOR_BLUE);
+    lcd.FillRect(x_pos+1,y_pos+1,width-1,height-1);
+    }
+void LedLcd::ButtonPushed(uint16_t x_pos,uint16_t y_pos, uint16_t width, uint16_t height) {
+    lcd.SetTextColor(LCD_COLOR_GREEN);
+    lcd.DrawRect(x_pos,y_pos,width,height);
+    lcd.SetTextColor(LCD_COLOR_GREEN);
+    lcd.FillRect(x_pos+1,y_pos+1,width-1,height-1);
+    }
+    
+void LedLcd::SetString(uint8_t x_pos,uint8_t y_pos,uint8_t *pText, Text_AlignModeTypdef mode) {
+    lcd.SetFont(&Font24);
+    lcd.SetTextColor(LCD_COLOR_WHITE);
+    lcd.SetBackColor(LCD_COLOR_RED);
+    lcd.DisplayStringAt(x_pos, y_pos,pText, mode);
+    }
+    
+LedLcd::LedLcd() {
+    lcd.Clear(LCD_COLOR_BLACK);
+    }
+    
+ void LedLcd::On(uint8_t ButtonNum) {
+    
+        ButtonNoPushed(0,0,80,80);
+        ButtonNoPushed(0,79,80,80);
+        ButtonNoPushed(0,159,80,80);
+        ButtonNoPushed(0,239,80,80); 
+        
+        if(ButtonNum==0) {
+           ButtonPushed(0,0,80,80); 
+            } 
+        else if(ButtonNum==1)  {
+            ButtonPushed(0,79,80,80);
+         }
+         else if(ButtonNum==2) {
+            ButtonPushed(0,159,80,80);
+             }    
+        else if(ButtonNum==3) {
+            ButtonPushed(0,239,80,80);
+            }
+            else if(ButtonNum==4) {
+                }
+        
+        SetString(0,0,(uint8_t *)"0",LEFT_MODE);
+        SetString(0,79,(uint8_t *)"1",LEFT_MODE);
+        SetString(0,159,(uint8_t *)"2",LEFT_MODE);  
+        SetString(0,239,(uint8_t *)"3",LEFT_MODE); 
+    }   
+    
\ No newline at end of file
diff -r 000000000000 -r 3f46be5ac38a Led_Lcd.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Led_Lcd.h	Mon Apr 24 15:30:35 2017 +0000
@@ -0,0 +1,19 @@
+#ifndef LED_LCD_H
+#define LED_LCD_H
+#include "LCD_DISCO_F429ZI.h"
+
+class LedLcd{
+    public:
+    void On(uint8_t ButtonNum);
+    LedLcd();
+    private:
+    void ButtonNoPushed(uint16_t x_pos,uint16_t y_pos, uint16_t width, uint16_t height);
+    void ButtonPushed(uint16_t x_pos,uint16_t y_pos, uint16_t width, uint16_t height);
+    void SetString(uint8_t x_pos,uint8_t y_pos,uint8_t *pText, Text_AlignModeTypdef mode);
+    
+    
+    };
+
+
+
+#endif
\ No newline at end of file
diff -r 000000000000 -r 3f46be5ac38a TS_DISCO_F429ZI.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TS_DISCO_F429ZI.lib	Mon Apr 24 15:30:35 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/teams/ST/code/TS_DISCO_F429ZI/#4f8b6df8e235
diff -r 000000000000 -r 3f46be5ac38a main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Apr 24 15:30:35 2017 +0000
@@ -0,0 +1,40 @@
+#include "mbed.h"
+#include "Keyboard_TS.h"
+#include "Led_Lcd.h"
+
+int main()
+
+{
+    LedLcd Led;
+    KeyboardTs Keyboard;
+
+    while(1) {
+
+        switch(Keyboard.eRead()) {
+            case BUTTON_0:
+                Led.On(0);
+                break;
+
+            case BUTTON_1:
+                Led.On(1);
+                break;
+
+            case BUTTON_2:
+                Led.On(2);
+                break;
+
+            case BUTTON_3:
+                Led.On(3);
+                break;
+                
+            default :
+                Led.On(4);
+                break;
+
+        }
+
+        wait(0.1);
+
+    }
+
+}
\ No newline at end of file
diff -r 000000000000 -r 3f46be5ac38a mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Apr 24 15:30:35 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/mbed_official/code/mbed/builds/856d2700e60b
\ No newline at end of file