Anna Malcharek / Mbed 2 deprecated 2d

Dependencies:   LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI

Files at this revision

API Documentation at this revision

Comitter:
amalcharek
Date:
Sat May 16 11:47:20 2020 +0000
Commit message:
bblabla; ;

Changed in this revision

BSP_DISCO_F429ZI.lib Show annotated file Show diff for this revision Revisions of this file
KeyboardTsLcd.cpp Show annotated file Show diff for this revision Revisions of this file
KeyboardTsLcd.h 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BSP_DISCO_F429ZI.lib	Sat May 16 11:47:20 2020 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/ST/code/BSP_DISCO_F429ZI/#53d9067a4feb
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/KeyboardTsLcd.cpp	Sat May 16 11:47:20 2020 +0000
@@ -0,0 +1,31 @@
+#include "mbed.h"
+#include "KeyboardTsLcd.h"
+
+KeyboardTsLcd::KeyboardTsLcd(unsigned char _ucColumn)
+{
+    pKeyboard = new KeyboardTs(_ucColumn);
+    pLed = new LedLcd(_ucColumn);
+    
+}
+    
+    enum KeyboardState KeyboardTsLcd::eRead(){
+        
+        switch(pKeyboard->eRead()) {
+            case BUTTON_0:
+                pLed->On(0);
+                return BUTTON_0;
+            case BUTTON_1:
+                pLed->On(1);
+                return BUTTON_1;
+            case BUTTON_2:
+                pLed->On(2);
+                return BUTTON_2;
+            case BUTTON_3:
+                pLed->On(3);
+                return BUTTON_3;
+            default :
+                pLed->On(4);
+                return NO_BUTTON;
+        }
+        }
+    
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/KeyboardTsLcd.h	Sat May 16 11:47:20 2020 +0000
@@ -0,0 +1,15 @@
+#ifndef KEYBOARD_TS_LCD_H
+#define KEYBOARD_TS_LCD_H
+#include "Keyboard_Ts.h"
+#include "Led_Lcd.h"
+
+class KeyboardTsLcd{
+    public:
+        KeyboardTsLcd(unsigned char);
+        enum KeyboardState eRead();
+    private:
+        KeyboardTs *pKeyboard;
+        LedLcd *pLed;
+};
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Keyboard_Ts.cpp	Sat May 16 11:47:20 2020 +0000
@@ -0,0 +1,36 @@
+#include "Keyboard_Ts.h"
+
+#include "TS_DISCO_F429ZI.h"
+TS_DISCO_F429ZI ts;
+TS_StateTypeDef TS_State;
+
+KeyboardTs::KeyboardTs(unsigned char x){
+    ColumnXPos = x*80;
+    }
+
+enum KeyboardState KeyboardTs::eRead(){
+    
+    ts.GetState(&TS_State);
+    
+    if (TS_State.TouchDetected){
+        
+        if(((TS_State.X)>ColumnXPos) && ((TS_State.X)<ColumnXPos+80)){
+            
+            if(((TS_State.Y)>0)&&((TS_State.Y)<80)){
+                return BUTTON_0;
+            }
+            else if(((TS_State.Y)>81) && ((TS_State.Y)<160)){
+                return BUTTON_1;
+            } 
+            else if(((TS_State.Y)>161) && ((TS_State.Y)<240)){
+                return BUTTON_2;
+            } 
+            else if(((TS_State.Y)>241) && ((TS_State.Y)<320)){
+                return BUTTON_3;
+            }
+        }
+    } 
+    return NO_BUTTON;
+ }
+
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Keyboard_Ts.h	Sat May 16 11:47:20 2020 +0000
@@ -0,0 +1,19 @@
+#ifndef KEYBOARD_TS_H
+#define KEYBOARD_TS_H
+
+enum KeyboardState{
+    BUTTON_0,
+    BUTTON_1,
+    BUTTON_2,
+    BUTTON_3,
+    NO_BUTTON};
+    
+class KeyboardTs{
+    public:
+        enum KeyboardState eRead();
+        KeyboardTs(unsigned char x = 0);
+    private:
+        unsigned char ColumnXPos;
+};
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LCD_DISCO_F429ZI.lib	Sat May 16 11:47:20 2020 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/ST/code/LCD_DISCO_F429ZI/#dc55a068bc1a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Led_Lcd.cpp	Sat May 16 11:47:20 2020 +0000
@@ -0,0 +1,54 @@
+#include "Led_Lcd.h"
+
+#include "LCD_DISCO_F429ZI.h"
+LCD_DISCO_F429ZI lcd;
+
+LedLcd::LedLcd(unsigned char x){
+    lcd.Clear(LCD_COLOR_BLACK);
+    LEDXPOS = x*80;
+    
+}    
+
+void LedLcd::On(unsigned char ucLedIndex){
+    
+    lcd.SetTextColor(LCD_COLOR_BLUE);
+    lcd.FillRect(LEDXPOS, 0, 80, 320);
+    
+    lcd.SetTextColor(LCD_COLOR_YELLOW);
+    lcd.FillRect(LEDXPOS, ucLedIndex*80, 79, 79);
+   /* switch(ucLedIndex){
+        case 0:
+            lcd.FillRect(0, 0, 79, 79);
+        break;
+        case 1:
+            lcd.FillRect(0, 81, 79, 79);
+        break;
+        case 2:
+            lcd.FillRect(0, 161, 79, 79);
+        break;
+        case 3:
+            lcd.FillRect(0, 241, 79, 79);
+        break;
+        
+    
+        default:
+        break;
+        
+    } */
+        lcd.SetTextColor(LCD_COLOR_GREEN);
+        lcd.DrawRect(LEDXPOS, 0, 79, 79);
+        lcd.DrawRect(LEDXPOS, 80, 79, 79);
+        lcd.DrawRect(LEDXPOS, 160, 79, 79);
+        lcd.DrawRect(LEDXPOS, 240, 79, 79);
+    
+        BSP_LCD_SetFont(&Font24);
+        lcd.SetBackColor(LCD_COLOR_RED);
+        lcd.SetTextColor(LCD_COLOR_WHITE);
+        lcd.DisplayStringAt(LEDXPOS + 1, 1, (uint8_t *)"1", LEFT_MODE);
+        lcd.DisplayStringAt(LEDXPOS + 1, 81, (uint8_t *)"2", LEFT_MODE);
+        lcd.DisplayStringAt(LEDXPOS + 1, 161, (uint8_t *)"3", LEFT_MODE);
+        lcd.DisplayStringAt(LEDXPOS + 1, 241, (uint8_t *)"4", LEFT_MODE);
+        
+
+    
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Led_Lcd.h	Sat May 16 11:47:20 2020 +0000
@@ -0,0 +1,12 @@
+#ifndef LED_LCD_H
+#define LED_LCD_H
+
+class LedLcd{
+    public:
+        LedLcd(unsigned char x = 0);
+        void On(unsigned char ucLedIndex);
+    private:
+        unsigned char LEDXPOS;
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TS_DISCO_F429ZI.lib	Sat May 16 11:47:20 2020 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/ST/code/TS_DISCO_F429ZI/#4f8b6df8e235
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat May 16 11:47:20 2020 +0000
@@ -0,0 +1,11 @@
+#include "mbed.h"
+#include "KeyboardTsLcd.h"
+
+int main()
+{
+    KeyboardTsLcd Keyboard(1);
+    while(1){
+        Keyboard.eRead();
+        wait(0.1);
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat May 16 11:47:20 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file