Hi Matt,
On 29-11-11 11:43, mattschinkel wrote:
I read in the glcd_common library that it is recommended to have a
glcd_clear_screen() procedure in the glcd device-libraries when
block-writes are not supported.
Q1: what are block writes?
Block writes are a fast way to draw a square or rectangular area (for
lcd's that support it). At this point maybe only stm032qvt.
For example, you could draw a block from 0,0 to 1,1
1. send the glcd the block area to write to (0,0,1,1)
2. send data for 0,0
3. send data for 0,1
4. send data for 1,0
5. send data for 1,1
You could see how this would be useful for drawing a picture or font
character that matches in bit/byte order. See the font lib.
Aha, I had the impression that it was a hardware feature!
The KS0108 library has already something alike, but no
GLCD_BLOCK_WRITE_TYPE defined. I'll have to look more closely in
glcd_common what it implies when it would be defined in ks0108.
The KS0108 always draws 8 pixels at a time (in a vertical row). This
allows a more efficient procedure than writing pixel-by-pixel like in
the clear_screen in common.jal.
stm032qvt sends 2 bytes of data per pixel (the color) during block
writes. If you draw pixel by pixel, you would have to send command +
coordinates + color = 12 bytes.
When block writes are not supported a generic glcd_clear_screen()
procedure is defined in glcd_common. Apart from clearing the screen it
sets the char_x and -y positions to zero. As far as I know this cannot
be done in the glcd-device library because glcd_common must be included
after the glcd-device library.
Q2: How do we to that?
My opinion is that setting char_x and char_y in the clear screen
procedure is pointless. It is there because it was there before Seb
and I looked at it.
However, we could prototype a glcd_reset_char_pos() procedure in the
glcd's device lib. reset_char_pos() would go in glcd_common and reset
the values.
I tend to agree that it is not very useful. So why not remove this
(requirement) from glcd_clear_screen() procedures.
If there is a good argument ('because my application relies on it' is
not good enough IMHO) a prototype in the glcd device library might be an
alternative.
Q3: What is 'fonts with horizontal bit alignment'?
Where can I read about this
The above block write is top left horizontal, it is best to use a font
that matches in bit order.
You can see that I started writing in the top left, then write
horizontally before going to the next line.
'Next line' is in terms of pixels, I suppose?
As I said the KS0108 writes 8 pixels at a time, and when properly
aligned (y-coordinate a multiple of 8) it can write text very fast (8
lines of pixels simultaneously). The current library does the alignment
by itself, which means effectively that for text it behaves like an
8-lines character lcd (but for the x-coordinate it can align on pixel
boundary!). It would be nice to make it possible to align text also
vertically at pixel-boundary, but to do that efficiently needs some
study...
Note: glcd_fill in the KS0108 library works also (vertically) like a
character-LCD (y-coordinate truncted to a multiple of 8).
Although I currently have only a KS0108 based glcd, I have looked in the
other glcd libraries. I'm afraid I have some comments:
1. Many 'public' functions and procedures do not have a generic name
(starting with 'glcd_'), but start with 'nokia' or 'stm' or 'touch'.
This is not the way we should provide libraries! It makes switching
between glcd's not very easy while we try with Jallib to make everything
device independent as far as possible/reasonable.
This is why there is a glcd_common. It has generic proc names for all
glcd's
I think Seb didn't like some procedures in glcd_common and went with
his own for nokia lib, and therefore the nokia sample uses some nokia
procedures directly. Actually I think he has no choice but to use some
kind of lcd update procedure.
When these procedures would be declared 'private' I couldn't have an
objection. When using private procedure the user deliberately takes the
risc that migrating to another glcd becomes more difficult.
A quick look at my sample 18f4620_glcd_touch_stm032qvt_003.jal shows
that I only use glcd_ procs in the user code. Nothing starting with
stm_ or alike. Is this what you like?
Yes, but the question if I like it or not is not so important!
I think it is more important that Jallib provides a consistent interface
for similar devices. In this particular case: the Jallib glcd-libraries
should provide the user with a set of public constants, variables,
procedures and functions (all with a name starting with 'glcd_') which
are sufficient for most applications. Only in exceptional situations he
might be forced to use private procedures (names starting with _ks0108,
_stm, _nokia, etc.).
Personally I think we need a standard template for notes on every
procedure.
Yes! See other thread.
Regards, Rob.
--
R. Hamerling, Netherlands --- http://www.robh.nl
--
You received this message because you are subscribed to the Google Groups
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jallib?hl=en.