avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Trick for creating WYSIWYG bitmaps in C [was: how to


From: Derric Tubbs
Subject: Re: [avr-gcc-list] Trick for creating WYSIWYG bitmaps in C [was: how to specifiy a binary constant]
Date: Fri, 23 Sep 2005 07:37:48 -0700 (PDT)

Sorry about that, my bad, you have to put spaces
between all of the symbols that make up the bitmap.

Tubbs

--- Bob Paddock <address@hidden> wrote:

> 
> I thought I'd try this bitmap 'trick' via copy&paste
> of the
> #defines and code into the file I was working on,
> this is what I get:
> 
> Name/name.c:692: error: `sXXXXXX__' undeclared here
> (not in a function)
> Name/name.c:692: error: initializer element is not
> constant
> Name/name.c:692: error: (near initialization for
> `lcd_char_P[0]')
> Name/name.c:693: error: `sX_____X_' undeclared here
> (not in a function)
> Name/name.c:693: error: initializer element is not
> constant
> [snip rest of the bitmap erros]
> 
> Is this 'trick' compiler or compiler option
> dependent?
> 
> This is usually the problem with 'tricks' they come
> back and
> bite you at some point.
> 
> On Thu, 22 Sep 2005 23:48:38 -0400, Derric Tubbs
> <address@hidden> wrote:
> 
> > Secondly, I got this little trick from the book
> that
> > the link above points to, the book is called
> "Expert C
> > Programming".  Anyhow for an 8 bit LCD bitmap like
> > Vincent mentioned below, do the following:
> >
> > #define X )*2+1
> > #define _ )*2
> > #define s ((((((((0 /* 8 parens for 8 bit, 16 for
> 16,
> > etc) */
> >
> > Then you just "draw" your bitmap as such:
> >
> > uint8_t lcd_char_P[] =
> > {
> >   sXXXXXX__,
> >   sX_____X_,
> >   sX______X,
> >   sX_____X_,
> >   sXXXXXX__,
> >   sX_______,
> >   sX_______,
> >   sX_______
> > }
> >
> > and then make sure you undef the X,s, and _.  Now
> > doesn't that look like a big P right in your code
> ;)
> >
> > Pretty cool little trick.  Kind of extravegant but
> > something similar to this sure would have made
> things
> > clearer when I was looking at some code that
> defined
> > characters on a graphic LCD the other day ;)
> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]