<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="pl-pl">
<link rel="self" type="application/atom+xml" href="https://forum.atnel.pl/feed.php?f=4&amp;t=5426&amp;mode" />

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2014-01-04T20:41:08+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=4&amp;t=5426&amp;mode</id>
<entry>
<author><name><![CDATA[Badman]]></name></author>
<updated>2014-01-04T20:41:08+01:00</updated>
<published>2014-01-04T20:41:08+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=5426&amp;p=63818#p63818</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=5426&amp;p=63818#p63818"/>
<title type="html"><![CDATA[Re: Kompilacja warunkowa]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=5426&amp;p=63818#p63818"><![CDATA[
Dziękuję, nie wiedziałem że w dyrektywach można używać iloczyn logiczny.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=916">Badman</a> — 4 sty 2014, o 20:41</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Krauser]]></name></author>
<updated>2014-01-04T20:29:33+01:00</updated>
<published>2014-01-04T20:29:33+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=5426&amp;p=63816#p63816</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=5426&amp;p=63816#p63816"/>
<title type="html"><![CDATA[Re: Kompilacja warunkowa]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=5426&amp;p=63816#p63816"><![CDATA[
To to skoro wiesz co ma być to dlaczego masz:<br />[syntax=c]#elif USE_ST7565_STRING == 1[/syntax]<br />który to warunek jest spełniony gdy USE_ST7565_CHAR = 0 i USE_ST7565_STRING = 1<br />Zastąp to:<br />[syntax=c]#if USE_ST7565_STRING == 1 &amp;&amp; USE_ST7565_CHAR == 1[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=465">Krauser</a> — 4 sty 2014, o 20:29</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Badman]]></name></author>
<updated>2014-01-04T19:47:59+01:00</updated>
<published>2014-01-04T19:47:59+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=5426&amp;p=63812#p63812</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=5426&amp;p=63812#p63812"/>
<title type="html"><![CDATA[Kompilacja warunkowa]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=5426&amp;p=63812#p63812"><![CDATA[
Piszę bibliotekę i mam problem z kompilacją warunkową, w pliku nagłówkowym mam np.:<br /><br />#define USE_ST7565_CHAR1<br />#define USE_ST7565_STRING   1<br /><br />w pliku biblioteki mam:<br />[syntax=c]#if USE_ST7565_CHAR == 1<br />//----------------------------------------------------------------------------------------<br />//<br />//Wyswietla znak ascii na pozycji x,y koloru charColor z tlem bkColor<br />//<br />//----------------------------------------------------------------------------------------<br />void st7565_write_char_8x16( uint8_t x, uint8_t y, char c, uint16_t charColor, uint16_t bkColor)<br />{<br />uint8_t i=0, j=0;<br />uint8_t tmp_char=0;<br /><br />    for( i = 0; i &lt; 16; i++ )<br />    {<br />        tmp_char = pgm_read_byte(&amp;(ascii_8x16&#91;(( c - 0x20 ) * 16 ) + i&#93;));<br />        for( j = 0; j &lt; 8; j++ )<br />        {<br />            if((( tmp_char &gt;&gt; ( 7 - j )) &amp; 0x01 ) == 0x01 )<br />            {<br />            st7565_set_pixel( x + j, y + i, charColor );<br />            }<br />            else<br />            {<br />            st7565_set_pixel( x + j, y + i, bkColor );<br />            }<br />        }<br />    }<br />}<br /><br />#elif USE_ST7565_STRING == 1<br />//----------------------------------------------------------------------------------------<br />//<br />//Wyswietla tekst od pozycji x,y koloru charColor z tlem bkColor<br />//<br />//----------------------------------------------------------------------------------------<br />void st7565_write_string_8x16( uint8_t x, uint8_t y, char * str, uint16_t charColor, uint16_t bkColor )<br />{<br />    while( *str )<br />    {<br />    st7565_write_char_8x16( x, y, *str++, charColor, bkColor );<br />       x += 8;<br />    }<br />}<br />#endif[/syntax] <br /><br />w main jest użycie funkcji st7565_write_string_8x16, podczas kompilacji mam:<br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">avr-gcc -Wl,-Map,LCD_ST7565.map -mmcu=atmega32 -o&quot;LCD_ST7565.elf&quot;  ./main.o  ./ST7565/ST7565.o   <br />./main.o: In function `main':<br />main.c:(.text+0x38): undefined reference to `st7565_write_string_8x16'<br />make: *** &#91;LCD_ST7565.elf&#93; Error 1</div><br /><br />czyli funkcja st7565_write_string_8x16 nie jest kompilowana <img src="https://forum.atnel.pl/images/smilies/icon_e_sad.gif" alt=":(" title="Smutny" /><br />Korzystam z takiej konstrukcji ponieważ funkcja  st7565_write_string_8x16 ma być kompilowana tylko wtedy, gdy USE_ST7565_CHAR = 1 i USE_ST7565_STRING = 1. W przypadku kiedy USE_ST7565_CHAR = 0 funkcja st7565_write_string_8x16 ma nie zostać skompiklowana.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=916">Badman</a> — 4 sty 2014, o 19:47</p><hr />
]]></content>
</entry>
</feed>