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 0:f3da1afb14d9, committed 2020-05-10
- Comitter:
- matisembed
- Date:
- Sun May 10 14:31:55 2020 +0000
- Child:
- 1:4a8b2dbb7ff3
- Commit message:
- publishing ready program
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BSP_DISCO_F429ZI.lib Sun May 10 14:31:55 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/ST/code/BSP_DISCO_F429ZI/#53d9067a4feb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/KeyboardTsLcd.cpp Sun May 10 14:31:55 2020 +0000
@@ -0,0 +1,26 @@
+#include "KeyboardTsLcd.h"
+
+KeyboardTsLcd::KeyboardTsLcd(unsigned char ucColumnNr){
+ pKeyboard = new KeyboardTs(ucColumnNr);
+ pLed = new LedLcd(ucColumnNr);
+}
+
+void KeyboardTsLcd::eRead(void){
+ switch(pKeyboard -> eRead()){
+ 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;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/KeyboardTsLcd.h Sun May 10 14:31:55 2020 +0000
@@ -0,0 +1,13 @@
+#ifndef KEYBOARD_TS_LCD_H
+#define KEYBOARD_TS_LCD_H
+#include "Keyboard_Ts.h"
+#include "Led_Lcd.h"
+
+class KeyboardTsLcd{
+ public:
+ KeyboardTsLcd(unsigned char ucColumnNr);
+ KeyboardTs *pKeyboard;
+ LedLcd *pLed;
+ void eRead(void);
+};
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Keyboard_Ts.cpp Sun May 10 14:31:55 2020 +0000
@@ -0,0 +1,42 @@
+#include "Keyboard_Ts.h"
+
+#define LENGTH_SIDE_SQUARE 80
+
+KeyboardTs::KeyboardTs(unsigned char ucColumnNr){
+
+ TouchScreen.Init(lcd.GetXSize(), lcd.GetYSize());
+
+ if(ucColumnNr == 1){
+ square_x_pos = 80;
+ }
+ else if(ucColumnNr == 2){
+ square_x_pos = 160;
+ }
+ else{
+ square_x_pos = 0;
+ }
+}
+
+enum KeyboardState KeyboardTs::eRead(void){
+
+ TouchScreen.GetState(&TSState);
+
+ if(TSState.TouchDetected){
+ if((TSState.X > square_x_pos) && (TSState.X <= square_x_pos + LENGTH_SIDE_SQUARE)){
+
+ if((TSState.Y > 0) && (TSState.Y <= LENGTH_SIDE_SQUARE)){
+ return BUTTON_0;
+ }
+ else if((TSState.Y > LENGTH_SIDE_SQUARE) && (TSState.Y <= 2 * LENGTH_SIDE_SQUARE)){
+ return BUTTON_1;
+ }
+ else if((TSState.Y > 2 * LENGTH_SIDE_SQUARE) && (TSState.Y <= 3 * LENGTH_SIDE_SQUARE)){
+ return BUTTON_2;
+ }
+ else if((TSState.Y > 3 * LENGTH_SIDE_SQUARE) && (TSState.Y <= 4 * LENGTH_SIDE_SQUARE)){
+ return BUTTON_3;
+ }
+ }
+ }
+ return NO_BUTTON_PRESSED;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Keyboard_Ts.h Sun May 10 14:31:55 2020 +0000
@@ -0,0 +1,17 @@
+#ifndef KEYBOARD_TS_H
+#define KEYBOARD_TS_H
+#include "TS_DISCO_F429ZI.h"
+#include "LCD_DISCO_F429ZI.h"
+
+enum KeyboardState {BUTTON_0, BUTTON_1, BUTTON_2, BUTTON_3, NO_BUTTON_PRESSED};
+
+class KeyboardTs{
+ TS_DISCO_F429ZI TouchScreen;
+ TS_StateTypeDef TSState;
+ LCD_DISCO_F429ZI lcd;
+ unsigned char square_x_pos;
+ public:
+ KeyboardTs(unsigned char ucColumnNr);
+ enum KeyboardState eRead(void);
+};
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD_DISCO_F429ZI.lib Sun May 10 14:31:55 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/ST/code/LCD_DISCO_F429ZI/#dc55a068bc1a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Led_Lcd.cpp Sun May 10 14:31:55 2020 +0000
@@ -0,0 +1,41 @@
+#include "Led_Lcd.h"
+
+#define LENGTH_SIDE_SQUARE 80
+
+LedLcd::LedLcd(unsigned char ucColumnNr){
+
+ lcd.Clear(LCD_COLOR_BLACK);
+ lcd.SetFont(&Font24);
+
+ if(ucColumnNr == 1){
+ square_x_pos = 80;
+ }
+ else if(ucColumnNr == 2){
+ square_x_pos = 160;
+ }
+ else{
+ square_x_pos = 0;
+ }
+}
+
+void LedLcd::On(unsigned char uLedLcdNumber){
+
+ for(unsigned char ucSquareCounter = 0; ucSquareCounter <= 3; ucSquareCounter++){
+ lcd.SetTextColor(LCD_COLOR_GREEN);
+ lcd.DrawRect(square_x_pos ,ucSquareCounter * LENGTH_SIDE_SQUARE, LENGTH_SIDE_SQUARE, LENGTH_SIDE_SQUARE);
+ if(ucSquareCounter == uLedLcdNumber){
+ lcd.SetTextColor(LCD_COLOR_YELLOW);
+ }
+ else{
+ lcd.SetTextColor(LCD_COLOR_BLUE);
+ }
+ lcd.FillRect(square_x_pos + 1, ucSquareCounter * LENGTH_SIDE_SQUARE + 1, LENGTH_SIDE_SQUARE - 1, LENGTH_SIDE_SQUARE - 1);
+
+ }
+ lcd.SetBackColor(LCD_COLOR_RED);
+ lcd.SetTextColor(LCD_COLOR_WHITE);
+ lcd.DisplayStringAt(square_x_pos, 0 * LENGTH_SIDE_SQUARE,(uint8_t *)"0", LEFT_MODE);
+ lcd.DisplayStringAt(square_x_pos, 1 * LENGTH_SIDE_SQUARE,(uint8_t *)"1", LEFT_MODE);
+ lcd.DisplayStringAt(square_x_pos, 2 * LENGTH_SIDE_SQUARE,(uint8_t *)"2", LEFT_MODE);
+ lcd.DisplayStringAt(square_x_pos, 3 * LENGTH_SIDE_SQUARE,(uint8_t *)"3", LEFT_MODE);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Led_Lcd.h Sun May 10 14:31:55 2020 +0000
@@ -0,0 +1,12 @@
+#ifndef LED_LCD_H
+#define LED_LCD_H
+#include "LCD_DISCO_F429ZI.h"
+
+class LedLcd{
+ LCD_DISCO_F429ZI lcd;
+ unsigned char square_x_pos;
+ public:
+ LedLcd(unsigned char ucColumnNr);
+ void On(unsigned char uLedLcdNumber);
+};
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TS_DISCO_F429ZI.lib Sun May 10 14:31:55 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/ST/code/TS_DISCO_F429ZI/#4f8b6df8e235
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sun May 10 14:31:55 2020 +0000
@@ -0,0 +1,15 @@
+#include "mbed.h"
+#include "KeyboardTsLcd.h"
+
+int main(){
+
+ KeyboardTsLcd Keyboard(0);
+ KeyboardTsLcd LedLcd(2);
+
+ while(1){
+ Keyboard.eRead();
+ wait(0.1);
+ LedLcd.pLed -> On(3 - Keyboard.pKeyboard -> eRead());
+ wait(0.1);
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun May 10 14:31:55 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file