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++
Diff: main.cpp
- Revision:
- 0:355a7d27c2f6
- Child:
- 2:bda0167d200a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Dec 25 23:14:30 2015 +0000 @@ -0,0 +1,51 @@ +#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"); + +//AnalogIn ain(PA_13); + +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"); + fflush(lcdlog); + 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); + } +} +