sa

Dependencies:   LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI

Files at this revision

API Documentation at this revision

Comitter:
wierzba100
Date:
Mon May 16 16:35:32 2022 +0000
Commit message:
awsf

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	Mon May 16 16:35:32 2022 +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	Mon May 16 16:35:32 2022 +0000
@@ -0,0 +1,49 @@
+#ifndef __KEYBOARDTSLCD_H
+#define __KEYBOARDTSLCD_H
+
+#include "KeyboardTsLcd.h"
+
+extern LCD_DISCO_F429ZI lcd;
+
+
+KeyboardTsLcd::KeyboardTsLcd(unsigned char _ucColumn)
+{
+    
+    lcd.Clear(LCD_COLOR_BLACK);
+    lcd.SetBackColor(LCD_COLOR_BLACK);
+    pKeyboard = new KeyboardTs(_ucColumn);
+    pLed = new LedLcd(_ucColumn);
+    pLed_2 = new LedLcd(2);
+};
+
+void KeyboardTsLcd::eRead(void)
+{
+    switch(pKeyboard -> eRead()) 
+    {
+        case BUTTON_0:
+            pLed -> On(0);
+            pLed_2 -> On(3);
+            break;
+        case BUTTON_1:
+            pLed -> On(1);
+            pLed_2 -> On(2);
+            break;
+        case BUTTON_2:
+            pLed -> On(2);
+            pLed_2 -> On(1);
+            break;
+        case BUTTON_3:
+            pLed -> On(3);
+            pLed_2 -> On(0);
+            break;
+        default :
+            pLed -> On(4);
+            pLed_2 -> On(4);
+            break;
+    }
+}
+
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/KeyboardTsLcd.h	Mon May 16 16:35:32 2022 +0000
@@ -0,0 +1,16 @@
+#include "Keyboard_Ts.h"
+#include "Led_Lcd.h"
+
+class KeyboardTsLcd
+{
+    private:
+        LedLcd *pLed;
+        LedLcd *pLed_2;
+        KeyboardTs *pKeyboard;
+    public:
+        void SetBackgroundColor(void);
+        KeyboardTsLcd(unsigned char);
+        void eRead(void);
+    
+    
+};
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Keyboard_Ts.cpp	Mon May 16 16:35:32 2022 +0000
@@ -0,0 +1,33 @@
+#include "Keyboard_Ts.h"
+#include "TS_DISCO_F429ZI.h"
+
+TS_DISCO_F429ZI ts;
+
+TS_StateTypeDef TS_State;
+
+#define RECTANGLE_SIZE 80
+
+KeyboardTs::KeyboardTs(unsigned char ucColumnPos): ucColumnPos(ucColumnPos){}
+
+KeyboardState enumTab[]={ BUTTON_0, BUTTON_1, BUTTON_2, BUTTON_3 };
+
+enum KeyboardState KeyboardTs::eRead(void)
+{
+    ts.GetState(&TS_State);
+    unsigned int uiX;
+    unsigned int uiY;
+    if (TS_State.TouchDetected)
+    {
+        uiX=TS_State.X;
+        uiY=TS_State.Y;
+        
+        if((uiX > (RECTANGLE_SIZE * ucColumnPos)) && (uiX < (RECTANGLE_SIZE * (ucColumnPos+1))))
+        {
+            return enumTab[uiY/RECTANGLE_SIZE];
+        }
+    }
+    return RELASED;
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Keyboard_Ts.h	Mon May 16 16:35:32 2022 +0000
@@ -0,0 +1,26 @@
+#ifndef __KEBOARDTS_H
+#define __KEBOARDTS_H
+
+#include "mbed.h"
+
+enum KeyboardState
+{
+    RELASED,
+    BUTTON_0,
+    BUTTON_1,
+    BUTTON_2,
+    BUTTON_3
+};
+
+class KeyboardTs
+{
+    public:
+        KeyboardTs(unsigned char);
+        enum KeyboardState eRead(void);
+    private:
+        unsigned char ucColumnPos;
+        unsigned int uiXrange_start;
+        unsigned int uiXrange_stop;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LCD_DISCO_F429ZI.lib	Mon May 16 16:35:32 2022 +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	Mon May 16 16:35:32 2022 +0000
@@ -0,0 +1,46 @@
+#include "Led_Lcd.h"
+
+LCD_DISCO_F429ZI lcd;
+
+#define RECTANGLE_SIZE 80
+
+LedLcd::LedLcd(unsigned char ucButtonPos): ucButtonDisplayMode(ucButtonPos){}
+
+void LedLcd::Column(void)
+{
+    switch(ucButtonDisplayMode)
+    {
+        case 0:
+            uiXpos=0;
+            break;
+        case 1:
+            uiXpos=80;
+            break;
+        default:
+            uiXpos=160;
+            
+    }
+}
+
+void LedLcd::On(unsigned char ucLedNr)
+{
+    Column();
+    char cNr[2] ="0";
+    for(unsigned int uiButtonCtr=0;uiButtonCtr<4;uiButtonCtr++)
+    {
+        if(ucLedNr==uiButtonCtr)
+        {
+            lcd.SetTextColor(LCD_COLOR_YELLOW);
+        }else
+        {
+            lcd.SetTextColor(LCD_COLOR_BLUE);
+        }
+        lcd.FillRect(uiXpos, uiButtonCtr*RECTANGLE_SIZE, RECTANGLE_SIZE, RECTANGLE_SIZE);
+        lcd.SetTextColor(LCD_COLOR_GREEN);
+        lcd.DrawRect(uiXpos, uiButtonCtr*RECTANGLE_SIZE, RECTANGLE_SIZE, RECTANGLE_SIZE);
+        lcd.SetTextColor(LCD_COLOR_WHITE);
+        lcd.SetBackColor(LCD_COLOR_RED);
+        lcd.DisplayStringAt(uiXpos, uiButtonCtr*RECTANGLE_SIZE, (uint8_t *)cNr , LEFT_MODE);
+        cNr[0]=cNr[0] + 1;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Led_Lcd.h	Mon May 16 16:35:32 2022 +0000
@@ -0,0 +1,17 @@
+#ifndef __LEDLCD_H
+#define __LEDLCD_H
+
+#include "LCD_DISCO_F429ZI.h"
+
+class LedLcd
+{
+    public:
+        LedLcd(unsigned char);
+        void On(unsigned char);
+        void Column(void);
+    private:
+        unsigned char ucButtonDisplayMode;
+        unsigned int uiXpos;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TS_DISCO_F429ZI.lib	Mon May 16 16:35:32 2022 +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	Mon May 16 16:35:32 2022 +0000
@@ -0,0 +1,12 @@
+#include "mbed.h"
+#include "KeyboardTsLcd.h"
+
+int main()
+{
+    KeyboardTsLcd Keyboard(0);
+    while(1)
+    {
+        Keyboard.eRead(); 
+        wait(0.1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon May 16 16:35:32 2022 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file