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++
main.cpp
- Committer:
- icis4
- Date:
- 2015-12-26
- Revision:
- 4:8188d5640a90
- Parent:
- 3:79e2d3d36b63
- Child:
- 5:8ed13d45a9ce
File content as of revision 4:8188d5640a90:
/* 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" #include "LCD_DISCO_F429ZI.h" #include "LCD_LOG_DISCO.h" LCD_DISCO_F429ZI lcd; TS_DISCO_F429ZI ts; LCDLog lcdlog("lcdlog"); extern "C" { int LCD_LOG_write(uint8_t* text); } int main() { TS_StateTypeDef TS_State; uint16_t x, y; uint8_t status; lcdlog.Init(stdout, "TOUCHSCREEN DEMO"); status = ts.Init(lcd.GetXSize(), lcd.GetYSize()); if (status != TS_OK) { lcdlog.Footer("INIT FAIL\n"); } else { lcdlog.Footer("INIT OK"); } 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; } } wait_ms(5); } }