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:bc13b866415b, committed 2020-05-18
- Comitter:
- hubtel
- Date:
- Mon May 18 19:47:58 2020 +0000
- Commit message:
- MBED_1
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BSP_DISCO_F429ZI.lib Mon May 18 19:47:58 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/Keyboard_Ts.cpp Mon May 18 19:47:58 2020 +0000
@@ -0,0 +1,25 @@
+#include "Keyboard_Ts.h"
+
+KeyboardTs::KeyboardTs(unsigned char ucColumnNumber){
+ ucColumn = ucColumnNumber;
+ }
+
+
+enum KeyboardState KeyboardTs::eRead(){
+ TS_StateTypeDef TS_State;
+ GetState(&TS_State);
+ if((TS_State.TouchDetected) && (TS_State.X < 80*(1+ucColumn)) && (TS_State.X > 80*ucColumn) && (TS_State.Y < 80) && (TS_State.Y > 0){
+ return BUTTON_0;
+ }
+ else if((TS_State.TouchDetected) && (TS_State.X < 80*(1+ucColumn)) && (TS_State.X > 80*ucColumn) && (TS_State.Y < 160) && (TS_State.Y > 80)){
+ return BUTTON_1;
+ }
+ else if((TS_State.TouchDetected) && (TS_State.X < 80*(1+ucColumn)) && (TS_State.X > 80*ucColumn) && (TS_State.Y < 240) && (TS_State.Y > 160)){
+ return BUTTON_2;
+ }
+ else if((TS_State.TouchDetected) && (TS_State.X < 80*(1+ucColumn)) && (TS_State.X > 80*ucColumn) && (TS_State.Y < 320) && (TS_State.Y > 240)){
+ return BUTTON_3;
+ }
+ else
+ return RELASED;
+ }
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Keyboard_Ts.h Mon May 18 19:47:58 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 ucColumnNumber);
+ unsigned char ucColumn;
+ };
+
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Keyboard_TsLcd.cpp Mon May 18 19:47:58 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;
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Keyboard_TsLcd.h Mon May 18 19:47:58 2020 +0000
@@ -0,0 +1,16 @@
+#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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD_DISCO_F429ZI.lib Mon May 18 19:47:58 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 Mon May 18 19:47:58 2020 +0000
@@ -0,0 +1,31 @@
+#include "Led_Lcd.h"
+
+LedLcd::LedLcd(unsigned char ucColumnNumber){
+ Clear(LCD_COLOR_BLACK);
+ SetBackColor(LCD_COLOR_RED);
+ SetFont(&Font24);
+
+ ucColumn = ucColumnNumber;
+
+
+
+}
+
+void LedLcd::On(unsigned char LedPos){
+ for(unsigned char ucIterator = 0; ucIterator < 4; ucIterator++){
+ if(LedPos == ucIterator){
+ SetTextColor(LCD_COLOR_GREEN);
+ }
+ else{
+ SetTextColor(LCD_COLOR_BLUE);
+ }
+ FillRect((1 + ucColumn*80), (ucIterator*80)+1, 78, 78);
+ char tab[2] = {ucIterator+48,0};
+ SetTextColor(LCD_COLOR_WHITE);
+ DisplayStringAt((ucColumn*80), ucIterator*80, (uint8_t *)tab, LEFT_MODE);
+ }
+ for(unsigned char ucIterator = 0; ucIterator < 4; ucIterator++){
+ SetTextColor(LCD_COLOR_GREEN);
+ DrawRect((0 + ucColumn*80), (ucIterator*80), 80, 80);
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Led_Lcd.h Mon May 18 19:47:58 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 ucColumnNumber);
+ unsigned char ucColumn;
+ };
+
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TS_DISCO_F429ZI.lib Mon May 18 19:47:58 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 Mon May 18 19:47:58 2020 +0000
@@ -0,0 +1,28 @@
+#include "mbed.h"
+#include "Keyboard_TsLcd.h"
+
+int main(){
+ KeyboardTsLcd Keyboardy(0);
+ LedLcd Lcd(2);
+
+ while(1) {
+ switch(Keyboardy.eRead()){
+ case BUTTON_0:
+ Lcd.On(3);
+ break;
+ case BUTTON_1:
+ Lcd.On(2);
+ break;
+ case BUTTON_2:
+ Lcd.On(1);
+ break;
+ case BUTTON_3:
+ Lcd.On(0);
+ break;
+ default:
+ Lcd.On(4);
+ break;
+ };
+ wait(0.1);
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon May 18 19:47:58 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file