<p><b>@lebrush</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/RIOT-OS/RIOT/pull/7588#discussion_r140479452">cpu/sam0_common/periph/i2c.c</a>:</p>
<pre style='color:#555'>>  
     /* Enable Smart Mode (ACK is sent when DATA.DATA is read) */
-    I2CSercom->CTRLB.reg = SERCOM_I2CM_CTRLB_SMEN;
+    dev(bus)->CTRLB.reg = SERCOM_I2CM_CTRLB_SMEN;
 
     /* Find and set baudrate. Read speed configuration. Set transfer
      * speed: SERCOM_I2CM_CTRLA_SPEED(0): Standard-mode (Sm) up to 100
      * kHz and Fast-mode (Fm) up to 400 kHz */
     switch (speed) {
</pre>
<p>I meant the following: you can redefine the <code>i2c_speed_t</code> in <code>periph_cpu_common.h</code> as</p>
<div class="highlight highlight-source-c"><pre><span class="pl-k">typedef</span> <span class="pl-k">enum</span> {
I2C_SPEED_NORMAL = <span class="pl-c1">100000</span>,
I2C_SPEED_FAST = <span class="pl-c1">400000</span>,
...
} <span class="pl-c1">i2c_speed_t</span>;</pre></div>
<p>Then you can skip the <code>switch</code>:</p>
<div class="highlight highlight-source-c"><pre>tmp_baud = (<span class="pl-c1">int32_t</span>)(((CLOCK_CORECLOCK + (<span class="pl-c1">2</span> * (speed)) - <span class="pl-c1">1</span>) / (<span class="pl-c1">2</span> * (speed))) - <span class="pl-c1">5</span>);
<span class="pl-k">if</span> (tmp_baud < <span class="pl-c1">255</span> && tmp_baud > <span class="pl-c1">0</span>) {
        <span class="pl-c1">dev</span>(bus)->CTRLA.<span class="pl-smi">reg</span> |= <span class="pl-c1">SERCOM_I2CM_CTRLA_SPEED</span>(<span class="pl-c1">0</span>);
        <span class="pl-c1">dev</span>(bus)->BAUD.<span class="pl-smi">reg</span> = <span class="pl-c1">SERCOM_I2CM_BAUD_BAUD</span>(tmp_baud);
}</pre></div>
<p>But now I relised that the <code>high</code> speed has different values (2 instead of 0 and HSBAD instead of BAUD), so I'm not sure it makes sense.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/RIOT-OS/RIOT/pull/7588#discussion_r140479452">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AEn7YK-tMDtKr13aDXeLPngcRCD42iVNks5sk6YbgaJpZM4PRpi8">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AEn7YHnM1B8qQzKnHRWqEUhTdcbQBPnKks5sk6YbgaJpZM4PRpi8.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/RIOT-OS/RIOT/pull/7588#discussion_r140479452"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/RIOT-OS/RIOT","title":"RIOT-OS/RIOT","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/RIOT-OS/RIOT"}},"updates":{"snippets":[{"icon":"PERSON","message":"@lebrush commented on #7588"}],"action":{"name":"View Pull Request","url":"https://github.com/RIOT-OS/RIOT/pull/7588#discussion_r140479452"}}}</script>