AGH PPO MBED cz.I

Dependencies:   LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI

Files at this revision

API Documentation at this revision

Comitter:
kasruk11
Date:
Sat May 09 18:21:16 2020 +0000
Commit message:
09.05.2020

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
Keyboard_TsLcd.cpp Show annotated file Show diff for this revision Revisions of this file
Keyboard_TsLcd.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 2101f3b06f18 BSP_DISCO_F429ZI.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BSP_DISCO_F429ZI.lib	Sat May 09 18:21:16 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/ST/code/BSP_DISCO_F429ZI/#53d9067a4feb
diff -r 000000000000 -r 2101f3b06f18 Keyboard_Ts.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Keyboard_Ts.cpp	Sat May 09 18:21:16 2020 +0000
@@ -0,0 +1,28 @@
+#include "Keyboard_Ts.h"
+
+KeyboardTs::KeyboardTs(unsigned char ColumnNumber){
+    Column = ColumnNumber;
+    }
+
+enum KeyboardState KeyboardTs::eRead(){
+    
+    TS_StateTypeDef TS_State;
+    GetState(&TS_State);
+    
+    if((TS_State.TouchDetected) && (TS_State.X > (80 * Column)) && (TS_State.X < (80 * (Column + 1))) && (TS_State.Y > 0) && (TS_State.Y < 80)){
+        return BUTTON_0;
+        }
+    else if((TS_State.TouchDetected) && (TS_State.X > (80 * Column)) && (TS_State.X < (80 * (Column + 1))) && (TS_State.Y > 80) && (TS_State.Y < 160)){
+        return BUTTON_1;
+        }
+    else if((TS_State.TouchDetected) && (TS_State.X > (80 * Column)) && (TS_State.X < (80 * (Column + 1))) && (TS_State.Y > 160) && (TS_State.Y < 240)){ 
+        return BUTTON_2;   
+        }
+    else if((TS_State.TouchDetected) && (TS_State.X > (80 * Column)) && (TS_State.X < (80 * (Column + 1))) && (TS_State.Y > 240) && (TS_State.Y < 320 )){
+        return BUTTON_3;
+        }
+    else{
+        return RELASED;
+        }
+    
+    }
\ No newline at end of file
diff -r 000000000000 -r 2101f3b06f18 Keyboard_Ts.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Keyboard_Ts.h	Sat May 09 18:21:16 2020 +0000
@@ -0,0 +1,15 @@
+#ifndef KEYBOARD
+#define KEYBOARD
+
+#include "TS_DISCO_F429ZI.h"
+
+enum KeyboardState {BUTTON_0, BUTTON_1, BUTTON_2, BUTTON_3, RELASED};
+
+ class KeyboardTs: private TS_DISCO_F429ZI{
+     public:
+     enum KeyboardState eRead();
+     KeyboardTs(unsigned char);
+     unsigned char Column;
+    };
+
+#endif 
\ No newline at end of file
diff -r 000000000000 -r 2101f3b06f18 Keyboard_TsLcd.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Keyboard_TsLcd.cpp	Sat May 09 18:21:16 2020 +0000
@@ -0,0 +1,28 @@
+#include "Keyboard_TsLcd.h"
+
+KeyboardTsLcd::KeyboardTsLcd(unsigned char _ucColumn){
+    pKeyboard = new KeyboardTs(_ucColumn);
+    pLed = new LedLcd(_ucColumn);
+    };
+    
+enum KeyboardState KeyboardTsLcd::eRead(){
+    enum KeyboardState Button = pKeyboard -> eRead();   
+    switch(Button) {
+            case BUTTON_0:
+                pLed -> On(0);
+                break;
+            case BUTTON_1:
+                pLed -> On(1);
+                break;
+            case BUTTON_2:
+                pLed -> On(2);
+                break;
+            case BUTTON_3:
+                pLed -> On(3);
+                break;
+            default :
+                pLed -> On(4);
+                break;
+        }
+    return Button;
+}
diff -r 000000000000 -r 2101f3b06f18 Keyboard_TsLcd.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Keyboard_TsLcd.h	Sat May 09 18:21:16 2020 +0000
@@ -0,0 +1,18 @@
+#ifndef KEYBOARD_TSLCD
+#define KEYBOARD_TSLCD
+
+#include "Keyboard_Ts.h"
+#include "Led_Lcd.h"
+
+
+ class KeyboardTsLcd{
+     public:
+        enum KeyboardState eRead();
+        KeyboardTsLcd(unsigned char);
+     private:
+        KeyboardTs *pKeyboard;
+        LedLcd *pLed;
+     
+    };
+
+#endif 
\ No newline at end of file
diff -r 000000000000 -r 2101f3b06f18 LCD_DISCO_F429ZI.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LCD_DISCO_F429ZI.lib	Sat May 09 18:21:16 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/ST/code/LCD_DISCO_F429ZI/#dc55a068bc1a
diff -r 000000000000 -r 2101f3b06f18 Led_Lcd.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Led_Lcd.cpp	Sat May 09 18:21:16 2020 +0000
@@ -0,0 +1,32 @@
+#include "Led_Lcd.h"
+
+LedLcd::LedLcd(unsigned char ColumnNumber){
+    Clear(LCD_COLOR_BLACK);
+    SetFont(&Font24);
+    SetBackColor(LCD_COLOR_RED);
+    Column = ColumnNumber;
+    for(unsigned char ucIndex = 0;  ucIndex < 4; ucIndex++){
+        SetTextColor(LCD_COLOR_GREEN);
+        DrawRect((80*ColumnNumber),ucIndex*80,80,80);
+      }
+    
+    }
+
+void LedLcd::On(unsigned char LedPos){
+     
+    for(unsigned char ucIndex = 0;  ucIndex < 4; ucIndex++){
+            
+        if (LedPos == ucIndex){
+             SetTextColor(LCD_COLOR_GREEN);
+        }   
+        else{
+             SetTextColor(LCD_COLOR_BLUE);
+        }
+            
+        FillRect(1 + (80*Column),(ucIndex*80)+1,78,78);
+        SetTextColor(LCD_COLOR_WHITE);
+        char data[2] = {ucIndex + 48, 0};
+        DisplayStringAt((80*Column),ucIndex*80, (uint8_t *) data, LEFT_MODE);
+        }
+    
+}
\ No newline at end of file
diff -r 000000000000 -r 2101f3b06f18 Led_Lcd.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Led_Lcd.h	Sat May 09 18:21:16 2020 +0000
@@ -0,0 +1,13 @@
+#ifndef LED
+#define LED
+
+#include "LCD_DISCO_F429ZI.h"
+
+ class LedLcd: private LCD_DISCO_F429ZI{
+     public:
+     void On(unsigned char);
+     LedLcd(unsigned char);
+     unsigned char Column;
+    };
+
+#endif 
\ No newline at end of file
diff -r 000000000000 -r 2101f3b06f18 TS_DISCO_F429ZI.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TS_DISCO_F429ZI.lib	Sat May 09 18:21:16 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/ST/code/TS_DISCO_F429ZI/#4f8b6df8e235
diff -r 000000000000 -r 2101f3b06f18 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat May 09 18:21:16 2020 +0000
@@ -0,0 +1,10 @@
+#include "mbed.h"
+#include "Keyboard_TsLcd.h"
+
+int main(){
+    KeyboardTsLcd Keyboard(1);
+    while(1) {
+        Keyboard.eRead();
+        wait(0.1);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 2101f3b06f18 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat May 09 18:21:16 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file