<p>This is a low footprint implementation for SAUL active-low and state init.</p>
<p>The basic idea, is to add flags in <code>saul_gpio_params_t</code> structures and pass this to <code>read</code>/<code>write</code> instead of only <code>pin</code>.<br>
This removes the need to duplicate drivers and only adds one flag.</p>
<p>I changed the <code>samr21-xpro</code> to invert led and button.</p>
<p>My footprint tests where done with <code>examples/saul</code> the <code>samr21-xpro</code></p>
<table>
<thead>
<tr>
<th>Steps</th>
<th><code>samr21-xpro</code></th>
<th><code>iotlab-m3</code></th>
</tr>
</thead>
<tbody>
<tr>
<td>Original</td>
<td>17364</td>
<td>21352</td>
</tr>
<tr>
<td>Change dev</td>
<td>17340</td>
<td>21332</td>
</tr>
<tr>
<td>Inverted support</td>
<td>17360</td>
<td>21352</td>
</tr>
<tr>
<td>Init support</td>
<td>17384</td>
<td>21380</td>
</tr></tbody></table>
<p>All steps are done in different commit so I could only put some part of it.</p>
<blockquote>
<h1>Size testing procedure</h1>
<p>export RIOT_VERSION=''  #┬áprevents the version to change size<br>
make BOARD=samr21-xpro | grep 'examples/saul' | cut -f 4<br>
make BOARD=iotlab-m3 | grep 'examples/saul' | cut -f 4</p>
</blockquote>
<p>I did not put initial state setting in the output only mode for readability, but I could (it is harmless by default). Or put a DEVELHELP message when using it for an input.</p>
<p>This could replace <a href="https://github.com/RIOT-OS/RIOT/pull/7151" class="issue-link js-issue-link" data-url="https://github.com/RIOT-OS/RIOT/issues/7151" data-id="234231797" data-error-text="Failed to load issue title" data-permission-text="Issue title is private">#7151</a>, <a href="https://github.com/RIOT-OS/RIOT/pull/7148" class="issue-link js-issue-link" data-url="https://github.com/RIOT-OS/RIOT/issues/7148" data-id="234155026" data-error-text="Failed to load issue title" data-permission-text="Issue title is private">#7148</a></p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/RIOT-OS/RIOT/pull/7586'>https://github.com/RIOT-OS/RIOT/pull/7586</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>saul/gpio: use saul_gpio_params_t structure as saul device</li>
  <li>saul/gpio: add support for inverted mode gpios</li>
  <li>samr21-xpro/gpio: set LED/BUTTON gpios as inverted</li>
  <li>saul/gpio: add support to initialized state</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-0">boards/arduino-atmega-common/include/gpio_params.h</a>
    (3)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-1">boards/arduino-due/include/gpio_params.h</a>
    (3)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-2">boards/arduino-mkr-common/include/gpio_params.h</a>
    (3)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-3">boards/arduino-zero/include/gpio_params.h</a>
    (3)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-4">boards/b-l072z-lrwan1/include/gpio_params.h</a>
    (15)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-5">boards/calliope-mini/include/gpio_params.h</a>
    (6)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-6">boards/cc2650stk/include/gpio_params.h</a>
    (12)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-7">boards/frdm-k22f/include/gpio_params.h</a>
    (9)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-8">boards/iotlab-common/include/gpio_params.h</a>
    (9)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-9">boards/maple-mini/include/gpio_params.h</a>
    (6)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-10">boards/microbit/include/gpio_params.h</a>
    (6)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-11">boards/mulle/include/gpio_params.h</a>
    (9)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-12">boards/nrf52840dk/include/gpio_params.h</a>
    (24)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-13">boards/nrf52dk/include/gpio_params.h</a>
    (24)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-14">boards/nucleo-common/include/gpio_params.h</a>
    (6)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-15">boards/nucleo144-common/include/gpio_params.h</a>
    (12)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-16">boards/nucleo32-common/include/gpio_params.h</a>
    (3)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-17">boards/nz32-sc151/include/gpio_params.h</a>
    (3)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-18">boards/pba-d-01-kw2x/include/gpio_params.h</a>
    (15)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-19">boards/remote-pa/include/gpio_params.h</a>
    (12)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-20">boards/remote-reva/include/gpio_params.h</a>
    (12)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-21">boards/remote-revb/include/gpio_params.h</a>
    (12)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-22">boards/samd21-xpro/include/gpio_params.h</a>
    (6)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-23">boards/samr21-xpro/include/gpio_params.h</a>
    (6)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-24">boards/sodaq-autonomo/include/gpio_params.h</a>
    (3)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-25">boards/stm32f0discovery/include/gpio_params.h</a>
    (9)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-26">boards/stm32f3discovery/include/gpio_params.h</a>
    (27)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-27">boards/stm32f4discovery/include/gpio_params.h</a>
    (15)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-28">boards/stm32f7discovery/include/gpio_params.h</a>
    (15)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-29">drivers/include/saul/.swp</a>
    (0)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-30">drivers/include/saul/periph.h</a>
    (13)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-31">drivers/saul/gpio_saul.c</a>
    (15)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-32">sys/auto_init/saul/auto_init_gpio.c</a>
    (14)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/7586/files#diff-33">sys/include/saul_reg.h</a>
    (2)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/RIOT-OS/RIOT/pull/7586.patch'>https://github.com/RIOT-OS/RIOT/pull/7586.patch</a></li>
  <li><a href='https://github.com/RIOT-OS/RIOT/pull/7586.diff'>https://github.com/RIOT-OS/RIOT/pull/7586.diff</a></li>
</ul>

<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/7586">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AEn7YB2MR0ob0DdMGh6KSwywKzg6u1DIks5sgUxZgaJpZM4PRPeB">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AEn7YJJq-qQr6l1ugFGYQgBkiMkowslgks5sgUxZgaJpZM4PRPeB.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/7586"></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":"DESCRIPTION","message":"saul/gpio: Low footprint handling of active-low signals + state initialization (#7586)"}],"action":{"name":"View Pull Request","url":"https://github.com/RIOT-OS/RIOT/pull/7586"}}}</script>