<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>combine two different twi into a single function</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/42189/combine-two-different-twi-into-a-single-function</link><description>Hi! 
 I am using nrf52840,sdk 14.2,Keil IDE 
 I am using bmp180 and mpu6050 sensors. 
 In proximity code,I have integrated both sensors separately,It works fine. 
 But while combining two sensor codes,I have a problem because both have different twi function</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 07 Jan 2019 08:47:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/42189/combine-two-different-twi-into-a-single-function" /><item><title>RE: combine two different twi into a single function</title><link>https://devzone.nordicsemi.com/thread/164164?ContentTypeID=1</link><pubDate>Mon, 07 Jan 2019 08:47:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b50c6a3d-77e7-40af-b709-6cfa4a3e9fb7</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;The standard approach is to have a &lt;em&gt;&lt;strong&gt;layered&lt;/strong&gt;&lt;/em&gt; approach:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/OSI_model"&gt;https://en.wikipedia.org/wiki/OSI_model&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.webopedia.com/quick_ref/OSI_Layers.asp"&gt;https://www.webopedia.com/quick_ref/OSI_Layers.asp&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;That way, you separate the basic hardware operations - START condition, Addressing, ACK, NAK, transferring bytes - from the specific details for each sensor.&lt;/p&gt;
&lt;p&gt;You will also need to make sure that&amp;nbsp;your code for one sensor doesn&amp;#39;t try to use the bus while your code for the other sensor is using it!&lt;/p&gt;
&lt;p&gt;EDIT&lt;/p&gt;
&lt;p&gt;The Nordic &lt;a href="https://www.nordicsemi.com/Software-and-Tools/Development-Kits/Nordic-Thingy-52" rel="noopener noreferrer" target="_blank"&gt;&lt;strong&gt;Thingy&lt;/strong&gt; &lt;/a&gt;has several slaves on its I2C bus - so you could look at how that handles it ...&lt;/p&gt;
&lt;p&gt;I would suggest that you work this out first &lt;em&gt;&lt;strong&gt;without&lt;/strong&gt; &lt;/em&gt;the added complication of BLE.&lt;/p&gt;
&lt;p&gt;The I2C specification is here:&amp;nbsp;&lt;a href="https://www.nxp.com/docs/en/user-guide/UM10204.pdf"&gt;www.nxp.com/.../UM10204.pdf&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>