Hi Matt,

So I tried to understand what's behind glcd_common & co, here's some
feedback:

First, there are unused things, like GLCD_COLOR_SIZE for instance. I'd
suggest to remove all unnecessary, unused code, to make it clearer to read.
There are lots of portions of code commented out, better delete them too
(SVN is here to help if needed).

When specifying size, for instance height and width, you then use this kind
of logic:

-- set width of pixel x,y variables
if !defined(GLCD_X_PIXELS) then
   const GLCD_X_SIZE = 1
else
   if GLCD_X_PIXELS < 256 then
      const GLCD_X_SIZE = 1
   else
      const GLCD_X_SIZE = 2
   end if
end if


GLCD_X_SIZE is then used to define the number of bytes needed to store this
information ("byte*..."). Why not GLCD_X_SIZE = (GLCD_X_PIXELS / 256) + 1 ?
at least it would scale when screen is bigger, and I found the logic easier
to understand (that's a personal taste though). We'd need to check about
integer part when using division like this.

I think I can now try to migrate nokia_3310 on current API, at least slowly
moving to it. But having glcd_common, glcd_font cleaned would help me
understand the big picture.

See other comments inlined.

HTH
Cheers,
Seb

2011/2/13 mattschinkel <[email protected]>

> I wrote some notes by just a quick look at my libs. may not be
> complete or accurate.
>
> LCD DEVICE LIB REQUIREMENTS (must be contained in lib):
>
> -- constants required on all glcd's
> const GLCD_X_PIXELS = 240
> const GLCD_Y_PIXELS = 320
>

Also, about GLCD_X_PIXELS: why not just "GLCD_PIXEL_WIDTH" ? Well, not an
issue, we'll see later about names...


> const GLCD_COLOR_BITS = 16 -- 16bit color, 65535 colors
>
> -- required for drawing shapes.
> procedure lcd_write_pixel(byte in x,word in y,word in color) is
>
> -- only required if using fonts.
>

currently, you can't use chars *or* pixels, both are required
(compilation).


> -- See glcd_font.jal for an explanation of how fonts work
> -- and how they should be printed to the screen.
> -- by lcd'put(byte in char) in glcd_common
> procedure lcd_write_char(byte in font[], byte in x,word in y,byte in
> value) is
>
>
>
> GLCD FONT LIB INCLUDE BLOCK (for your sample)
>
> -- setup fonts
> const byte FONT_MORE_THEN_ONE = TRUE -- use more then one font
>

I think it's "_THAN_" :)


> const byte FONT_BIT_DIRECTION = FONT_TOP_RIGHT_HORIZONTAL -- see
> constants_jallib.jal
> const byte FONT_AUTO_WRAP = TRUE -- auto wrap text at end of screen
> --
> include glcd_font -- include the font library
> --
> -- choose some fonts
> alias FONT_1        is FONT_8X12_TOP_RIGHT_HORIZONTAL_NO_NAME
> alias FONT_1_WIDTH  is FONT_8X12_WIDTH
> alias FONT_1_HEIGHT is FONT_8X12_HEIGHT
> --
> -- set your current font
> FONT_NUMBER = 1  -- select your font number
> FONT_WIDTH  = FONT_1_WIDTH  -- must match current font width
> FONT_HEIGHT = FONT_1_HEIGHT -- must match current font height
>

OK, I can see what you mean, but usage is quite clumsy IMHO, specifying how
font_1 is created, then specifying all parameters for current font, from
font_1.


>
> GLCD_COMMON INCLUDE BLOCK (for your sample)
>
> var word LCD_BACK_COLOR = 0xFFFF -- white
> var word LCD_PEN_COLOR  = 0      -- black
>

How colors are coded (!= RGB) ? Is it GLCD specific ? If so, maybe each GLCD
lib should provide common aliases (GLCD_BLACK, _WHITE, _BLUE,...) and maybe
a glcd_rgb_color(r,g,b) returning appropriate color encoding.


include glcd_stm032qvt-003
> glcd_init()
> include glcd_common
>
>
>
> HOW TO PRINT A FONT AND SHAPE IN YOUR SAMPLE
>
> -- set back color
> LCD_BACK_COLOR = 0xffe0 -- yellow
> LCD_PEN_COLOR  = 0xf800 -- red pen
> --
> -- prints a string with current font
> -- see "-- set your current font" near your glcd_font include
> glcd_char_x_pos = 80             -- set a x position
> glcd_char_y_pos = 320 - 12       -- set a y position
> const byte string_y[] = "Y:   "  -- define a string
> print_string(lcd,string_y)       -- print a string
>
> -- draw a new circle
> LCD_PEN_COLOR = 0xf800 -- RED PEN
> lcd_circle(touch_x,touch_y,20)
>
>
> --
> 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.
>
>


-- 
Sébastien Lelong
http://www.sirloon.net
http://sirbot.org

-- 
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.

Reply via email to