<?xml version="1.0" encoding="utf-8"?>
				<!-- generator="e107" -->
				<!-- content type="Novinky" -->
				<rss  version="2.0" 
					xmlns:content="http://purl.org/rss/1.0/modules/content/" 
					xmlns:atom="http://www.w3.org/2005/Atom"
					xmlns:dc="http://purl.org/dc/elements/1.1/"
					xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"

				>
				<channel>
				<title>MCU-mikroelektronika : Novinky</title>
				<link>http://mcu.cz/</link>
				<description>Web plný informací o procesorech a mikrořadičích, včetně jejich programování a aplikací.</description>

<language>cs-CZ</language>
				<copyright>       </copyright>
				<managingEditor>mcu@nospam.com (MCU Admin)</managingEditor>
				<webMaster>mcu@nospam.com (MCU Admin)</webMaster>
				<pubDate>Thu, 17 May 2012 18:05:08 +0200</pubDate>
				<lastBuildDate>Thu, 17 May 2012 18:05:08 +0200</lastBuildDate>
				<docs>http://backend.userland.com/rss</docs>
				<generator>e107 (http://e107.org)</generator>
				<sy:updatePeriod>hourly</sy:updatePeriod>
				<sy:updateFrequency>1</sy:updateFrequency>

				<ttl>60</ttl>
<atom:link href="http://mcu.cz/plugins/rss_menu/rss.php?news.2" rel="self" type="application/rss+xml" />

					<image>
					<title>MCU-mikroelektronika : Novinky</title>
					<url>http://mcu.cz/images/logo.png</url>
					<link>http://mcu.cz/</link>
					<width>88</width>
					<height>31</height>
					<description>Web plný informací o procesorech a mikrořadičích, včetně jejich programování a aplikací.</description>
					</image>
<item>
<title>BT Droid</title>
<link>http://mcu.cz/news.php?item.3058.3</link>
<description><![CDATA[<img src='../images/newspost_images/logo/microchip.jpg' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/>Při hledání námětu na dnešní článeček jsem se dostal až do země vycházejícího slunce. Výsledek je ale celkem zajímavý. Jedná se program, který umožňuje připojit k PIC24F64G002 Bluetooth moduly <a class='bbcode' href='http://amzn.to/lB8AJo' rel='external' >Planex BT-MicroEDR2X</a>(Class 2) nebo <a class='bbcode' href='http://amzn.to/k5rfwa' rel='external' >Planex BT-MicroEDR1X</a>(Class 1).<br />Autor originálu využil tento program ve spojení s MT s Androidem. Proto také název BT-Droid.<br /><div style='text-align:center'><img src='../images/newspost_images/30/58/01.png' style="width:600px; border: 2px solid black; margin: 5px;"'/></div><br /><div style='text-align:center'><img src='../images/newspost_images/30/58/02.jpg' style="width:600px; border: 2px solid black; margin: 5px;"'/></div><br /><div style='text-align:right'><hr/><a class='bbcode' href='http://side2.jp/2011/05/android-bluetooth-dongle-pic24f/' rel='external' ><span style='color:#0000ff'><strong class='bbcode bold'>Zdroj</strong></span></a> </div><br />]]></description>
<content:encoded><![CDATA[<img src='../images/newspost_images/logo/microchip.jpg' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/>Při hledání námětu na dnešní článeček jsem se dostal až do země vycházejícího slunce. Výsledek je ale celkem zajímavý. Jedná se program, který umožňuje připojit k PIC24F64G002 Bluetooth moduly <a class='bbcode' href='http://amzn.to/lB8AJo' rel='external' >Planex BT-MicroEDR2X</a>(Class 2) nebo <a class='bbcode' href='http://amzn.to/k5rfwa' rel='external' >Planex BT-MicroEDR1X</a>(Class 1).<br />Autor originálu využil tento program ve spojení s MT s Androidem. Proto také název BT-Droid.<br /><div style='text-align:center'><img src='../images/newspost_images/30/58/01.png' style="width:600px; border: 2px solid black; margin: 5px;"'/></div><br /><div style='text-align:center'><img src='../images/newspost_images/30/58/02.jpg' style="width:600px; border: 2px solid black; margin: 5px;"'/></div><br /><div style='text-align:right'><hr/><a class='bbcode' href='http://side2.jp/2011/05/android-bluetooth-dongle-pic24f/' rel='external' ><span style='color:#0000ff'><strong class='bbcode bold'>Zdroj</strong></span></a> </div><br />]]></content:encoded>
<category domain='http://mcu.cz/news.php?cat.3'>Mikroprocesory</category>
<dc:creator>Kosta</dc:creator>
<pubDate>Fri, 18 May 2012 00:00:00 +0200</pubDate>
<guid isPermaLink="true">http://mcu.cz/news.php?item.3058.3</guid>
</item>

<item>
<title>Java pro STM32F</title>
<link>http://mcu.cz/news.php?item.3115.7</link>
<description><![CDATA[<img src='http://mcu.cz/images/newspost_images/31/15/javalog.png' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/><img src='http://mcu.cz/images/newspost_images/logo/arm.png' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/><a class='bbcode' href='http://www.st.com' rel='external' ><img src='http://mcu.cz/images/newspost_images/logo/st.jpg' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/></a>Zdá se, že i na půdu mikrořadičů začíná pronikat programovací jazyk java. Kávopijci (dle loga) se mohou radovat. Francouzská firma IS2T si pro svou java platformu vybrala též mcu STM32, konkrétně kit STM3220G, což je kit s STM32F207. V textu další informace.<br /><br /><br />Hned úvodem bych rád poznamenal, že jsem toho o novém produktu moc nezjistil. Takže pokud někdo víte víc, tak rád uvítám další informace a doplním je do textu.<br /><br />Java je připravena pro mcu STM32F2xx (ARM Cortex M3 od STMicroelectronics), LPC2000 (ARM7DTMI od NXP) a AVR32 (Atmel). Podrobnosti k různým platformám naleznete <a class='bbcode' href='http://www.is2t.com/en/products-microej-bsp-cots.php' rel='external' >zde</a>.<br /><br />Platforma pro STM32F2xx je, jak již bylo řečeno, založena na kitu STM3220G. Jde o poměrně vybavený kit (viz následující obrázek).<br /><br /><div style='text-align:center'><img src='http://mcu.cz/images/newspost_images/31/15/kit_stm3220.jpg' class='bbcode' alt=''  /><br /><strong class='bbcode bold'>Kit STM3220G</strong></div><br /><br />COTS Java Platforma pro STM32 podporuje výše uvedený kit a obsahuje knihovny pro následující prvky:<br /><ul class='bbcode'><li class='bbcode'>    Ethernet port (včetně integrovaného TCP/IP stacku)<br /></li><li class='bbcode'>    Sensors:<br /><ul class='bbcode'><li class='bbcode'> LIS302DL akcelerometr<br /></li><li class='bbcode'> potentiometer<br /></li><li class='bbcode'> joystik</li></ul><br /></li><li class='bbcode'>    QVG Color LCD s rozlišením 240x320 včetně dotykového snímače<br /></li><li class='bbcode'>    Connectors for JTAG, USART, USB 2.0, TWI, SPI<br /></li><li class='bbcode'>    SD Card Reader<br /></li><li class='bbcode'>    4 x User LED<br /></li></ul><br /><br />Zahrnuta je podpora pro ST-Link v.2, takže z vývojového prostředí (založené na Eclipse) je možné přímo ladit vytvářené aplikace.<br /><br />Jsou dodávány jak ostré verze, tak i verze "Evaluation", které je limitována na 3 měsíce od prvního spuštění a 1 hodinu běhu runtime.<br /><br />IS2T Java platforma se skládá ze 3 hlavních komponent:<br /><br /><ul class='bbcode'><li class='bbcode'> EmbJPF<br /><ul class='bbcode'><li class='bbcode'>    Embedded Java Platform je binarní run-time, který se nahrává do mcu. Virtuální stroj představuje MicroJvm® virtual machine.</li></ul><br /></li><li class='bbcode'> SimJPF<br /><ul class='bbcode'><li class='bbcode'>    Simulated Java Platform je protějšek EmbJPF který může být simulován na pracovní stanici. Výkonná část, která simuluje MicroJvm virtuální stroj je S3™ (Smart Simulator Simulator).</li></ul><br /></li><li class='bbcode'> Tools<br /><ul class='bbcode'><li class='bbcode'>    Vývojové nástroje obsahují všechny potřebné pomůcky vyžadované pro efektivní vývoj v Javě (debugger, analyzáry, atd.). </li></ul></li></ul><br /><br />Zajímavou součástí je Micro Widget Toolkit (MWT), což je high-level grafická knihovna ulehčující tvorbu grafického GUI pro aplikace. Viz následující příklad ovládání pro pračku:<br /><br /><div style='text-align:center'><img src='http://www.is2t.com/en/images/screenshot-washing-machine-1.png' class='bbcode' alt=''  /></div><br /><br /><br />Protože jde o poměrně čerstvý produkt (použitelná verze portované Javy byla uvolněna v polovině dubna) tak ještě není k dispozici příliš informací. Existuje pouze data brief od STMicroelectronics, ke stažení je <a class='bbcode' href='http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATA_BRIEF/DM00047301.pdf' rel='external' >zde</a>.<br /><br /><br /><strong class='bbcode bold'>Odkazy</strong><br /><br />Home page produktu na webu ST je <a class='bbcode' href='http://www.st.com/internet/evalboard/product/252535.jsp?wt.mc_id=enews_may12_stm32_java' rel='external' >zde</a>.<br /><br />Home page produktu na webu fy IS2T je <a class='bbcode' href='odkaz' rel='external' >zde</a>.]]></description>
<content:encoded><![CDATA[<img src='http://mcu.cz/images/newspost_images/31/15/javalog.png' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/><img src='http://mcu.cz/images/newspost_images/logo/arm.png' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/><a class='bbcode' href='http://www.st.com' rel='external' ><img src='http://mcu.cz/images/newspost_images/logo/st.jpg' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/></a>Zdá se, že i na půdu mikrořadičů začíná pronikat programovací jazyk java. Kávopijci (dle loga) se mohou radovat. Francouzská firma IS2T si pro svou java platformu vybrala též mcu STM32, konkrétně kit STM3220G, což je kit s STM32F207. V textu další informace.<br /><br /><br />Hned úvodem bych rád poznamenal, že jsem toho o novém produktu moc nezjistil. Takže pokud někdo víte víc, tak rád uvítám další informace a doplním je do textu.<br /><br />Java je připravena pro mcu STM32F2xx (ARM Cortex M3 od STMicroelectronics), LPC2000 (ARM7DTMI od NXP) a AVR32 (Atmel). Podrobnosti k různým platformám naleznete <a class='bbcode' href='http://www.is2t.com/en/products-microej-bsp-cots.php' rel='external' >zde</a>.<br /><br />Platforma pro STM32F2xx je, jak již bylo řečeno, založena na kitu STM3220G. Jde o poměrně vybavený kit (viz následující obrázek).<br /><br /><div style='text-align:center'><img src='http://mcu.cz/images/newspost_images/31/15/kit_stm3220.jpg' class='bbcode' alt=''  /><br /><strong class='bbcode bold'>Kit STM3220G</strong></div><br /><br />COTS Java Platforma pro STM32 podporuje výše uvedený kit a obsahuje knihovny pro následující prvky:<br /><ul class='bbcode'><li class='bbcode'>    Ethernet port (včetně integrovaného TCP/IP stacku)<br /></li><li class='bbcode'>    Sensors:<br /><ul class='bbcode'><li class='bbcode'> LIS302DL akcelerometr<br /></li><li class='bbcode'> potentiometer<br /></li><li class='bbcode'> joystik</li></ul><br /></li><li class='bbcode'>    QVG Color LCD s rozlišením 240x320 včetně dotykového snímače<br /></li><li class='bbcode'>    Connectors for JTAG, USART, USB 2.0, TWI, SPI<br /></li><li class='bbcode'>    SD Card Reader<br /></li><li class='bbcode'>    4 x User LED<br /></li></ul><br /><br />Zahrnuta je podpora pro ST-Link v.2, takže z vývojového prostředí (založené na Eclipse) je možné přímo ladit vytvářené aplikace.<br /><br />Jsou dodávány jak ostré verze, tak i verze "Evaluation", které je limitována na 3 měsíce od prvního spuštění a 1 hodinu běhu runtime.<br /><br />IS2T Java platforma se skládá ze 3 hlavních komponent:<br /><br /><ul class='bbcode'><li class='bbcode'> EmbJPF<br /><ul class='bbcode'><li class='bbcode'>    Embedded Java Platform je binarní run-time, který se nahrává do mcu. Virtuální stroj představuje MicroJvm® virtual machine.</li></ul><br /></li><li class='bbcode'> SimJPF<br /><ul class='bbcode'><li class='bbcode'>    Simulated Java Platform je protějšek EmbJPF který může být simulován na pracovní stanici. Výkonná část, která simuluje MicroJvm virtuální stroj je S3™ (Smart Simulator Simulator).</li></ul><br /></li><li class='bbcode'> Tools<br /><ul class='bbcode'><li class='bbcode'>    Vývojové nástroje obsahují všechny potřebné pomůcky vyžadované pro efektivní vývoj v Javě (debugger, analyzáry, atd.). </li></ul></li></ul><br /><br />Zajímavou součástí je Micro Widget Toolkit (MWT), což je high-level grafická knihovna ulehčující tvorbu grafického GUI pro aplikace. Viz následující příklad ovládání pro pračku:<br /><br /><div style='text-align:center'><img src='http://www.is2t.com/en/images/screenshot-washing-machine-1.png' class='bbcode' alt=''  /></div><br /><br /><br />Protože jde o poměrně čerstvý produkt (použitelná verze portované Javy byla uvolněna v polovině dubna) tak ještě není k dispozici příliš informací. Existuje pouze data brief od STMicroelectronics, ke stažení je <a class='bbcode' href='http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATA_BRIEF/DM00047301.pdf' rel='external' >zde</a>.<br /><br /><br /><strong class='bbcode bold'>Odkazy</strong><br /><br />Home page produktu na webu ST je <a class='bbcode' href='http://www.st.com/internet/evalboard/product/252535.jsp?wt.mc_id=enews_may12_stm32_java' rel='external' >zde</a>.<br /><br />Home page produktu na webu fy IS2T je <a class='bbcode' href='odkaz' rel='external' >zde</a>.]]></content:encoded>
<category domain='http://mcu.cz/news.php?cat.7'>Vyloveno ze Sítě</category>
<dc:creator>mard</dc:creator>
<pubDate>Thu, 17 May 2012 03:55:12 +0200</pubDate>
<guid isPermaLink="true">http://mcu.cz/news.php?item.3115.7</guid>
</item>

<item>
<title>miniRing Core Calculator</title>
<link>http://mcu.cz/news.php?item.1525.7</link>
<description><![CDATA[<img src='../images/newspost_images/15/25/toroid.jpg' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/>Občas se stane, že potřebujete spočítat cívku, konkrétně toroidní cívku. Já vím, u mikrokontrolerů se to může zdát tak trochu mimo mísu. Ale co už, nejen MCU je bastlíř živ. No i na mne si došlápla rodinka a byl jsem donucen se věnovat takové banalitě jako je oprava spotřební elektroniky.<br />Při té příležitosti jsem našel tento prográmek. Autorem je DL5SWB a musím říci, že to je užitečný pomocník.<br /><br />Program zná spoustu běžně dostupných jader (Amidon, Ferroxcube....). Dokáže vypočítat počet závitů, potřebnou délku drátu, jeho maximální průměr a ztráty. Dále lze také zadat vlastní parametry jádra a to se nám může hodit pokud chceme zužitkovat "šuplíkové" zásoby z bývalé produkce Prametu.<br /><div style='text-align:center'><img src='../images/newspost_images/15/25/minirk_e.gif' style="width:600px; border: 2px solid black; margin: 5px;"'/></div><br /><div style='text-align:right'><hr/><a class='bbcode' href='http://www.dl5swb.de/html/mini_ring_core_calculator.htm' rel='external' ><span style='color:#0000ff'><strong class='bbcode bold'>Zdroj</strong></span></a>  </div>]]></description>
<content:encoded><![CDATA[<img src='../images/newspost_images/15/25/toroid.jpg' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/>Občas se stane, že potřebujete spočítat cívku, konkrétně toroidní cívku. Já vím, u mikrokontrolerů se to může zdát tak trochu mimo mísu. Ale co už, nejen MCU je bastlíř živ. No i na mne si došlápla rodinka a byl jsem donucen se věnovat takové banalitě jako je oprava spotřební elektroniky.<br />Při té příležitosti jsem našel tento prográmek. Autorem je DL5SWB a musím říci, že to je užitečný pomocník.<br /><br />Program zná spoustu běžně dostupných jader (Amidon, Ferroxcube....). Dokáže vypočítat počet závitů, potřebnou délku drátu, jeho maximální průměr a ztráty. Dále lze také zadat vlastní parametry jádra a to se nám může hodit pokud chceme zužitkovat "šuplíkové" zásoby z bývalé produkce Prametu.<br /><div style='text-align:center'><img src='../images/newspost_images/15/25/minirk_e.gif' style="width:600px; border: 2px solid black; margin: 5px;"'/></div><br /><div style='text-align:right'><hr/><a class='bbcode' href='http://www.dl5swb.de/html/mini_ring_core_calculator.htm' rel='external' ><span style='color:#0000ff'><strong class='bbcode bold'>Zdroj</strong></span></a>  </div>]]></content:encoded>
<category domain='http://mcu.cz/news.php?cat.7'>Vyloveno ze Sítě</category>
<dc:creator>Kosta</dc:creator>
<pubDate>Thu, 17 May 2012 00:00:00 +0200</pubDate>
<guid isPermaLink="true">http://mcu.cz/news.php?item.1525.7</guid>
</item>

<item>
<title>STM32F0 - zahájení masové výroby</title>
<link>http://mcu.cz/news.php?item.3114.40</link>
<description><![CDATA[<img src='http://mcu.cz/images/newspost_images/logo/arm.png' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/><a class='bbcode' href='http://www.st.com' rel='external' ><img src='http://mcu.cz/images/newspost_images/logo/st.jpg' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/></a>STMicroelectronics zahájil v souladu s plánem minulý týden běžnou masovou výrobu nového čipu STM32F051. V souvislosti s tímto milníkem vydal tiskovou zprávu v angličtině, kterou vám přinášíme.<br /><br /><br /><span style='font-size:18px'>STMicroelectronics Enters Production with New STM32 F0 Microcontrollers Targeting Budget Applications</span><br /><br /><br /><div style='text-align:center'><img src='http://mcu.cz/images/newspost_images/31/14/stm32f0discovery_p3296big.jpg' class='bbcode' alt=''  /></div><br /><br /><br /><strong class='bbcode bold'>High-volume availability, plus engineering essentials leveraging STM32 'DNA', catalyzes design starts with advanced ARM® Cortex™-M0 family</strong><br /><br />STMicroelectronics (NYSE: STM), a global semiconductor leader serving customers across the spectrum of electronic applications and a world leader in microcontrollers, has begun volume production of its 32-bit STM32 F0 microcontroller series launched in February 2012 to bridge the gap to high-end features in 8- and 16-bit applications.<br /><br />With a dedicated Discovery Kit also available, and leveraging the extensive STM32 development ecosystem, engineers now have everything they need to use ST’s new microcontrollers featuring the ARM® Cortex™-M0 processor in cost-sensitive consumer and industrial products.<br /><br />“Now entering production, perfectly on schedule, our <a class='bbcode' href='http://www.st.com/internet/mcu/class/1734.jsp' rel='external' >STM32 F0 series</a> has achieved an important milestone, enabling ST customers to lead development of competitively priced, low-power end products delivering enhanced performance and value,” said Michel Buffa, General Manager for ST’s Microcontroller Division.<br /><br />Developers can purchase the STM32F0 Discovery Kit to start new projects based on STM32 F0 devices. The kit contains a prototype microcontroller board featuring pushbuttons and indicator LEDs, which plugs directly into a PC’s USB port and is supported by demonstration code and sample firmware. The kit is compatible with STM32 software development environments from leading third-party vendors Atollic, IAR, Keil™, and TASKING.<br /><br />STM32 F0 microcontrollers take advantage of the modern ARM Cortex-M0 32-bit embedded processor architecture, enabling product developers to break traditional price and performance limitations imposed by older, proprietary 8-bit and 16-bit devices. Pin compatibility, in addition to software, peripherals and development-tools compatibility across more than 300 device variants now available in all STM32 Cortex-M0, Cortex-M3 and Cortex-M4 series enhances flexibility and scalability, and can help reduce development costs and time to market for new products. In addition, the STM32 F0 series integrates high-value features not found in Cortex-M0 microcontrollers from competing suppliers.<br /><br /><strong class='bbcode bold'>Differentiating the STM32 F0 ARM Cortex-M0 series:</strong><br />Differentiating features of ST’s STM32 F0 devices include built-in hardware RAM-parity checking, which simplifies compatibility with Class-B Industry safety standard for home appliance applications and enhances real-time application performance. A Clock Security System (CSS) is also integrated, which enhances the reliability of the application. In addition, advanced timing capabilities with dead-time generation and inverted channels help designers overcome common challenges when designing motor controls.<br /><br />The devices also integrate hardware touch-sensing control and a 12-bit Analog/Digital Converter (ADC) capable of up to 1Msample/s conversion, which is more than twice the speed supported by some competing devices. Other features include a 12-bit Digital/Analog Converter (DAC), and two tightly coupled programmable analog comparators. This outstanding analog integration, in a low-cost microcontroller family, enables developers to target applications requiring precision high-speed sensing and control across multiple channels.<br /><br />STM32 F0 devices also integrate a hardware Consumer Electronics Control (CEC) module allowing connections to other home multimedia devices using the latest industry-standard protocols while leaving the microcontroller’s CPU, memory and peripherals free to perform other tasks.<br /><br />With four low-power modes, including a 5.3µA STOP mode and a 2.8µA STANDBY mode with the real-time clock running, the energy-conscious STM32 F0 family simplifies deployment and extends battery life in applications such as remote controls, sensor networks and smart meters.<br /><br />High-performance communication features include a Serial Peripheral Interface (SPI) with support for programmable data frame up to 16 bits and baud rate up to 18Mbit/s, as well as an I2C port supporting Fast mode+ communication at up to 1Mbit/s. Also, activity on the I2C port can wake the microcontroller from STOP mode on address match.<br /><br />Further advantages for engineers include reduced constraints for easy communication clock setting. Programmable analog and digital noise filtering ensure robust communication. There is also a 6Mbit/s USART with support for multiple clock input options, capable of operating independently from the main processor clock frequency.<br /><br /><strong class='bbcode bold'>Prices and availability:</strong><br />The STM32 F0 is in mass production now, offering embedded memory densities from 16Kbyte to 64Kbyte Flash and 4Kbyte to 8Kbyte SRAM and UFQFPN32, LQFP48 and LQFP64 package options. An additional 20-pin in 16kbyte Flash configuration and extension to 128Kbyte Flash in a 100-pin package will soon be available. Resale prices for STM32 F0 microcontrollers start from $0.95 in quantities of 1000 pieces.<br /><br />The STM32F0 Discovery Kit is available from ST sales offices and from distributors, priced at $7.99.]]></description>
<content:encoded><![CDATA[<img src='http://mcu.cz/images/newspost_images/logo/arm.png' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/><a class='bbcode' href='http://www.st.com' rel='external' ><img src='http://mcu.cz/images/newspost_images/logo/st.jpg' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/></a>STMicroelectronics zahájil v souladu s plánem minulý týden běžnou masovou výrobu nového čipu STM32F051. V souvislosti s tímto milníkem vydal tiskovou zprávu v angličtině, kterou vám přinášíme.<br /><br /><br /><span style='font-size:18px'>STMicroelectronics Enters Production with New STM32 F0 Microcontrollers Targeting Budget Applications</span><br /><br /><br /><div style='text-align:center'><img src='http://mcu.cz/images/newspost_images/31/14/stm32f0discovery_p3296big.jpg' class='bbcode' alt=''  /></div><br /><br /><br /><strong class='bbcode bold'>High-volume availability, plus engineering essentials leveraging STM32 'DNA', catalyzes design starts with advanced ARM® Cortex™-M0 family</strong><br /><br />STMicroelectronics (NYSE: STM), a global semiconductor leader serving customers across the spectrum of electronic applications and a world leader in microcontrollers, has begun volume production of its 32-bit STM32 F0 microcontroller series launched in February 2012 to bridge the gap to high-end features in 8- and 16-bit applications.<br /><br />With a dedicated Discovery Kit also available, and leveraging the extensive STM32 development ecosystem, engineers now have everything they need to use ST’s new microcontrollers featuring the ARM® Cortex™-M0 processor in cost-sensitive consumer and industrial products.<br /><br />“Now entering production, perfectly on schedule, our <a class='bbcode' href='http://www.st.com/internet/mcu/class/1734.jsp' rel='external' >STM32 F0 series</a> has achieved an important milestone, enabling ST customers to lead development of competitively priced, low-power end products delivering enhanced performance and value,” said Michel Buffa, General Manager for ST’s Microcontroller Division.<br /><br />Developers can purchase the STM32F0 Discovery Kit to start new projects based on STM32 F0 devices. The kit contains a prototype microcontroller board featuring pushbuttons and indicator LEDs, which plugs directly into a PC’s USB port and is supported by demonstration code and sample firmware. The kit is compatible with STM32 software development environments from leading third-party vendors Atollic, IAR, Keil™, and TASKING.<br /><br />STM32 F0 microcontrollers take advantage of the modern ARM Cortex-M0 32-bit embedded processor architecture, enabling product developers to break traditional price and performance limitations imposed by older, proprietary 8-bit and 16-bit devices. Pin compatibility, in addition to software, peripherals and development-tools compatibility across more than 300 device variants now available in all STM32 Cortex-M0, Cortex-M3 and Cortex-M4 series enhances flexibility and scalability, and can help reduce development costs and time to market for new products. In addition, the STM32 F0 series integrates high-value features not found in Cortex-M0 microcontrollers from competing suppliers.<br /><br /><strong class='bbcode bold'>Differentiating the STM32 F0 ARM Cortex-M0 series:</strong><br />Differentiating features of ST’s STM32 F0 devices include built-in hardware RAM-parity checking, which simplifies compatibility with Class-B Industry safety standard for home appliance applications and enhances real-time application performance. A Clock Security System (CSS) is also integrated, which enhances the reliability of the application. In addition, advanced timing capabilities with dead-time generation and inverted channels help designers overcome common challenges when designing motor controls.<br /><br />The devices also integrate hardware touch-sensing control and a 12-bit Analog/Digital Converter (ADC) capable of up to 1Msample/s conversion, which is more than twice the speed supported by some competing devices. Other features include a 12-bit Digital/Analog Converter (DAC), and two tightly coupled programmable analog comparators. This outstanding analog integration, in a low-cost microcontroller family, enables developers to target applications requiring precision high-speed sensing and control across multiple channels.<br /><br />STM32 F0 devices also integrate a hardware Consumer Electronics Control (CEC) module allowing connections to other home multimedia devices using the latest industry-standard protocols while leaving the microcontroller’s CPU, memory and peripherals free to perform other tasks.<br /><br />With four low-power modes, including a 5.3µA STOP mode and a 2.8µA STANDBY mode with the real-time clock running, the energy-conscious STM32 F0 family simplifies deployment and extends battery life in applications such as remote controls, sensor networks and smart meters.<br /><br />High-performance communication features include a Serial Peripheral Interface (SPI) with support for programmable data frame up to 16 bits and baud rate up to 18Mbit/s, as well as an I2C port supporting Fast mode+ communication at up to 1Mbit/s. Also, activity on the I2C port can wake the microcontroller from STOP mode on address match.<br /><br />Further advantages for engineers include reduced constraints for easy communication clock setting. Programmable analog and digital noise filtering ensure robust communication. There is also a 6Mbit/s USART with support for multiple clock input options, capable of operating independently from the main processor clock frequency.<br /><br /><strong class='bbcode bold'>Prices and availability:</strong><br />The STM32 F0 is in mass production now, offering embedded memory densities from 16Kbyte to 64Kbyte Flash and 4Kbyte to 8Kbyte SRAM and UFQFPN32, LQFP48 and LQFP64 package options. An additional 20-pin in 16kbyte Flash configuration and extension to 128Kbyte Flash in a 100-pin package will soon be available. Resale prices for STM32 F0 microcontrollers start from $0.95 in quantities of 1000 pieces.<br /><br />The STM32F0 Discovery Kit is available from ST sales offices and from distributors, priced at $7.99.]]></content:encoded>
<category domain='http://mcu.cz/news.php?cat.40'>Článek v angličtině</category>
<dc:creator>mard</dc:creator>
<pubDate>Wed, 16 May 2012 08:44:59 +0200</pubDate>
<guid isPermaLink="true">http://mcu.cz/news.php?item.3114.40</guid>
</item>

<item>
<title>Jednoduchá regulovaná zátěž</title>
<link>http://mcu.cz/news.php?item.3112.7</link>
<description><![CDATA[<img src='http://mcu.cz/images/newspost_images/27/05/eetimes.png' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/>Pokud potřebujete regulovatelnou zátěž, tak se můžete inspirovat jednoduchým zapojením z EEtimes, ke kterému George Graves vytvořil PCB.<br /><br /><br /><strong class='bbcode bold'>Schéma</strong><br /><br /><div style='text-align:center'><img src='http://mcu.cz/images/newspost_images/31/12/currsour.png' class='bbcode' alt=''  /></div><br /><br /><br />Myslím že schéma je poměrně samovysvětlující, není potřeba zapojení nějak rozebírat. Snad jen to, že pro napájení je potřeba 12V DC adaptér.<br /><br /><br /><strong class='bbcode bold'>Provedení</strong><br /><br /><div style='text-align:center'><img src='http://mcu.cz/images/newspost_images/31/12/currsour02.jpg' class='bbcode' alt=''  /></div><br /><br /><br /><strong class='bbcode bold'>Odkaz</strong><br /><br />Blog, kde naleznete podklady pro PCB (klišé spodního dílu i malý PCB pro paralelní sadu odporů) naleznete <a class='bbcode' href='http://forums.adafruit.com/viewtopic.php?f=44&amp;t=28487' rel='external' >zde</a>.<br />]]></description>
<content:encoded><![CDATA[<img src='http://mcu.cz/images/newspost_images/27/05/eetimes.png' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/>Pokud potřebujete regulovatelnou zátěž, tak se můžete inspirovat jednoduchým zapojením z EEtimes, ke kterému George Graves vytvořil PCB.<br /><br /><br /><strong class='bbcode bold'>Schéma</strong><br /><br /><div style='text-align:center'><img src='http://mcu.cz/images/newspost_images/31/12/currsour.png' class='bbcode' alt=''  /></div><br /><br /><br />Myslím že schéma je poměrně samovysvětlující, není potřeba zapojení nějak rozebírat. Snad jen to, že pro napájení je potřeba 12V DC adaptér.<br /><br /><br /><strong class='bbcode bold'>Provedení</strong><br /><br /><div style='text-align:center'><img src='http://mcu.cz/images/newspost_images/31/12/currsour02.jpg' class='bbcode' alt=''  /></div><br /><br /><br /><strong class='bbcode bold'>Odkaz</strong><br /><br />Blog, kde naleznete podklady pro PCB (klišé spodního dílu i malý PCB pro paralelní sadu odporů) naleznete <a class='bbcode' href='http://forums.adafruit.com/viewtopic.php?f=44&amp;t=28487' rel='external' >zde</a>.<br />]]></content:encoded>
<category domain='http://mcu.cz/news.php?cat.7'>Vyloveno ze Sítě</category>
<dc:creator>mard</dc:creator>
<pubDate>Wed, 16 May 2012 05:06:49 +0200</pubDate>
<guid isPermaLink="true">http://mcu.cz/news.php?item.3112.7</guid>
</item>

<item>
<title>Což takhle si sbastlit Sputnik 1</title>
<link>http://mcu.cz/news.php?item.3052.7</link>
<description><![CDATA[<img src='../images/newspost_images/30/52/sputnik1_tx_00.jpg' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/>Prosím, nekamenovat. Vím, že obsah je úplně mimo témata tohoto serveru, ale prostě mi to nedalo. Úpně náhodou jsem narazil na toto schéma - repliku vysílače, který pípal ze Sputniku 1. Myslím, že je velmi poučné se podívat co to vlastně tehdy letělo.<br />Šokující jednoduchost. Opravdu v jednoduchosti je krása. No a druhým šokem pro mě bylo, že ty bateriové elektronky jsou stále dostupné. Cca 50 stříbrných za kus. No nekupte to. <img src='http://mcu.cz/images/emotes/default/smile.png' alt='' style='vertical-align:middle; border:0' />  <br /><div style='text-align:center'><img src='../images/newspost_images/30/52/sputnik1_tx_01.jpg' style="width:600px; border: 2px solid black; margin: 5px;"'/></div><br /><div style='text-align:center'><img src='../images/newspost_images/30/52/sputnik1_tx_02.jpg' style="width:600px; border: 2px solid black; margin: 5px;"'/></div><br /><div style='text-align:right'><hr/><a class='bbcode' href='http://dl3jin.de/sputnik1_tx.htm' rel='external' ><span style='color:#0000ff'><strong class='bbcode bold'>Zdroj</strong></span></a></div>]]></description>
<content:encoded><![CDATA[<img src='../images/newspost_images/30/52/sputnik1_tx_00.jpg' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/>Prosím, nekamenovat. Vím, že obsah je úplně mimo témata tohoto serveru, ale prostě mi to nedalo. Úpně náhodou jsem narazil na toto schéma - repliku vysílače, který pípal ze Sputniku 1. Myslím, že je velmi poučné se podívat co to vlastně tehdy letělo.<br />Šokující jednoduchost. Opravdu v jednoduchosti je krása. No a druhým šokem pro mě bylo, že ty bateriové elektronky jsou stále dostupné. Cca 50 stříbrných za kus. No nekupte to. <img src='http://mcu.cz/images/emotes/default/smile.png' alt='' style='vertical-align:middle; border:0' />  <br /><div style='text-align:center'><img src='../images/newspost_images/30/52/sputnik1_tx_01.jpg' style="width:600px; border: 2px solid black; margin: 5px;"'/></div><br /><div style='text-align:center'><img src='../images/newspost_images/30/52/sputnik1_tx_02.jpg' style="width:600px; border: 2px solid black; margin: 5px;"'/></div><br /><div style='text-align:right'><hr/><a class='bbcode' href='http://dl3jin.de/sputnik1_tx.htm' rel='external' ><span style='color:#0000ff'><strong class='bbcode bold'>Zdroj</strong></span></a></div>]]></content:encoded>
<category domain='http://mcu.cz/news.php?cat.7'>Vyloveno ze Sítě</category>
<dc:creator>Kosta</dc:creator>
<pubDate>Wed, 16 May 2012 00:00:00 +0200</pubDate>
<guid isPermaLink="true">http://mcu.cz/news.php?item.3052.7</guid>
</item>

<item>
<title>Rychlost GPIO toggle</title>
<link>http://mcu.cz/news.php?item.3089.2</link>
<description><![CDATA[<img src='http://mcu.cz/images/newspost_images/logo/arm.png' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/><a class='bbcode' href='http://www.st.com' rel='external' ><img src='http://mcu.cz/images/newspost_images/logo/st.jpg' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/></a>Kolega s nickem <a class='bbcode' href='http://mcu.cz/plugins/pm/pm.php?send.326' rel='external' >cancel</a> věnoval svůj čas a péči tomu, aby ověřil jak se projevuje na rychlosti změn výstupní hodnoty GPIO pinu použití knihovních funkcí a přímý přístup do SFR registru, otextovaný v praxi na STM32F4 Discovery kitu. Myslím že rozdíl bude pro mnoho lidí zajímavý, zejména pro ty, kteří chtějí využít hlavně vysoké taktovací frekvence jádra tohoto mcu.<br /><br /><strong class='bbcode bold'>Popis</strong><br /><br />Pozn Mard: text píšu já, na základě obdržených informací a podkladů, tedy překlepy jsou na moje triko.<br /><br />Použití knihovních funkcí z Peripherial Library při změně výstupní hodnoty GPIO pinu znamená, že procesor musí provádět krok za krokem všechny příkazy v knihovní funkci a dále ztrácí čas na volání podprogramů a při návratu z nich. Což je jistě pomalejší než přímý přístup k SFR registru. Bohužel přesná hodnota pojmu "jistě pomalejší" nikomu zatím nestála za určení. Nejlepší teorií je praxe a proto kolega cancel sestavil následující testovací prográmek.<br /><br /><div class='code_highlight code-box' style='unicode-bidi: embed; direction: ltr'><div class="c" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">GPIO_SetBits<span style="color: #66cc66;">&#40;</span>GPIOD, GPIO_Pin_15<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">GPIO_ResetBits<span style="color: #66cc66;">&#40;</span>GPIOD, GPIO_Pin_15<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">GPIOD-&gt;BSRRL=GPIO_Pin_15; <span style="color: #808080; font-style: italic;">//set</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">GPIOD-&gt;BSRRH=GPIO_Pin_15; <span style="color: #808080; font-style: italic;">//reset</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li></ol></div></div><br /><br />Program vygeneruje kladný pulz pomocí knihovních funkcí a pak kladný pulz pomocí přímého přístupu. Z rozdílu délek je možné určit dobu, kterou mcu stráví řešením knihovní funkce. No a nyní už zbývá jen program přeložit a otestovat výstup PD15 osciloskopem. Průběh vidíte na následujícím obrázku.<br /><br /><div style='text-align:center'><img src='http://mcu.cz/images/newspost_images/30/89/oscilo.jpg' class='bbcode' alt=''  /></div><br /><br /><br />Pokud tedy odhadneme délku kladného pulzu vpravo na 5 ns a levého, delšího, na 50 ns, tak je jasné že při změně hodnoty na pinu prostřednictvím volání periferní knihovny "ztratíme" cca 45 ns zpracováním volání a obsluhy funkce.<br /><br /><br /><strong class='bbcode bold'>Závěr</strong><br /><br />Doba, kterou zabere práce se změnou výstupní hodnoty GPIO pinu pomocí knihovní funkce je cca 10 krát delší než přímý přístup o SFR registru. Za pohodlnost kterou přináší knihovní funkce je tedy potřeba zaplatit tuto daň. Kdo potřebuje rychlejší změny výstupní hodnoty, tak se bez přímého přístupu k SFR registrům neobejde.<br /><br /><br />]]></description>
<content:encoded><![CDATA[<img src='http://mcu.cz/images/newspost_images/logo/arm.png' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/><a class='bbcode' href='http://www.st.com' rel='external' ><img src='http://mcu.cz/images/newspost_images/logo/st.jpg' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/></a>Kolega s nickem <a class='bbcode' href='http://mcu.cz/plugins/pm/pm.php?send.326' rel='external' >cancel</a> věnoval svůj čas a péči tomu, aby ověřil jak se projevuje na rychlosti změn výstupní hodnoty GPIO pinu použití knihovních funkcí a přímý přístup do SFR registru, otextovaný v praxi na STM32F4 Discovery kitu. Myslím že rozdíl bude pro mnoho lidí zajímavý, zejména pro ty, kteří chtějí využít hlavně vysoké taktovací frekvence jádra tohoto mcu.<br /><br /><strong class='bbcode bold'>Popis</strong><br /><br />Pozn Mard: text píšu já, na základě obdržených informací a podkladů, tedy překlepy jsou na moje triko.<br /><br />Použití knihovních funkcí z Peripherial Library při změně výstupní hodnoty GPIO pinu znamená, že procesor musí provádět krok za krokem všechny příkazy v knihovní funkci a dále ztrácí čas na volání podprogramů a při návratu z nich. Což je jistě pomalejší než přímý přístup k SFR registru. Bohužel přesná hodnota pojmu "jistě pomalejší" nikomu zatím nestála za určení. Nejlepší teorií je praxe a proto kolega cancel sestavil následující testovací prográmek.<br /><br /><div class='code_highlight code-box' style='unicode-bidi: embed; direction: ltr'><div class="c" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">GPIO_SetBits<span style="color: #66cc66;">&#40;</span>GPIOD, GPIO_Pin_15<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">GPIO_ResetBits<span style="color: #66cc66;">&#40;</span>GPIOD, GPIO_Pin_15<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">GPIOD-&gt;BSRRL=GPIO_Pin_15; <span style="color: #808080; font-style: italic;">//set</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">GPIOD-&gt;BSRRH=GPIO_Pin_15; <span style="color: #808080; font-style: italic;">//reset</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li></ol></div></div><br /><br />Program vygeneruje kladný pulz pomocí knihovních funkcí a pak kladný pulz pomocí přímého přístupu. Z rozdílu délek je možné určit dobu, kterou mcu stráví řešením knihovní funkce. No a nyní už zbývá jen program přeložit a otestovat výstup PD15 osciloskopem. Průběh vidíte na následujícím obrázku.<br /><br /><div style='text-align:center'><img src='http://mcu.cz/images/newspost_images/30/89/oscilo.jpg' class='bbcode' alt=''  /></div><br /><br /><br />Pokud tedy odhadneme délku kladného pulzu vpravo na 5 ns a levého, delšího, na 50 ns, tak je jasné že při změně hodnoty na pinu prostřednictvím volání periferní knihovny "ztratíme" cca 45 ns zpracováním volání a obsluhy funkce.<br /><br /><br /><strong class='bbcode bold'>Závěr</strong><br /><br />Doba, kterou zabere práce se změnou výstupní hodnoty GPIO pinu pomocí knihovní funkce je cca 10 krát delší než přímý přístup o SFR registru. Za pohodlnost kterou přináší knihovní funkce je tedy potřeba zaplatit tuto daň. Kdo potřebuje rychlejší změny výstupní hodnoty, tak se bez přímého přístupu k SFR registrům neobejde.<br /><br /><br />]]></content:encoded>
<category domain='http://mcu.cz/news.php?cat.2'>Konstrukce</category>
<dc:creator>mard</dc:creator>
<pubDate>Tue, 15 May 2012 03:04:47 +0200</pubDate>
<guid isPermaLink="true">http://mcu.cz/news.php?item.3089.2</guid>
</item>

<item>
<title>Kvartet ala PIC</title>
<link>http://mcu.cz/news.php?item.3047.3</link>
<description><![CDATA[<img src='../images/newspost_images/logo/osa.png' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/>Popravdě, tato hračka mě šokovala. PIC16F628, která dokáže nahradit kvartet - BASS, VIOLIN, GUITAR1, GUITAR2. A to jakože fakt pěkně.<br />Jednotlivé nástroje je možné samostatně zapnout/vypnout. Je to opět krásný příklad aplikace v RTOSu.<br /><div style='text-align:center'><img src='../images/newspost_images/30/47/quartet.jpg' style="width:600px; border: 2px solid black; margin: 5px;"'/></div><br /><div style='text-align:right'><hr/><a class='bbcode' href='http://www.pic24.ru/doku.php/en/osa/ref/appendix/quartet' rel='external' ><span style='color:#0000ff'><strong class='bbcode bold'>Zdroj</strong></span></a>  </div>]]></description>
<content:encoded><![CDATA[<img src='../images/newspost_images/logo/osa.png' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/>Popravdě, tato hračka mě šokovala. PIC16F628, která dokáže nahradit kvartet - BASS, VIOLIN, GUITAR1, GUITAR2. A to jakože fakt pěkně.<br />Jednotlivé nástroje je možné samostatně zapnout/vypnout. Je to opět krásný příklad aplikace v RTOSu.<br /><div style='text-align:center'><img src='../images/newspost_images/30/47/quartet.jpg' style="width:600px; border: 2px solid black; margin: 5px;"'/></div><br /><div style='text-align:right'><hr/><a class='bbcode' href='http://www.pic24.ru/doku.php/en/osa/ref/appendix/quartet' rel='external' ><span style='color:#0000ff'><strong class='bbcode bold'>Zdroj</strong></span></a>  </div>]]></content:encoded>
<category domain='http://mcu.cz/news.php?cat.3'>Mikroprocesory</category>
<dc:creator>Kosta</dc:creator>
<pubDate>Tue, 15 May 2012 00:00:00 +0200</pubDate>
<guid isPermaLink="true">http://mcu.cz/news.php?item.3047.3</guid>
</item>

<item>
<title>LibOpenCM3 4.</title>
<link>http://mcu.cz/news.php?item.3104.3</link>
<description><![CDATA[<img src='http://mcu.cz/images/newspost_images/logo/arm.png' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/><a class='bbcode' href='http://www.st.com' rel='external' ><img src='http://mcu.cz/images/newspost_images/logo/st.jpg' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/></a>Seriál zaměřený na využití knihovny LibOpenCM3 od kolegy FaBo pokračuje dalším dílem, zaměřeným na komunikaci po 1-Wire sběrnici. Myslím že text může být dobrou inspirací pro všechny, kteří mají zájem komunikovat s Dallas teplotními senzory nebo třeba identifikačními buttony (případně jinými zařízeními s 1wire sběrnicí). <br /><br /><br /><strong class='bbcode bold'>Popis</strong><br /><br />Posielam nie celkom originalny prispevok k obsluhe zbernice 1-Wire.<br />Su v nom pouzite casti kodu od Maxim-Dallas, AN187, "1-Wire Search<br />Algorithm" (v prilohe), nie je tam sice uvedeny ziadny copyright ale ani<br />tam nie je napisane, ze je kod volne pouzitelny. <br />Pozn Mard: doufám že Maxim Dallas bude rád, že publikujeme článek zaměřený<br />na komunikaci s jeho obvody <img src='http://mcu.cz/images/emotes/default/smile.png' alt='' style='vertical-align:middle; border:0' /> <br /><br /><br />K textu su nasledujuce subory:<br />lib_1wire.h<br />lib_1wire.c - zakladna obsluha zbernice 1-wire, vseobecna cast a<br />implementacia specifickych aktivit implementovanych pre STM32 pomocou<br />libopencm3. Doplnene su funkcie pre riadenie stavu zbernice, mod strong<br />pre napajanie zariadeni v parasite power (meni sa nastavenie funkcie<br />pinu portu procesora). <br /><br />demo_1w.c - komunikacia s teplomermi ds1820, osklbany fragment kodu bez<br />nepodstatnych veci (UART, casovace atd ...)<br /><br /><br /><strong class='bbcode bold'>Poznamky k pouzitiu 1-Wire na STM32 </strong><br /><br />1. Zbernicu treba pripojit odporom 2K2...4k7 k napajaciemu napatiu 3.3V<br /><br />2. Zbernica je privedena priamo na procesor, co obmedzuje jej pouzitie<br />na lokalne vyuzitie v ramci zariadenia (teplota nejakeho chladica,<br />nasavaneho vzduchu ventilatorom, identifikacne cislo zariadenia/pcb<br />atd.), ale aj pri lokalnom pouziti je vhodne pin procesora chranit, vid.<br />napr. prilozeny obrazok. Transil nie je vhodny z dovodu jeho velkej<br />kapacity, treba pouzit schottkyho diody alebo niektory zo specializovanych<br />ochrannych obvodov.<br /><br /><div style='text-align:center'><img src='http://mcu.cz/images/newspost_images/31/04/owport_white.png' class='bbcode' alt=''  /></div><br /><br />Pri priamom pripojeni zbernice k procesoru dokaze na zbernici (skruteny<br />par, cca Z=110 Ohm) pracovat cca 35 zariadeni do vzdialenosti par metrov<br />(vyskusane).<br /><br />3. Pokial je treba pouzit zbernicu 1-wire v exterieri, je potrebne<br />pouzit niektory z budicov od Maximu, zvladnut sa da dlzka zbernice do<br />cca 100m. Zbernica musi byt tvorena skrutenym parom a dosledne<br />galvanicky oddelena od okolia.<br /><br />4. Pre velmi velke vzdialenosti cca 500m (overene az do 650m v<br />priemyselnom prostredi + 64 senzorov) je potrebne poskladat uz specialny<br />(galvanicky oddeleny 4kV) booster a obsluha zbernice je uz relativne<br />komplikovana (kontrola oneskorenia, urovne odrazov, impedancne<br />prisposobenie, interaktivne nastavenie komparacnych casov a urovni atd.)<br />a dosledne dbat na topologiu siete a impedanciu vedenia. <br /><br />S pozdravom<br />Peter Fabo<br /><br /><br />Zdrojový kód demo_1w.c: <input class='button' type='button' value='Show' onClick="if (this.value=='Show') {this.value='Hide'; document.getElementById('670632993').style.display='';} else {this.value='Show'; document.getElementById('670632993').style.display='none';}"><br><div class='indent'><div id='670632993' style='display: none'><div class='code_highlight code-box' style='unicode-bidi: embed; direction: ltr'><div class="c" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/* demo_1wire.c</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* Ukazka pouzitia kniznice pre obsluhu zbernice 1-wire.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* Fragment programu, obsahuje len podstatne casti pre demonstraciu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* funkcnosti zbernice 1-wire.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;*/</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#include &lt;libopencm3/stm32/f1/rcc.h&gt;#include &lt;libopencm3/stm32/f1/gpio.h&gt;#include &quot;lib_1wire.h&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Konfiguracia systemu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Nastavnie portu pre 1-wire je vo funkcii owSetup() </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp;Inicializacia hodinovych signalov pre periferie</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> clock_setup<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; rcc_clock_setup_in_hse_8mhz_out_24mhz<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/* Enable GPIOA clock. */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; rcc_peripheral_enable_clock<span style="color: #66cc66;">&#40;</span>&RCC_APB2ENR, RCC_APB2ENR_IOPAEN<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ... hodiny pre dalsie periferie ...</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Funkcia casoveho oneskorenia - moze byt implementovana pomocou casovaca</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// alebo casovej slucky v programe </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> delay_us<span style="color: #66cc66;">&#40;</span>u16 time<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ...</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Fragment main funkcie pre pracu s 1-Wire zbernicou </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 i=<span style="color: #cc66cc;">0</span>;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// vseobecne pocitadlo</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 state=0x00;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// stav zbernice</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 data=0x00;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// aktualne nacitane data</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">extern</span> u8 ROM_NO<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#93;</span>;<span style="color: #808080; font-style: italic;">// ID buffer kniznice lib_1wire</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">int</span> main<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; clock_setup<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; owInit<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// inicializacia a reset zbernice 1-wire</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Nacitanie ID vsetkych zariadeni zbernice</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; state=owFirst<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>state!=<span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ID prveho zariadenia je v buffri ROM_NO</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ... spracovanie ID &nbsp;...</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">do</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; state=owNext<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>state==<span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #000000; font-weight: bold;">break</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ID nasledujuceho zariadenia je v buffri ROM_NO</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ... spracovanie ID &nbsp;...</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span>state<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Predpokladajme ze na zbernici mame pripojene len zariadenia </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// DS18x20 (teplomer typ B,S), spustime prevod teploty a nacitame data</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// posledneho senzoru zo zoznamu (ID zostalo v ROM_NO)</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; owReset<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; owVerify<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// aktualizacia ID</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; owWriteStrong<span style="color: #66cc66;">&#40;</span>0x44<span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// spustenie prevodu, napajanie obvodu </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span>i=<span style="color: #cc66cc;">0</span>; i&lt;<span style="color: #cc66cc;">75</span>; i++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 750 usec delay </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; delay_us<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10000</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; owSetResistive<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// zbernica do standardneho modu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; owReset<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// nacitanie dat zo senzoru po byte</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; owVerify<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; owWriteByte<span style="color: #66cc66;">&#40;</span>0xBE<span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// citanie scratch pamete senzora</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span>i=<span style="color: #cc66cc;">0</span>; i&lt;<span style="color: #cc66cc;">9</span>; i++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// pamet ma 9 byte</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data=owReadByte<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// aktualny byte je v premennej data</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ... spracovanie dat</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ...</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Koniec zdrojoveho textu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li></ol></div></div></div></div><br /><br /><br /><br /><br />Zdrojový kód lib_1wire.c: <input class='button' type='button' value='Show' onClick="if (this.value=='Show') {this.value='Hide'; document.getElementById('1944077161').style.display='';} else {this.value='Show'; document.getElementById('1944077161').style.display='none';}"><br><div class='indent'><div id='1944077161' style='display: none'><div class='code_highlight code-box' style='unicode-bidi: embed; direction: ltr'><div class="c" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/* lib_1wire.c</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* Implementacia funkcii pre 1-Wire zbernicu.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* ToDo: </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* 1. Funkcie high-level API su prebrate z AN187 a nie su optimalizovane </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* &nbsp; &nbsp;pre gcc kompilator ARM.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;*/</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Include &amp; define</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#include &lt;libopencm3/stm32/f1/gpio.h&gt;#include &quot;lib_1wire.h&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Lokalne premenne</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 &nbsp;ROM_NO<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#93;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// lokalny buffer pre ID zariadenia</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 &nbsp;crc8;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// globalna hodnota CRC</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">int</span> LastDiscrepancy;&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// priznak konfliktu na zbernici pri vyhladavani ID</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">int</span> LastFamilyDiscrepancy;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">int</span> LastDeviceFlag;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">static</span> u8 dscrc_table<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">94</span>,<span style="color: #cc66cc;">188</span>,<span style="color: #cc66cc;">226</span>, <span style="color: #cc66cc;">97</span>, <span style="color: #cc66cc;">63</span>,<span style="color: #cc66cc;">221</span>,<span style="color: #cc66cc;">131</span>,<span style="color: #cc66cc;">194</span>,<span style="color: #cc66cc;">156</span>,<span style="color: #cc66cc;">126</span>, <span style="color: #cc66cc;">32</span>,<span style="color: #cc66cc;">163</span>,<span style="color: #cc66cc;">253</span>, <span style="color: #cc66cc;">31</span>, <span style="color: #cc66cc;">65</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #cc66cc;">157</span>,<span style="color: #cc66cc;">195</span>, <span style="color: #cc66cc;">33</span>,<span style="color: #cc66cc;">127</span>,<span style="color: #cc66cc;">252</span>,<span style="color: #cc66cc;">162</span>, <span style="color: #cc66cc;">64</span>, <span style="color: #cc66cc;">30</span>, <span style="color: #cc66cc;">95</span>, &nbsp;<span style="color: #cc66cc;">1</span>,<span style="color: #cc66cc;">227</span>,<span style="color: #cc66cc;">189</span>, <span style="color: #cc66cc;">62</span>, <span style="color: #cc66cc;">96</span>,<span style="color: #cc66cc;">130</span>,<span style="color: #cc66cc;">220</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #cc66cc;">35</span>,<span style="color: #cc66cc;">125</span>,<span style="color: #cc66cc;">159</span>,<span style="color: #cc66cc;">193</span>, <span style="color: #cc66cc;">66</span>, <span style="color: #cc66cc;">28</span>,<span style="color: #cc66cc;">254</span>,<span style="color: #cc66cc;">160</span>,<span style="color: #cc66cc;">225</span>,<span style="color: #cc66cc;">191</span>, <span style="color: #cc66cc;">93</span>, &nbsp;<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">128</span>,<span style="color: #cc66cc;">222</span>, <span style="color: #cc66cc;">60</span>, <span style="color: #cc66cc;">98</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #cc66cc;">190</span>,<span style="color: #cc66cc;">224</span>, &nbsp;<span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">92</span>,<span style="color: #cc66cc;">223</span>,<span style="color: #cc66cc;">129</span>, <span style="color: #cc66cc;">99</span>, <span style="color: #cc66cc;">61</span>,<span style="color: #cc66cc;">124</span>, <span style="color: #cc66cc;">34</span>,<span style="color: #cc66cc;">192</span>,<span style="color: #cc66cc;">158</span>, <span style="color: #cc66cc;">29</span>, <span style="color: #cc66cc;">67</span>,<span style="color: #cc66cc;">161</span>,<span style="color: #cc66cc;">255</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #cc66cc;">70</span>, <span style="color: #cc66cc;">24</span>,<span style="color: #cc66cc;">250</span>,<span style="color: #cc66cc;">164</span>, <span style="color: #cc66cc;">39</span>,<span style="color: #cc66cc;">121</span>,<span style="color: #cc66cc;">155</span>,<span style="color: #cc66cc;">197</span>,<span style="color: #cc66cc;">132</span>,<span style="color: #cc66cc;">218</span>, <span style="color: #cc66cc;">56</span>,<span style="color: #cc66cc;">102</span>,<span style="color: #cc66cc;">229</span>,<span style="color: #cc66cc;">187</span>, <span style="color: #cc66cc;">89</span>, &nbsp;<span style="color: #cc66cc;">7</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #cc66cc;">219</span>,<span style="color: #cc66cc;">133</span>,<span style="color: #cc66cc;">103</span>, <span style="color: #cc66cc;">57</span>,<span style="color: #cc66cc;">186</span>,<span style="color: #cc66cc;">228</span>, &nbsp;<span style="color: #cc66cc;">6</span>, <span style="color: #cc66cc;">88</span>, <span style="color: #cc66cc;">25</span>, <span style="color: #cc66cc;">71</span>,<span style="color: #cc66cc;">165</span>,<span style="color: #cc66cc;">251</span>,<span style="color: #cc66cc;">120</span>, <span style="color: #cc66cc;">38</span>,<span style="color: #cc66cc;">196</span>,<span style="color: #cc66cc;">154</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #cc66cc;">101</span>, <span style="color: #cc66cc;">59</span>,<span style="color: #cc66cc;">217</span>,<span style="color: #cc66cc;">135</span>, &nbsp;<span style="color: #cc66cc;">4</span>, <span style="color: #cc66cc;">90</span>,<span style="color: #cc66cc;">184</span>,<span style="color: #cc66cc;">230</span>,<span style="color: #cc66cc;">167</span>,<span style="color: #cc66cc;">249</span>, <span style="color: #cc66cc;">27</span>, <span style="color: #cc66cc;">69</span>,<span style="color: #cc66cc;">198</span>,<span style="color: #cc66cc;">152</span>,<span style="color: #cc66cc;">122</span>, <span style="color: #cc66cc;">36</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #cc66cc;">248</span>,<span style="color: #cc66cc;">166</span>, <span style="color: #cc66cc;">68</span>, <span style="color: #cc66cc;">26</span>,<span style="color: #cc66cc;">153</span>,<span style="color: #cc66cc;">199</span>, <span style="color: #cc66cc;">37</span>,<span style="color: #cc66cc;">123</span>, <span style="color: #cc66cc;">58</span>,<span style="color: #cc66cc;">100</span>,<span style="color: #cc66cc;">134</span>,<span style="color: #cc66cc;">216</span>, <span style="color: #cc66cc;">91</span>, &nbsp;<span style="color: #cc66cc;">5</span>,<span style="color: #cc66cc;">231</span>,<span style="color: #cc66cc;">185</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #cc66cc;">140</span>,<span style="color: #cc66cc;">210</span>, <span style="color: #cc66cc;">48</span>,<span style="color: #cc66cc;">110</span>,<span style="color: #cc66cc;">237</span>,<span style="color: #cc66cc;">179</span>, <span style="color: #cc66cc;">81</span>, <span style="color: #cc66cc;">15</span>, <span style="color: #cc66cc;">78</span>, <span style="color: #cc66cc;">16</span>,<span style="color: #cc66cc;">242</span>,<span style="color: #cc66cc;">172</span>, <span style="color: #cc66cc;">47</span>,<span style="color: #cc66cc;">113</span>,<span style="color: #cc66cc;">147</span>,<span style="color: #cc66cc;">205</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #cc66cc;">17</span>, <span style="color: #cc66cc;">79</span>,<span style="color: #cc66cc;">173</span>,<span style="color: #cc66cc;">243</span>,<span style="color: #cc66cc;">112</span>, <span style="color: #cc66cc;">46</span>,<span style="color: #cc66cc;">204</span>,<span style="color: #cc66cc;">146</span>,<span style="color: #cc66cc;">211</span>,<span style="color: #cc66cc;">141</span>,<span style="color: #cc66cc;">111</span>, <span style="color: #cc66cc;">49</span>,<span style="color: #cc66cc;">178</span>,<span style="color: #cc66cc;">236</span>, <span style="color: #cc66cc;">14</span>, <span style="color: #cc66cc;">80</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #cc66cc;">175</span>,<span style="color: #cc66cc;">241</span>, <span style="color: #cc66cc;">19</span>, <span style="color: #cc66cc;">77</span>,<span style="color: #cc66cc;">206</span>,<span style="color: #cc66cc;">144</span>,<span style="color: #cc66cc;">114</span>, <span style="color: #cc66cc;">44</span>,<span style="color: #cc66cc;">109</span>, <span style="color: #cc66cc;">51</span>,<span style="color: #cc66cc;">209</span>,<span style="color: #cc66cc;">143</span>, <span style="color: #cc66cc;">12</span>, <span style="color: #cc66cc;">82</span>,<span style="color: #cc66cc;">176</span>,<span style="color: #cc66cc;">238</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #cc66cc;">50</span>,<span style="color: #cc66cc;">108</span>,<span style="color: #cc66cc;">142</span>,<span style="color: #cc66cc;">208</span>, <span style="color: #cc66cc;">83</span>, <span style="color: #cc66cc;">13</span>,<span style="color: #cc66cc;">239</span>,<span style="color: #cc66cc;">177</span>,<span style="color: #cc66cc;">240</span>,<span style="color: #cc66cc;">174</span>, <span style="color: #cc66cc;">76</span>, <span style="color: #cc66cc;">18</span>,<span style="color: #cc66cc;">145</span>,<span style="color: #cc66cc;">207</span>, <span style="color: #cc66cc;">45</span>,<span style="color: #cc66cc;">115</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #cc66cc;">202</span>,<span style="color: #cc66cc;">148</span>,<span style="color: #cc66cc;">118</span>, <span style="color: #cc66cc;">40</span>,<span style="color: #cc66cc;">171</span>,<span style="color: #cc66cc;">245</span>, <span style="color: #cc66cc;">23</span>, <span style="color: #cc66cc;">73</span>, &nbsp;<span style="color: #cc66cc;">8</span>, <span style="color: #cc66cc;">86</span>,<span style="color: #cc66cc;">180</span>,<span style="color: #cc66cc;">234</span>,<span style="color: #cc66cc;">105</span>, <span style="color: #cc66cc;">55</span>,<span style="color: #cc66cc;">213</span>,<span style="color: #cc66cc;">139</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #cc66cc;">87</span>, &nbsp;<span style="color: #cc66cc;">9</span>,<span style="color: #cc66cc;">235</span>,<span style="color: #cc66cc;">181</span>, <span style="color: #cc66cc;">54</span>,<span style="color: #cc66cc;">104</span>,<span style="color: #cc66cc;">138</span>,<span style="color: #cc66cc;">212</span>,<span style="color: #cc66cc;">149</span>,<span style="color: #cc66cc;">203</span>, <span style="color: #cc66cc;">41</span>,<span style="color: #cc66cc;">119</span>,<span style="color: #cc66cc;">244</span>,<span style="color: #cc66cc;">170</span>, <span style="color: #cc66cc;">72</span>, <span style="color: #cc66cc;">22</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #cc66cc;">233</span>,<span style="color: #cc66cc;">183</span>, <span style="color: #cc66cc;">85</span>, <span style="color: #cc66cc;">11</span>,<span style="color: #cc66cc;">136</span>,<span style="color: #cc66cc;">214</span>, <span style="color: #cc66cc;">52</span>,<span style="color: #cc66cc;">106</span>, <span style="color: #cc66cc;">43</span>,<span style="color: #cc66cc;">117</span>,<span style="color: #cc66cc;">151</span>,<span style="color: #cc66cc;">201</span>, <span style="color: #cc66cc;">74</span>, <span style="color: #cc66cc;">20</span>,<span style="color: #cc66cc;">246</span>,<span style="color: #cc66cc;">168</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #cc66cc;">116</span>, <span style="color: #cc66cc;">42</span>,<span style="color: #cc66cc;">200</span>,<span style="color: #cc66cc;">150</span>, <span style="color: #cc66cc;">21</span>, <span style="color: #cc66cc;">75</span>,<span style="color: #cc66cc;">169</span>,<span style="color: #cc66cc;">247</span>,<span style="color: #cc66cc;">182</span>,<span style="color: #cc66cc;">232</span>, <span style="color: #cc66cc;">10</span>, <span style="color: #cc66cc;">84</span>,<span style="color: #cc66cc;">215</span>,<span style="color: #cc66cc;">137</span>,<span style="color: #cc66cc;">107</span>, <span style="color: #cc66cc;">53</span><span style="color: #66cc66;">&#125;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Implementacia high-level funkcii podla Maxim, AN187</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; Inicializacia portu zbernice 1-wire</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval: none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owInit<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Nastavenie 1-wire zbernice do resistive modu. Predpoklada pripojenie</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// zdroja hodin k periferii.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; gpio_set_mode<span style="color: #66cc66;">&#40;</span>OW_PORT, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_OPENDRAIN, OW_TERM<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; gpio_set<span style="color: #66cc66;">&#40;</span>OW_PORT, OW_TERM<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; delay_us<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10000</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 10 msec delay na ustalenie stavu zbernice</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; owReset<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Find the 'first' devices on the 1-Wire bus</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : TRUE &nbsp;- device found, ROM number in ROM_NO buffer</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FALSE - no device present</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 owFirst<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// reset the search state</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;LastDiscrepancy = <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;LastDeviceFlag = <span style="color: #000000; font-weight: bold;">FALSE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;LastFamilyDiscrepancy = <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">return</span> owSearch<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Find the 'next' devices on the 1-Wire bus</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : TRUE &nbsp;- device found, ROM number in ROM_NO buffer</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FALSE : device not found, end of search</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 owNext<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">return</span> owSearch<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Perform the 1-Wire Search Algorithm on the 1-Wire bus </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; using the existing search state.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : TRUE &nbsp;- device found, ROM number in ROM_NO buffer</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FALSE : device not found, end of search</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 owSearch<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #993333;">int</span> id_bit_number;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #993333;">int</span> last_zero, rom_byte_number, search_result;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #993333;">int</span> id_bit, cmp_id_bit;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #993333;">unsigned</span> <span style="color: #993333;">char</span> rom_byte_mask, search_direction;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// initialize for search</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;id_bit_number = <span style="color: #cc66cc;">1</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;last_zero = <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;rom_byte_number = <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;rom_byte_mask = <span style="color: #cc66cc;">1</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;search_result = <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;crc8 = <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// if the last call was not the last one</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>!LastDeviceFlag<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 1-Wire reset</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>!owReset<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// reset the search</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LastDiscrepancy = <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LastDeviceFlag = <span style="color: #000000; font-weight: bold;">FALSE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LastFamilyDiscrepancy = <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">FALSE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// issue the search command </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; owWriteByte<span style="color: #66cc66;">&#40;</span>0xF0<span style="color: #66cc66;">&#41;</span>; &nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// loop to do the search</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">do</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// read a bit and its complement</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;id_bit = owReadBit<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cmp_id_bit = owReadBit<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// check for no devices on 1-wire</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>id_bit == <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> && <span style="color: #66cc66;">&#40;</span>cmp_id_bit == <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">break</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">else</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// all devices coupled have 0 or 1</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>id_bit != cmp_id_bit<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;search_direction = id_bit; &nbsp;<span style="color: #808080; font-style: italic;">// bit write value for search</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// if this discrepancy if before the Last Discrepancy</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// on a previous next then pick the same as last time</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>id_bit_number &lt; LastDiscrepancy<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; search_direction = <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>ROM_NO<span style="color: #66cc66;">&#91;</span>rom_byte_number<span style="color: #66cc66;">&#93;</span> &amp; rom_byte_mask<span style="color: #66cc66;">&#41;</span> &gt; <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">else</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// if equal to last pick 1, if not then pick 0</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; search_direction = <span style="color: #66cc66;">&#40;</span>id_bit_number == LastDiscrepancy<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// if 0 was picked then record its position in LastZero</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>search_direction == <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last_zero = id_bit_number;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// check for Last discrepancy in family</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>last_zero &lt; <span style="color: #cc66cc;">9</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LastFamilyDiscrepancy = last_zero;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// set or clear the bit in the ROM byte rom_byte_number</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// with mask rom_byte_mask</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>search_direction == <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ROM_NO<span style="color: #66cc66;">&#91;</span>rom_byte_number<span style="color: #66cc66;">&#93;</span> |= rom_byte_mask;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ROM_NO<span style="color: #66cc66;">&#91;</span>rom_byte_number<span style="color: #66cc66;">&#93;</span> &= ~rom_byte_mask;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// serial number search direction write bit</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; owWriteBit<span style="color: #66cc66;">&#40;</span>search_direction<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// increment the byte counter id_bit_number</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// and shift the mask rom_byte_mask</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; id_bit_number++;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rom_byte_mask &lt;&lt;= <span style="color: #cc66cc;">1</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// if the mask is 0 then go to new SerialNum byte rom_byte_number and reset mask</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>rom_byte_mask == <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; owCrc8<span style="color: #66cc66;">&#40;</span>ROM_NO<span style="color: #66cc66;">&#91;</span>rom_byte_number<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>; &nbsp;<span style="color: #808080; font-style: italic;">// accumulate the CRC</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rom_byte_number++;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rom_byte_mask = <span style="color: #cc66cc;">1</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span>rom_byte_number &lt; <span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#41;</span>; &nbsp;<span style="color: #808080; font-style: italic;">// loop until through all ROM bytes 0-7</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// if the search was successful then</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>!<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>id_bit_number &lt; <span style="color: #cc66cc;">65</span><span style="color: #66cc66;">&#41;</span> || <span style="color: #66cc66;">&#40;</span>crc8 != <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// search successful so set LastDiscrepancy,LastDeviceFlag,search_result</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LastDiscrepancy = last_zero;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// check for last device</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>LastDiscrepancy == <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LastDeviceFlag = <span style="color: #000000; font-weight: bold;">TRUE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;search_result = <span style="color: #000000; font-weight: bold;">TRUE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// if no device found then reset counters so next 'search' will be like a first</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>!search_result || !ROM_NO<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; LastDiscrepancy = <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; LastDeviceFlag = <span style="color: #000000; font-weight: bold;">FALSE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; LastFamilyDiscrepancy = <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; search_result = <span style="color: #000000; font-weight: bold;">FALSE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">return</span> search_result;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Verify the device with the ROM number in ROM_NO buffer is present.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : TRUE &nbsp;: device verified present</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FALSE : device not present</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 owVerify<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #993333;">unsigned</span> <span style="color: #993333;">char</span> rom_backup<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#93;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #993333;">int</span> i,rslt,ld_backup,ldf_backup,lfd_backup;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// keep a backup copy of the current state</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>i = <span style="color: #cc66cc;">0</span>; i &lt; <span style="color: #cc66cc;">8</span>; i++<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; rom_backup<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> = ROM_NO<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;ld_backup = LastDiscrepancy;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;ldf_backup = LastDeviceFlag;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;lfd_backup = LastFamilyDiscrepancy;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// set search to find the same device</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;LastDiscrepancy = <span style="color: #cc66cc;">64</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;LastDeviceFlag = <span style="color: #000000; font-weight: bold;">FALSE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>owSearch<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// check if same device found</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; rslt = <span style="color: #000000; font-weight: bold;">TRUE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>i = <span style="color: #cc66cc;">0</span>; i &lt; <span style="color: #cc66cc;">8</span>; i++<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>rom_backup<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> != ROM_NO<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rslt = <span style="color: #000000; font-weight: bold;">FALSE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">break</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">else</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;rslt = <span style="color: #000000; font-weight: bold;">FALSE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// restore the search state </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>i = <span style="color: #cc66cc;">0</span>; i &lt; <span style="color: #cc66cc;">8</span>; i++<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; ROM_NO<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> = rom_backup<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;LastDiscrepancy = ld_backup;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;LastDeviceFlag = ldf_backup;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;LastFamilyDiscrepancy = lfd_backup;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// return the result of the verify</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">return</span> rslt;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Setup the search to find the device type 'family_code' on the next call</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; to owNext() if it is present.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owTargetSetup<span style="color: #66cc66;">&#40;</span>u8 family_code<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;u8 i;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// set the search state to find SearchFamily type devices</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;ROM_NO<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span> = family_code;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>i = <span style="color: #cc66cc;">1</span>; i &lt; <span style="color: #cc66cc;">8</span>; i++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; ROM_NO<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> = <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;LastDiscrepancy = <span style="color: #cc66cc;">64</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;LastFamilyDiscrepancy = <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;LastDeviceFlag = <span style="color: #000000; font-weight: bold;">FALSE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Setup the search to skip the current device type on the next call</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; to owNext().</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owFamilySkipSetup<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// set the Last discrepancy to last family discrepancy</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;LastDiscrepancy = LastFamilyDiscrepancy;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;LastFamilyDiscrepancy = <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// check for end of list</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>LastDiscrepancy == <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; LastDeviceFlag = <span style="color: #000000; font-weight: bold;">TRUE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Setup new ROM number</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;array with new ROM number</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owSetRom<span style="color: #66cc66;">&#40;</span>u8 *array<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; u8 i=<span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span>i=<span style="color: #cc66cc;">0</span>; i&lt;<span style="color: #cc66cc;">8</span>; i++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ROM_NO<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>=array<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Calculate the CRC8 of the byte value provided with the </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; current global 'crc8' value.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;byte value</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : current global crc8 value</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 owCrc8<span style="color: #66cc66;">&#40;</span>u8 value<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;crc8 = dscrc_table<span style="color: #66cc66;">&#91;</span>crc8 ^ value<span style="color: #66cc66;">&#93;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">return</span> crc8;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//--------------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Implementacia low-level funkcii pre STM32</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//--------------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Reset 1-wire zbernice s detekciou pritomnosti zariadenia</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : TRUE &nbsp;- device present</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FALSE - no device present</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 owReset<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; u8 state=<span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; gpio_clear<span style="color: #66cc66;">&#40;</span>OW_PORT, OW_TERM<span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// master Tx reset pulse 480usec min.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; delay_us<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">480</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; gpio_set<span style="color: #66cc66;">&#40;</span>OW_PORT, OW_TERM<span style="color: #66cc66;">&#41;</span>; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; delay_us<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">80</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// wait 20usec + 60usec presence pulse</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; state = GPIO_IDR<span style="color: #66cc66;">&#40;</span>OW_PORT<span style="color: #66cc66;">&#41;</span>; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; delay_us<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">400</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// master Rx 80usec + 400usec minimum</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>state &amp; OW_TERM<span style="color: #66cc66;">&#41;</span>==OW_TERM<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span> </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">FALSE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span><span style="color: #66cc66;">&#123;</span> </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">TRUE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Vyslanie 8-bitov na zbernicu 1-wire</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;8-bit data</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owWriteByte<span style="color: #66cc66;">&#40;</span>u8 byte_value<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; u8 i=<span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span>i=<span style="color: #cc66cc;">0</span>; i&lt;<span style="color: #cc66cc;">8</span>; i++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// LSB first</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; owWriteBit<span style="color: #66cc66;">&#40;</span>byte_value&gt;&gt;i<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Vyslanie 1 bitu na zbernicu 1-wire</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;data, akceptovany je LSB</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owWriteBit<span style="color: #66cc66;">&#40;</span>u8 bit_value<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">switch</span><span style="color: #66cc66;">&#40;</span>bit_value &amp; 0x01<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> 0x00: </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gpio_clear<span style="color: #66cc66;">&#40;</span>OW_PORT, OW_TERM<span style="color: #66cc66;">&#41;</span>; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; delay_us<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">60</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gpio_set<span style="color: #66cc66;">&#40;</span>OW_PORT, OW_TERM<span style="color: #66cc66;">&#41;</span>; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">break</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> 0x01: </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gpio_clear<span style="color: #66cc66;">&#40;</span>OW_PORT, OW_TERM<span style="color: #66cc66;">&#41;</span>; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; delay_us<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gpio_set<span style="color: #66cc66;">&#40;</span>OW_PORT, OW_TERM<span style="color: #66cc66;">&#41;</span>; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; delay_us<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">55</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">break</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;delay_us<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Nacitanie 1 bitu zo zbernicu 1-wire</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : nacitana hodnota 0/1</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 owReadBit<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; u8 state=0x00;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; gpio_clear<span style="color: #66cc66;">&#40;</span>OW_PORT, OW_TERM<span style="color: #66cc66;">&#41;</span>; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; delay_us<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// doba citacieho pulzu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; gpio_set<span style="color: #66cc66;">&#40;</span>OW_PORT, OW_TERM<span style="color: #66cc66;">&#41;</span>; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; delay_us<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// oneskorenie pre ustalenie slave</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; state = GPIO_IDR<span style="color: #66cc66;">&#40;</span>OW_PORT<span style="color: #66cc66;">&#41;</span>; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; delay_us<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">50</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>state &amp; OW_TERM<span style="color: #66cc66;">&#41;</span>==OW_TERM<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">1</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Nacitanie 1 byte zo zbernicu 1-wire</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : nacitana hodnota 8-bit hodnota</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 owReadByte<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; u8 value=0x00;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; u8 i=<span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span>i=<span style="color: #cc66cc;">0</span>; i&lt;<span style="color: #cc66cc;">8</span>; i++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// LSB first</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value |= <span style="color: #66cc66;">&#40;</span>owReadBit<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>&lt;&lt;i<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> value;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Nastavenie zbernice do STRONG modu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owSetStrong<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; gpio_set_mode<span style="color: #66cc66;">&#40;</span>OW_PORT, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, OW_TERM<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Nastavenie zbernice do RESISTIVE modu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owSetResistive<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; gpio_set_mode<span style="color: #66cc66;">&#40;</span>OW_PORT, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_OPENDRAIN, OW_TERM<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Vyslanie 8-bitov na zbernicu 1-wire a nastavenie </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; zbernice do STRONG modu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;8-bit data</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owWriteStrong<span style="color: #66cc66;">&#40;</span>u8 byte_value<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; u8 i=<span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span>i=<span style="color: #cc66cc;">0</span>; i&lt;<span style="color: #cc66cc;">8</span>; i++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; owWriteBit<span style="color: #66cc66;">&#40;</span>byte_value&gt;&gt;i<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; gpio_set_mode<span style="color: #66cc66;">&#40;</span>OW_PORT, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, OW_TERM<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Koniec zdrojoveho textu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li></ol></div></div></div></div><br /><br /><br /><br />Zdrojový kód lib_1wire.h: <input class='button' type='button' value='Show' onClick="if (this.value=='Show') {this.value='Hide'; document.getElementById('1950919584').style.display='';} else {this.value='Show'; document.getElementById('1950919584').style.display='none';}"><br><div class='indent'><div id='1950919584' style='display: none'><div class='code_highlight code-box' style='unicode-bidi: embed; direction: ltr'><div class="c" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/* lib_1wire.h</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* Deklaracie funkcii pre rozhranie 1-Wire</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* Vseobecna obsluha rozhrania 1-wire je odvodena z dokumentu fy.Maxim</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* Application Note 187, 1-Wire Search Algorithm, Mar. 28, 2002.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* Port a pin portu, ktore budu pouzite pre zbernicu 1-wire je potrebne </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* deklarovat v substituciach OW_PORT a OW_TERM.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* Kniznica vyzaduje externu funkciu pre casovanie 'delay_us(u16 time)', </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* ktora musi mat rozlisenie casoveho intervalu 1usec, moze byt implementovana</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* lubovolnym sposobom (casovac, programova slucka).</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;*/</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Include &amp; define</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#ifndef LIB_1WIRE_H</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#define LIB_1WIRE_H</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#define OW_PORT&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; GPIOA&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; // deklaracia portu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#define OW_TERM&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; GPIO0&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; // deklaracia pinu portu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#define TRUE &nbsp;0x01</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#define FALSE 0x00</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">extern</span> <span style="color: #993333;">void</span> delay_us<span style="color: #66cc66;">&#40;</span>u16 time<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Vseobecna komunikacia s obvodmi zbernice</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owInit<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// konfiguracia portu pre 1-wire</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 &nbsp; owReset<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// reset zbernice a kontrola pritomnosti zariadeni</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 &nbsp; owFirst<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// nacitanie ID prveho zariadenia</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 &nbsp; owNext<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// iteracia zoznamu zariadeni</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 &nbsp; owVerify<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// kontrola existencia ID zariadenia</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owTargetSetup<span style="color: #66cc66;">&#40;</span>u8 fcode<span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// nastavenie podmnoziny vyhladavanych zariadeni</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owFamilySkipSetup<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// zrusenie selektivneho vyhladavania</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owSetRom<span style="color: #66cc66;">&#40;</span>u8 *array<span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// nastavenie ID konkretneho zariadenia</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Riadenie stavu zbernice </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owSetStrong<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span>;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// napajanie zariadenie v parazite power mode</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owSetResistive<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// pull-upp mod zbernice</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owWriteByte<span style="color: #66cc66;">&#40;</span>u8 value<span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// zapis byte na zbernicu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owWriteStrong<span style="color: #66cc66;">&#40;</span>u8 value<span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// zapis byte a prepnutie do strong modu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 &nbsp; owReadByte<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// nacitanie byte zo zbernice</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Neverejne funkcie low-level</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 &nbsp; owSearch<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// interny vyhladavaci algoritmus</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owWriteBit<span style="color: #66cc66;">&#40;</span>u8 bit_value<span style="color: #66cc66;">&#41;</span>;&nbsp; <span style="color: #808080; font-style: italic;">// zapis jedneho bite</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 &nbsp; owReadBit<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// nacitanie bite</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 &nbsp; owCrc8<span style="color: #66cc66;">&#40;</span>u8 value<span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// vypocet/kontrola CRC ID zariadenia</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#endif</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Koniec zdrojoveho textu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li></ol></div></div></div></div><br /><br /><br /><br /><br /><br /><br /><br /><strong class='bbcode bold'>Odkazy</strong><br /><br />LibOpenCM3 1. naleznete <a class='bbcode' href='http://mcu.cz/comment-n2943.html' rel='external' >zde</a>.<br />LibOpenCM3 2. naleznete <a class='bbcode' href='http://mcu.cz/comment-n2994.html' rel='external' >zde</a>. (LCD)<br />LibOpenCM3 3. naleznete <a class='bbcode' href='http://mcu.cz/comment-n3006.html' rel='external' >zde</a>. (A/D převodník)<br /><br />Wiki o knihovně LibOpenCM3 je <a class='bbcode' href='http://www.libopencm3.org/wiki/Main_Page' rel='external' >zde</a>.<br /><br />Knihovnu LibOpenCM3 si můžete stáhnout na sourceforge <a class='bbcode' href='http://sourceforge.net/projects/libopencm3/' rel='external' >zde</a>.<br /><br />Reference manuál k Value Line naleznete <a class='bbcode' href='http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/REFERENCE_MANUAL/CD00246267.pdf' rel='external' >zde</a>.<br /><br /><br />Autorem zdrojového kódu je <strong class='bbcode bold'>Peter Fabo</strong>. <span style='color:#ff0000'>Za zaslání děkujeme!</span>]]></description>
<content:encoded><![CDATA[<img src='http://mcu.cz/images/newspost_images/logo/arm.png' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/><a class='bbcode' href='http://www.st.com' rel='external' ><img src='http://mcu.cz/images/newspost_images/logo/st.jpg' style="align:right; width:100px; border: 2px solid black; float: right; margin-left: 5px;"'/></a>Seriál zaměřený na využití knihovny LibOpenCM3 od kolegy FaBo pokračuje dalším dílem, zaměřeným na komunikaci po 1-Wire sběrnici. Myslím že text může být dobrou inspirací pro všechny, kteří mají zájem komunikovat s Dallas teplotními senzory nebo třeba identifikačními buttony (případně jinými zařízeními s 1wire sběrnicí). <br /><br /><br /><strong class='bbcode bold'>Popis</strong><br /><br />Posielam nie celkom originalny prispevok k obsluhe zbernice 1-Wire.<br />Su v nom pouzite casti kodu od Maxim-Dallas, AN187, "1-Wire Search<br />Algorithm" (v prilohe), nie je tam sice uvedeny ziadny copyright ale ani<br />tam nie je napisane, ze je kod volne pouzitelny. <br />Pozn Mard: doufám že Maxim Dallas bude rád, že publikujeme článek zaměřený<br />na komunikaci s jeho obvody <img src='http://mcu.cz/images/emotes/default/smile.png' alt='' style='vertical-align:middle; border:0' /> <br /><br /><br />K textu su nasledujuce subory:<br />lib_1wire.h<br />lib_1wire.c - zakladna obsluha zbernice 1-wire, vseobecna cast a<br />implementacia specifickych aktivit implementovanych pre STM32 pomocou<br />libopencm3. Doplnene su funkcie pre riadenie stavu zbernice, mod strong<br />pre napajanie zariadeni v parasite power (meni sa nastavenie funkcie<br />pinu portu procesora). <br /><br />demo_1w.c - komunikacia s teplomermi ds1820, osklbany fragment kodu bez<br />nepodstatnych veci (UART, casovace atd ...)<br /><br /><br /><strong class='bbcode bold'>Poznamky k pouzitiu 1-Wire na STM32 </strong><br /><br />1. Zbernicu treba pripojit odporom 2K2...4k7 k napajaciemu napatiu 3.3V<br /><br />2. Zbernica je privedena priamo na procesor, co obmedzuje jej pouzitie<br />na lokalne vyuzitie v ramci zariadenia (teplota nejakeho chladica,<br />nasavaneho vzduchu ventilatorom, identifikacne cislo zariadenia/pcb<br />atd.), ale aj pri lokalnom pouziti je vhodne pin procesora chranit, vid.<br />napr. prilozeny obrazok. Transil nie je vhodny z dovodu jeho velkej<br />kapacity, treba pouzit schottkyho diody alebo niektory zo specializovanych<br />ochrannych obvodov.<br /><br /><div style='text-align:center'><img src='http://mcu.cz/images/newspost_images/31/04/owport_white.png' class='bbcode' alt=''  /></div><br /><br />Pri priamom pripojeni zbernice k procesoru dokaze na zbernici (skruteny<br />par, cca Z=110 Ohm) pracovat cca 35 zariadeni do vzdialenosti par metrov<br />(vyskusane).<br /><br />3. Pokial je treba pouzit zbernicu 1-wire v exterieri, je potrebne<br />pouzit niektory z budicov od Maximu, zvladnut sa da dlzka zbernice do<br />cca 100m. Zbernica musi byt tvorena skrutenym parom a dosledne<br />galvanicky oddelena od okolia.<br /><br />4. Pre velmi velke vzdialenosti cca 500m (overene az do 650m v<br />priemyselnom prostredi + 64 senzorov) je potrebne poskladat uz specialny<br />(galvanicky oddeleny 4kV) booster a obsluha zbernice je uz relativne<br />komplikovana (kontrola oneskorenia, urovne odrazov, impedancne<br />prisposobenie, interaktivne nastavenie komparacnych casov a urovni atd.)<br />a dosledne dbat na topologiu siete a impedanciu vedenia. <br /><br />S pozdravom<br />Peter Fabo<br /><br /><br />Zdrojový kód demo_1w.c: <input class='button' type='button' value='Show' onClick="if (this.value=='Show') {this.value='Hide'; document.getElementById('1703056644').style.display='';} else {this.value='Show'; document.getElementById('1703056644').style.display='none';}"><br><div class='indent'><div id='1703056644' style='display: none'><div class='code_highlight code-box' style='unicode-bidi: embed; direction: ltr'><div class="c" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/* demo_1wire.c</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* Ukazka pouzitia kniznice pre obsluhu zbernice 1-wire.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* Fragment programu, obsahuje len podstatne casti pre demonstraciu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* funkcnosti zbernice 1-wire.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;*/</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#include &lt;libopencm3/stm32/f1/rcc.h&gt;#include &lt;libopencm3/stm32/f1/gpio.h&gt;#include &quot;lib_1wire.h&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Konfiguracia systemu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Nastavnie portu pre 1-wire je vo funkcii owSetup() </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp;Inicializacia hodinovych signalov pre periferie</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> clock_setup<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; rcc_clock_setup_in_hse_8mhz_out_24mhz<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/* Enable GPIOA clock. */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; rcc_peripheral_enable_clock<span style="color: #66cc66;">&#40;</span>&RCC_APB2ENR, RCC_APB2ENR_IOPAEN<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ... hodiny pre dalsie periferie ...</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Funkcia casoveho oneskorenia - moze byt implementovana pomocou casovaca</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// alebo casovej slucky v programe </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> delay_us<span style="color: #66cc66;">&#40;</span>u16 time<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ...</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Fragment main funkcie pre pracu s 1-Wire zbernicou </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 i=<span style="color: #cc66cc;">0</span>;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// vseobecne pocitadlo</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 state=0x00;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// stav zbernice</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 data=0x00;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// aktualne nacitane data</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">extern</span> u8 ROM_NO<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#93;</span>;<span style="color: #808080; font-style: italic;">// ID buffer kniznice lib_1wire</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">int</span> main<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; clock_setup<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; owInit<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// inicializacia a reset zbernice 1-wire</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Nacitanie ID vsetkych zariadeni zbernice</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; state=owFirst<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>state!=<span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ID prveho zariadenia je v buffri ROM_NO</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ... spracovanie ID &nbsp;...</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">do</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; state=owNext<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>state==<span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #000000; font-weight: bold;">break</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ID nasledujuceho zariadenia je v buffri ROM_NO</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ... spracovanie ID &nbsp;...</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span>state<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Predpokladajme ze na zbernici mame pripojene len zariadenia </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// DS18x20 (teplomer typ B,S), spustime prevod teploty a nacitame data</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// posledneho senzoru zo zoznamu (ID zostalo v ROM_NO)</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; owReset<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; owVerify<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// aktualizacia ID</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; owWriteStrong<span style="color: #66cc66;">&#40;</span>0x44<span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// spustenie prevodu, napajanie obvodu </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span>i=<span style="color: #cc66cc;">0</span>; i&lt;<span style="color: #cc66cc;">75</span>; i++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 750 usec delay </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; delay_us<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10000</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; owSetResistive<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// zbernica do standardneho modu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; owReset<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// nacitanie dat zo senzoru po byte</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; owVerify<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; owWriteByte<span style="color: #66cc66;">&#40;</span>0xBE<span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// citanie scratch pamete senzora</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span>i=<span style="color: #cc66cc;">0</span>; i&lt;<span style="color: #cc66cc;">9</span>; i++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// pamet ma 9 byte</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data=owReadByte<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// aktualny byte je v premennej data</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ... spracovanie dat</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ...</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Koniec zdrojoveho textu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li></ol></div></div></div></div><br /><br /><br /><br /><br />Zdrojový kód lib_1wire.c: <input class='button' type='button' value='Show' onClick="if (this.value=='Show') {this.value='Hide'; document.getElementById('942170600').style.display='';} else {this.value='Show'; document.getElementById('942170600').style.display='none';}"><br><div class='indent'><div id='942170600' style='display: none'><div class='code_highlight code-box' style='unicode-bidi: embed; direction: ltr'><div class="c" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/* lib_1wire.c</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* Implementacia funkcii pre 1-Wire zbernicu.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* ToDo: </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* 1. Funkcie high-level API su prebrate z AN187 a nie su optimalizovane </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* &nbsp; &nbsp;pre gcc kompilator ARM.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;*/</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Include &amp; define</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#include &lt;libopencm3/stm32/f1/gpio.h&gt;#include &quot;lib_1wire.h&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Lokalne premenne</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 &nbsp;ROM_NO<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#93;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// lokalny buffer pre ID zariadenia</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 &nbsp;crc8;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// globalna hodnota CRC</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">int</span> LastDiscrepancy;&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// priznak konfliktu na zbernici pri vyhladavani ID</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">int</span> LastFamilyDiscrepancy;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">int</span> LastDeviceFlag;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">static</span> u8 dscrc_table<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">94</span>,<span style="color: #cc66cc;">188</span>,<span style="color: #cc66cc;">226</span>, <span style="color: #cc66cc;">97</span>, <span style="color: #cc66cc;">63</span>,<span style="color: #cc66cc;">221</span>,<span style="color: #cc66cc;">131</span>,<span style="color: #cc66cc;">194</span>,<span style="color: #cc66cc;">156</span>,<span style="color: #cc66cc;">126</span>, <span style="color: #cc66cc;">32</span>,<span style="color: #cc66cc;">163</span>,<span style="color: #cc66cc;">253</span>, <span style="color: #cc66cc;">31</span>, <span style="color: #cc66cc;">65</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #cc66cc;">157</span>,<span style="color: #cc66cc;">195</span>, <span style="color: #cc66cc;">33</span>,<span style="color: #cc66cc;">127</span>,<span style="color: #cc66cc;">252</span>,<span style="color: #cc66cc;">162</span>, <span style="color: #cc66cc;">64</span>, <span style="color: #cc66cc;">30</span>, <span style="color: #cc66cc;">95</span>, &nbsp;<span style="color: #cc66cc;">1</span>,<span style="color: #cc66cc;">227</span>,<span style="color: #cc66cc;">189</span>, <span style="color: #cc66cc;">62</span>, <span style="color: #cc66cc;">96</span>,<span style="color: #cc66cc;">130</span>,<span style="color: #cc66cc;">220</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #cc66cc;">35</span>,<span style="color: #cc66cc;">125</span>,<span style="color: #cc66cc;">159</span>,<span style="color: #cc66cc;">193</span>, <span style="color: #cc66cc;">66</span>, <span style="color: #cc66cc;">28</span>,<span style="color: #cc66cc;">254</span>,<span style="color: #cc66cc;">160</span>,<span style="color: #cc66cc;">225</span>,<span style="color: #cc66cc;">191</span>, <span style="color: #cc66cc;">93</span>, &nbsp;<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">128</span>,<span style="color: #cc66cc;">222</span>, <span style="color: #cc66cc;">60</span>, <span style="color: #cc66cc;">98</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #cc66cc;">190</span>,<span style="color: #cc66cc;">224</span>, &nbsp;<span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">92</span>,<span style="color: #cc66cc;">223</span>,<span style="color: #cc66cc;">129</span>, <span style="color: #cc66cc;">99</span>, <span style="color: #cc66cc;">61</span>,<span style="color: #cc66cc;">124</span>, <span style="color: #cc66cc;">34</span>,<span style="color: #cc66cc;">192</span>,<span style="color: #cc66cc;">158</span>, <span style="color: #cc66cc;">29</span>, <span style="color: #cc66cc;">67</span>,<span style="color: #cc66cc;">161</span>,<span style="color: #cc66cc;">255</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #cc66cc;">70</span>, <span style="color: #cc66cc;">24</span>,<span style="color: #cc66cc;">250</span>,<span style="color: #cc66cc;">164</span>, <span style="color: #cc66cc;">39</span>,<span style="color: #cc66cc;">121</span>,<span style="color: #cc66cc;">155</span>,<span style="color: #cc66cc;">197</span>,<span style="color: #cc66cc;">132</span>,<span style="color: #cc66cc;">218</span>, <span style="color: #cc66cc;">56</span>,<span style="color: #cc66cc;">102</span>,<span style="color: #cc66cc;">229</span>,<span style="color: #cc66cc;">187</span>, <span style="color: #cc66cc;">89</span>, &nbsp;<span style="color: #cc66cc;">7</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #cc66cc;">219</span>,<span style="color: #cc66cc;">133</span>,<span style="color: #cc66cc;">103</span>, <span style="color: #cc66cc;">57</span>,<span style="color: #cc66cc;">186</span>,<span style="color: #cc66cc;">228</span>, &nbsp;<span style="color: #cc66cc;">6</span>, <span style="color: #cc66cc;">88</span>, <span style="color: #cc66cc;">25</span>, <span style="color: #cc66cc;">71</span>,<span style="color: #cc66cc;">165</span>,<span style="color: #cc66cc;">251</span>,<span style="color: #cc66cc;">120</span>, <span style="color: #cc66cc;">38</span>,<span style="color: #cc66cc;">196</span>,<span style="color: #cc66cc;">154</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #cc66cc;">101</span>, <span style="color: #cc66cc;">59</span>,<span style="color: #cc66cc;">217</span>,<span style="color: #cc66cc;">135</span>, &nbsp;<span style="color: #cc66cc;">4</span>, <span style="color: #cc66cc;">90</span>,<span style="color: #cc66cc;">184</span>,<span style="color: #cc66cc;">230</span>,<span style="color: #cc66cc;">167</span>,<span style="color: #cc66cc;">249</span>, <span style="color: #cc66cc;">27</span>, <span style="color: #cc66cc;">69</span>,<span style="color: #cc66cc;">198</span>,<span style="color: #cc66cc;">152</span>,<span style="color: #cc66cc;">122</span>, <span style="color: #cc66cc;">36</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #cc66cc;">248</span>,<span style="color: #cc66cc;">166</span>, <span style="color: #cc66cc;">68</span>, <span style="color: #cc66cc;">26</span>,<span style="color: #cc66cc;">153</span>,<span style="color: #cc66cc;">199</span>, <span style="color: #cc66cc;">37</span>,<span style="color: #cc66cc;">123</span>, <span style="color: #cc66cc;">58</span>,<span style="color: #cc66cc;">100</span>,<span style="color: #cc66cc;">134</span>,<span style="color: #cc66cc;">216</span>, <span style="color: #cc66cc;">91</span>, &nbsp;<span style="color: #cc66cc;">5</span>,<span style="color: #cc66cc;">231</span>,<span style="color: #cc66cc;">185</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #cc66cc;">140</span>,<span style="color: #cc66cc;">210</span>, <span style="color: #cc66cc;">48</span>,<span style="color: #cc66cc;">110</span>,<span style="color: #cc66cc;">237</span>,<span style="color: #cc66cc;">179</span>, <span style="color: #cc66cc;">81</span>, <span style="color: #cc66cc;">15</span>, <span style="color: #cc66cc;">78</span>, <span style="color: #cc66cc;">16</span>,<span style="color: #cc66cc;">242</span>,<span style="color: #cc66cc;">172</span>, <span style="color: #cc66cc;">47</span>,<span style="color: #cc66cc;">113</span>,<span style="color: #cc66cc;">147</span>,<span style="color: #cc66cc;">205</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #cc66cc;">17</span>, <span style="color: #cc66cc;">79</span>,<span style="color: #cc66cc;">173</span>,<span style="color: #cc66cc;">243</span>,<span style="color: #cc66cc;">112</span>, <span style="color: #cc66cc;">46</span>,<span style="color: #cc66cc;">204</span>,<span style="color: #cc66cc;">146</span>,<span style="color: #cc66cc;">211</span>,<span style="color: #cc66cc;">141</span>,<span style="color: #cc66cc;">111</span>, <span style="color: #cc66cc;">49</span>,<span style="color: #cc66cc;">178</span>,<span style="color: #cc66cc;">236</span>, <span style="color: #cc66cc;">14</span>, <span style="color: #cc66cc;">80</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #cc66cc;">175</span>,<span style="color: #cc66cc;">241</span>, <span style="color: #cc66cc;">19</span>, <span style="color: #cc66cc;">77</span>,<span style="color: #cc66cc;">206</span>,<span style="color: #cc66cc;">144</span>,<span style="color: #cc66cc;">114</span>, <span style="color: #cc66cc;">44</span>,<span style="color: #cc66cc;">109</span>, <span style="color: #cc66cc;">51</span>,<span style="color: #cc66cc;">209</span>,<span style="color: #cc66cc;">143</span>, <span style="color: #cc66cc;">12</span>, <span style="color: #cc66cc;">82</span>,<span style="color: #cc66cc;">176</span>,<span style="color: #cc66cc;">238</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #cc66cc;">50</span>,<span style="color: #cc66cc;">108</span>,<span style="color: #cc66cc;">142</span>,<span style="color: #cc66cc;">208</span>, <span style="color: #cc66cc;">83</span>, <span style="color: #cc66cc;">13</span>,<span style="color: #cc66cc;">239</span>,<span style="color: #cc66cc;">177</span>,<span style="color: #cc66cc;">240</span>,<span style="color: #cc66cc;">174</span>, <span style="color: #cc66cc;">76</span>, <span style="color: #cc66cc;">18</span>,<span style="color: #cc66cc;">145</span>,<span style="color: #cc66cc;">207</span>, <span style="color: #cc66cc;">45</span>,<span style="color: #cc66cc;">115</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #cc66cc;">202</span>,<span style="color: #cc66cc;">148</span>,<span style="color: #cc66cc;">118</span>, <span style="color: #cc66cc;">40</span>,<span style="color: #cc66cc;">171</span>,<span style="color: #cc66cc;">245</span>, <span style="color: #cc66cc;">23</span>, <span style="color: #cc66cc;">73</span>, &nbsp;<span style="color: #cc66cc;">8</span>, <span style="color: #cc66cc;">86</span>,<span style="color: #cc66cc;">180</span>,<span style="color: #cc66cc;">234</span>,<span style="color: #cc66cc;">105</span>, <span style="color: #cc66cc;">55</span>,<span style="color: #cc66cc;">213</span>,<span style="color: #cc66cc;">139</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #cc66cc;">87</span>, &nbsp;<span style="color: #cc66cc;">9</span>,<span style="color: #cc66cc;">235</span>,<span style="color: #cc66cc;">181</span>, <span style="color: #cc66cc;">54</span>,<span style="color: #cc66cc;">104</span>,<span style="color: #cc66cc;">138</span>,<span style="color: #cc66cc;">212</span>,<span style="color: #cc66cc;">149</span>,<span style="color: #cc66cc;">203</span>, <span style="color: #cc66cc;">41</span>,<span style="color: #cc66cc;">119</span>,<span style="color: #cc66cc;">244</span>,<span style="color: #cc66cc;">170</span>, <span style="color: #cc66cc;">72</span>, <span style="color: #cc66cc;">22</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #cc66cc;">233</span>,<span style="color: #cc66cc;">183</span>, <span style="color: #cc66cc;">85</span>, <span style="color: #cc66cc;">11</span>,<span style="color: #cc66cc;">136</span>,<span style="color: #cc66cc;">214</span>, <span style="color: #cc66cc;">52</span>,<span style="color: #cc66cc;">106</span>, <span style="color: #cc66cc;">43</span>,<span style="color: #cc66cc;">117</span>,<span style="color: #cc66cc;">151</span>,<span style="color: #cc66cc;">201</span>, <span style="color: #cc66cc;">74</span>, <span style="color: #cc66cc;">20</span>,<span style="color: #cc66cc;">246</span>,<span style="color: #cc66cc;">168</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #cc66cc;">116</span>, <span style="color: #cc66cc;">42</span>,<span style="color: #cc66cc;">200</span>,<span style="color: #cc66cc;">150</span>, <span style="color: #cc66cc;">21</span>, <span style="color: #cc66cc;">75</span>,<span style="color: #cc66cc;">169</span>,<span style="color: #cc66cc;">247</span>,<span style="color: #cc66cc;">182</span>,<span style="color: #cc66cc;">232</span>, <span style="color: #cc66cc;">10</span>, <span style="color: #cc66cc;">84</span>,<span style="color: #cc66cc;">215</span>,<span style="color: #cc66cc;">137</span>,<span style="color: #cc66cc;">107</span>, <span style="color: #cc66cc;">53</span><span style="color: #66cc66;">&#125;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Implementacia high-level funkcii podla Maxim, AN187</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; Inicializacia portu zbernice 1-wire</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval: none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owInit<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Nastavenie 1-wire zbernice do resistive modu. Predpoklada pripojenie</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// zdroja hodin k periferii.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; gpio_set_mode<span style="color: #66cc66;">&#40;</span>OW_PORT, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_OPENDRAIN, OW_TERM<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; gpio_set<span style="color: #66cc66;">&#40;</span>OW_PORT, OW_TERM<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; delay_us<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10000</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 10 msec delay na ustalenie stavu zbernice</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; owReset<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Find the 'first' devices on the 1-Wire bus</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : TRUE &nbsp;- device found, ROM number in ROM_NO buffer</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FALSE - no device present</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 owFirst<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// reset the search state</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;LastDiscrepancy = <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;LastDeviceFlag = <span style="color: #000000; font-weight: bold;">FALSE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;LastFamilyDiscrepancy = <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">return</span> owSearch<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Find the 'next' devices on the 1-Wire bus</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : TRUE &nbsp;- device found, ROM number in ROM_NO buffer</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FALSE : device not found, end of search</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 owNext<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">return</span> owSearch<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Perform the 1-Wire Search Algorithm on the 1-Wire bus </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; using the existing search state.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : TRUE &nbsp;- device found, ROM number in ROM_NO buffer</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FALSE : device not found, end of search</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 owSearch<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #993333;">int</span> id_bit_number;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #993333;">int</span> last_zero, rom_byte_number, search_result;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #993333;">int</span> id_bit, cmp_id_bit;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #993333;">unsigned</span> <span style="color: #993333;">char</span> rom_byte_mask, search_direction;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// initialize for search</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;id_bit_number = <span style="color: #cc66cc;">1</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;last_zero = <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;rom_byte_number = <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;rom_byte_mask = <span style="color: #cc66cc;">1</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;search_result = <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;crc8 = <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// if the last call was not the last one</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>!LastDeviceFlag<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 1-Wire reset</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>!owReset<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// reset the search</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LastDiscrepancy = <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LastDeviceFlag = <span style="color: #000000; font-weight: bold;">FALSE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LastFamilyDiscrepancy = <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">FALSE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// issue the search command </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; owWriteByte<span style="color: #66cc66;">&#40;</span>0xF0<span style="color: #66cc66;">&#41;</span>; &nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// loop to do the search</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">do</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// read a bit and its complement</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;id_bit = owReadBit<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cmp_id_bit = owReadBit<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// check for no devices on 1-wire</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>id_bit == <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> && <span style="color: #66cc66;">&#40;</span>cmp_id_bit == <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">break</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">else</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// all devices coupled have 0 or 1</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>id_bit != cmp_id_bit<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;search_direction = id_bit; &nbsp;<span style="color: #808080; font-style: italic;">// bit write value for search</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// if this discrepancy if before the Last Discrepancy</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// on a previous next then pick the same as last time</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>id_bit_number &lt; LastDiscrepancy<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; search_direction = <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>ROM_NO<span style="color: #66cc66;">&#91;</span>rom_byte_number<span style="color: #66cc66;">&#93;</span> &amp; rom_byte_mask<span style="color: #66cc66;">&#41;</span> &gt; <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">else</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// if equal to last pick 1, if not then pick 0</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; search_direction = <span style="color: #66cc66;">&#40;</span>id_bit_number == LastDiscrepancy<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// if 0 was picked then record its position in LastZero</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>search_direction == <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last_zero = id_bit_number;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// check for Last discrepancy in family</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>last_zero &lt; <span style="color: #cc66cc;">9</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LastFamilyDiscrepancy = last_zero;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// set or clear the bit in the ROM byte rom_byte_number</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// with mask rom_byte_mask</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>search_direction == <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ROM_NO<span style="color: #66cc66;">&#91;</span>rom_byte_number<span style="color: #66cc66;">&#93;</span> |= rom_byte_mask;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ROM_NO<span style="color: #66cc66;">&#91;</span>rom_byte_number<span style="color: #66cc66;">&#93;</span> &= ~rom_byte_mask;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// serial number search direction write bit</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; owWriteBit<span style="color: #66cc66;">&#40;</span>search_direction<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// increment the byte counter id_bit_number</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// and shift the mask rom_byte_mask</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; id_bit_number++;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rom_byte_mask &lt;&lt;= <span style="color: #cc66cc;">1</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// if the mask is 0 then go to new SerialNum byte rom_byte_number and reset mask</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>rom_byte_mask == <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; owCrc8<span style="color: #66cc66;">&#40;</span>ROM_NO<span style="color: #66cc66;">&#91;</span>rom_byte_number<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>; &nbsp;<span style="color: #808080; font-style: italic;">// accumulate the CRC</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rom_byte_number++;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rom_byte_mask = <span style="color: #cc66cc;">1</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span>rom_byte_number &lt; <span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#41;</span>; &nbsp;<span style="color: #808080; font-style: italic;">// loop until through all ROM bytes 0-7</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// if the search was successful then</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>!<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>id_bit_number &lt; <span style="color: #cc66cc;">65</span><span style="color: #66cc66;">&#41;</span> || <span style="color: #66cc66;">&#40;</span>crc8 != <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// search successful so set LastDiscrepancy,LastDeviceFlag,search_result</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LastDiscrepancy = last_zero;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// check for last device</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>LastDiscrepancy == <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LastDeviceFlag = <span style="color: #000000; font-weight: bold;">TRUE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;search_result = <span style="color: #000000; font-weight: bold;">TRUE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// if no device found then reset counters so next 'search' will be like a first</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>!search_result || !ROM_NO<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; LastDiscrepancy = <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; LastDeviceFlag = <span style="color: #000000; font-weight: bold;">FALSE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; LastFamilyDiscrepancy = <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; search_result = <span style="color: #000000; font-weight: bold;">FALSE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">return</span> search_result;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Verify the device with the ROM number in ROM_NO buffer is present.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : TRUE &nbsp;: device verified present</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FALSE : device not present</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 owVerify<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #993333;">unsigned</span> <span style="color: #993333;">char</span> rom_backup<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#93;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #993333;">int</span> i,rslt,ld_backup,ldf_backup,lfd_backup;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// keep a backup copy of the current state</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>i = <span style="color: #cc66cc;">0</span>; i &lt; <span style="color: #cc66cc;">8</span>; i++<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; rom_backup<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> = ROM_NO<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;ld_backup = LastDiscrepancy;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;ldf_backup = LastDeviceFlag;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;lfd_backup = LastFamilyDiscrepancy;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// set search to find the same device</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;LastDiscrepancy = <span style="color: #cc66cc;">64</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;LastDeviceFlag = <span style="color: #000000; font-weight: bold;">FALSE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>owSearch<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// check if same device found</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; rslt = <span style="color: #000000; font-weight: bold;">TRUE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>i = <span style="color: #cc66cc;">0</span>; i &lt; <span style="color: #cc66cc;">8</span>; i++<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>rom_backup<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> != ROM_NO<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rslt = <span style="color: #000000; font-weight: bold;">FALSE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">break</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">else</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;rslt = <span style="color: #000000; font-weight: bold;">FALSE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// restore the search state </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>i = <span style="color: #cc66cc;">0</span>; i &lt; <span style="color: #cc66cc;">8</span>; i++<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; ROM_NO<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> = rom_backup<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;LastDiscrepancy = ld_backup;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;LastDeviceFlag = ldf_backup;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;LastFamilyDiscrepancy = lfd_backup;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// return the result of the verify</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">return</span> rslt;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Setup the search to find the device type 'family_code' on the next call</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; to owNext() if it is present.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owTargetSetup<span style="color: #66cc66;">&#40;</span>u8 family_code<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;u8 i;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// set the search state to find SearchFamily type devices</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;ROM_NO<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span> = family_code;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>i = <span style="color: #cc66cc;">1</span>; i &lt; <span style="color: #cc66cc;">8</span>; i++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; ROM_NO<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> = <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;LastDiscrepancy = <span style="color: #cc66cc;">64</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;LastFamilyDiscrepancy = <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;LastDeviceFlag = <span style="color: #000000; font-weight: bold;">FALSE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Setup the search to skip the current device type on the next call</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; to owNext().</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owFamilySkipSetup<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// set the Last discrepancy to last family discrepancy</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;LastDiscrepancy = LastFamilyDiscrepancy;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;LastFamilyDiscrepancy = <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// check for end of list</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>LastDiscrepancy == <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; LastDeviceFlag = <span style="color: #000000; font-weight: bold;">TRUE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Setup new ROM number</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;array with new ROM number</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owSetRom<span style="color: #66cc66;">&#40;</span>u8 *array<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; u8 i=<span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span>i=<span style="color: #cc66cc;">0</span>; i&lt;<span style="color: #cc66cc;">8</span>; i++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ROM_NO<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>=array<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Calculate the CRC8 of the byte value provided with the </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; current global 'crc8' value.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;byte value</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : current global crc8 value</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 owCrc8<span style="color: #66cc66;">&#40;</span>u8 value<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;crc8 = dscrc_table<span style="color: #66cc66;">&#91;</span>crc8 ^ value<span style="color: #66cc66;">&#93;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">return</span> crc8;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//--------------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Implementacia low-level funkcii pre STM32</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//--------------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Reset 1-wire zbernice s detekciou pritomnosti zariadenia</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : TRUE &nbsp;- device present</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FALSE - no device present</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 owReset<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; u8 state=<span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; gpio_clear<span style="color: #66cc66;">&#40;</span>OW_PORT, OW_TERM<span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// master Tx reset pulse 480usec min.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; delay_us<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">480</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; gpio_set<span style="color: #66cc66;">&#40;</span>OW_PORT, OW_TERM<span style="color: #66cc66;">&#41;</span>; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; delay_us<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">80</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// wait 20usec + 60usec presence pulse</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; state = GPIO_IDR<span style="color: #66cc66;">&#40;</span>OW_PORT<span style="color: #66cc66;">&#41;</span>; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; delay_us<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">400</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// master Rx 80usec + 400usec minimum</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>state &amp; OW_TERM<span style="color: #66cc66;">&#41;</span>==OW_TERM<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span> </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">FALSE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span><span style="color: #66cc66;">&#123;</span> </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">TRUE</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Vyslanie 8-bitov na zbernicu 1-wire</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;8-bit data</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owWriteByte<span style="color: #66cc66;">&#40;</span>u8 byte_value<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; u8 i=<span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span>i=<span style="color: #cc66cc;">0</span>; i&lt;<span style="color: #cc66cc;">8</span>; i++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// LSB first</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; owWriteBit<span style="color: #66cc66;">&#40;</span>byte_value&gt;&gt;i<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Vyslanie 1 bitu na zbernicu 1-wire</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;data, akceptovany je LSB</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owWriteBit<span style="color: #66cc66;">&#40;</span>u8 bit_value<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #b1b100;">switch</span><span style="color: #66cc66;">&#40;</span>bit_value &amp; 0x01<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> 0x00: </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gpio_clear<span style="color: #66cc66;">&#40;</span>OW_PORT, OW_TERM<span style="color: #66cc66;">&#41;</span>; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; delay_us<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">60</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gpio_set<span style="color: #66cc66;">&#40;</span>OW_PORT, OW_TERM<span style="color: #66cc66;">&#41;</span>; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">break</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> 0x01: </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gpio_clear<span style="color: #66cc66;">&#40;</span>OW_PORT, OW_TERM<span style="color: #66cc66;">&#41;</span>; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; delay_us<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gpio_set<span style="color: #66cc66;">&#40;</span>OW_PORT, OW_TERM<span style="color: #66cc66;">&#41;</span>; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; delay_us<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">55</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">break</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;delay_us<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Nacitanie 1 bitu zo zbernicu 1-wire</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : nacitana hodnota 0/1</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 owReadBit<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; u8 state=0x00;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; gpio_clear<span style="color: #66cc66;">&#40;</span>OW_PORT, OW_TERM<span style="color: #66cc66;">&#41;</span>; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; delay_us<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// doba citacieho pulzu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; gpio_set<span style="color: #66cc66;">&#40;</span>OW_PORT, OW_TERM<span style="color: #66cc66;">&#41;</span>; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; delay_us<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// oneskorenie pre ustalenie slave</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; state = GPIO_IDR<span style="color: #66cc66;">&#40;</span>OW_PORT<span style="color: #66cc66;">&#41;</span>; </div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; delay_us<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">50</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>state &amp; OW_TERM<span style="color: #66cc66;">&#41;</span>==OW_TERM<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">1</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Nacitanie 1 byte zo zbernicu 1-wire</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : nacitana hodnota 8-bit hodnota</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 owReadByte<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; u8 value=0x00;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; u8 i=<span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span>i=<span style="color: #cc66cc;">0</span>; i&lt;<span style="color: #cc66cc;">8</span>; i++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// LSB first</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value |= <span style="color: #66cc66;">&#40;</span>owReadBit<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>&lt;&lt;i<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> value;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Nastavenie zbernice do STRONG modu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owSetStrong<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; gpio_set_mode<span style="color: #66cc66;">&#40;</span>OW_PORT, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, OW_TERM<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Nastavenie zbernice do RESISTIVE modu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owSetResistive<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; gpio_set_mode<span style="color: #66cc66;">&#40;</span>OW_PORT, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_OPENDRAIN, OW_TERM<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @brief &nbsp; &nbsp;Vyslanie 8-bitov na zbernicu 1-wire a nastavenie </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; zbernice do STRONG modu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @param &nbsp; &nbsp;8-bit data</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; * @retval : none</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; */</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owWriteStrong<span style="color: #66cc66;">&#40;</span>u8 byte_value<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; u8 i=<span style="color: #cc66cc;">0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span>i=<span style="color: #cc66cc;">0</span>; i&lt;<span style="color: #cc66cc;">8</span>; i++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; owWriteBit<span style="color: #66cc66;">&#40;</span>byte_value&gt;&gt;i<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; gpio_set_mode<span style="color: #66cc66;">&#40;</span>OW_PORT, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, OW_TERM<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Koniec zdrojoveho textu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li></ol></div></div></div></div><br /><br /><br /><br />Zdrojový kód lib_1wire.h: <input class='button' type='button' value='Show' onClick="if (this.value=='Show') {this.value='Hide'; document.getElementById('238330791').style.display='';} else {this.value='Show'; document.getElementById('238330791').style.display='none';}"><br><div class='indent'><div id='238330791' style='display: none'><div class='code_highlight code-box' style='unicode-bidi: embed; direction: ltr'><div class="c" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/* lib_1wire.h</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* Deklaracie funkcii pre rozhranie 1-Wire</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* Vseobecna obsluha rozhrania 1-wire je odvodena z dokumentu fy.Maxim</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* Application Note 187, 1-Wire Search Algorithm, Mar. 28, 2002.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* Port a pin portu, ktore budu pouzite pre zbernicu 1-wire je potrebne </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* deklarovat v substituciach OW_PORT a OW_TERM.</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* Kniznica vyzaduje externu funkciu pre casovanie 'delay_us(u16 time)', </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* ktora musi mat rozlisenie casoveho intervalu 1usec, moze byt implementovana</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;* lubovolnym sposobom (casovac, programova slucka).</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp;*/</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Include &amp; define</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#ifndef LIB_1WIRE_H</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#define LIB_1WIRE_H</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#define OW_PORT&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; GPIOA&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; // deklaracia portu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#define OW_TERM&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; GPIO0&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; // deklaracia pinu portu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#define TRUE &nbsp;0x01</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#define FALSE 0x00</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">extern</span> <span style="color: #993333;">void</span> delay_us<span style="color: #66cc66;">&#40;</span>u16 time<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Vseobecna komunikacia s obvodmi zbernice</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owInit<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// konfiguracia portu pre 1-wire</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 &nbsp; owReset<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// reset zbernice a kontrola pritomnosti zariadeni</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 &nbsp; owFirst<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// nacitanie ID prveho zariadenia</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 &nbsp; owNext<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// iteracia zoznamu zariadeni</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 &nbsp; owVerify<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// kontrola existencia ID zariadenia</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owTargetSetup<span style="color: #66cc66;">&#40;</span>u8 fcode<span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// nastavenie podmnoziny vyhladavanych zariadeni</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owFamilySkipSetup<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// zrusenie selektivneho vyhladavania</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owSetRom<span style="color: #66cc66;">&#40;</span>u8 *array<span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// nastavenie ID konkretneho zariadenia</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Riadenie stavu zbernice </span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owSetStrong<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span>;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// napajanie zariadenie v parazite power mode</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owSetResistive<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// pull-upp mod zbernice</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owWriteByte<span style="color: #66cc66;">&#40;</span>u8 value<span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// zapis byte na zbernicu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owWriteStrong<span style="color: #66cc66;">&#40;</span>u8 value<span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// zapis byte a prepnutie do strong modu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 &nbsp; owReadByte<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// nacitanie byte zo zbernice</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Neverejne funkcie low-level</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 &nbsp; owSearch<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// interny vyhladavaci algoritmus</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> owWriteBit<span style="color: #66cc66;">&#40;</span>u8 bit_value<span style="color: #66cc66;">&#41;</span>;&nbsp; <span style="color: #808080; font-style: italic;">// zapis jedneho bite</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 &nbsp; owReadBit<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// nacitanie bite</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">u8 &nbsp; owCrc8<span style="color: #66cc66;">&#40;</span>u8 value<span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// vypocet/kontrola CRC ID zariadenia</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#endif</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Koniec zdrojoveho textu</span></div></li><li style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//----------------------------------------------------------------------</span></div></li></ol></div></div></div></div><br /><br /><br /><br /><br /><br /><br /><br /><strong class='bbcode bold'>Odkazy</strong><br /><br />LibOpenCM3 1. naleznete <a class='bbcode' href='http://mcu.cz/comment-n2943.html' rel='external' >zde</a>.<br />LibOpenCM3 2. naleznete <a class='bbcode' href='http://mcu.cz/comment-n2994.html' rel='external' >zde</a>. (LCD)<br />LibOpenCM3 3. naleznete <a class='bbcode' href='http://mcu.cz/comment-n3006.html' rel='external' >zde</a>. (A/D převodník)<br /><br />Wiki o knihovně LibOpenCM3 je <a class='bbcode' href='http://www.libopencm3.org/wiki/Main_Page' rel='external' >zde</a>.<br /><br />Knihovnu LibOpenCM3 si můžete stáhnout na sourceforge <a class='bbcode' href='http://sourceforge.net/projects/libopencm3/' rel='external' >zde</a>.<br /><br />Reference manuál k Value Line naleznete <a class='bbcode' href='http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/REFERENCE_MANUAL/CD00246267.pdf' rel='external' >zde</a>.<br /><br /><br />Autorem zdrojového kódu je <strong class='bbcode bold'>Peter Fabo</strong>. <span style='color:#ff0000'>Za zaslání děkujeme!</span>]]></content:encoded>
<category domain='http://mcu.cz/news.php?cat.3'>Mikroprocesory</category>
<dc:creator>mard</dc:creator>
<pubDate>Mon, 14 May 2012 05:36:34 +0200</pubDate>
<guid isPermaLink="true">http://mcu.cz/news.php?item.3104.3</guid>
</item>


				</channel>
				</rss>
