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

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2014-12-08T17:35:14+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=50&amp;t=9401&amp;mode</id>
<entry>
<author><name><![CDATA[mirekk36]]></name></author>
<updated>2014-12-08T17:35:14+01:00</updated>
<published>2014-12-08T17:35:14+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=9401&amp;p=107827#p107827</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=9401&amp;p=107827#p107827"/>
<title type="html"><![CDATA[Re: LCD HD44780 - automatycznie przesuwanie na odpowiedni pi]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=9401&amp;p=107827#p107827"><![CDATA[
<div class="quotetitle">mokrowski napisał(a):</div><div class="quotecontent"><br />Tu masz implementację z przesunięciem. Zapoznaj się z BitTemplateOperation.hpp w Counterek6.<br /></div><br />Jak na to spojrzałem pierwszy raz to pomyślałem &quot;Boże co to za herezje!&quot; <img src="https://forum.atnel.pl/images/smilies/icon_lol.gif" alt=":lol:" title="Śmieje się" /><br /><br />a na poważnie - widać rękę Mistrza w C++ <img src="https://forum.atnel.pl/images/smilies/icon_e_wink.gif" alt=";)" title="Puszcza oko" /><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=54">mirekk36</a> — 8 gru 2014, o 17:35</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Paul Dirac]]></name></author>
<updated>2014-11-23T22:38:43+01:00</updated>
<published>2014-11-23T22:38:43+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=9401&amp;p=105673#p105673</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=9401&amp;p=105673#p105673"/>
<title type="html"><![CDATA[LCD HD44780 - automatycznie przesuwanie na odpowiedni pin]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=9401&amp;p=105673#p105673"><![CDATA[
Witam!<br /><br />W projekcie do inijcalizacji pinów lcd, chciałbym podawać ustawienie w postaci linijki kodu:<br />[syntax=cpp]*RSMode::ptr() |= Lcd&lt;PortRS, PortE&gt;::state_high;[/syntax]<br />co ma sugerować, że na odpowiednim pinie pojawi mi się stan niski. <br />Oto cały kod:<br />[syntax=cpp]#ifndef PORTS_H_<br />#define PORTS_H_<br /><br /><br />#include &lt;stdint.h&gt;<br />#include &lt;avr/io.h&gt;<br />#include &lt;stdlib.h&gt;<br /><br />#define IORegister(namepin,reg,numpin)\<br />struct namepin##reg##Register##numpin{\<br />static volatile uint8_t* ptr(){\<br />return &amp;reg;\<br />}\<br />int valuesa;\<br />int operator&lt;&lt;(int shift)const{\<br />static int hvalue;\<br />hvalue = hvalue &lt;&lt; shift;\<br />return hvalue;\ <br />}\<br />static int ShiftBit(void){\<br />static int shift = numpin;\<br />return shift;\<br />}\<br />namepin##reg##Register##numpin&amp; operator=(const bool&amp; value){\<br />valuesa = value&lt;&lt;ShiftBit();\<br />*ptr() = valuesa;\<br />return *this;\<br />}\<br />}<br /><br />template &lt;class InputRegister, class OutputRegister, class ModeRegister&gt;<br />struct Port{<br />typedef  InputRegister Input;<br />typedef OutputRegister Output;<br />typedef  ModeRegister Mode;<br />};<br /><br />// Rejestracja portów wejścia/wyjścia<br />IORegister(RS, PORTA, PORTA2);<br />IORegister(E, PORTA, PORTA3);<br />IORegister(D4, PORTA, PORTA4);<br />IORegister(D5, PORTA, PORTA5);<br />IORegister(D6, PORTA, PORTA6);<br />IORegister(D7, PORTA, PORTA7);<br /><br />// Rejestracja portów kierunku - mode<br />IORegister(RS, DDRA, PORTA2);<br />IORegister(E, DDRA, PORTA3);<br />IORegister(D4, DDRA, PORTA4);<br />IORegister(D5, DDRA, PORTA5);<br />IORegister(D6, DDRA, PORTA6);<br />IORegister(D7, DDRA, PORTA7);<br /><br /><br />// Rejestracja portów wejściowych<br />IORegister(RS, PINA, PORTA2);<br />IORegister(E, PINA, PORTA3);<br />IORegister(D4, PINA, PORTA4);<br />IORegister(D5, PINA, PORTA5);<br />IORegister(D6, PINA, PORTA6);<br />IORegister(D7, PINA, PORTA7);<br /><br /><br />// Połączenie portów PORTX, DDRX, PINX<br />typedef Port&lt;RSPINARegisterPORTA2, RSPORTARegisterPORTA2, RSDDRARegisterPORTA2&gt; RSPortA2;<br />typedef Port&lt;EPINARegisterPORTA3, EPORTARegisterPORTA3, EDDRARegisterPORTA3&gt; EPortA3;<br />typedef Port&lt;D4PINARegisterPORTA4, D4PORTARegisterPORTA4, D4DDRARegisterPORTA4&gt; D4PortA4;<br />typedef Port&lt;D5PINARegisterPORTA5, D5PORTARegisterPORTA5, D5DDRARegisterPORTA5&gt; D5PortA5;<br />typedef Port&lt;D6PINARegisterPORTA6, D6PORTARegisterPORTA6, D6DDRARegisterPORTA6&gt; D6PortA6;<br />typedef Port&lt;D7PINARegisterPORTA7, D7PORTARegisterPORTA7, D7DDRARegisterPORTA7&gt; D6PortA7;[/syntax]<br /><br />[syntax=cpp]#ifndef LCD_H_<br />#define LCD_H_<br /><br />#include &lt;stdint.h&gt;<br />#include &lt;avr/io.h&gt;<br /><br />#include &quot;ports.hpp&quot;<br />#include &quot;BitTemplateOperation.hpp&quot;<br /><br />template&lt;class PortRS, class PortE&gt;<br />class Lcd{<br />public:<br />Lcd();<br />void Lcd_init(void);<br />private:<br />typedef typename PortRS::Input RSInput;<br />typedef typename PortRS::Output RSOutput;<br />typedef typename PortRS::Mode RSMode;<br />typedef typename PortE::Input EInput;<br />typedef typename PortE::Output EOutput;<br />typedef typename PortE::Mode EMode;<br />const uint8_t state_low;<br />const uint8_t state_high;<br />};<br /><br />//init port for LCD<br />template&lt;class PortRS, class PortE&gt;<br />Lcd&lt;PortRS, PortE&gt;::Lcd():state_low(0), state_high(1){<br />*RSMode::ptr() |= Lcd&lt;PortRS, PortE&gt;::state_high;<br />*RSOutput::ptr() |= Lcd&lt;PortRS, PortE&gt;::state_low;<br />*EMode::ptr() |= Lcd&lt;PortRS, PortE&gt;::state_high&lt;&lt;EMode::ShiftBit();<br />*EOutput::ptr() |= Lcd&lt;PortRS, PortE&gt;::state_low&lt;&lt;EMode::ShiftBit();<br />}[/syntax]<br /><br />[syntax=cpp]#include &lt;avr/io.h&gt;<br /><br />#include &quot;lcd.hpp&quot;<br />#include &quot;ports.hpp&quot;<br /><br />int main(void)<br />{<br />Lcd&lt;RSPortA2, EPortA3&gt; my_lcd = Lcd&lt;RSPortA2, EPortA3&gt;();<br />    while(1)<br />    {<br />        //TODO:: Please write your application code <br />    }<br />}[/syntax]<br /><br />Wszystko działa gdy wykorzystuje kod postaci:<br />[syntax=cpp]*EOutput::ptr() |= Lcd&lt;PortRS, PortE&gt;::state_low&lt;&lt;EMode::ShiftBit();[/syntax]<br /><br />ja po prostu chciałbym to skrócic, aby przesuniecie było automatycznie. Wszelkie sugestie mile widziane.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1035">Paul Dirac</a> — 23 lis 2014, o 22:38</p><hr />
]]></content>
</entry>
</feed>