Need advice on how some code should work

Hi all,

I’m in the process of converting some driver code for a graphic vacuum fluorescent display from plain AVR to Arduino as well as cleaning up some things, speeding up inefficient code, etc…

What I would like some advice on is this:

I currently have a function to reverse data on a character by character (or graphics object by object) basis.

The next function is a global reverse select.

To explain, the first function would be used like this (imagine that the blue is REVERSE VIDEO):

The current TIME is 03:44

Code-wise, it would be done like this:

VFD.print ("The current ");
VFD.setReverse (1);
VFD.print ("TIME");
VFD.setReverse (0);
VFD.print (" is 03:44");

The second function is a GLOBAL reverse. That is, everything would work in reverse. With the global reverse turned on, the same code above would yield:

The current TIME is 03:44

This is so that the driver can be used with LCD displays (which typically are reverse of VFD - that is on a VFD a pixel glows while on an LCD a pixel is black).

My question is this: I plan to add a third function… a global invert that only reverses what is currently on the screen. For example, you could display some text and/or graphics, then make the whole screen “blink” by doing a repeating set of “invert - delay - invert - delay” calls.

The difference is that the “blinker” invert does not change any “normal/reverse” flags. Any subsequent text or graphics are printed the same as previously set.

At first I thought that the global reverse function would do what I wanted, but it won’t because it can be left in an unknown state (that is, if I called it an even number of times, the “state” of reverse would be the same, but if called an odd number of times, the state of reverse would be inverted).

So finally to the advice that I am asking for… should the global invert ALSO do the “blink” function, depending on the programmer to leave “blink” in the proper state, of should there be a separate function for this?

That is, should I have this:

(1) Reverse/Normal text
(2) Global reverse/normal

or this:

(1) Reverse/Normal text
(2) Global reverse/normal
(3) A reverse function that does not change the state of global reverse (i.e. used for blinking)

Geez… I hope this isn’t too confusing!

Any advice will be appreciated. Thanks!

– Roger