STM32F429I-DISCO Template w/ stdout redirection to display
Dependencies: LCD_DISCO_F429ZI LCD_LOG_DISCO TS_DISCO_F429ZI mbed-dev
Status
- Just working
Planned features
- Redirect stderr with color change
- rewrite entire lcd_log to C++
Revision 5:8ed13d45a9ce, committed 2015-12-27
- Comitter:
- icis4
- Date:
- Sun Dec 27 13:03:21 2015 +0000
- Parent:
- 4:8188d5640a90
- Commit message:
- Initialization, bugs, unused vars
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 8188d5640a90 -r 8ed13d45a9ce main.cpp --- a/main.cpp Sat Dec 26 09:53:29 2015 +0000 +++ b/main.cpp Sun Dec 27 13:03:21 2015 +0000 @@ -1,21 +1,3 @@ -/* Copyright (c) 2015 Ivaylo Iltchev www.iltchev.com, MIT License -* -* Permission is hereby granted, free of charge, to any person obtaining a copy of this software -* and associated documentation files (the "Software"), to deal in the Software without -* restriction, including without limitation the rights to use, copy, modify, merge, publish, -* distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all copies or -* substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING -* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - #include "mbed.h" #include <stdio.h> #include "TS_DISCO_F429ZI.h" @@ -33,13 +15,11 @@ int main() { TS_StateTypeDef TS_State; - uint16_t x, y; - uint8_t status; + uint16_t x = 0, y = 0; lcdlog.Init(stdout, "TOUCHSCREEN DEMO"); - status = ts.Init(lcd.GetXSize(), lcd.GetYSize()); - if (status != TS_OK) + if (ts.Init(lcd.GetXSize(), lcd.GetYSize()) != TS_OK) { lcdlog.Footer("INIT FAIL\n"); } else { @@ -47,20 +27,17 @@ } printf("** Start **\n"); - x = TS_State.X; - y = TS_State.Y; while(1) { ts.GetState(&TS_State); if (TS_State.TouchDetected) { if (x != TS_State.X || y != TS_State.Y) { - printf("x=%03d y=%03d\n", x, y); x = TS_State.X; y = TS_State.Y; + printf("x=%03d y=%03d\n", x, y); } } wait_ms(5); } } -