Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI
Revision 1:1ce1a6359874, committed 2020-06-01
- Comitter:
- kacpergaweda
- Date:
- Mon Jun 01 11:21:26 2020 +0000
- Parent:
- 0:8a56d85a76bc
- Commit message:
- MBED GAWEDA cz1
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/KeyboardTs.cpp Mon Jun 01 11:21:26 2020 +0000
@@ -0,0 +1,46 @@
+#include "TS_DISCO_F429ZI.h"
+#include "KeyboardTs.h"
+
+TS_DISCO_F429ZI ts;
+
+TS_StateTypeDef TS_State;
+
+KeyboardTs::KeyboardTs(uint8_t iColumnNumberConstructor){
+ iColumnNumber = iColumnNumberConstructor;
+}
+
+
+
+enum eKEYBOARD_KEY KeyboardTs::eRead(){
+ ts.GetState(&TS_State);
+ if (TS_State.TouchDetected)
+ {
+ x = TS_State.X;
+ y = TS_State.Y;
+ if(x >= iColumnNumber*80 & x <= iColumnNumber*80+80 & y >= 0 & y <= 80)
+ {
+ return BUTTON_0;
+ }
+ else if (x >= iColumnNumber*80 & x <= iColumnNumber*80+80 & y >=80 & y <= 160)
+ {
+ return BUTTON_1;
+ }
+ else if (x >= iColumnNumber*80 & x <= iColumnNumber*80+80 & y >=160 & y <= 240)
+ {
+ return BUTTON_2;
+ }
+ else if (x >= iColumnNumber*80 & x <= iColumnNumber*80+80 & y >=240 & y <= 320)
+ {
+ return BUTTON_3;
+ }
+ else
+ {
+ return NOT_TOUCHED;
+ }
+ }
+ else
+ {
+ return NOT_TOUCHED;
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/KeyboardTs.h Mon Jun 01 11:21:26 2020 +0000
@@ -0,0 +1,24 @@
+#ifndef KEYBOARDTS_H
+#define KEYBOARDTS_H
+#include "mbed.h"
+
+enum eKEYBOARD_KEY {BUTTON_0, BUTTON_1, BUTTON_2, BUTTON_3, NOT_TOUCHED};
+
+class KeyboardTs{
+ public:
+ KeyboardTs(uint8_t iColumnNumberConstructor);
+ enum eKEYBOARD_KEY eRead(void);
+ uint8_t iColumnNumber;
+ private:
+ uint16_t x, y;
+
+
+
+ };
+
+
+
+
+
+
+#endif
\ No newline at end of file
--- a/KeyboardTs.lib Mon Jun 01 11:13:48 2020 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -KeyboardTs#eaf97ac7b4c5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/KeyboardTsLcd.cpp Mon Jun 01 11:21:26 2020 +0000
@@ -0,0 +1,37 @@
+#include "KeyboardTs.h"
+#include "LedLcd.h"
+#include "mbed.h"
+#include "KeyboardTsLcd.h"
+
+KeyboardTs *pKeyboard;
+LedLcd *pLed;
+
+KeyboardTsLcd::KeyboardTsLcd(unsigned char _ucColumn)
+{
+pKeyboard = new KeyboardTs(_ucColumn);
+pLed = new LedLcd(_ucColumn);
+}
+
+
+
+enum eKEYBOARD_KEY 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 NOT_TOUCHED;
+ }
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/KeyboardTsLcd.h Mon Jun 01 11:21:26 2020 +0000
@@ -0,0 +1,15 @@
+#ifndef KEYBOARDTSLCD_H
+#define KEYBOARDTSLCD_H
+
+
+class KeyboardTsLcd{
+ public:
+ enum eKEYBOARD_KEY eRead(void);
+ KeyboardTsLcd(unsigned char _ucColumn);
+};
+
+
+
+
+
+#endif
\ No newline at end of file
--- a/KeyboardTsLcd.lib Mon Jun 01 11:13:48 2020 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -KeyboardTsLcd#bde7434e8e7c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/LedLcd.cpp Mon Jun 01 11:21:26 2020 +0000
@@ -0,0 +1,71 @@
+#include "LedLcd.h"
+#include "LCD_DISCO_F429ZI.h"
+
+LCD_DISCO_F429ZI lcd;
+
+
+LedLcd::LedLcd(uint8_t iColumnNumberConstructor){
+ iColumnNumber = iColumnNumberConstructor;
+ LcdInit();
+}
+
+
+void LedLcd::DrawKey(uint16_t iXPosKey, uint16_t iyPosKey, uint8_t iKeyNumber, uint32_t iColor){
+ uint8_t iKeyNumberArray[1];
+ lcd.SetFont(&Font24);
+ lcd.SetTextColor(iColor);
+ lcd.FillRect(iXPosKey, iyPosKey, 80, 80);
+ lcd.SetTextColor(LCD_COLOR_GREEN);
+ lcd.DrawRect(iXPosKey, iyPosKey, 80, 80);
+ lcd.SetBackColor(LCD_COLOR_RED);
+ lcd.SetTextColor(LCD_COLOR_WHITE);
+ sprintf((char*)iKeyNumberArray, "%d", iKeyNumber);
+ lcd.DisplayStringAt(iXPosKey, iyPosKey, (uint8_t *) &iKeyNumberArray , LEFT_MODE);
+
+
+}
+
+void LedLcd::On(uint8_t iKeyIndex){
+ uint8_t iKeyCounter;
+
+ for(iKeyCounter = 0; iKeyCounter <= 3; iKeyCounter++){
+ if(iKeyIndex == iKeyCounter){
+ DrawKey(iColumnNumber*80, iKeyCounter*80, iKeyCounter, LCD_COLOR_GREEN);
+ }
+ else{
+ DrawKey(iColumnNumber*80, iKeyCounter*80 , iKeyCounter, LCD_COLOR_BLUE);
+ }
+ }
+}
+/*
+void LedLcd::TouchScreenInit(){
+ uint8_t status;
+ BSP_LCD_SetFont(&Font20);
+ status = ts.Init(lcd.GetXSize(), lcd.GetYSize());
+
+ if (status != TS_OK)
+ {
+ lcd.Clear(LCD_COLOR_RED);
+ lcd.SetBackColor(LCD_COLOR_RED);
+ lcd.SetTextColor(LCD_COLOR_WHITE);
+ lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN", CENTER_MODE);
+ lcd.DisplayStringAt(0, LINE(6), (uint8_t *)"INIT FAIL", CENTER_MODE);
+ }
+ else
+ {
+ lcd.Clear(LCD_COLOR_GREEN);
+ lcd.SetBackColor(LCD_COLOR_GREEN);
+ lcd.SetTextColor(LCD_COLOR_WHITE);
+ lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN", CENTER_MODE);
+ lcd.DisplayStringAt(0, LINE(6), (uint8_t *)"INIT OK", CENTER_MODE);
+ }
+}
+*/
+
+void LedLcd::LcdInit(void){
+ lcd.Clear(LCD_COLOR_BLACK);
+ lcd.SetBackColor(LCD_COLOR_BLACK);
+}
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/LedLcd.h Mon Jun 01 11:21:26 2020 +0000
@@ -0,0 +1,24 @@
+#ifndef LED_LCD
+#define LED_LCD
+#include "mbed.h"
+
+class LedLcd {
+ private:
+ void DrawKey(uint16_t iXPosKey, uint16_t iyPosKey, uint8_t iKeyNumber, uint32_t iColor);
+ uint8_t iColumnNumber;
+ public:
+ LedLcd(uint8_t iColumnNumberConstructor);
+ void LcdInit(void);
+ void On(uint8_t iKeyIndex);
+};
+
+
+
+
+
+
+
+
+
+
+#endif
\ No newline at end of file
--- a/Led_Lcd.lib Mon Jun 01 11:13:48 2020 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -Led_Lcd#6a3992dd0bfd