2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5 <html xmlns="http://www.w3.org/1999/xhtml">
7 <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
8 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9 <title>Switches — Freedom Metal v201905 documentation</title>
10 <link rel="stylesheet" href="../_static/alabaster.css" type="text/css" />
11 <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
12 <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
13 <script type="text/javascript" src="../_static/jquery.js"></script>
14 <script type="text/javascript" src="../_static/underscore.js"></script>
15 <script type="text/javascript" src="../_static/doctools.js"></script>
16 <link rel="index" title="Index" href="../genindex.html" />
17 <link rel="search" title="Search" href="../search.html" />
18 <link rel="next" title="Timer API" href="timer.html" />
19 <link rel="prev" title="SPIs" href="spi.html" />
21 <link rel="stylesheet" href="../_static/custom.css" type="text/css" />
24 <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
29 <div class="document">
30 <div class="documentwrapper">
31 <div class="bodywrapper">
34 <div class="body" role="main">
36 <div class="section" id="switches">
37 <h1>Switches<a class="headerlink" href="#switches" title="Permalink to this headline">¶</a></h1>
38 <p>API for reading toggle switches. </p>
39 <div class="breathe-sectiondef docutils container">
40 <p class="breathe-sectiondef-title rubric">Functions</p>
42 <dt id="_CPPv316metal_switch_getPc">
43 <span id="_CPPv216metal_switch_getPc"></span><span id="metal_switch_get__cP"></span><span class="target" id="switch_8h_1a7693902f215f3fc2cf032ebe25fe1d83"></span><em class="property">struct</em> <a class="reference internal" href="#_CPPv312metal_switch" title="metal_switch">metal_switch</a> *<code class="descname">metal_switch_get</code><span class="sig-paren">(</span>char *<em>label</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv316metal_switch_getPc" title="Permalink to this definition">¶</a><br /></dt>
44 <dd><p>Get a handle for a switch. </p>
45 <p><dl class="docutils">
46 <dt><strong>Return</strong></dt>
47 <dd>A handle to the switch, or NULL if none is found for the requested label </dd>
48 <dt><strong>Parameters</strong></dt>
49 <dd><ul class="breatheparameterlist first last simple">
50 <li><code class="docutils literal notranslate"><span class="pre">label</span></code>: The DeviceTree label for the desired switch </li>
58 <dt id="_CPPv333metal_switch_interrupt_controllerP12metal_switch">
59 <span id="_CPPv233metal_switch_interrupt_controllerP12metal_switch"></span><span id="metal_switch_interrupt_controller__metal_switchP"></span><span class="target" id="switch_8h_1a3f2190c66bb759060060ddc910c61313"></span><em class="property">struct</em> <a class="reference internal" href="interrupt.html#_CPPv315metal_interrupt" title="metal_interrupt">metal_interrupt</a> *<code class="descname">metal_switch_interrupt_controller</code><span class="sig-paren">(</span><em class="property">struct</em> <a class="reference internal" href="#_CPPv312metal_switch" title="metal_switch">metal_switch</a> *<em>sw</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv333metal_switch_interrupt_controllerP12metal_switch" title="Permalink to this definition">¶</a><br /></dt>
60 <dd><p>Get the interrupt controller for a switch. </p>
61 <p><dl class="docutils">
62 <dt><strong>Return</strong></dt>
63 <dd>The interrupt controller handle </dd>
64 <dt><strong>Parameters</strong></dt>
65 <dd><ul class="breatheparameterlist first last simple">
66 <li><code class="docutils literal notranslate"><span class="pre">sw</span></code>: The handle for the switch </li>
74 <dt id="_CPPv329metal_switch_get_interrupt_idP12metal_switch">
75 <span id="_CPPv229metal_switch_get_interrupt_idP12metal_switch"></span><span id="metal_switch_get_interrupt_id__metal_switchP"></span><span class="target" id="switch_8h_1aac53a083b9fd1060da134610dd5faad2"></span>int <code class="descname">metal_switch_get_interrupt_id</code><span class="sig-paren">(</span><em class="property">struct</em> <a class="reference internal" href="#_CPPv312metal_switch" title="metal_switch">metal_switch</a> *<em>sw</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv329metal_switch_get_interrupt_idP12metal_switch" title="Permalink to this definition">¶</a><br /></dt>
76 <dd><p>Get the interrupt id for a switch. </p>
77 <p><dl class="docutils">
78 <dt><strong>Return</strong></dt>
79 <dd>The interrupt ID for the switch </dd>
80 <dt><strong>Parameters</strong></dt>
81 <dd><ul class="breatheparameterlist first last simple">
82 <li><code class="docutils literal notranslate"><span class="pre">sw</span></code>: The handle for the switch </li>
91 <dt id="_CPPv312metal_switch">
92 <span id="_CPPv212metal_switch"></span><span id="metal_switch"></span><span class="target" id="structmetal__switch"></span><em class="property">struct </em><code class="descname">metal_switch</code><a class="headerlink" href="#_CPPv312metal_switch" title="Permalink to this definition">¶</a><br /></dt>
93 <dd><em>#include <switch.h></em><p>A handle for a switch. </p>
103 <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
104 <div class="sphinxsidebarwrapper">
105 <h1 class="logo"><a href="../index.html">Freedom Metal</a></h1>
116 <li class="toctree-l1"><a class="reference internal" href="../introduction.html">Introduction to Freedom Metal</a></li>
117 <li class="toctree-l1"><a class="reference internal" href="../devguide.html">Developer Guide</a></li>
118 <li class="toctree-l1 current"><a class="reference internal" href="../api.html">API Reference</a><ul class="current">
119 <li class="toctree-l2"><a class="reference internal" href="button.html">Buttons</a></li>
120 <li class="toctree-l2"><a class="reference internal" href="cache.html">Caches</a></li>
121 <li class="toctree-l2"><a class="reference internal" href="clock.html">Clocks</a></li>
122 <li class="toctree-l2"><a class="reference internal" href="cpu.html">CPU</a></li>
123 <li class="toctree-l2"><a class="reference internal" href="gpio.html">GPIO</a></li>
124 <li class="toctree-l2"><a class="reference internal" href="interrupt.html">Interrupts</a></li>
125 <li class="toctree-l2"><a class="reference internal" href="itim.html">ITIM</a></li>
126 <li class="toctree-l2"><a class="reference internal" href="led.html">LEDs</a></li>
127 <li class="toctree-l2"><a class="reference internal" href="lock.html">Locks</a></li>
128 <li class="toctree-l2"><a class="reference internal" href="memory.html">Memory Enumeration</a></li>
129 <li class="toctree-l2"><a class="reference internal" href="pmp.html">PMPs</a></li>
130 <li class="toctree-l2"><a class="reference internal" href="shutdown.html">Shutdown</a></li>
131 <li class="toctree-l2"><a class="reference internal" href="spi.html">SPIs</a></li>
132 <li class="toctree-l2 current"><a class="current reference internal" href="#">Switches</a></li>
133 <li class="toctree-l2"><a class="reference internal" href="timer.html">Timer API</a></li>
134 <li class="toctree-l2"><a class="reference internal" href="tty.html">TTY</a></li>
135 <li class="toctree-l2"><a class="reference internal" href="uart.html">UARTs</a></li>
140 <div class="relations">
141 <h3>Related Topics</h3>
143 <li><a href="../index.html">Documentation overview</a><ul>
144 <li><a href="../api.html">API Reference</a><ul>
145 <li>Previous: <a href="spi.html" title="previous chapter">SPIs</a></li>
146 <li>Next: <a href="timer.html" title="next chapter">Timer API</a></li>
151 <div id="searchbox" style="display: none" role="search">
152 <h3>Quick search</h3>
153 <div class="searchformwrapper">
154 <form class="search" action="../search.html" method="get">
155 <input type="text" name="q" />
156 <input type="submit" value="Go" />
157 <input type="hidden" name="check_keywords" value="yes" />
158 <input type="hidden" name="area" value="default" />
162 <script type="text/javascript">$('#searchbox').show(0);</script>
165 <div class="clearer"></div>
168 ©2019, SiFive Inc..
171 Powered by <a href="http://sphinx-doc.org/">Sphinx 1.7.5</a>
172 & <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.11</a>
175 <a href="../_sources/apiref/switch.rst.txt"
176 rel="nofollow">Page source</a>