1
Dependencies: BSP_DISCO_F429ZI LCD_DISCO_F429ZI TS_DISCO_F429ZI mbed
Revision 0:6b004e89c859, committed 2018-05-14
- Comitter:
- marutson
- Date:
- Mon May 14 18:22:52 2018 +0000
- Commit message:
- 1
Changed in this revision
diff -r 000000000000 -r 6b004e89c859 BSP_DISCO_F429ZI.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BSP_DISCO_F429ZI.lib Mon May 14 18:22:52 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/ST/code/BSP_DISCO_F429ZI/#53d9067a4feb
diff -r 000000000000 -r 6b004e89c859 KeyboardTsLcd.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/KeyboardTsLcd.cpp Mon May 14 18:22:52 2018 +0000 @@ -0,0 +1,27 @@ + +#include "KeyboardTsLcd.h" + +KeyboardTsLcd::KeyboardTsLcd() +{ +pKeyboard = new KeyboardTs(0); +pLed = new LedLcd(0); + +}; +int KeyboardTsLcd::eRead (void) { + switch(pKeyboard -> eRead()) { + case LED_0: + pLed -> On(0); + return 2; + case LED_1: + pLed -> On(1); + return 1; + case LED_2: + pLed -> On(2); + return 0; + + default: + pLed -> On(4); + return 4; + } +}; +
diff -r 000000000000 -r 6b004e89c859 KeyboardTsLcd.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/KeyboardTsLcd.h Mon May 14 18:22:52 2018 +0000 @@ -0,0 +1,18 @@ +#ifndef KEYBOARDTSCLD_H +#define KEYBOARDTSCLD_H + +#include "Led_Lcd.h" +#include "Keyboard_Ts.h" + +class KeyboardTsLcd { + + KeyboardTs *pKeyboard; + LedLcd *pLed; + + public: + KeyboardTsLcd(void); + int eRead(void); + +}; + +#endif \ No newline at end of file
diff -r 000000000000 -r 6b004e89c859 Keyboard_Ts.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Keyboard_Ts.cpp Mon May 14 18:22:52 2018 +0000 @@ -0,0 +1,29 @@ +#include "TS_DISCO_F429ZI.h" +#include "Keyboard_Ts.h" + +TS_DISCO_F429ZI ts; +TS_StateTypeDef TS_State; + +unsigned char ucColumnChosen; + +KeyboardTs::KeyboardTs(unsigned char ucSetColums){ + ts.Init(240,320); + ucColumnChosen = ucSetColums; +} + +enum KeyboardState KeyboardTs::eRead(void){ + ts.GetState(&TS_State); + if (TS_State.TouchDetected) { + if (TS_State.Y >= 80 * ucColumnChosen && TS_State.Y <= 80 * (ucColumnChosen+1)) { + if (TS_State.X <= 80) + return LED_0; + else if (TS_State.X >= 80 && TS_State.X <= 160) + return LED_1; + else if (TS_State.X>= 160 && TS_State.X <= 240) + return LED_2; + else if (TS_State.X >= 240 && TS_State.X <= 320) + return LED_3; + } + } + return RELEASED; +} \ No newline at end of file
diff -r 000000000000 -r 6b004e89c859 Keyboard_Ts.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Keyboard_Ts.h Mon May 14 18:22:52 2018 +0000 @@ -0,0 +1,19 @@ +#ifndef KEYBOARD_TS_H +#define KEYBOARD_TS_H + +enum KeyboardState{ + RELEASED, + LED_0, + LED_1, + LED_2, + LED_3}; + +class KeyboardTs { + + + public: + KeyboardTs(unsigned char = 0); + enum KeyboardState eRead(void); +}; + +#endif \ No newline at end of file
diff -r 000000000000 -r 6b004e89c859 LCD_DISCO_F429ZI.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD_DISCO_F429ZI.lib Mon May 14 18:22:52 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/ST/code/LCD_DISCO_F429ZI/#dc55a068bc1a
diff -r 000000000000 -r 6b004e89c859 Lcd_Lcd.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Lcd_Lcd.cpp Mon May 14 18:22:52 2018 +0000 @@ -0,0 +1,30 @@ +#include "LCD_DISCO_F429ZI.h" +#include "Led_Lcd.h" + +LCD_DISCO_F429ZI lcd; + +LedLcd::LedLcd(unsigned char SetColumn) +{ + lcd.Clear(LCD_COLOR_BLACK); + BSP_LCD_SetFont(&Font24); + ucColChosen = SetColumn; +} + +void LedLcd::On(unsigned char ucLedIndex) +{ + unsigned char ucLoopCounter = 0; + for (ucLoopCounter = 0 ; ucLoopCounter <= 2 ; ucLoopCounter ++) { + + lcd.SetTextColor(LCD_COLOR_GREEN); + lcd.DrawRect(80*ucLoopCounter,80* ucColChosen,80,80); + if (ucLoopCounter == ucLedIndex) + lcd.SetTextColor(LCD_COLOR_YELLOW); + else + lcd.SetTextColor(LCD_COLOR_BLUE); + lcd.FillRect(1 + 80*ucLoopCounter,1 + 80 * ucColChosen,78,78); + lcd.SetBackColor(LCD_COLOR_RED); + lcd.SetTextColor(LCD_COLOR_WHITE); + lcd.DisplayChar(80*ucLoopCounter,80 * ucColChosen , 48 + ucLoopCounter ); + } +} +
diff -r 000000000000 -r 6b004e89c859 Led_Lcd.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Led_Lcd.h Mon May 14 18:22:52 2018 +0000 @@ -0,0 +1,14 @@ +#ifndef LED_LCD_H +#define LED_LCD_H + +class LedLcd { + + unsigned char ucColChosen; + + public: + LedLcd(unsigned char = 0); + void On(unsigned char); + +}; + +#endif \ No newline at end of file
diff -r 000000000000 -r 6b004e89c859 TS_DISCO_F429ZI.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TS_DISCO_F429ZI.lib Mon May 14 18:22:52 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/ST/code/TS_DISCO_F429ZI/#4f8b6df8e235
diff -r 000000000000 -r 6b004e89c859 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon May 14 18:22:52 2018 +0000 @@ -0,0 +1,16 @@ +#include "mbed.h" +#include "KeyboardTsLcd.h" + + +int main() +{ + KeyboardTsLcd Keyboard; + LedLcd LedRight(2); + + + while(1) { + LedRight.On(Keyboard.eRead()); + wait(0.1); + } +} + \ No newline at end of file
diff -r 000000000000 -r 6b004e89c859 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon May 14 18:22:52 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/5aab5a7997ee \ No newline at end of file