stm32f469-disco test
Dependencies: BSP_DISCO_F469NI LCD_DISCO_F469NI TS_DISCO_F469NI mbed ros_lib_kinetic
Fork of DISCO-F469NI_LCDTS_demo by
Revision 4:ff637e680ea7, committed 2017-07-25
- Comitter:
- wupinxian
- Date:
- Tue Jul 25 06:10:36 2017 +0000
- Parent:
- 3:98e2c23d57b2
- Commit message:
- vol1.0
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
ros_lib_kinetic.lib | Show annotated file Show diff for this revision Revisions of this file |
diff -r 98e2c23d57b2 -r ff637e680ea7 main.cpp --- a/main.cpp Wed Jul 05 06:50:17 2017 +0000 +++ b/main.cpp Tue Jul 25 06:10:36 2017 +0000 @@ -2,83 +2,63 @@ #include "TS_DISCO_F469NI.h" #include "LCD_DISCO_F469NI.h" +#define button_rad 50 + +#define button_dist 100 +///// +#include <ros.h> +#include<turtlesim/Pose.h> +#include <std_msgs/String.h> +#include <Pose.h> + +////// + LCD_DISCO_F469NI lcd; TS_DISCO_F469NI ts; int main() { + TS_StateTypeDef TS_State; - uint16_t x, y; + uint8_t status; + turtlesim::Pose pose; + + /*uint16_t x, y; uint8_t text[30]; - uint8_t status; uint8_t idx; uint8_t cleared = 0; uint8_t prev_nb_touches = 0; - + */ BSP_LCD_SetFont(&Font24); lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN DEMO", CENTER_MODE); - wait(1); - + status = ts.Init(lcd.GetXSize(), lcd.GetYSize()); - if (status != TS_OK) - { - lcd.Clear(LCD_COLOR_RED); - lcd.SetBackColor(LCD_COLOR_RED); - lcd.SetTextColor(LCD_COLOR_WHITE); - lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN INIT FAIL", CENTER_MODE); - } - else - { - lcd.Clear(LCD_COLOR_GREEN); - lcd.SetBackColor(LCD_COLOR_GREEN); - lcd.SetTextColor(LCD_COLOR_WHITE); - lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN INIT OK", CENTER_MODE); - } - - wait(1); - lcd.SetBackColor(LCD_COLOR_BLUE); - lcd.SetTextColor(LCD_COLOR_WHITE); + + lcd.SetBackColor(LCD_COLOR_WHITE); + lcd.SetTextColor(LCD_COLOR_BLACK); + + lcd.DisplayChar(lcd.GetXSize()/2,lcd.GetYSize()/2,'W'); + lcd.DrawCircle(lcd.GetXSize()/2,lcd.GetYSize()/2,button_rad); + + lcd.DisplayChar(lcd.GetXSize()/2,lcd.GetYSize()/2+button_dist,'S'); + lcd.DrawCircle(lcd.GetXSize()/2,lcd.GetYSize()/2+button_dist,button_rad); + lcd.DisplayChar(lcd.GetXSize()/2+button_dist,lcd.GetYSize()/2+button_dist,'D'); + lcd.DrawCircle(lcd.GetXSize()/2+button_dist,lcd.GetYSize()/2+button_dist,button_rad); + + + lcd.DisplayChar(lcd.GetXSize()/2-button_dist,lcd.GetYSize()/2+button_dist,'A'); + lcd.DrawCircle(lcd.GetXSize()/2-button_dist,lcd.GetYSize()/2+button_dist,button_rad); + + //Pose.x = 5 ; + pose.x=5.5; while(1) { - - ts.GetState(&TS_State); - if (TS_State.touchDetected) - { - // Clear lines corresponding to old touches coordinates - if (TS_State.touchDetected < prev_nb_touches) - { - for (idx = (TS_State.touchDetected + 1); idx <= 5; idx++) - { - lcd.ClearStringLine(idx); - } - } - prev_nb_touches = TS_State.touchDetected; - cleared = 0; - sprintf((char*)text, "Touches: %d", TS_State.touchDetected); - lcd.DisplayStringAt(0, LINE(0), (uint8_t *)&text, LEFT_MODE); - for (idx = 0; idx < TS_State.touchDetected; idx++) - { - x = TS_State.touchX[idx]; - y = TS_State.touchY[idx]; - sprintf((char*)text, "Touch %d: x=%d y=%d ", idx+1, x, y); - lcd.DisplayStringAt(0, LINE(idx+1), (uint8_t *)&text, LEFT_MODE); - lcd.FillCircle(TS_State.touchX[idx], TS_State.touchY[idx], 20); - } - } - else - { - if (!cleared) - { - lcd.Clear(LCD_COLOR_BLUE); - sprintf((char*)text, "Touches: 0"); - lcd.DisplayStringAt(0, LINE(0), (uint8_t *)&text, LEFT_MODE); - cleared = 1; - } - } + + } }
diff -r 98e2c23d57b2 -r ff637e680ea7 ros_lib_kinetic.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ros_lib_kinetic.lib Tue Jul 25 06:10:36 2017 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/garyservin/code/ros_lib_kinetic/#a849bf78d77f