I'm working on a new line print API in apps that's supposed to replaces
most of lcd_puts_* and lcd_putsxy_*.
The lcd_puts* became really messy and it still doesn't support scrolling
properly (not at all for pixel based functions). The rework I'm working
on will hopefully be simplified and fix scrolling, while allowing more
control over the line style and contents.
My motivation is to properly implement  (line separator in lists).
This line separator cannot be properly implemented just in apps because
scrolling draws over it, and scrolling is entirely in firmware and calls
only firmware function. To not further complicate lcd_puts* a rework is
My idea is a having a single function:
put_line(int x, int y, struct line_desc *desc, const char *fmt, ...).
- x, y are the position of the line (in pixels!).
- struct line_desc defines other properties the line: style (for line
selectors, and the line separators mentioned above), scrolling, line
height and multiline information.
- fmt is a format string that controls the contents of the line. Similar
to printf() tags can be used to put icons, text and margins (perhaps
other stuff too in the future), the variable paramter list is then used
to build the contents
There are some complications, most notably scrolling, multiline and RTL,
which I can hopefully work out soon (i think I will solve scrolling by
setting up a callback so apps code can do the actual drawing). As if now
there is a preview of my work in , see apps/gui/bitmap/list.c for an
example of how to use the new api.
So, what do you think? Is going forward worthwhile and welcome? Do you
have comments/remarks/suggestions as to the proposed API function?
Received on 2013-02-15