MBED part 1 final version
Dependencies: LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI
Revision 0:04d5c5df5af6, committed 2020-05-09
- Comitter:
- rzeminska
- Date:
- Sat May 09 08:32:26 2020 +0000
- Commit message:
- MBED1
Changed in this revision
diff -r 000000000000 -r 04d5c5df5af6 BSP_DISCO_F429ZI.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BSP_DISCO_F429ZI.lib Sat May 09 08:32:26 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/ST/code/BSP_DISCO_F429ZI/#53d9067a4feb
diff -r 000000000000 -r 04d5c5df5af6 Keyboard_Ts.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Keyboard_Ts.cpp Sat May 09 08:32:26 2020 +0000 @@ -0,0 +1,26 @@ +#include "Keyboard_Ts.h" + +KeyboardTs::KeyboardTs(unsigned char ucColumn){ + Init(240,320); + ucColIndex = ucColumn; +} + +enum KeyboardState KeyboardTs::eRead(){ + TS_StateTypeDef TS_State; + GetState(&TS_State); + if((TS_State.TouchDetected) && (TS_State.X <((ucColIndex + 1) * 80)) && (TS_State.X > (ucColIndex * 80)) && (TS_State.Y < 80) && (TS_State.Y > 0)){ + return BUTTON_0; + } + else if((TS_State.TouchDetected) && (TS_State.X < ((ucColIndex + 1) * 80)) && (TS_State.X > (ucColIndex * 80)) && (TS_State.Y < 160) && (TS_State.Y > 81)){ + return BUTTON_1; + } + else if((TS_State.TouchDetected) && (TS_State.X < ((ucColIndex + 1) * 80)) && (TS_State.X > (ucColIndex * 80)) && (TS_State.Y < 240) && (TS_State.Y > 161)){ + return BUTTON_2; + } + else if((TS_State.TouchDetected) && (TS_State.X < ((ucColIndex + 1) * 80)) && (TS_State.X > (ucColIndex * 80)) && (TS_State.Y < 320) && (TS_State.Y > 241)){ + return BUTTON_3; + } + else{ + return RELEASED; + } +} \ No newline at end of file
diff -r 000000000000 -r 04d5c5df5af6 Keyboard_Ts.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Keyboard_Ts.h Sat May 09 08:32:26 2020 +0000 @@ -0,0 +1,22 @@ +#ifndef KEYBOARD_H +#define KEYBOARD_H + +#include "TS_DISCO_F429ZI.h" + +enum KeyboardState{ + BUTTON_0, + BUTTON_1, + BUTTON_2, + BUTTON_3, + RELEASED +}; + +class KeyboardTs: private TS_DISCO_F429ZI{ + public: + KeyboardTs(unsigned char = 0); + enum KeyboardState eRead(); + private: + unsigned char ucColIndex; +}; + +#endif \ No newline at end of file
diff -r 000000000000 -r 04d5c5df5af6 Keyboard_TsLcd.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Keyboard_TsLcd.cpp Sat May 09 08:32:26 2020 +0000 @@ -0,0 +1,29 @@ +#include "Keyboard_TsLcd.h" + +KeyboardTsLcd::KeyboardTsLcd(unsigned char _ucColumn) +{ + pKeyboard = new KeyboardTs(_ucColumn); + pLed = new LedLcd(_ucColumn); +} + +enum KeyboardState KeyboardTsLcd::eRead(){ + enum KeyboardState eBtnOut = pKeyboard->eRead(); + switch(eBtnOut){ + 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 eBtnOut; +} \ No newline at end of file
diff -r 000000000000 -r 04d5c5df5af6 Keyboard_TsLcd.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Keyboard_TsLcd.h Sat May 09 08:32:26 2020 +0000 @@ -0,0 +1,16 @@ +#ifndef KEYBOARD_TSLCD +#define KEYBOARD_TSLCD + +#include "Keyboard_Ts.h" +#include "Led_Lcd.h" + +class KeyboardTsLcd{ + public: + KeyboardTsLcd(unsigned char); + enum KeyboardState eRead(); + private: + KeyboardTs* pKeyboard; + LedLcd* pLed; +}; + +#endif \ No newline at end of file
diff -r 000000000000 -r 04d5c5df5af6 LCD_DISCO_F429ZI.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD_DISCO_F429ZI.lib Sat May 09 08:32:26 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/ST/code/LCD_DISCO_F429ZI/#dc55a068bc1a
diff -r 000000000000 -r 04d5c5df5af6 Led_Lcd.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Led_Lcd.cpp Sat May 09 08:32:26 2020 +0000 @@ -0,0 +1,27 @@ +#include "Led_Lcd.h" + +LedLcd::LedLcd(unsigned char ucColumn){ + Clear(LCD_COLOR_BLACK); + SetFont(&Font24); + SetTextColor(LCD_COLOR_GREEN); + ucColIndex = ucColumn; + for(unsigned char ucBtnIndex = 0; ucBtnIndex < 4; ucBtnIndex++){ + DrawRect((ucColIndex * 80), (ucBtnIndex * 80), 80, 80); + } +} + +void LedLcd::On(unsigned char ucGreenBtn){ + SetBackColor(LCD_COLOR_RED); + for(unsigned char ucBtnIndex = 0; ucBtnIndex < 4; ucBtnIndex++){ + if(ucBtnIndex == ucGreenBtn){ + SetTextColor(LCD_COLOR_GREEN); + } + else{ + SetTextColor(LCD_COLOR_BLUE); + } + FillRect((ucColIndex * 80)+1, ((ucBtnIndex * 80) + 1), 78, 78); + SetTextColor(LCD_COLOR_WHITE); + char number[2] = {ucBtnIndex + 48, 0}; + DisplayStringAt((ucColIndex * 80), (ucBtnIndex * 80), (uint8_t *)number, LEFT_MODE); + } +}
diff -r 000000000000 -r 04d5c5df5af6 Led_Lcd.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Led_Lcd.h Sat May 09 08:32:26 2020 +0000 @@ -0,0 +1,14 @@ +#ifndef LED_H +#define LED_H + +#include "LCD_DISCO_F429ZI.h" + +class LedLcd: private LCD_DISCO_F429ZI{ + public: + LedLcd(unsigned char); + void On(unsigned char = 0); + private: + unsigned char ucColIndex; +}; + +#endif \ No newline at end of file
diff -r 000000000000 -r 04d5c5df5af6 TS_DISCO_F429ZI.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TS_DISCO_F429ZI.lib Sat May 09 08:32:26 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/ST/code/TS_DISCO_F429ZI/#4f8b6df8e235
diff -r 000000000000 -r 04d5c5df5af6 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat May 09 08:32:26 2020 +0000 @@ -0,0 +1,26 @@ +#include "Keyboard_TsLcd.h" + +int main(){ + KeyboardTsLcd Keyboard(0); + LedLcd Lcd(2); + while(1){ + switch(Keyboard.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); + } +}
diff -r 000000000000 -r 04d5c5df5af6 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat May 09 08:32:26 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file