16
Clear Screen
The
Clear Screen
block clears an entire screen to show only the background color. A good
application for this is right before a background display gets drawn.
Element
The
Element
block outputs a function call trigger. For elements being actively drawn on the
screen, the
Element
block will first clear the area behind it before drawing. This can be useful for text
being drawn and updated on the screen in the same position.
It should be noted that for elements that will be changing position on the screen, this block is
not a good option, as it will only clear the next position that a block is to be drawn in, leaving an artifact
still from the previous position.
Drawing Text Example
Working with Raptor™ Strings,
Printf
, etc.
Because the end goal of Simulink is to generate C code, there is no direct notion of a String
object. Raptor™ provides a few blocks to make working with String text easier.
3.2.5.a –
Raptor
™
String
and
Printf
blocks
The first block Raptor™ provides is the
String
block. The
String
block allocates a block of
program memory of a particular character length and if defined, initializes it with a null-terminated
String value. The benefit to this is that a String of text can now be passed around without needing to
explicitly handle it as an array of characters.
The other String block that is commonly useful in display design is the
Printf
block. The Raptor™
Printf
block exposes all the functionality of a C format string in Raptor™ . Perhaps the most powerful
feature of this block is that it will read the provided format string, and create input ports for each of the
parameters. The block then outputs the formatted string.
There are a number of other String blocks available in the Raptor™ library as well to convert
Raptor™ Strings to and from arrays, determine length, and even perform a Scanf on a string.
Drawing String Text
Drawing text is fairly straightforward, with a few caveats.