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

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

Re: [avr-gcc-list] Re: Strings: escape sequence to insert arbitrary hex


From: Juergen Harms
Subject: Re: [avr-gcc-list] Re: Strings: escape sequence to insert arbitrary hex value ?
Date: Thu, 05 Feb 2009 13:36:36 +0100
User-agent: Thunderbird 2.0.0.19 (X11/20090114)

I have made good experience using the fact that the compiler concatenates sub-strings. Just dumping examples from existing code:

static char e_origin[] PROGMEM =
        "\x1b""AT\x00\x00\x14\x12\x01\x00""C\x7F\x00" ;

This example also illustrates one problem and its solution: the compiler has difficulties to distinguish between letters (at least a..f) that are part of a constant and letters that are part of a character string. In case of such an ambiguity, I simply start a new substring.

Here is a more complicated example that illustrates the transparency of comments with respect to concatenation, and that you need not resort to substrings as in the case of D\x82marrer (dont ask me why I used sub-strings for "CArr\x88""ter - I presently have a small problem and cannot try things out).

static char e_idle1[] PROGMEM =
        "\x1b""AE\x0B"                              // button borders #9
        "\x1b""AT\x28\x20\xCC\x32\x11\x00"  // KEY_SHARE + 1
                "CArr\x88""ter / D\x82marrer\x00" ;

Good luck!





reply via email to

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