<?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=23&amp;t=8502&amp;mode" />

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2014-09-13T22:49:06+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=23&amp;t=8502&amp;mode</id>
<entry>
<author><name><![CDATA[artur85]]></name></author>
<updated>2014-09-13T22:49:06+01:00</updated>
<published>2014-09-13T22:49:06+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=8502&amp;p=95371#p95371</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=8502&amp;p=95371#p95371"/>
<title type="html"><![CDATA[Re: Moja biblioteka do obsługi wyświetlacza z Nokii3510i]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=8502&amp;p=95371#p95371"><![CDATA[
Jak tu nie szaleć kiedy zapał jest i chęci <img src="https://forum.atnel.pl/images/smilies/icon_e_biggrin.gif" alt=":D" title="Bardzo szczęśliwy" /> A pomysłów w głowie pełno<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1212">artur85</a> — 13 wrz 2014, o 22:49</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[mirekk36]]></name></author>
<updated>2014-09-13T08:15:28+01:00</updated>
<published>2014-09-13T08:15:28+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=8502&amp;p=95303#p95303</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=8502&amp;p=95303#p95303"/>
<title type="html"><![CDATA[Re: Moja biblioteka do obsługi wyświetlacza z Nokii3510i]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=8502&amp;p=95303#p95303"><![CDATA[
Kolega widzę &quot;szaleje&quot; z projektami <img src="https://forum.atnel.pl/images/smilies/icon_e_wink.gif" alt=";)" title="Puszcza oko" /> oczywiście w pozytywnym tego słowa znaczeniu .... aż miło popatrzeć ... Świetna robota.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=54">mirekk36</a> — 13 wrz 2014, o 08:15</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[artur85]]></name></author>
<updated>2014-09-13T16:54:59+01:00</updated>
<published>2014-09-13T05:33:34+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=8502&amp;p=95292#p95292</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=8502&amp;p=95292#p95292"/>
<title type="html"><![CDATA[Moja biblioteka do obsługi wyświetlacza z Nokii3510i]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=8502&amp;p=95292#p95292"><![CDATA[
Parę słów o sterowniku.<br />Obsługiwana liczba kolorów:<br /> - <strong>4096 </strong>(12bit, 4 - R, 4 - G, 4 - B);<br /> - <strong>256</strong> (8bit, 3 - R, 3 - G, 2 - B).<br />Wybór w pliku nagłówkowym sterownika.<br /><br />Funkcje w bibliotece podzieliłem na kilka grup:<br /> - <strong>funkcje do rysowania figur:</strong><br />Można rysować linie, prostokąty, trójkąty. W planach są jeszcze figury owalne, wypełnianie gradientem i... tworzenie prostych grafik wektorowych. Zobaczymy co z tego wyjdzie  <img src="https://forum.atnel.pl/images/smilies/icon_e_smile.gif" alt=":)" title="Szczęśliwy" /> <br /> - <strong>funkcje do obsługi tekstu, tryb 1:</strong><br />Funkcje wyświetlające stringi i zmienne. Rozmieszczenie tekstu z rozdzielczością piksela. Możliwość wyboru koloru czcionki oraz tła (można je również wyłączyć), obrót o 90 stopni. Jest też możliwość pozycjonowania tekstu na lewo albo na prawo względem podanych współrzędnych.<br /> - <strong>funkcje do obsługi tekstu, tryb 2:</strong><br />Taki niby tryb tekstowy. Jako współrzędne tekstu podaje się nr wiersza i kolumny. Kluczowa komenda LCD_printf. Służy do wyświetlania stringów, zmiennych oraz formatowania tekstu. Dokładniejszy jej opis znajduje się w pliku z biblioteką. Tak na marginesie to cały tekst &quot;test mode 3&quot; z demka został wyświetlony przy jednorazowym użyciu właśnie tej funkcji.<br /> - <strong>funkcje (a właściwie 1 funkcja) do wyświetlania obrazków:</strong> <br />Na razie obraz wyświetlany jest tylko przy ustawionej palecie z 256 kolorami. Obrazek znajduje się w pliku nagłówkowym MyImage.h. Plik generowany automatycznie za pomocą skryptu napisanego w Scilabie. Skrypt ten &quot;wyciąga&quot; kolory z obrazka i po odpowiednim przemieleniu wrzuca je w plik nagłówkowy. Przed uruchomieniem skryptu trzeba obrazek przeskalować  <img src="https://forum.atnel.pl/images/smilies/icon_e_wink.gif" alt=";)" title="Puszcza oko" /> <br /><br />Jak już pisałem, funkcje podzieliłem na grupy. Każdą grupę można włączyć/wyłączyć w zależności od potrzeb.<br />Szacowana zajętość kodu przez funkcje:<br />figury geometryczne -<strong>ok 2,5kB</strong> flash<br />obsługa tekstu tryb 1 -<strong>ok 3kB</strong> flash<br />obsługa tekstu tryb 2 -<strong>ok 2kB</strong> flash<br />wczytywanie grafiki -<strong>ok 0,1kB</strong> flash (+rozmiar obrazka!)<br /><br />Demko udało mi się upchać na atmedze8, zajętość flasha 97,3% <img src="https://forum.atnel.pl/images/smilies/icon_e_biggrin.gif" alt=":D" title="Bardzo szczęśliwy" /><br />Atmega ta może też pomieścić obrazek o rozmiarze wyświetlacza czyli 98x67 pikseli (paleta 256kolorów).<a href="http://forum.atnel.pl/_obrazki/o/1212/455791bf10c0411cb130c3b8fcc77010.jpg"  class="postlink">Pozdrowienia dla Pana Hermana <img src="https://forum.atnel.pl/images/smilies/icon_e_biggrin.gif" alt=":D" title="Bardzo szczęśliwy" /></a><br /><br />Koniec mojego ględzenia, pora na kod:<br />nokia3510i.c<br />[syntax=c]/*<br /> * nokia3510i.c<br /> *<br /> *  Created on: 7 wrz 2014<br /> *      Author: Artur<br /> */<br /><br />#include &lt;avr/io.h&gt;<br />#include &quot;nokia3510i.h&quot;<br />#include &lt;util/delay.h&gt;<br />#include &lt;stdarg.h&gt;<br />#if _USE_IMAGE_READ<br />#include &quot;MyImage.h&quot;<br />#endif<br /><br />uint8_t lcd_clr&#91;3&#93;;<br />uint8_t lcd_bg_clr&#91;3&#93;;<br />uint8_t kolory=1;<br />uint8_t IsBgCol=1;<br />uint8_t direction;<br />uint8_t rotation;<br />uint8_t loc_x=1, loc_y=1;<br /><br /><br />//inicjalizacja wyświetlacza<br />void LCD_init(void)<br />{<br />MY_DDR|=MY_CLK|MY_CS|MY_RST|MY_SIO;<br />RST_LOW;//reset stan niski<br />_delay_ms(5);<br />RST_HI;//reset stan wysoki<br />_delay_ms(5);<br />LCD_send_byte(0x01,1);//software reset<br />_delay_ms(5);<br />LCD_send_byte(0xC6,1);//initial escape<br />LCD_send_byte(0xB9, 1);// Refresh set<br />LCD_send_byte(0x00, 0);<br />LCD_send_byte(0xB6,1);//display settings<br />LCD_send_byte(0X80,0);//liczba cykli b10000000<br />LCD_send_byte(0x80,0);//bez inwersji N line<br />LCD_send_byte(0x81,0);//podział częstotliwości, bias rate 1/9, sterownik na gorze, rozmiar 98x67<br />LCD_send_byte(84,0);<br />LCD_send_byte(69,0);<br />LCD_send_byte(82,0);<br />LCD_send_byte(67,0);<br />LCD_send_byte(0xB3,1);//ustawienia skali szarosci 1<br />LCD_send_byte(0x11,0);<br />LCD_send_byte(0x22,0);<br />LCD_send_byte(0x33,0);<br />LCD_send_byte(0x44,0);<br />LCD_send_byte(0x55,0);<br />LCD_send_byte(0x66,0);<br />LCD_send_byte(0x77,0);<br />LCD_send_byte(0x88,0);<br />LCD_send_byte(0x99,0);<br />LCD_send_byte(0xAA,0);<br />LCD_send_byte(0xBB,0);<br />LCD_send_byte(0xCC,0);<br />LCD_send_byte(0xDD,0);<br />LCD_send_byte(0xEE,0);<br />LCD_send_byte(0xFF,0);<br />LCD_send_byte(0xB5,1);//korekcja GAMMA<br />LCD_send_byte(0x01,0);<br />LCD_send_byte(0xBD,1);//common driver<br />LCD_send_byte(0x00,0);<br />LCD_send_byte(0xBE,1);//power controll<br />LCD_send_byte(0x03, 0);<br />LCD_send_byte(0x11,1);//sleep out<br />LCD_send_byte(0xBA,1);//voltage controll<br />LCD_send_byte(0x7F, 0);<br />LCD_send_byte(0x03, 0);<br />LCD_send_byte(0xB7, 1);// Temperature gradient<br />for(uint8_t i=0; i&lt;14; i++)<br />LCD_send_byte(0, 0);<br />LCD_send_byte(0x03,1);//booster voltage on<br />_delay_ms(40);<br /><br />#if _USE_ALL_COLORS<br />LCD_send_byte(0x3A, 1);<br />LCD_send_byte(0x03, 0);//tryb 444 - 4096 kolorów<br /><br />#else<br />LCD_send_byte(0x3A, 1);<br />LCD_send_byte(0x02, 0);//tryb 332 - 256 kolorów<br />LCD_send_byte(0x2D, 1);//ustawienie palety kolorów<br />LCD_send_byte(~0x00, 0);// RED<br />LCD_send_byte(~0x02, 0);<br />LCD_send_byte(~0x04, 0);<br />LCD_send_byte(~0x06, 0);<br />LCD_send_byte(~0x07, 0);<br />LCD_send_byte(~0x08, 0);<br />LCD_send_byte(~0x0a, 0);<br />LCD_send_byte(~0x0f, 0);<br />LCD_send_byte(~0x00, 0);// GREEN<br />LCD_send_byte(~0x02, 0);<br />LCD_send_byte(~0x04, 0);<br />LCD_send_byte(~0x06, 0);<br />LCD_send_byte(~0x07, 0);<br />LCD_send_byte(~0x08, 0);<br />LCD_send_byte(~0x0a, 0);<br />LCD_send_byte(~0x0f, 0);<br />LCD_send_byte(~0x00, 0);// BLUE<br />LCD_send_byte(~0x05, 0);<br />LCD_send_byte(~0x07, 0);<br />LCD_send_byte(~0x0f, 0);<br />#endif<br />LCD_all_pixels_off();<br />LCD_SetColor(0,0,0);//kolor czarny<br /><br />#if _COMMON_STRING_MODE<br />LCD_SetBackgroudColor(_BLACK);<br />#endif<br />LCD_Clear();<br />LCD_display_on();<br />}<br /><br />void LCD_send_byte(uint8_t data, uint8_t isCMD)<br />{<br /><br />if (isCMD) CS_HI;<br />CS_LOW;<br />CLK_LOW;<br />//wysłanie C/D<br />if (isCMD)<br />SIO_LOW;<br />else<br />SIO_HI;<br />CLK_HI;<br />for (uint8_t i =0;i&lt;8;i++){<br />CLK_LOW;<br />if (data&amp;128)<br />SIO_HI;<br />else<br />SIO_LOW;<br />CLK_HI;<br />data&lt;&lt;=1;<br />}<br />}<br /><br />//wyświetlenie piksela o zadanych współrzędnych<br />//kolor piksela ustawia się komendą LCD_SetColor<br />void LCD_Pixel(uint8_t xPos, uint8_t yPos) {<br />if ((xPos&lt;98)&amp;&amp;(yPos&lt;67)){<br />//położenie piksela x<br />LCD_send_byte(0x2A, 1);<br />LCD_send_byte(xPos, 0);<br />LCD_send_byte(xPos,0);<br />//położenie piksela y<br />LCD_send_byte(0x2B, 1);<br />LCD_send_byte(yPos, 0);<br />LCD_send_byte(yPos,0);<br />//wysłanie koloru piksela do DDRAM<br />LCD_send_byte(0x2C, 1);<br />LCD_send_byte(lcd_clr&#91;0&#93;, 0);<br />#if _USE_ALL_COLORS<br />LCD_send_byte(lcd_clr&#91;1&#93;, 0);<br />#endif<br />LCD_send_byte(0x00,1);//odśwież<br />}<br />}<br />//wszystkie pikele zgaszone - czarny ekran<br />//aby wyjść z tego trybu należy użyć komendy LCD_display_on<br />void LCD_all_pixels_off(void){<br />LCD_send_byte(0x22,1);//wylacz piksele<br />LCD_send_byte(0x00,1);//odśwież<br />}<br />//wszystkie pikele zapalone - biały ekran<br />//aby wyjść z tego trybu należy użyć komendy LCD_display_on<br />void LCD_all_pixels_on(void){<br />LCD_send_byte(0x13,1);//zapal piksele<br />LCD_send_byte(0x00,1);//odśwież<br />}<br /><br />//służy do włączania pikseli po komendzie LCD_all_pixels_off albo LCD_all_pixels_on<br />void LCD_display_on(void){<br />LCD_send_byte(0x13,1);//zapal piksele<br />LCD_send_byte(0x00,1);//odśwież<br />}<br /><br />//odśieżenie ekranu<br />void LCD_refresh(void){<br />LCD_send_byte(0x00,1);//odśwież<br />}<br /><br />//ustawienie kontrastu, domyślan wartość contrast = 63<br />void LCD_contrast(uint8_t contrast){<br /><br />LCD_send_byte(0x25,1);<br />LCD_send_byte(contrast,0);<br />}<br /><br />//wyczyszczenie ekranu, przed użyciem komendy należy wybrać kolor tła za pomocą komendy LCD_SetColor<br />void LCD_Clear(void) {<br />LCD_send_byte(0x2A, 1);<br />LCD_send_byte(0, 0);<br />LCD_send_byte(97,0);<br />LCD_send_byte(0x2B, 1);<br />LCD_send_byte(0, 0);<br />LCD_send_byte(66,0);<br />LCD_send_byte(0x2C, 1);<br />#if _USE_ALL_COLORS<br />for(uint16_t cnt = 0; cnt &lt; 3283; cnt++)<br />{<br />LCD_send_byte(lcd_clr&#91;0&#93;, 0);<br />LCD_send_byte(lcd_clr&#91;1&#93;, 0);<br />LCD_send_byte(lcd_clr&#91;2&#93;, 0);<br />}<br />#else<br />for(uint16_t cnt = 0; cnt &lt; 6566; cnt++)<br />{<br />LCD_send_byte(lcd_clr&#91;0&#93;, 0);<br />}<br />#endif<br /><br />LCD_send_byte(0x00,1);//odśwież<br />}<br /><br />//wartości każdego koloru w zakresie od 0 do 15<br />//zarówno dla mode 444 (4096 kolorów) jak i mode 332 (256 kolorów)<br />//zdefiniowane kolory: _WHITE, _BLACK, _RED, _GREEN, _BLUE, _YELLOW, _CYAN, _MAGENTA<br />void LCD_SetColor(uint8_t red, uint8_t green, uint8_t blue) {<br />#if _USE_ALL_COLORS<br />lcd_clr&#91;0&#93; = red&lt;&lt;4;<br />lcd_clr&#91;1&#93; = blue&lt;&lt;4;<br />lcd_clr&#91;2&#93; = green&lt;&lt;4;<br />lcd_clr&#91;0&#93; |= green;<br />lcd_clr&#91;1&#93; |= red;<br />lcd_clr&#91;2&#93; |= blue;<br />lcd_clr&#91;0&#93; ^= 0xFF;<br />lcd_clr&#91;1&#93; ^= 0xFF;<br />lcd_clr&#91;2&#93; ^= 0xFF;<br />#else<br />lcd_clr&#91;0&#93;=((red&lt;&lt;4)&amp;0b11100000)|((green&lt;&lt;1&amp;0b00011100))|((blue&gt;&gt;2)&amp;0b00000011);<br />lcd_clr&#91;1&#93;=((red&lt;&lt;4)&amp;0b11100000)|((green&lt;&lt;1&amp;0b00011100))|((blue&gt;&gt;2)&amp;0b00000011);<br />lcd_clr&#91;2&#93;=((red&lt;&lt;4)&amp;0b11100000)|((green&lt;&lt;1&amp;0b00011100))|((blue&gt;&gt;2)&amp;0b00000011);<br />#endif<br />}<br /><br />#if _COMMON_STRING_MODE<br /><br />//komenda do ustawiania parametrów tekstu<br />//<br />//IsBg = 1 - tło aktywne<br />//Is = 0 - brak tła<br />//<br />//dir = _LEFT (1)  - tekst wyświetlany po lewej stronie względem współrzędnych początkowych (przydatne przy wyświetlaniu liczb)<br />//dir = _RIGHT (0) - tekst wyświetlany po prawej stronie względem współrzędnych początkowych<br />//<br />//rot = _ROT_ON (1) - tekst pionowy<br />//rot = _ROT_OFF (0) - tekst poziomy<br />void LCD_String_settings(uint8_t IsBg,uint8_t dir,uint8_t rot){<br />IsBgCol=IsBg;<br />direction=dir;<br />rotation=rot;<br />}<br /><br />//ustawienie koloru tła tekstu<br />//zdefiniowane kolory: _WHITE, _BLACK, _RED, _GREEN, _BLUE, _YELLOW, _CYAN, _MAGENTA<br />void LCD_SetBackgroudColor(uint8_t red, uint8_t green, uint8_t blue) {<br /><br />#if _USE_ALL_COLORS<br />lcd_bg_clr&#91;1&#93; = blue&lt;&lt;4;<br />lcd_bg_clr&#91;0&#93; = red&lt;&lt;4;<br />lcd_bg_clr&#91;1&#93; |= red;<br />lcd_bg_clr&#91;2&#93; = green&lt;&lt;4;<br />lcd_bg_clr&#91;0&#93; |= green;<br />lcd_bg_clr&#91;2&#93; |= blue;<br />lcd_bg_clr&#91;0&#93; ^= 0xFF;<br />lcd_bg_clr&#91;1&#93; ^= 0xFF;<br />lcd_bg_clr&#91;2&#93; ^= 0xFF;<br />#else<br />lcd_bg_clr&#91;0&#93;=((red&lt;&lt;4)&amp;0b11100000)|((green&lt;&lt;1&amp;0b00011100))|((blue&gt;&gt;2)&amp;0b00000011);<br />lcd_bg_clr&#91;1&#93;=((red&lt;&lt;4)&amp;0b11100000)|((green&lt;&lt;1&amp;0b00011100))|((blue&gt;&gt;2)&amp;0b00000011);<br />lcd_bg_clr&#91;2&#93;=((red&lt;&lt;4)&amp;0b11100000)|((green&lt;&lt;1&amp;0b00011100))|((blue&gt;&gt;2)&amp;0b00000011);<br />#endif<br />}<br />#endif<br /><br />#if _USE_STRING_WRITE_MODE_1<br /><br />//wyświetlenie strina o zadanych współrzędnych, czcionka wysoka na 8 pikseli<br />void LCD_String(char *text,uint8_t pos_x,uint8_t pos_y){<br />if (rotation)<br />{<br />if (direction==1){//obliczanie nowych współrzędnych początkowych gdy tekst wyświelany jest w lewo<br />uint8_t count=0;<br />while (text&#91;count&#93;!='\0')<br />count++;<br />pos_y-=count*6;<br />}<br />pos_x+=8;<br />}<br />else<br />{<br />if (direction==1){//obliczanie nowych współrzędnych początkowych gdy tekst wyświelany jest w lewo<br />uint8_t count=0;<br />while (text&#91;count&#93;!='\0')<br />count++;<br />pos_x-=count*6;<br />}<br />}<br />uint8_t color_temp&#91;3&#93;;<br />color_temp&#91;0&#93;=lcd_clr&#91;0&#93;;<br />color_temp&#91;1&#93;=lcd_clr&#91;1&#93;;<br />color_temp&#91;2&#93;=lcd_clr&#91;2&#93;;<br />uint8_t x_temp=pos_x;<br />uint8_t y_temp=pos_y;<br />uint8_t nr=0;<br />uint8_t char_temp;<br />while (text&#91;nr&#93;!='\0')<br />{<br />if ((text&#91;nr&#93;&lt;127)&amp;&amp;(text&#91;nr&#93;&gt;31))<br />{<br />for (uint8_t i = 0; i &lt; 5; i++ )<br />{<br />// kopiowanie tablicy<br />char_temp = pgm_read_byte(&amp;( font&#91; text&#91;nr&#93;-32 &#93;&#91; i &#93; ) );<br />for (uint8_t k=0;k&lt;8;k++){<br />if (char_temp&amp;1)<br />{<br />lcd_clr&#91;0&#93;=color_temp&#91;0&#93;;<br />lcd_clr&#91;1&#93;=color_temp&#91;1&#93;;<br />lcd_clr&#91;2&#93;=color_temp&#91;2&#93;;<br />LCD_Pixel(x_temp,y_temp);<br />}<br />else<br />{<br />if (IsBgCol){<br />lcd_clr&#91;0&#93;=lcd_bg_clr&#91;0&#93;;<br />lcd_clr&#91;1&#93;=lcd_bg_clr&#91;1&#93;;<br />lcd_clr&#91;2&#93;=lcd_bg_clr&#91;2&#93;;<br />LCD_Pixel(x_temp,y_temp);<br />}<br />}<br />char_temp&gt;&gt;=1;<br />if(rotation)<br />x_temp--;<br />else<br />y_temp++;<br />}<br />if(rotation){<br />x_temp=pos_x;<br />y_temp++;<br />}<br />else<br />{<br />y_temp=pos_y;<br />x_temp++;<br />}<br />}<br />}<br />lcd_clr&#91;0&#93;=lcd_bg_clr&#91;0&#93;;<br />lcd_clr&#91;1&#93;=lcd_bg_clr&#91;1&#93;;<br />lcd_clr&#91;2&#93;=lcd_bg_clr&#91;2&#93;;<br />if (IsBgCol){<br />for (uint8_t k=0;k&lt;8;k++)<br />if(rotation)<br />LCD_Pixel(x_temp-k,y_temp);<br />else<br />LCD_Pixel(x_temp,k+y_temp);<br />}<br />nr++;<br />if(rotation){<br />y_temp++;<br />}<br />else<br />x_temp++;<br />}<br />lcd_clr&#91;0&#93;=color_temp&#91;0&#93;;<br />lcd_clr&#91;1&#93;=color_temp&#91;1&#93;;<br />lcd_clr&#91;2&#93;=color_temp&#91;2&#93;;<br />LCD_send_byte(0x00,1);//odśwież<br />}<br /><br />//wyświetlenie liczby typu uint8_t<br />void LCD_uint8_t(uint8_t zmienna,uint8_t pozx,uint8_t pozy){<br />char string_temp&#91;&#93;=&quot;    &quot;;<br />//uint8_t ind;<br />string_temp&#91;0&#93;=48+zmienna/100;<br />zmienna%=100;<br />string_temp&#91;1&#93;=48+zmienna/10;<br />zmienna%=10;<br />string_temp&#91;2&#93;=48+zmienna;<br />string_temp&#91;3&#93;='\0';<br />if (string_temp&#91;0&#93;==48)<br />{<br />string_temp&#91;0&#93;=string_temp&#91;1&#93;;<br />string_temp&#91;1&#93;=string_temp&#91;2&#93;;<br />string_temp&#91;2&#93;=string_temp&#91;3&#93;;<br />if (string_temp&#91;0&#93;=='0')<br />{<br />string_temp&#91;0&#93;=string_temp&#91;1&#93;;<br />string_temp&#91;1&#93;=string_temp&#91;2&#93;;<br />}<br />}<br />LCD_String(string_temp,pozx,pozy);<br />}<br /><br />//wyświetlenie liczby typu int16, metoda I<br />void LCD_int16_t(int16_t zmienna,uint8_t pozx,uint8_t pozy){<br />char string_temp&#91;&#93;=&quot;       &quot;;<br />uint8_t liczba_ujemna=0;<br />if(zmienna&lt;0){<br />liczba_ujemna=1;<br />zmienna=0-zmienna;<br />}<br />string_temp&#91;0&#93;=48+zmienna/10000;<br />zmienna%=10000;<br />string_temp&#91;1&#93;=48+zmienna/1000;<br />zmienna%=1000;<br />string_temp&#91;2&#93;=48+zmienna/100;<br />zmienna%=100;<br />string_temp&#91;3&#93;=48+zmienna/10;<br />zmienna%=10;<br />string_temp&#91;4&#93;=48+zmienna;<br />string_temp&#91;5&#93;='\0';<br />if (string_temp&#91;0&#93;==48)<br />{<br />string_temp&#91;0&#93;=string_temp&#91;1&#93;;<br />string_temp&#91;1&#93;=string_temp&#91;2&#93;;<br />string_temp&#91;2&#93;=string_temp&#91;3&#93;;<br />string_temp&#91;3&#93;=string_temp&#91;4&#93;;<br />string_temp&#91;4&#93;=string_temp&#91;5&#93;;<br />if (string_temp&#91;0&#93;=='0')<br />{<br />string_temp&#91;0&#93;=string_temp&#91;1&#93;;<br />string_temp&#91;1&#93;=string_temp&#91;2&#93;;<br />string_temp&#91;2&#93;=string_temp&#91;3&#93;;<br />string_temp&#91;3&#93;=string_temp&#91;4&#93;;<br />if (string_temp&#91;0&#93;=='0')<br />{<br />string_temp&#91;0&#93;=string_temp&#91;1&#93;;<br />string_temp&#91;1&#93;=string_temp&#91;2&#93;;<br />string_temp&#91;2&#93;=string_temp&#91;3&#93;;<br />if (string_temp&#91;0&#93;=='0')<br />{<br />string_temp&#91;0&#93;=string_temp&#91;1&#93;;<br />string_temp&#91;1&#93;=string_temp&#91;2&#93;;<br />}<br />}<br />}<br />}<br />if (liczba_ujemna)<br />{<br />string_temp&#91;7&#93;=string_temp&#91;6&#93;;<br />string_temp&#91;6&#93;=string_temp&#91;5&#93;;<br />string_temp&#91;5&#93;=string_temp&#91;4&#93;;<br />string_temp&#91;4&#93;=string_temp&#91;3&#93;;<br />string_temp&#91;3&#93;=string_temp&#91;2&#93;;<br />string_temp&#91;2&#93;=string_temp&#91;1&#93;;<br />string_temp&#91;1&#93;=string_temp&#91;0&#93;;<br />string_temp&#91;0&#93;='-';<br />}<br />LCD_String(string_temp,pozx,pozy);<br />}<br /><br />#endif<br /><br />#if _USE_STRING_WRITE_MODE_2<br /><br />//wyświetlenie znaku ascii (zdefiniowana tylko część znaków)<br />void LCD_Char(char txt){<br />uint8_t pos_x=_COLUMN(loc_x);<br />uint8_t pos_y=_ROW(loc_y);<br />uint8_t color_temp&#91;3&#93;;<br />color_temp&#91;0&#93;=lcd_clr&#91;0&#93;;<br />color_temp&#91;1&#93;=lcd_clr&#91;1&#93;;<br />color_temp&#91;2&#93;=lcd_clr&#91;2&#93;;<br />uint8_t x_temp=pos_x;<br />uint8_t y_temp=pos_y;<br />uint8_t char_temp;<br />if ((txt&lt;127)&amp;&amp;(txt&gt;31))<br />for (uint8_t i = 0; i &lt; 5; i++ )<br />{<br />// kopiowanie tablicy<br />char_temp = pgm_read_byte(&amp;( font&#91; txt-32 &#93;&#91; i &#93; ) );<br />for (uint8_t k=0;k&lt;8;k++){<br />if (char_temp&amp;1)<br />{<br />lcd_clr&#91;0&#93;=color_temp&#91;0&#93;;<br />lcd_clr&#91;1&#93;=color_temp&#91;1&#93;;<br />lcd_clr&#91;2&#93;=color_temp&#91;2&#93;;<br />LCD_Pixel(x_temp,y_temp);<br />}<br />else<br />{<br />if (IsBgCol){<br />lcd_clr&#91;0&#93;=lcd_bg_clr&#91;0&#93;;<br />lcd_clr&#91;1&#93;=lcd_bg_clr&#91;1&#93;;<br />lcd_clr&#91;2&#93;=lcd_bg_clr&#91;2&#93;;<br />LCD_Pixel(x_temp,y_temp);<br />}<br />}<br />char_temp&gt;&gt;=1;<br />y_temp++;<br />}<br />y_temp=pos_y;<br />x_temp++;<br />}<br />lcd_clr&#91;0&#93;=lcd_bg_clr&#91;0&#93;;<br />lcd_clr&#91;1&#93;=lcd_bg_clr&#91;1&#93;;<br />lcd_clr&#91;2&#93;=lcd_bg_clr&#91;2&#93;;<br />if (IsBgCol){<br />for (uint8_t k=0;k&lt;8;k++)<br />LCD_Pixel(x_temp,k+y_temp);<br />}<br />x_temp++;<br />lcd_clr&#91;0&#93;=color_temp&#91;0&#93;;<br />lcd_clr&#91;1&#93;=color_temp&#91;1&#93;;<br />lcd_clr&#91;2&#93;=color_temp&#91;2&#93;;<br />LCD_send_byte(0x00,1);//odśwież<br /><br />}<br />//wyświetlenie liczby typu int16, metoda II<br />void LCD_int_t(int16_t zmienna){<br />char string_temp&#91;&#93;=&quot;       &quot;;<br />uint8_t liczba_ujemna=0;<br />uint8_t nr=0;<br />if(zmienna&lt;0){<br />liczba_ujemna=1;<br />zmienna=0-zmienna;<br />}<br />string_temp&#91;0&#93;=48+zmienna/10000;<br />zmienna%=10000;<br />string_temp&#91;1&#93;=48+zmienna/1000;<br />zmienna%=1000;<br />string_temp&#91;2&#93;=48+zmienna/100;<br />zmienna%=100;<br />string_temp&#91;3&#93;=48+zmienna/10;<br />zmienna%=10;<br />string_temp&#91;4&#93;=48+zmienna;<br />string_temp&#91;5&#93;='\0';<br />if (string_temp&#91;0&#93;==48)<br />{<br />string_temp&#91;0&#93;=string_temp&#91;1&#93;;<br />string_temp&#91;1&#93;=string_temp&#91;2&#93;;<br />string_temp&#91;2&#93;=string_temp&#91;3&#93;;<br />string_temp&#91;3&#93;=string_temp&#91;4&#93;;<br />string_temp&#91;4&#93;=string_temp&#91;5&#93;;<br />if (string_temp&#91;0&#93;=='0')<br />{<br />string_temp&#91;0&#93;=string_temp&#91;1&#93;;<br />string_temp&#91;1&#93;=string_temp&#91;2&#93;;<br />string_temp&#91;2&#93;=string_temp&#91;3&#93;;<br />string_temp&#91;3&#93;=string_temp&#91;4&#93;;<br />if (string_temp&#91;0&#93;=='0')<br />{<br />string_temp&#91;0&#93;=string_temp&#91;1&#93;;<br />string_temp&#91;1&#93;=string_temp&#91;2&#93;;<br />string_temp&#91;2&#93;=string_temp&#91;3&#93;;<br />if (string_temp&#91;0&#93;=='0')<br />{<br />string_temp&#91;0&#93;=string_temp&#91;1&#93;;<br />string_temp&#91;1&#93;=string_temp&#91;2&#93;;<br />}<br />}<br />}<br />}<br />if (liczba_ujemna)<br />{<br />string_temp&#91;7&#93;=string_temp&#91;6&#93;;<br />string_temp&#91;6&#93;=string_temp&#91;5&#93;;<br />string_temp&#91;5&#93;=string_temp&#91;4&#93;;<br />string_temp&#91;4&#93;=string_temp&#91;3&#93;;<br />string_temp&#91;3&#93;=string_temp&#91;2&#93;;<br />string_temp&#91;2&#93;=string_temp&#91;1&#93;;<br />string_temp&#91;1&#93;=string_temp&#91;0&#93;;<br />string_temp&#91;0&#93;='-';<br />}<br />while (string_temp&#91;nr&#93;!='\0'){<br />LCD_Char(string_temp&#91;nr&#93;);<br />if(loc_x&lt;16)<br />loc_x++;<br />else<br />{<br />loc_x=1;<br />if(loc_y&lt;8)<br />loc_y++;<br />else<br />loc_y=1;<br />}<br />nr++;<br />}<br />LCD_send_byte(0x00,1);//odśwież<br />}<br />//ustawienie współrzędnych tekstu poprzez podanie numru wiersza - ROW i kolumny - COLUMN<br />//1 &lt; ROW &lt; 8<br />//1 &lt; COLUMN &lt; 16<br />void LCD_coordinates(uint8_t x,uint8_t y)<br />{<br />if((x&gt;0)&amp;&amp;(x&lt;16))<br />loc_x=x;<br />if((y&gt;0)&amp;&amp;(y&lt;8))<br />loc_y=y;<br />}<br />//komenda do wyświetlania tekstu, zmiennych oraz formatowania tekstu<br />//działanie podobne do fprintf, wpisanie w stringu  %d, oraz podanie jako argument zmienną typu int16<br />//spowoduje wyświetlenie tej zmiennej w tekście razem ze stringiem<br />//escape sequences, zdefiniowane komendy:<br />// /n - wyświetlenie tekstu w nowej linii<br />// /t - znak tabulacji (zdefiniowany jako 4 zwykłe odstepy)<br />// // - wyświetlenie znaku '/' w stringu<br />// /% - wyświetlenie znaku '%' w stringu<br />// /CRGB - ustawienie koloru czcionki, np. CFF0 spowoduje wyświetlenie koloru żółtego (kolor czerwony + zielony)<br />// /BRGB - ustawienie koloru tła, działanie analogiczne jak dla CRGB, jeśli tło było wyłączone a zostanie użyta komenda, to tło zostanie włączone<br />// /bx - b0 - wyłączenie tła, b1 - włączenie tła<br />void LCD_printf(char *text,...)<br />{<br />uint16_t nr=0;<br />va_list ap;<br />va_start(ap,text);<br />int16_t temp=0;<br />uint8_t col_temp&#91;3&#93;={0,0,0};<br />while (text&#91;nr&#93;!='\0')<br />{<br />if(text&#91;nr&#93;==47){//escape codes mode :)<br />nr++;<br />switch (text&#91;nr&#93;){<br />case 'n':<br />nr++;<br />loc_x=1;<br />if (loc_y&lt;8)<br />loc_y++;<br />else<br />loc_y=1;<br />break;<br />case '/':// znak '/'<br />LCD_Char(47);<br />if(loc_x&lt;16)<br />loc_x++;<br />else<br />{<br />loc_x=1;<br />if(loc_y&lt;8)<br />loc_y++;<br />else<br />loc_y=1;<br />}<br />nr++;<br />break;<br />case '%':// znak '/'<br />LCD_Char('%');<br />loc_x++;<br />nr++;<br />break;<br />case 't':<br />nr++;<br />if(loc_x&lt;2)<br />loc_x=2;<br />else<br />if(loc_x&lt;6)<br />loc_x=6;<br />else<br />if(loc_x&lt;10)<br />loc_x=10;<br />else<br />if(loc_x&lt;14)<br />loc_x=14;<br />break;<br />case 'C':<br />nr++;<br />if((text&#91;nr&#93;&gt;47)&amp;&amp;(text&#91;nr&#93;&lt;58))<br />col_temp&#91;0&#93;=text&#91;nr&#93;-48;<br />if((text&#91;nr&#93;&gt;64)&amp;&amp;(text&#91;nr&#93;&lt;71))<br />col_temp&#91;0&#93;=text&#91;nr&#93;-55;<br />if((text&#91;nr&#93;&gt;96)&amp;&amp;(text&#91;nr&#93;&lt;103))<br />col_temp&#91;0&#93;=text&#91;nr&#93;-87;<br />nr++;<br />if((text&#91;nr&#93;&gt;47)&amp;&amp;(text&#91;nr&#93;&lt;58))<br />col_temp&#91;1&#93;=text&#91;nr&#93;-48;<br />if((text&#91;nr&#93;&gt;64)&amp;&amp;(text&#91;nr&#93;&lt;71))<br />col_temp&#91;1&#93;=text&#91;nr&#93;-55;<br />if((text&#91;nr&#93;&gt;96)&amp;&amp;(text&#91;nr&#93;&lt;103))<br />col_temp&#91;1&#93;=text&#91;nr&#93;-87;<br />nr++;<br />if((text&#91;nr&#93;&gt;47)&amp;&amp;(text&#91;nr&#93;&lt;58))<br />col_temp&#91;2&#93;=text&#91;nr&#93;-48;<br />if((text&#91;nr&#93;&gt;64)&amp;&amp;(text&#91;nr&#93;&lt;71))<br />col_temp&#91;2&#93;=text&#91;nr&#93;-55;<br />if((text&#91;nr&#93;&gt;96)&amp;&amp;(text&#91;nr&#93;&lt;103))<br />col_temp&#91;2&#93;=text&#91;nr&#93;-87;<br />LCD_SetColor(col_temp&#91;0&#93;,col_temp&#91;1&#93;,col_temp&#91;2&#93;);<br />nr++;<br />break;<br />case 'B':<br />nr++;<br />if((text&#91;nr&#93;&gt;47)&amp;&amp;(text&#91;nr&#93;&lt;58))<br />col_temp&#91;0&#93;=text&#91;nr&#93;-48;<br />if((text&#91;nr&#93;&gt;64)&amp;&amp;(text&#91;nr&#93;&lt;71))<br />col_temp&#91;0&#93;=text&#91;nr&#93;-55;<br />if((text&#91;nr&#93;&gt;96)&amp;&amp;(text&#91;nr&#93;&lt;103))<br />col_temp&#91;0&#93;=text&#91;nr&#93;-87;<br />nr++;<br />if((text&#91;nr&#93;&gt;47)&amp;&amp;(text&#91;nr&#93;&lt;58))<br />col_temp&#91;1&#93;=text&#91;nr&#93;-48;<br />if((text&#91;nr&#93;&gt;64)&amp;&amp;(text&#91;nr&#93;&lt;71))<br />col_temp&#91;1&#93;=text&#91;nr&#93;-55;<br />if((text&#91;nr&#93;&gt;96)&amp;&amp;(text&#91;nr&#93;&lt;103))<br />col_temp&#91;1&#93;=text&#91;nr&#93;-87;<br />nr++;<br />if((text&#91;nr&#93;&gt;47)&amp;&amp;(text&#91;nr&#93;&lt;58))<br />col_temp&#91;2&#93;=text&#91;nr&#93;-48;<br />if((text&#91;nr&#93;&gt;64)&amp;&amp;(text&#91;nr&#93;&lt;71))<br />col_temp&#91;2&#93;=text&#91;nr&#93;-55;<br />if((text&#91;nr&#93;&gt;96)&amp;&amp;(text&#91;nr&#93;&lt;103))<br />col_temp&#91;2&#93;=text&#91;nr&#93;-87;<br />BACKGROUND_ON;<br />LCD_SetBackgroudColor(col_temp&#91;0&#93;,col_temp&#91;1&#93;,col_temp&#91;2&#93;);<br />nr++;<br />break;<br />case 'b':<br />nr++;<br />if (text&#91;nr&#93;=='0')<br />BACKGROUND_OFF;<br />else<br />if (text&#91;nr&#93;=='1')<br />BACKGROUND_ON;<br />nr++;<br />break;<br />}<br />}<br />else<br />{<br />if (text&#91;nr&#93;=='%')<br />{<br />nr++;<br />switch (text&#91;nr&#93;){<br />case 'd':<br />temp = va_arg(ap,int16_t);<br />LCD_int_t(temp);<br />nr++;<br />break;<br />}<br />}<br />else<br />{<br />LCD_Char(text&#91;nr&#93;);<br />if(loc_x&lt;16)<br />loc_x++;<br />else<br />{<br />loc_x=1;<br />if(loc_y&lt;8)<br />loc_y++;<br />else<br />loc_y=1;<br />}<br />nr++;<br />}<br />}<br />}<br />va_end(ap);<br />}<br />#endif<br /><br />#if _USE_DRAW_MODE<br />//rysuj linię o zadanych współrzędnych, wykorzystanie algorytmu Bresenhama<br />void LCD_line(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2){<br />//algorytm Bresenhama<br />{<br />// zmienne pomocnicze<br />int8_t xi,yi, dy,dx;<br />int d, ai, bi;<br />int x = x1, y = y1;<br />// ustalenie kierunku rysowania<br />if (x1 &lt; x2)<br />{<br />xi = 1;<br />dx = x2 - x1;<br />}<br />else<br />{<br />xi = -1;<br />dx = x1 - x2;<br />}<br />// ustalenie kierunku rysowania<br />if (y1 &lt; y2)<br />{<br />yi = 1;<br />dy = y2 - y1;<br />}<br />else<br />{<br />yi = -1;<br />dy = y1 - y2;<br />}<br />// pierwszy piksel<br />LCD_Pixel(x, y);<br />// oś wiodąca OX<br />if (dx &gt; dy)<br />{<br />ai = (dy - dx) * 2;<br />bi = dy * 2;<br />d = bi - dx;<br />// pętla po kolejnych x<br />while (x != x2)<br />{<br />// test współczynnika<br />if (d &gt;= 0)<br />{<br />x += xi;<br />y += yi;<br />d += ai;<br />}<br />else<br />{<br />d += bi;<br />x += xi;<br />}<br />LCD_Pixel(x, y);<br />}<br />}<br />// oś wiodąca OY<br />else<br />{<br />ai = ( dx - dy ) * 2;<br />bi = dx * 2;<br />d = bi - dy;<br />// pętla po kolejnych y<br />while (y != y2)<br />{<br />// test współczynnika<br />if (d &gt;= 0)<br />{<br />x += xi;<br />y += yi;<br />d += ai;<br />}<br />else<br />{<br />d += bi;<br />y += yi;<br />}<br />LCD_Pixel(x, y);<br />}<br />}<br />}<br />LCD_send_byte(0x00,1);//odśwież<br />}<br /><br />//wypełniony prostokąt<br />void LCD_frect(uint8_t pos_x1, uint8_t pos_y1, uint8_t pos_x2, uint8_t pos_y2)<br />{<br />uint8_t temp;<br />if (pos_x1&gt;pos_x2){<br />temp=pos_x1;<br />pos_x1=pos_x2;<br />pos_x2=temp;<br />}<br />if (pos_y1&gt;pos_y2){<br />temp=pos_y1;<br />pos_y1=pos_y2;<br />pos_y2=temp;<br />}<br />LCD_send_byte(0x2A, 1);<br />LCD_send_byte(pos_x1, 0);<br />LCD_send_byte(pos_x2,0);<br />LCD_send_byte(0x2B, 1);<br />LCD_send_byte(pos_y1, 0);<br />LCD_send_byte(pos_y2,0);<br />LCD_send_byte(0x36,1);<br />LCD_send_byte(0b00000000,0);<br />LCD_send_byte(0x2C, 1);<br />#if _USE_ALL_COLORS<br />uint16_t length=(((pos_x2-pos_x1+1)*(pos_y2-pos_y1+1)+1)*3)/2-1;<br />#else<br />uint16_t length=(pos_x2-pos_x1+1)*(pos_y2-pos_y1+1);<br />#endif<br />for (uint16_t i=0;i&lt;length;i++)<br />{<br />LCD_send_byte(lcd_clr&#91;i%3&#93;, 0);<br />}<br />}<br />//prostokąt bez wypełnienia, możliwość ustawienia grubości ramki<br />void LCD_rect(uint8_t pos_x1, uint8_t pos_y1, uint8_t pos_x2, uint8_t pos_y2, uint8_t width){<br />uint8_t temp;<br />if (pos_x1&gt;pos_x2){<br />temp=pos_x1;<br />pos_x1=pos_x2;<br />pos_x2=temp;<br />}<br />if (pos_y1&gt;pos_y2){<br />temp=pos_y1;<br />pos_y1=pos_y2;<br />pos_y2=temp;<br />}<br />//zakres pamięci w jakim dokonywane są zmiany 41&lt;x&lt;50, 31&lt;y&lt;40<br />//start<br />LCD_send_byte(0x2A, 1);<br />LCD_send_byte(pos_x1, 0);<br />LCD_send_byte(pos_x2,0);<br />LCD_send_byte(0x2B, 1);<br />LCD_send_byte(pos_y1, 0);<br />LCD_send_byte(pos_y2,0);<br />//koniec<br /><br />#if _USE_ALL_COLORS<br />uint16_t length_x=(width*(pos_x2-pos_x1+2)*3)/2-1;<br />uint16_t length_y=(width*(pos_y2-pos_y1+2)*3)/2-1;<br />#else<br />uint16_t length_x=width*(pos_x2-pos_x1+1);<br />uint16_t length_y=width*(pos_y2-pos_y1+1);<br />#endif<br />LCD_send_byte(0x36,1);<br />LCD_send_byte(0b00000000,0);<br />LCD_send_byte(0x2C, 1);<br />for (uint16_t i=0;i&lt;length_x;i++)<br />{<br />LCD_send_byte(lcd_clr&#91;i%3&#93;, 0);<br />}<br /><br />LCD_send_byte(0x36,1);<br />LCD_send_byte(0b00100000,0);<br />LCD_send_byte(0x2C, 1);<br />for (uint16_t i=0;i&lt;length_y;i++)<br />{<br />LCD_send_byte(lcd_clr&#91;i%3&#93;, 0);<br />}<br />//zakres pamięci w jakim dokonywane są zmiany 41&lt;x&lt;50, 31&lt;y&lt;40<br />//start<br />LCD_send_byte(0x2A, 1);<br />LCD_send_byte(97-pos_x2,0);<br />LCD_send_byte(97-pos_x1, 0);<br />LCD_send_byte(0x2B, 1);<br />LCD_send_byte(67-pos_y2,0);<br />LCD_send_byte(67-pos_y1, 0);<br />//koniec<br /><br />LCD_send_byte(0x36,1);<br />LCD_send_byte(0b11000000,0);<br />LCD_send_byte(0x2C, 1);<br />for (uint16_t i=0;i&lt;length_x;i++)<br />{<br />LCD_send_byte(lcd_clr&#91;i%3&#93;, 0);<br />}<br /><br />LCD_send_byte(0x36,1);<br />LCD_send_byte(0b11100000,0);<br />LCD_send_byte(0x2C, 1);<br />for (uint16_t i=0;i&lt;length_y;i++)<br />{<br />LCD_send_byte(lcd_clr&#91;i%3&#93;, 0);<br />}<br />LCD_send_byte(0x00,1);//odśwież<br /><br />}<br /><br />//rysowanie trójkąta<br />void LCD_triangle(uint8_t x1, uint8_t y1,uint8_t x2, uint8_t y2,uint8_t x3, uint8_t y3)<br />{<br />uint8_t temp;<br />int16_t a13=0,a23=0,a12=0;//,b1=0,b2=0,b3=0;<br />int16_t a_13=0,a_23=0,a_12=0;<br />uint8_t x_start,x_stop;<br />LCD_send_byte(0x36,1);<br />LCD_send_byte(0b00000000,0);<br />//linie pionowe:<br />// 0b00000001 - odcinek 1-2 pionowy<br />// 0x00000010 - odcinek 1-3 pionowy<br />// 0x00000100 - odcinek 2-3 pionowy<br />uint8_t linie_pionowe=0;<br />//uporządkowanie numeracji<br />if (y1&gt;y2)<br />{<br />temp=y1;<br />y1=y2;<br />y2=temp;<br />temp=x1;<br />x1=x2;<br />x2=temp;<br />}<br />if (y1&gt;y3)<br />{<br />temp=y1;<br />y1=y3;<br />y3=temp;<br />temp=x1;<br />x1=x3;<br />x3=temp;<br />}<br />if (y3&lt;y2){<br />temp=y3;<br />y3=y2;<br />y2=temp;<br />temp=x3;<br />x3=x2;<br />x2=temp;<br />}<br />//wykrycie linii pionowych<br />if (x1==x2){<br />linie_pionowe|=0b00000001;<br />}<br />else<br />{<br />a12=(100*(y1-y2))/(x1-x2);<br />a_12=(100*(x1-x2))/(y1-y2);<br />}<br /><br />if (x1==x3){<br />linie_pionowe|=0b00000010;<br />}<br />else<br />{<br />a13=(100*(y1-y3))/(x1-x3);<br />a_13=(100*(x1-x3))/(y1-y3);<br />}<br />if (x2==x3){<br />linie_pionowe|=0b00000100;<br />}<br />else<br />{<br />a23=(100*(y2-y3))/(x2-x3);<br />a_23=(100*(x2-x3))/(y2-y3);<br />}<br />//wyznaczanie współrzęnych punktów w przedziale y1 - y2<br />if (y1!=y2){<br />for (uint8_t y=y1;y&lt;=y2;y++)<br />{<br />//współrzędne na boku 1-2<br />if (linie_pionowe &amp;0b00000001)<br />{<br />x_start=x1;<br />}<br />else<br />{<br />if ((a12&gt;=-100)&amp;&amp;(a12&lt;=100))<br />{//nachylenie boku powyżej 45st względem osi x<br />x_start=x1+((y-y1)*100)/a12;<br />}<br />else<br />{//nachylenie boku poniżej 45st względem osi x<br />x_start=x1+((y-y1)*a_12)/100;<br />}<br />}<br />//współrzędne na boku 1-3<br />if (linie_pionowe &amp;0b00000010)<br />{<br />x_stop=x1;<br />}<br />else<br />{<br />if ((a13&gt;=-100)&amp;&amp;(a13&lt;=100))<br />{//nachylenie boku powyżej 45st względem osi x<br />x_stop=x1+((y-y1)*100)/a13;<br />}<br />else<br />{//nachylenie boku poniżej 45st względem osi x<br />x_stop=x1+((y-y1)*a_13)/100;<br />}<br />}<br />if (x_start&gt;x_stop)<br />{<br />temp=x_start;<br />x_start=x_stop;<br />x_stop=temp;<br />}<br />for (uint8_t x=x_start;x&lt;=x_stop;x++){<br />LCD_Pixel(x,y);<br />}<br />}<br />}<br />//wyznaczanie współrzęnych punktów w przedziale y2 - y3<br />if (y2!=y3){<br />for (uint8_t y=y2;y&lt;=y3;y++)<br />{<br />//współrzędne na boku 2-3<br />if (linie_pionowe &amp;0b00000100)<br />{<br />x_start=x3;<br />}<br />else<br />{<br />if ((a23&gt;=-100)&amp;&amp;(a23&lt;=100))<br />{//nachylenie boku powyżej 45st względem osi x<br />x_start=x2+((y-y2)*100)/a23;<br />}<br />else<br />{//nachylenie boku poniżej 45st względem osi x<br />x_start=x2+((y-y2)*a_23)/100;<br />}<br />}<br />//współrzędne na boku 1-3<br />if (linie_pionowe &amp;0b00000010)<br />{<br />x_stop=x1;<br />}<br />else<br />{<br />if ((a13&gt;=-100)&amp;&amp;(a13&lt;=100))<br />{//nachylenie boku powyżej 45st względem osi x<br />x_stop=x1+((y-y1)*100)/a13;<br />}<br />else<br />{//nachylenie boku poniżej 45st względem osi x<br />x_stop=x1+((y-y1)*a_13)/100;<br />}<br />}<br />if (x_start&gt;x_stop)<br />{<br />temp=x_start;<br />x_start=x_stop;<br />x_stop=temp;<br />}<br />for (uint8_t x=x_start;x&lt;=x_stop;x++){<br />LCD_Pixel(x,y);<br />}<br />}<br />}<br />LCD_Pixel(x1,y1);<br />LCD_Pixel(x2,y2);<br />LCD_Pixel(x3,y3);<br />LCD_send_byte(0x00,1);//odśwież<br />}<br /><br />#endif<br /><br />#if _USE_IMAGE_READ<br />//wyświetlenie obrazu z pliku font.h (generowany za pomocą skryptu napisanego w SCILAB<br />//obraz musi mieścić się w obszarze okna a więc maksymalny rozmiar obrazka to 98x67 pikseli<br />//na chwilę obecną wyświetlanie tekstu przy obsłudze 256 kolorów<br />//funkcja domyślnie wyśrodkowuje obrazek, za pomocą parametrów shift_x oraz shift_y można zmienić położenie<br />void LCD_image_read(int8_t shift_x,int8_t shift_y){<br />uint8_t pocz_x=(97-size_x)/2;<br />uint8_t pocz_y=(66-size_y)/2;<br />LCD_send_byte(0x2A, 1);<br />LCD_send_byte(pocz_x+shift_x, 0);<br />LCD_send_byte(pocz_x+size_x-1+shift_x,0);<br />LCD_send_byte(0x2B, 1);<br />LCD_send_byte(pocz_y+shift_y, 0);<br />LCD_send_byte(pocz_y+size_y-1+shift_y,0);<br />LCD_send_byte(0x36,1);<br />LCD_send_byte(0b00100000,0);<br />LCD_send_byte(0x2C, 1);<br />for (uint16_t i=0;i&lt;size_x*size_y;i++)<br />{<br />LCD_send_byte(pgm_read_byte(&amp;Image&#91;i&#93;), 0);<br />}<br />LCD_refresh();<br /><br /><br />}<br /><br /><br />#endif[/syntax]<br />nokia3510i.h<br />[syntax=c]/*<br /> * nokia3510i.h<br /> *<br /> *  Created on: 7 wrz 2014<br /> *      Author: Artur<br /> */<br /><br />#ifndef NOKIA3510I_H_<br />#define NOKIA3510I_H_<br /><br /><br /><br />///////////konfiguracja biblioteki///////////<br />#define _USE_ALL_COLORS 0//1 - 4096 kolorów (12bit)R - 4bit, G - 4bit, B - 4bit<br />//0 - 256 kolorów (8bit)R - 3bit, G - 3bit, B - 2bit<br /><br />#define _USE_STRING_WRITE_MODE_1 1 //obsługa tekstu tryb 1,ok 3kB flash<br /><br />#define _USE_STRING_WRITE_MODE_2 1//obsługa tekstu tryb 2,ok 2kB flash<br /><br />#define _USE_DRAW_MODE 1//figury geometryczne,ok 2,5kB flash<br /><br />#define _USE_IMAGE_READ 1//wczytywanie grafiki,0k 0,1kB flash (+rozmiar obrazka!)<br /><br /><br />/////////////////////////////////////<br /><br /><br />//dodanie funkcji wspólnych dla _USE_STRING_WRITE_MODE_1 i _USE_STRING_WRITE_MODE_2<br />#if _USE_STRING_WRITE_MODE_1<br />#ifndef _COMMON_STRING_MODE<br />#define _COMMON_STRING_MODE 1<br />#endif<br />#endif<br /><br />#if _USE_STRING_WRITE_MODE_2<br />#ifndef _COMMON_STRING_MODE<br />#define _COMMON_STRING_MODE 1<br />#endif<br />#endif<br /><br /><br />///////////konfiguracja portów wyświetlacza///////////<br /><br />#define MY_SIO (1&lt;&lt;PB3)<br />#define MY_CLK (1&lt;&lt;PB5)<br />#define MY_CS (1&lt;&lt;PB2)<br />#define MY_RST (1&lt;&lt;PB1)<br />#define MY_DDR DDRB<br />#define MY_PORT PORTB<br /><br />//alternatywna konfiguracja<br />//#define MY_SIO (1&lt;&lt;PC1)<br />//#define MY_CLK (1&lt;&lt;PC0)<br />//#define MY_CS (1&lt;&lt;PC2)<br />//#define MY_RST (1&lt;&lt;PC3)<br />//#define MY_DDR DDRC<br />//#define MY_PORT PORTC<br /><br />//ustawienie stanu wysokiego albo niskiego na pinach<br />#define CLK_LOW MY_PORT&amp;=~MY_CLK<br />#define CLK_HI MY_PORT|=MY_CLK<br /><br />#define CS_LOW MY_PORT&amp;=~MY_CS<br />#define CS_HI MY_PORT|=MY_CS<br /><br />#define SIO_LOW MY_PORT&amp;=~MY_SIO<br />#define SIO_HI MY_PORT|=MY_SIO<br /><br />#define RST_LOW MY_PORT&amp;=~MY_RST<br />#define RST_HI MY_PORT|=MY_RST<br /><br />///////////zdefiniowane kolory///////////<br />#define _WHITE 15,15,15<br />#define _BLACK 0,0,0<br />#define _RED 15,0,0<br />#define _GREEN 0,15,0<br />#define _BLUE 0,0,15<br />#define _YELLOW 15,15,0<br />#define _CYAN 0,15,15<br />#define _MAGENTA 15,0,15<br /><br />///////////ustawienia formatowania tekstu///////////<br />//pozycjonowanie tekstu<br />#define _LEFT 1<br />#define _RIGHT 0<br />//rotacja<br />#define _ROT_ON 1<br />#define _ROT_OFF 0<br />//wiersze i kolumny<br />//1&lt;=_ROW&lt;=8<br />#define _ROW(x) (2+8*(x-1))<br />// 1&lt;=COLUMN&lt;=17<br />#define _COLUMN(x) (1+6*(x-1))<br />//ustawienie tła tekstu<br />#define BACKGROUND_ON IsBgCol=1<br />#define BACKGROUND_OFF IsBgCol=0<br /><br /><br /><br />#if _COMMON_STRING_MODE<br />///////////tablica z fontem///////////<br />#include &lt;avr/pgmspace.h&gt;<br />static const uint8_t font &#91;&#93;&#91;5&#93; PROGMEM =<br />{<br />{0x00,0x00,0x00,0x00,0x00},//@ &#91; &#93;(8pxwide)032<br />{0x00,0x5E,0x00,0x00,0x00},//@0&#91;!&#93;(8pxwide)133<br />{0x06,0x00,0x06,0x00,0x00},//@5&#91;&quot;&#93;(8pxwide)234<br />{0x28,0x7C,0x28,0x7C,0x28},//@10&#91;#&#93;(8pxwide)335<br />{0x04,0x4A,0xCB,0x4A,0x30},//@15&#91;$&#93;(8pxwide)436<br />{0x46,0x26,0x18,0x64,0x62},//@20&#91;%&#93;(8pxwide)537<br />{0x34,0x4A,0x4A,0xF4,0x40},//@25&#91;&amp;&#93;(8pxwide)638<br />{0x00,0x06,0x00,0x00,0x00},//@30&#91;'&#93;(8pxwide)739<br />{0x00,0x3C,0x42,0x00,0x00},//@35&#91;(&#93;(8pxwide)840<br />{0x00,0x42,0x3C,0x00,0x00},//@40&#91;)&#93;(8pxwide)941<br />{0x00,0x14,0x0E,0x14,0x00},//@45&#91;*&#93;(8pxwide)1042<br />{0x10,0x10,0x7C,0x10,0x10},//@50&#91;+&#93;(8pxwide)1143<br />{0x00,0x00,0xC0,0x00,0x00},//@55&#91;,&#93;(8pxwide)1244<br />{0x10,0x10,0x10,0x10,0x10},//@60&#91;-&#93;(8pxwide)1345<br />{0x00,0x00,0x40,0x00,0x00},//@65&#91;.&#93;(8pxwide)1446<br />{0x00,0x60,0x18,0x06,0x00},//@70&#91;/&#93;(8pxwide)1547<br />{0x3C,0x42,0x42,0x3C,0x00},//@75&#91;0&#93;(8pxwide)1648<br />{0x00,0x04,0x7E,0x00,0x00},//@80&#91;1&#93;(8pxwide)1749<br />{0x44,0x62,0x52,0x4C,0x00},//@85&#91;2&#93;(8pxwide)1850<br />{0x24,0x42,0x4A,0x34,0x00},//@90&#91;3&#93;(8pxwide)1951<br />{0x30,0x2C,0x7E,0x20,0x00},//@95&#91;4&#93;(8pxwide)2052<br />{0x2E,0x4A,0x4A,0x32,0x00},//@100&#91;5&#93;(8pxwide)2153<br />{0x3C,0x4A,0x4A,0x30,0x00},//@105&#91;6&#93;(8pxwide)2254<br />{0x02,0x62,0x1A,0x06,0x00},//@110&#91;7&#93;(8pxwide)2355<br />{0x34,0x4A,0x4A,0x34,0x00},//@115&#91;8&#93;(8pxwide)2456<br />{0x00,0x0C,0x52,0x52,0x3C},//@120&#91;9&#93;(8pxwide)2557<br />{0x00,0x00,0x28,0x00,0x00},//@125&#91;:&#93;(8pxwide)2658<br />{0x00,0x00,0xD0,0x00,0x00},//@130&#91;;&#93;(8pxwide)2759<br />{0x00,0x10,0x28,0x44,0x00},//@135&#91;&lt;&#93;(8pxwide)2860<br />{0x28,0x28,0x28,0x28,0x00},//@140&#91;=&#93;(8pxwide)2961<br />{0x00,0x44,0x28,0x10,0x00},//@145&#91;&gt;&#93;(8pxwide)3062<br />{0x04,0x02,0x52,0x0C,0x00},//@150&#91;?&#93;(8pxwide)3163<br />{0x24,0x52,0x6A,0x52,0x3C},//@155&#91;@&#93;(8pxwide)3264<br />{0x7C,0x12,0x12,0x7C,0x00},//@160&#91;A&#93;(8pxwide)3365<br />{0x7E,0x4A,0x4A,0x34,0x00},//@165&#91;B&#93;(8pxwide)3466<br />{0x3C,0x42,0x42,0x24,0x00},//@170&#91;C&#93;(8pxwide)3567<br />{0x7E,0x42,0x42,0x3C,0x00},//@175&#91;D&#93;(8pxwide)3668<br />{0x7E,0x4A,0x4A,0x42,0x00},//@180&#91;E&#93;(8pxwide)3769<br />{0x7E,0x0A,0x0A,0x02,0x00},//@185&#91;F&#93;(8pxwide)3870<br />{0x3C,0x42,0x52,0x34,0x00},//@190&#91;G&#93;(8pxwide)3971<br />{0x7E,0x08,0x08,0x7E,0x00},//@195&#91;H&#93;(8pxwide)4072<br />{0x00,0x7E,0x00,0x00,0x00},//@200&#91;I&#93;(8pxwide)4173<br />{0x00,0x20,0x42,0x3E,0x00},//@205&#91;J&#93;(8pxwide)4274<br />{0x7E,0x08,0x14,0x62,0x00},//@210&#91;K&#93;(8pxwide)4375<br />{0x7E,0x40,0x40,0x40,0x00},//@215&#91;L&#93;(8pxwide)4476<br />{0x7E,0x04,0x08,0x04,0x7E},//@220&#91;M&#93;(8pxwide)4577<br />{0x7E,0x0C,0x30,0x7E,0x00},//@225&#91;N&#93;(8pxwide)4678<br />{0x3C,0x42,0x42,0x3C,0x00},//@230&#91;O&#93;(8pxwide)4779<br />{0x7E,0x0A,0x0A,0x04,0x00},//@235&#91;P&#93;(8pxwide)4880<br />{0x3C,0x42,0x42,0xBC,0x00},//@240&#91;Q&#93;(8pxwide)4981<br />{0x7E,0x1A,0x2A,0x44,0x00},//@245&#91;R&#93;(8pxwide)5082<br />{0x24,0x4A,0x4A,0x30,0x00},//@250&#91;S&#93;(8pxwide)5183<br />{0x02,0x02,0x7E,0x02,0x02},//@255&#91;T&#93;(8pxwide)5284<br />{0x3E,0x40,0x40,0x3E,0x00},//@260&#91;U&#93;(8pxwide)5385<br />{0x06,0x18,0x60,0x18,0x06},//@265&#91;V&#93;(8pxwide)5486<br />{0x1E,0x60,0x10,0x60,0x1E},//@270&#91;W&#93;(8pxwide)5587<br />{0x66,0x18,0x18,0x66,0x00},//@275&#91;X&#93;(8pxwide)5688<br />{0x06,0x08,0x70,0x08,0x06},//@280&#91;Y&#93;(8pxwide)5789<br />{0x62,0x52,0x4A,0x46,0x00},//@285&#91;Z&#93;(8pxwide)5890<br />{0x00,0x7E,0x42,0x00,0x00},//@290&#91;&#91;&#93;(8pxwide)5991<br />{0x00,0x06,0x18,0x60,0x00},//@295&#91;\&#93;(8pxwide)6092<br />{0x00,0x42,0x7E,0x00,0x00},//@300&#91;&#93;&#93;(8pxwide)6193<br />{0x00,0x0C,0x02,0x0C,0x00},//@305&#91;^&#93;(8pxwide)6294<br />{0x40,0x40,0x40,0x40,0x00},//@310&#91;_&#93;(8pxwide)6395<br />{0x00,0x06,0x00,0x00,0x00},//@315&#91;`&#93;(8pxwide)6496<br />{0x20,0x54,0x54,0x78,0x00},//@320&#91;a&#93;(8pxwide)6597<br />{0x7E,0x48,0x48,0x30,0x00},//@325&#91;b&#93;(8pxwide)6698<br />{0x30,0x48,0x48,0x00,0x00},//@330&#91;c&#93;(8pxwide)6799<br />{0x30,0x48,0x48,0x7E,0x00},//@335&#91;d&#93;(8pxwide)68100<br />{0x38,0x54,0x54,0x58,0x00},//@340&#91;e&#93;(8pxwide)69101<br />{0x10,0x7C,0x12,0x00,0x00},//@345&#91;f&#93;(8pxwide)70102<br />{0x08,0x94,0x94,0x78,0x00},//@350&#91;g&#93;(8pxwide)71103<br />{0x7E,0x10,0x10,0x60,0x00},//@355&#91;h&#93;(8pxwide)72104<br />{0x00,0x74,0x00,0x00,0x00},//@360&#91;i&#93;(8pxwide)73105<br />{0x40,0x80,0x74,0x00,0x00},//@365&#91;j&#93;(8pxwide)74106<br />{0x7E,0x10,0x28,0x40,0x00},//@370&#91;k&#93;(8pxwide)75107<br />{0x00,0x3E,0x40,0x00,0x00},//@375&#91;l&#93;(8pxwide)76108<br />{0x78,0x08,0x70,0x08,0x70},//@380&#91;m&#93;(8pxwide)77109<br />{0x70,0x10,0x60,0x00,0x00},//@385&#91;n&#93;(8pxwide)78110<br />{0x30,0x48,0x48,0x30,0x00},//@390&#91;o&#93;(8pxwide)79111<br />{0xF8,0x28,0x28,0x10,0x00},//@395&#91;p&#93;(8pxwide)80112<br />{0x10,0x28,0x28,0xF8,0x00},//@400&#91;q&#93;(8pxwide)81113<br />{0x78,0x10,0x08,0x00,0x00},//@405&#91;r&#93;(8pxwide)82114<br />{0x08,0x54,0x54,0x20,0x00},//@410&#91;s&#93;(8pxwide)83115<br />{0x04,0x3E,0x44,0x00,0x00},//@415&#91;t&#93;(8pxwide)84116<br />{0x38,0x40,0x40,0x38,0x00},//@420&#91;u&#93;(8pxwide)85117<br />{0x10,0x20,0x40,0x20,0x10},//@425&#91;v&#93;(8pxwide)86118<br />{0x30,0x40,0x30,0x40,0x30},//@430&#91;w&#93;(8pxwide)87119<br />{0x48,0x30,0x30,0x48,0x00},//@435&#91;x&#93;(8pxwide)88120<br />{0x00,0x98,0x60,0x18,0x00},//@440&#91;y&#93;(8pxwide)89121<br />{0x48,0x68,0x58,0x48,0x00},//@445&#91;z&#93;(8pxwide)90122<br />{0x10,0x6C,0x82,0x00,0x00},//@450&#91;{&#93;(8pxwide)91123<br />{0x00,0x7E,0x00,0x00,0x00},//@455&#91;|&#93;(8pxwide)92124<br />{0x82,0x6C,0x10,0x00,0x00},//@460&#91;}&#93;(8pxwide)93125<br />{0x08,0x04,0x08,0x10,0x08},//@465&#91;~&#93;(8pxwide)94126<br />};<br /><br />#endif<br /><br /> ///////////zmienne///////////<br /><br />extern uint8_t lcd_clr&#91;3&#93;;<br />extern uint8_t lcd_bg_clr&#91;3&#93;;<br />extern uint8_t kolory;<br />extern uint8_t IsBgCol;<br /><br /><br />///////////funkcje///////////<br /><br />void LCD_init(void);<br />void LCD_send_byte(uint8_t data, uint8_t isCMD);<br />void LCD_SetColor(uint8_t red, uint8_t green, uint8_t blue);<br />void LCD_Pixel(uint8_t xPos, uint8_t yPos);<br />void LCD_Clear(void);<br />void LCD_contrast(uint8_t contrast);<br />void LCD_all_pixels_off(void);<br />void LCD_all_pixels_on(void);<br />void LCD_display_on(void);<br />void LCD_refresh(void);<br /><br />#if _COMMON_STRING_MODE<br />void LCD_String_settings(uint8_t IsBg,uint8_t dir,uint8_t rot);<br />void LCD_SetBackgroudColor(uint8_t red, uint8_t green, uint8_t blue) ;<br />#endif<br /><br /><br />#if _USE_DRAW_MODE<br />void debug(uint8_t nr);<br />void LCD_line(uint8_t pos_x1, uint8_t pos_y1, uint8_t pos_x2, uint8_t pos_y2);<br />void LCD_frect(uint8_t pos_x1, uint8_t pos_y1, uint8_t pos_x2, uint8_t pos_y2);<br />void LCD_rect(uint8_t pos_x1,uint8_t pos_y1,uint8_t pos_x2,uint8_t pos_y2,uint8_t width);<br />void LCD_triangle(uint8_t x1, uint8_t y1,uint8_t x2, uint8_t y2,uint8_t x3, uint8_t y3);<br />#endif<br /><br />#if _USE_STRING_WRITE_MODE_1<br />void LCD_String(char *text,uint8_t pos_x,uint8_t pos_y);<br />void LCD_uint8_t(uint8_t zmienna,uint8_t pozx,uint8_t pozy);<br />void LCD_int16_t(int16_t zmienna,uint8_t pozx,uint8_t pozy);<br />#endif<br /><br />#if _USE_STRING_WRITE_MODE_2<br />void LCD_Char(char txt);<br />void LCD_int_t(int16_t zmienna);<br />void LCD_coordinates(uint8_t x,uint8_t y);<br />void LCD_printf(char *text,...);<br />#endif<br /><br />#if _USE_IMAGE_READ<br />void LCD_image_read(int8_t shift_x,int8_t shift_y);<br />#endif<br /><br /><br />#endif /* NOKIA3510I_H_ */[/syntax]<br />MyImage.h<br />[syntax=c]#ifndef MYIMAGE_H_<br />#define MYIMAGE_H_<br /><br />#include &lt;avr/pgmspace.h&gt;<br /><br />static const uint8_t size_y = 20;<br />static const uint8_t size_x = 48;<br />static const uint8_t Image &#91;&#93; PROGMEM =<br />{255, 255, 255, 255, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 255, 255, 255, 255, 255, 255, <br />182, 146, 109, 73, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 146, 182, 255, 255, 255, 182, 73, 0, <br />0, 0, 0, 0, 0, 0, 36, 36, 36, 36, 0, 0, 0, 73, 182, 255, 219, 109, 0, 0, 0, 0, <br />0, 0, 0, 36, 36, 73, 109, 73, 0, 0, 0, 0, 109, 219, 219, 73, 0, 0, 0, 0, 0, 36, <br />73, 109, 146, 182, 182, 109, 0, 0, 0, 0, 73, 219, 219, 73, 0, 0, 0, 36, 73, 109, 146, 182, <br />219, 182, 109, 36, 0, 0, 0, 0, 36, 219, 182, 36, 0, 0, 36, 109, 182, 182, 182, 182, 219, 146, <br />36, 0, 0, 0, 0, 0, 36, 219, 182, 36, 0, 0, 73, 182, 219, 182, 146, 146, 219, 109, 36, 0, <br />0, 0, 0, 0, 36, 182, 182, 36, 0, 0, 36, 146, 182, 219, 219, 219, 255, 182, 109, 36, 0, 0, <br />0, 0, 36, 219, 182, 36, 0, 0, 0, 36, 73, 109, 146, 182, 219, 219, 182, 109, 36, 0, 0, 0, <br />36, 219, 182, 36, 0, 0, 0, 36, 36, 36, 36, 73, 73, 109, 109, 73, 0, 0, 0, 0, 36, 219, <br />182, 36, 0, 0, 36, 73, 73, 36, 36, 36, 36, 0, 0, 0, 0, 0, 0, 0, 36, 219, 182, 36, <br />0, 0, 73, 146, 109, 73, 73, 73, 36, 0, 0, 0, 0, 0, 0, 0, 36, 219, 182, 36, 0, 0, <br />73, 182, 182, 109, 109, 109, 109, 109, 109, 36, 0, 0, 0, 0, 36, 219, 182, 36, 0, 0, 73, 182, <br />219, 219, 182, 182, 182, 182, 182, 109, 0, 0, 0, 0, 36, 215, 214, 36, 0, 0, 73, 182, 219, 182, <br />182, 146, 146, 109, 109, 73, 0, 0, 0, 0, 36, 215, 183, 36, 0, 0, 73, 182, 146, 109, 73, 73, <br />36, 36, 0, 0, 0, 0, 0, 0, 36, 215, 183, 68, 0, 0, 73, 146, 146, 73, 73, 36, 0, 0, <br />0, 0, 0, 0, 0, 0, 36, 219, 186, 41, 0, 0, 36, 77, 73, 73, 37, 36, 0, 0, 0, 0, <br />0, 0, 0, 0, 36, 218, 187, 77, 9, 13, 45, 45, 45, 77, 45, 41, 5, 4, 4, 4, 4, 4, <br />4, 4, 41, 219, 223, 91, 59, 59, 59, 86, 86, 86, 86, 54, 18, 18, 18, 13, 13, 13, 13, 13, <br />77, 219, 223, 91, 59, 59, 59, 91, 91, 91, 91, 54, 54, 22, 18, 18, 18, 13, 13, 13, 82, 219, <br />223, 91, 59, 59, 91, 91, 123, 155, 123, 123, 123, 122, 118, 86, 50, 13, 13, 13, 82, 219, 223, 91, <br />59, 59, 91, 159, 223, 223, 223, 191, 191, 187, 155, 118, 50, 13, 13, 13, 82, 219, 223, 91, 59, 59, <br />123, 191, 255, 223, 191, 155, 123, 118, 86, 50, 18, 13, 13, 13, 82, 219, 223, 91, 59, 59, 91, 159, <br />191, 223, 223, 155, 118, 86, 50, 18, 18, 13, 13, 13, 82, 219, 223, 91, 59, 59, 59, 91, 123, 155, <br />191, 223, 191, 155, 86, 50, 18, 13, 13, 13, 82, 219, 223, 91, 59, 59, 59, 91, 91, 123, 155, 155, <br />191, 223, 191, 118, 50, 13, 13, 13, 82, 219, 223, 91, 59, 59, 91, 127, 159, 191, 191, 191, 223, 223, <br />223, 155, 50, 13, 13, 13, 82, 219, 223, 91, 59, 59, 91, 159, 191, 191, 191, 191, 155, 155, 155, 86, <br />50, 13, 13, 13, 82, 219, 223, 91, 59, 59, 91, 91, 123, 123, 123, 86, 54, 54, 50, 50, 18, 13, <br />13, 13, 82, 219, 191, 91, 59, 59, 91, 123, 123, 155, 155, 123, 123, 123, 118, 86, 50, 13, 13, 13, <br />82, 219, 223, 91, 59, 59, 91, 159, 191, 223, 223, 223, 191, 191, 191, 119, 50, 13, 13, 13, 82, 219, <br />223, 91, 59, 59, 123, 191, 223, 191, 223, 223, 155, 155, 187, 155, 50, 13, 13, 13, 82, 219, 223, 91, <br />59, 59, 123, 191, 191, 155, 191, 187, 86, 86, 155, 155, 50, 13, 13, 13, 82, 219, 223, 91, 27, 59, <br />123, 159, 155, 123, 155, 155, 86, 54, 123, 118, 50, 13, 13, 13, 82, 219, 223, 91, 27, 59, 91, 127, <br />123, 91, 123, 123, 54, 54, 86, 86, 50, 13, 13, 13, 82, 219, 223, 91, 27, 59, 59, 91, 123, 91, <br />123, 123, 86, 86, 86, 82, 18, 13, 13, 13, 82, 219, 191, 91, 27, 59, 91, 159, 191, 191, 191, 191, <br />191, 191, 187, 118, 50, 13, 13, 13, 82, 219, 191, 91, 27, 59, 91, 159, 191, 223, 223, 223, 191, 191, <br />223, 155, 50, 13, 13, 13, 82, 219, 191, 91, 27, 27, 59, 91, 123, 123, 123, 123, 123, 123, 187, 155, <br />50, 13, 13, 13, 82, 219, 223, 91, 27, 27, 27, 59, 59, 54, 86, 86, 86, 86, 155, 155, 50, 13, <br />13, 13, 82, 219, 223, 91, 27, 27, 27, 59, 59, 54, 54, 54, 86, 86, 123, 118, 50, 13, 13, 13, <br />82, 219, 223, 123, 59, 27, 27, 27, 59, 54, 54, 54, 54, 86, 86, 50, 18, 13, 13, 13, 82, 219, <br />223, 159, 59, 27, 27, 27, 55, 54, 54, 54, 54, 54, 54, 18, 18, 13, 13, 45, 118, 223, 255, 191, <br />123, 59, 59, 59, 54, 54, 54, 54, 54, 86, 54, 50, 18, 13, 49, 114, 187, 255, 255, 255, 223, 159, <br />155, 123, 123, 155, 155, 155, 155, 155, 155, 155, 118, 150, 155, 219, 255, 255, 255, 255, 255, 255, 255, 255, <br />255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, };<br /><br />#endif /* MYIMAGE_H_ */[/syntax]<br /><br /><br />main.c (demko z filmiku)<br />[syntax=c]/*<br /> * main.c<br /> *<br /> *  Created on: 7 wrz 2014<br /> *      Author: Artur<br /> */<br /><br /><br />#include &lt;avr/io.h&gt;<br />#include &lt;stdio.h&gt;<br /><br />#include &lt;util/delay.h&gt;<br />#include &lt;avr/pgmspace.h&gt;<br />#include &quot;nokia3510i.h&quot;<br /><br />uint8_t znak_temp;<br />uint8_t nr_temp;<br />uint8_t demo=1;<br />volatile uint16_t timer1;<br />uint8_t poz_x,poz_y;<br />uint8_t koniec_petli;<br />int main(void)<br />{<br />LCD_init();<br />LCD_Clear();<br />LCD_SetColor(_WHITE);<br />while(1){<br />switch (demo)<br />{<br />case 1:<br /><br />#if _USE_DRAW_MODE<br /><br />for (uint8_t i=0;i&lt;16;i++)//paleta kolorów<br />{<br />LCD_SetColor(i,0,0);<br />LCD_frect(i*6,1,i*6+5,10);<br />LCD_SetColor(0,i,0);<br />LCD_frect(i*6,11,i*6+5,20);<br />LCD_SetColor(0,0,i);<br />LCD_frect(i*6,21,i*6+5,30);<br />LCD_SetColor(i,i,i);<br />LCD_frect(i*6,31,i*6+5,40);<br />}<br />LCD_SetColor(_WHITE);<br />for (uint8_t i =0;i&lt;5;i++){//linie<br />LCD_line(70-i*10,40,30+i*10,00);<br />LCD_line(30,0+10*i,70,40-10*i);<br />}<br />LCD_SetColor(_GREEN);<br />LCD_triangle(1,43,96,43,48,65);<br />LCD_SetColor(_BLUE);<br />LCD_triangle(3,60,15,46,20,55);<br />LCD_SetColor(_YELLOW);<br />LCD_rect(37,45,50,63,3);<br />LCD_SetColor(_RED);<br />LCD_rect(20,43,45,55,1);<br />LCD_SetColor(_MAGENTA);<br />LCD_triangle(65,55,78,60,90,35);<br />#endif<br />break;<br />case 2:<br />#if _USE_STRING_WRITE_MODE_1<br />LCD_SetColor(5,5,5);<br />for(uint8_t i=40;i&lt;60;i++)<br />for(uint8_t j=25;j&lt;45;j++)<br />LCD_Pixel(i,j);<br />BACKGROUND_OFF;<br />LCD_SetColor(_RED);<br />for (uint8_t i=0;i&lt;16;i++)<br />{<br />LCD_SetColor(i,i,0);<br />LCD_String(&quot;TEST mode 2&quot;,15+i,i);<br />}<br />LCD_SetColor(0,0,0);<br />LCD_String(&quot;TEST mode 2&quot;,15+14,14);<br />LCD_SetColor(12,0,0);<br />LCD_String(&quot;TEST mode 2&quot;,15+15,15);<br />LCD_String_settings(1,_RIGHT,_ROT_ON);<br />LCD_SetBackgroudColor(_BLUE);<br />LCD_SetColor(_WHITE);<br />LCD_String(&quot;Rotation&quot;,1,1);<br />LCD_SetBackgroudColor(3,3,3);<br />LCD_SetColor(_CYAN);<br />LCD_String_settings(1,_LEFT,_ROT_OFF);<br />LCD_String(&quot;LEFT&quot;,50,30);<br />LCD_String_settings(0,_RIGHT,_ROT_OFF);<br />LCD_String(&quot;RIGHT&quot;,50,40);<br />LCD_SetBackgroudColor(_BLACK);<br />for(int8_t i=-15;i&lt;16;i++){<br />LCD_SetColor(_BLACK);<br />LCD_String_settings(1,_LEFT,_ROT_OFF);<br />LCD_int16_t(i-1,50,50);<br />LCD_String_settings(1,_RIGHT,_ROT_OFF);<br />LCD_int16_t(i-1,50,60);<br />LCD_SetColor(_BLUE);<br />LCD_String_settings(1,_LEFT,_ROT_OFF);<br />LCD_int16_t(i,50,50);<br />LCD_String_settings(1,_RIGHT,_ROT_OFF);<br />LCD_int16_t(i,50,60);<br />_delay_ms(200);<br />}<br />#endif<br />break;<br />case 3:<br />#if _USE_STRING_WRITE_MODE_2<br />LCD_coordinates(1,1);<br />LCD_printf(&quot;/CFF0/B00Ftest mode 3&quot;//linia1<br />&quot;/n/b0strings/CF00 +&quot;//linia 2<br />&quot;/n/CFF0esc.codes(//n//t)/C0F0+&quot;//linia3<br />&quot;/CFF0variables /C00F+&quot;//linia4<br />&quot;/n/CFF0/BFFF/C000t/C111e/C222x/C333t /C555f/C666o/b0/C777r/C888m/C999a/CAAAt/CBBB/CCCCi/CDDDn/CFFFg&quot;//linia5<br />&quot;/n/CFF0/b0in one function&quot;//linia6<br />&quot;/n&gt;&gt; /CF00LCD_printf/CFF0 &lt;&lt;&quot;//linia7<br />&quot;/CFFFvariable/t%d&quot;,-1234);//linia8<br />#endif<br />break;<br />case 4:<br />#if _USE_STRING_WRITE_MODE_1<br />LCD_SetBackgroudColor(_BLACK);<br />BACKGROUND_ON;<br />poz_x=100;<br />poz_y=50;<br />while (!koniec_petli){<br />if(!timer1){<br />timer1=5;<br />LCD_SetColor(_YELLOW);<br />LCD_String(&quot;forum.atnel.pl&quot;,--poz_x,poz_y);<br />if (poz_x==10){<br />koniec_petli=1;<br />}<br />}<br />}<br />for (uint8_t i=0;i&lt;15;i++){<br />if (poz_x&lt;74){<br />LCD_SetColor(i,i,i);<br />LCD_String(&quot;pozdrowienia&quot;,1,30);<br />LCD_String(&quot;dla&quot;,1,40);<br />}<br />_delay_ms(50);<br />}<br />#endif<br />#if _USE_DRAW_MODE<br /><br />LCD_image_read(0,-20);<br />LCD_refresh();<br />_delay_ms(2000);<br />koniec_petli=0;<br />#endif<br />break;<br />}<br />_delay_ms(5000);<br />if (demo&lt;4)<br />demo++;<br />else<br />demo=1;<br />LCD_all_pixels_off();<br />LCD_SetColor(_BLACK);<br />LCD_Clear();<br />LCD_display_on();<br />}<br />while(1)<br />{<br /><br />}<br />}[/syntax]<br /><br />skrypt Scilaba<br />[syntax=scilab]P=imread('herman2.bmp');<br />imshow(P);<br />P_R=P(:,:,1);<br />P_G=P(:,:,2);<br />P_B=P(:,:,3);<br />P_R=P_R/32;<br />P_G=P_G/32;<br />P_B=P_B/64;<br /><br />P_R=P_R*32;<br />P_G=P_G*4;<br />P_out=P_R+P_G+P_B;<br />&#91;y,x&#93;=size(P_out);<br />MyFile=mopen('MyImage.h','w')<br />mfprintf(MyFile,'#ifndef MYIMAGE_H_\n#define MYIMAGE_H_\n\n#includ...<br />e &lt;avr/pgmspace.h&gt;\n\nstatic const uint8_t size_y = %d;\nstatic co...<br />nst uint8_t size_x = %d;\nstatic const uint8_t Image &#91;&#93; PROGMEM =...<br />\n{',y,x);<br />temp=0;<br />for j=1:x<br />    for i=1:y<br />        mfprintf(MyFile,'%d, ',P_out(i,j));<br /><br />        if temp&gt;20 then<br />            temp=0;<br />            mfprintf(MyFile,'\n');<br /><br /><br />        else<br />            temp=temp+1;<br />        end<br /><br /><br />    end<br />end<br /><br />mfprintf(MyFile,'};\n\n#endif /* MYIMAGE_H_ */')<br />mclose(MyFile);[/syntax]<br /><br />Prezentacja:<br /><div style="width: 583px; height: 471px; margin: 0 auto; padding-left: 26px; padding-top: 48px; background: url('https://www.atnel.pl/download/atnel_tv.png') no-repeat;"> <strong>iframe</strong> </div><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1212">artur85</a> — 13 wrz 2014, o 05:33</p><hr />
]]></content>
</entry>
</feed>