2017-05-28 06:04 PM
Hello!
I have success to access LCD(ili9341).
And let it display characters. Note the code for string/char to LCD display still under develop.
In general of C, many case use 'printf' for output.
Q1) How can I to use 'printf'? e.g. include stdio.h and then ....?
Sorry I am beginner of C, please give me some information/guild to lean,.
In AVR, they have something to transfer printf string stream to specific LCD driver.
static FILE mydata = FDEV_SETUP_STREAM(ili9341_putchar_printf, NULL, _FDEV_SETUP_WRITE);//mydata declaration and converting it into stream
Q2) How to manage printf for different kind of output such LCD & UART?
In some system, they have LCD for display(in operation) AND using UART communicate with PC for remote/ data logging or trace logging.
If only one 'printf', how to operate between different output device.
Please share your comment/ experience to me.
BR
LC
2017-05-28 07:51 PM
Depends on the tool chain, with Keil I can implement a routine to send a character to multiple output devices. I could use fprintf() and a handle to output to specific devices.
Consider using sprintf(), and then push the string buffer to the devices you want to use.
2017-05-28 11:20 PM
Clive One
Thanks for your comment.
I am using IAR for software development.
Do you have implementation information with IAR for me?
As you said that '
I could use fprintf() and a handle to output to specific devices.'.
Is it necessary specifier devices before use
fprintf()?
BR
LC
2017-05-29 09:30 AM
I don't actively use IAR tools, you'll need to review the documentation/examples related to the tools you have chosen.
GNU/GCC and Keil provide means to provide board specific character IO functions.
fprintf() provides for a FILE handle to be passed, and that could be managed in the fputc() retargeting code.
2017-05-29 09:49 AM
As far as I remember, the IAR WB has a detailed tutorial for redirecting console output.
But IMHO
fprintf()
is not the best way.Files are an OS metaphor, and the OS is missing here.
I would use
sprintf()
and work on strings, as suggested earlier.2017-05-29 12:07 PM
fprintf() provides a standard method to get output to different devices/streams, whether you use the handle as a 32-bit constant, or a pointer to a user defined structure. Generally avoids having to reinvent the wheel or create non-portable code. People should pick what's appropriate for them.
2017-05-31 11:44 PM
Hi ALL
I still cannot output string to LCD module.
Please share a code for my reference.
BR
LC
2017-06-01 07:36 AM
There are much more working libraries for Arduino boards. For your display also I think. Here you are supposed to make your own, or if you are lucky a library can be found (with Google). There are some working examples or APIs for displays which are meant for STM32 devices.
https://github.com/MaJerle/stm32fxxx_hal_libraries
or has interesting libraries too.BSP_LCD_DisplayStringAt(oma, BSP_LCD_GetYSize() / 2 + 45,(uint8_t *) buffer, CENTER_MODE); works for STM32F746 Discovery board. It has a LCD display.
2017-06-03 02:01 AM
Hi mich.lei
In before, I am testing all(every related LCD) code in ''main.c'' and it work fine in compile.
I move all code and relative reference(include & define) to separated file(ili9341.c & ili9341.h).
Of cause, the preprocessor has updated with location for them.
Unfortunately, there have error in linking and show below.
Please help me and give me your comment.
BR
Lewis
2017-06-03 07:52 AM
I am afraid I can't help you much with linking. I just fight back when my IDE does something odd. Besides, you seem to use different IDE than I.
If you have a IDE/linking problem, why don't you start a new discussion about that?