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:5bdb01371db5, committed 2020-05-24
- Comitter:
- lulusiova
- Date:
- Sun May 24 16:07:21 2020 +0000
- Commit message:
- mbed, cz. 1
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BSP_DISCO_F429ZI.lib Sun May 24 16:07:21 2020 +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 Sun May 24 16:07:21 2020 +0000
@@ -0,0 +1,28 @@
+#include "KeyboardTsLcd.h"
+
+KeyboardTsLcd::KeyboardTsLcd(unsigned char _ucColumn)
+{
+ pKeyboard = new KeyboardTs(_ucColumn);
+ pLed = new LedLcd(_ucColumn);
+}
+
+enum State KeyboardTsLcd::eRead(void)
+{
+ 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 RELASED;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/KeyboardTsLcd.h Sun May 24 16:07:21 2020 +0000
@@ -0,0 +1,16 @@
+#ifndef KEYBOARDTSLCD_H
+#define KEYBOARDTSLCD_H
+
+#include "Keyboard_Ts.h"
+#include "Led_Lcd.h"
+
+class KeyboardTsLcd{
+ public:
+ KeyboardTsLcd(unsigned char _ucColumn);
+ enum State eRead(void);
+ private:
+ KeyboardTs *pKeyboard;
+ LedLcd *pLed;
+ };
+
+#endif//KEYBOARDTSLCD_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Keyboard_Ts.cpp Sun May 24 16:07:21 2020 +0000
@@ -0,0 +1,42 @@
+#include "Keyboard_Ts.h"
+#include "TS_DISCO_F429ZI.h"
+
+TS_DISCO_F429ZI ts;
+
+KeyboardTs::KeyboardTs(unsigned char ucColumnPosition){
+ ts.Init(240, 320);
+ ucColumnIndex = ucColumnPosition;
+}
+
+enum State KeyboardTs::eRead(void){
+ TS_StateTypeDef TS_State;
+ ts.GetState(&TS_State);
+ uint16_t x, y;
+ x = TS_State.X;
+ y = TS_State.Y;
+ if(TS_State.TouchDetected){
+ if ((x > (ucColumnIndex*80)) && (x < ((ucColumnIndex+1)*80))){
+ if((y < 80) && (y > 0)){
+ return BUTTON_0;
+ }
+ else if((y > 80) && (y < 160)){
+ return BUTTON_1;
+ }
+ else if((y > 160) && (y < 240)){
+ return BUTTON_2;
+ }
+ else if(y > 240){
+ return BUTTON_3;
+ }
+ else {
+ return RELASED;
+ }
+ }
+ else {
+ return RELASED;
+ }
+ }
+ else{
+ return RELASED;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Keyboard_Ts.h Sun May 24 16:07:21 2020 +0000
@@ -0,0 +1,14 @@
+#ifndef KEYBOARDTS_H
+#define KEYBOARDTS_H
+
+enum State {BUTTON_0, BUTTON_1, BUTTON_2, BUTTON_3, RELASED};
+
+class KeyboardTs {
+ private:
+ unsigned char ucColumnIndex;
+ public:
+ KeyboardTs(unsigned char ucColumnPosition);
+ enum State eRead(void);
+ };
+
+#endif//KEYBOARDTS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD_DISCO_F429ZI.lib Sun May 24 16:07:21 2020 +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 Sun May 24 16:07:21 2020 +0000
@@ -0,0 +1,35 @@
+#include "Led_Lcd.h"
+#include "LCD_DISCO_F429ZI.h"
+
+LCD_DISCO_F429ZI lcd;
+
+LedLcd::LedLcd(unsigned char ucColumnPosition){
+ lcd.Clear(LCD_COLOR_BLACK);
+ ucColumnIndex = (80 * ucColumnPosition);
+}
+
+void LedLcd::On(unsigned char ucLedIndex){
+ lcd.SetTextColor(LCD_COLOR_GREEN);
+ lcd.FillRect(ucColumnIndex, 0, 80, 320);
+ unsigned char ucRectangleCounter;
+ for (ucRectangleCounter = 0; ucRectangleCounter < 4; ucRectangleCounter++){
+ lcd.SetTextColor(LCD_COLOR_BLUE);
+ lcd.FillRect((1+ucColumnIndex), (1+80*ucRectangleCounter), 78, 78);
+ }
+
+ lcd.SetTextColor(LCD_COLOR_YELLOW);
+
+ if((ucLedIndex == 0) || (ucLedIndex == 1) || (ucLedIndex == 2) || (ucLedIndex == 3)){
+ lcd.FillRect((ucColumnIndex+1), (1+80*ucLedIndex), 78, 78);
+ }
+ else {
+ }
+ lcd.SetBackColor(LCD_COLOR_RED);
+ lcd.SetTextColor(LCD_COLOR_WHITE);
+ BSP_LCD_SetFont(&Font24);
+ lcd.DisplayStringAt(ucColumnIndex, 0, (uint8_t *)"0", LEFT_MODE);
+ lcd.DisplayStringAt(ucColumnIndex, 80, (uint8_t *)"1", LEFT_MODE);
+ lcd.DisplayStringAt(ucColumnIndex, 160, (uint8_t *)"2", LEFT_MODE);
+ lcd.DisplayStringAt(ucColumnIndex, 240, (uint8_t *)"3", LEFT_MODE);
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Led_Lcd.h Sun May 24 16:07:21 2020 +0000
@@ -0,0 +1,12 @@
+#ifndef LEDLCD_H
+#define LEDLCD_H
+
+class LedLcd {
+ public:
+ LedLcd(unsigned char ucColumnPosition);
+ void On(unsigned char ucLedIndex);
+ private:
+ unsigned char ucColumnIndex;
+ };
+
+#endif//LEDLCD_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TS_DISCO_F429ZI.lib Sun May 24 16:07:21 2020 +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 Sun May 24 16:07:21 2020 +0000
@@ -0,0 +1,29 @@
+#include "mbed.h"
+#include "KeyboardTsLcd.h"
+
+int main()
+{
+ KeyboardTsLcd Keyboard(0);
+ LedLcd Led(2);
+
+ while(1) {
+ switch(Keyboard.eRead()) {
+ case BUTTON_0:
+ Led.On(3);
+ break;
+ case BUTTON_1:
+ Led.On(2);
+ break;
+ case BUTTON_2:
+ Led.On(1);
+ break;
+ case BUTTON_3:
+ Led.On(0);
+ break;
+ default :
+ Led.On(4);
+ break;
+ }
+ wait(0.1);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun May 24 16:07:21 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file