2d1
Dependencies: LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI
Revision 0:f4a48c08fea7, committed 2020-05-07
- Comitter:
- matis755
- Date:
- Thu May 07 15:13:01 2020 +0000
- Commit message:
- 2d1
Changed in this revision
diff -r 000000000000 -r f4a48c08fea7 BSP_DISCO_F429ZI.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BSP_DISCO_F429ZI.lib Thu May 07 15:13:01 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/ST/code/BSP_DISCO_F429ZI/#53d9067a4feb
diff -r 000000000000 -r f4a48c08fea7 Keyboard_Ts.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Keyboard_Ts.cpp Thu May 07 15:13:01 2020 +0000 @@ -0,0 +1,26 @@ +#include "Keyboard_Ts.h" + +KeyboardTs::KeyboardTs(unsigned char ucIdx) { + ucColIdx = ucIdx; + Init(240,320); +} + +enum KeyboardState KeyboardTs::eRead(void) { + TS_StateTypeDef TS_State; + GetState(&TS_State); + if ((TS_State.TouchDetected) && (TS_State.Y > 0 ) && (TS_State.Y < 80) && (TS_State.X > (80 * ucColIdx)) && (TS_State.X < (80 * (ucColIdx + 1)))) { + return BUTTON_1; + } + else if ((TS_State.TouchDetected) && (TS_State.Y > 80 ) && (TS_State.Y < 160) && (TS_State.X > (80 * ucColIdx)) && (TS_State.X < (80 * (ucColIdx + 1)))) { + return BUTTON_2; + } + else if ((TS_State.TouchDetected) && (TS_State.Y > 160 ) && (TS_State.Y < 240) && (TS_State.X > (80 * ucColIdx)) && (TS_State.X < (80 * (ucColIdx + 1)))) { + return BUTTON_3; + } + else if ((TS_State.TouchDetected) && (TS_State.Y > 240 ) && (TS_State.Y < 320) && (TS_State.X > (80 * ucColIdx)) && (TS_State.X < (80 * (ucColIdx + 1)))) { + return BUTTON_4; + } + else{ + return RELASED; + } +} \ No newline at end of file
diff -r 000000000000 -r f4a48c08fea7 Keyboard_Ts.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Keyboard_Ts.h Thu May 07 15:13:01 2020 +0000 @@ -0,0 +1,23 @@ +#ifndef KEYBOARD_TS +#define KEYBOARD_TS + +#include "TS_DISCO_F429ZI.h" + +enum KeyboardState{ + RELASED, + BUTTON_1, + BUTTON_2, + BUTTON_3, + BUTTON_4 +}; + +class KeyboardTs : private TS_DISCO_F429ZI { + private: + unsigned char ucColIdx; + public: + KeyboardTs(unsigned char); + enum KeyboardState eRead(void); + +}; + +#endif \ No newline at end of file
diff -r 000000000000 -r f4a48c08fea7 Keyboard_Ts_Lcd.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Keyboard_Ts_Lcd.cpp Thu May 07 15:13:01 2020 +0000 @@ -0,0 +1,27 @@ +#include "Keyboard_Ts_Lcd.h" + +KeyboardTsLcd::KeyboardTsLcd(unsigned char _ucColumn) +{ + pKeyboard = new KeyboardTs(_ucColumn); + pLed = new LedLcd(_ucColumn); +}; + +void KeyboardTsLcd::eRead(void) { + switch(pKeyboard -> eRead()) { + case BUTTON_1: + pLed -> On(0); + break; + case BUTTON_2: + pLed -> On(1); + break; + case BUTTON_3: + pLed -> On(2); + break; + case BUTTON_4: + pLed -> On(3); + break; + default : + pLed -> On(4); + break; + } +} \ No newline at end of file
diff -r 000000000000 -r f4a48c08fea7 Keyboard_Ts_Lcd.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Keyboard_Ts_Lcd.h Thu May 07 15:13:01 2020 +0000 @@ -0,0 +1,16 @@ +#ifndef KEYBOARDLCD +#define KEYBOARDLCD + +#include "Led_Lcd.h" +#include "Keyboard_Ts.h" + +class KeyboardTsLcd { + public: + KeyboardTsLcd(unsigned char); + void eRead(void); + private: + LedLcd *pLed; + KeyboardTs *pKeyboard; +}; + +#endif \ No newline at end of file
diff -r 000000000000 -r f4a48c08fea7 LCD_DISCO_F429ZI.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD_DISCO_F429ZI.lib Thu May 07 15:13:01 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/ST/code/LCD_DISCO_F429ZI/#dc55a068bc1a
diff -r 000000000000 -r f4a48c08fea7 Led_Lcd.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Led_Lcd.cpp Thu May 07 15:13:01 2020 +0000 @@ -0,0 +1,27 @@ +#include "Led_Lcd.h" + +LedLcd::LedLcd(unsigned char ucIdx) { + ucColIdx = ucIdx; + SetFont(&Font24); + Clear(LCD_COLOR_BLACK); + SetTextColor(LCD_COLOR_GREEN); + for(unsigned char I = 0; I < 4; I++) { + DrawRect(80*ucColIdx, 80*I, 80, 80); + } +} + +void LedLcd::On(unsigned char ucIdx) { + SetBackColor(LCD_COLOR_RED); + for(unsigned char I = 0; I < 4; I++) { + if(I == ucIdx) { + SetTextColor(LCD_COLOR_GREEN); + } + else { + SetTextColor(LCD_COLOR_BLUE); + } + FillRect(1+ (ucColIdx * 80), (I*80 + 1), 79, 79); + SetTextColor(LCD_COLOR_WHITE); + unsigned char ucAscii[2] = {48 + I, 0}; + DisplayStringAt((ucColIdx * 80), (I * 80), (uint8_t *)ucAscii, LEFT_MODE); + } +} \ No newline at end of file
diff -r 000000000000 -r f4a48c08fea7 Led_Lcd.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Led_Lcd.h Thu May 07 15:13:01 2020 +0000 @@ -0,0 +1,14 @@ +#ifndef LED_LCD +#define LED_LCD + +#include "LCD_DISCO_F429ZI.h" + +class LedLcd : private LCD_DISCO_F429ZI{ + private: + unsigned char ucColIdx; + public: + LedLcd(unsigned char); + void On(unsigned char); +}; + +#endif \ No newline at end of file
diff -r 000000000000 -r f4a48c08fea7 TS_DISCO_F429ZI.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TS_DISCO_F429ZI.lib Thu May 07 15:13:01 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/ST/code/TS_DISCO_F429ZI/#4f8b6df8e235
diff -r 000000000000 -r f4a48c08fea7 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu May 07 15:13:01 2020 +0000 @@ -0,0 +1,11 @@ +#include "mbed.h" +#include "Keyboard_Ts_Lcd.h" + +int main() { + KeyboardTsLcd Keyboard(1); + + while(1) { + Keyboard.eRead(); + wait(0.1); + } +} \ No newline at end of file
diff -r 000000000000 -r f4a48c08fea7 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu May 07 15:13:01 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file