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 3:715c5581d79f, committed 2020-05-25
- Comitter:
- lolkusus
- Date:
- Mon May 25 16:05:31 2020 +0000
- Parent:
- 2:dcc7a15ddd1a
- Commit message:
- Initial commit;
Changed in this revision
--- a/Keyboard.cpp Sat May 23 20:24:26 2020 +0000
+++ b/Keyboard.cpp Mon May 25 16:05:31 2020 +0000
@@ -1,7 +1,4 @@
#include "Keyboard.h"
-#include "TS_DISCO_F429ZI.h"
-
-TS_DISCO_F429ZI ts;
Keyboard::Keyboard(unsigned char ucColumn)
{
@@ -11,8 +8,7 @@
KeyState Keyboard::eRead()
{
- TS_StateTypeDef TS_State;
- ts.GetState(&TS_State); //tu wisi, jak dam komentarz to spoko, tzn bez klawy ale spoko
+ ts.GetState(&TS_State);
if ((TS_State.TouchDetected) && (TS_State.X <= 80*(ucColumnNumber+1)) && (TS_State.X >= 80*ucColumnNumber))
{
--- a/Keyboard.h Sat May 23 20:24:26 2020 +0000
+++ b/Keyboard.h Mon May 25 16:05:31 2020 +0000
@@ -1,6 +1,8 @@
#ifndef __Keyboard_H
#define __Keyboard_H
+#include "TS_DISCO_F429ZI.h"
+
typedef enum KeyState
{
BUTTON_0,
@@ -17,6 +19,8 @@
KeyState eRead();
private:
unsigned char ucColumnNumber;
+ TS_DISCO_F429ZI ts;
+ TS_StateTypeDef TS_State;
};
#endif
--- a/KeyboardLed.cpp Sat May 23 20:24:26 2020 +0000
+++ b/KeyboardLed.cpp Mon May 25 16:05:31 2020 +0000
@@ -3,7 +3,7 @@
KeyboardLed::KeyboardLed(unsigned char _ucColumn)
{
pKeyboard = new Keyboard(_ucColumn);
- pLed = new Ledboard(_ucColumn);
+ pLedboard = new Ledboard(_ucColumn);
};
KeyState KeyboardLed::eRead()
@@ -11,19 +11,19 @@
switch(pKeyboard->eRead())
{
case BUTTON_0:
- pLed->On(0);
+ pLedboard->On(0);
break;
case BUTTON_1:
- pLed->On(1);
+ pLedboard->On(1);
break;
case BUTTON_2:
- pLed->On(2);
+ pLedboard->On(2);
break;
case BUTTON_3:
- pLed->On(3);
+ pLedboard->On(3);
break;
default :
- pLed->Off();
+ pLedboard->Off();
break;
}
return(pKeyboard->eRead());
--- a/KeyboardLed.h Sat May 23 20:24:26 2020 +0000
+++ b/KeyboardLed.h Mon May 25 16:05:31 2020 +0000
@@ -11,7 +11,7 @@
KeyState eRead();
private:
Keyboard *pKeyboard;
- Ledboard *pLed;
+ Ledboard *pLedboard;
};
#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Led.cpp Mon May 25 16:05:31 2020 +0000
@@ -0,0 +1,36 @@
+#include "Led.h"
+
+extern LCD_DISCO_F429ZI lcd;
+
+Led::Led(unsigned char ucColumnNumber, unsigned char ucRowNumber)
+{
+ ucColumn = ucColumnNumber;
+ ucRow = ucRowNumber;
+
+ Redraw(COLOR_DARK);
+}
+
+void Led::On()
+{
+ Redraw(COLOR_LIT);
+}
+
+
+void Led::Off()
+{
+ Redraw(COLOR_DARK);
+}
+
+void Led::Redraw (uint32_t Color)
+{
+ char cBuffor[3];
+ lcd.SetTextColor(LCD_COLOR_GREEN);
+ lcd.DrawRect(80*ucColumn,80*ucRow,80,80);
+
+ lcd.SetTextColor(Color);
+ lcd.FillRect(2+80*ucColumn,2+80*ucRow,77,77);
+
+ sprintf(cBuffor, "%d", ucRow);
+ lcd.SetTextColor(LCD_COLOR_WHITE);
+ lcd.DisplayStringAt(1+80*ucColumn,1+80*ucRow,(uint8_t *)&cBuffor, LEFT_MODE);
+}
--- a/Led.h Sat May 23 20:24:26 2020 +0000 +++ b/Led.h Mon May 25 16:05:31 2020 +0000 @@ -1,6 +1,9 @@ #ifndef __Led_H #define __Led_H +#define COLOR_LIT LCD_COLOR_GREEN +#define COLOR_DARK LCD_COLOR_BLUE + #include "LCD_DISCO_F429ZI.h" class Led
--- a/Ledboard.cpp Sat May 23 20:24:26 2020 +0000
+++ b/Ledboard.cpp Mon May 25 16:05:31 2020 +0000
@@ -16,9 +16,16 @@
void Ledboard::On(unsigned char ledNumber)
{
- if(ledNumber < LED_COUNT)
+ for (unsigned char ucLedCounter = 0; ucLedCounter < LED_COUNT; ucLedCounter++)
{
- Leds[ledNumber]->On();
+ if(ucLedCounter == ledNumber)
+ {
+ Leds[ucLedCounter]->On();
+ }
+ else
+ {
+ Leds[ucLedCounter]->Off();
+ }
}
}
--- a/TS_DISCO_F429ZI.lib Sat May 23 20:24:26 2020 +0000 +++ b/TS_DISCO_F429ZI.lib Mon May 25 16:05:31 2020 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/users/lolkusus/code/TS_DISCO_F429ZI/#9835e5b1371a +https://os.mbed.com/teams/ST/code/TS_DISCO_F429ZI/#4f8b6df8e235
--- a/main.cpp Sat May 23 20:24:26 2020 +0000
+++ b/main.cpp Mon May 25 16:05:31 2020 +0000
@@ -7,14 +7,11 @@
KeyboardLed MyKeyboardTsLcd(0);
Ledboard MyLedboard(2);
-DigitalIn guzik(USER_BUTTON);
-
int main()
{
while(1)
{
- // if(guzik) MyLedboard.On(0); else MyLedboard.Off();
switch(MyKeyboardTsLcd.eRead())
{
case BUTTON_0: