-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1e912ef
commit deccf94
Showing
35 changed files
with
824 additions
and
89 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="List of all items in this crate"><title>List of all items in this crate</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b0742ba02757f159.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="dummy_pin" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0 (90b35a623 2024-11-26)" data-channel="1.83.0" data-search-js="search-f0d225181b97f9a4.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="../static.files/main-f070b9041d14864c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod sys"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../dummy_pin/index.html">dummy_<wbr>pin</a><span class="version">0.1.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h3><a href="#structs">Crate Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><h1>List of all items</h1><h3 id="structs">Structs</h3><ul class="all-items"><li><a href="struct.DummyPin.html">DummyPin</a></li><li><a href="struct.LastStateDummyPin.html">LastStateDummyPin</a></li><li><a href="level/struct.High.html">level::High</a></li><li><a href="level/struct.Low.html">level::Low</a></li></ul></section></div></main></body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta http-equiv="refresh" content="0;URL=../../../dummy_pin/level/index.html"> | ||
<title>Redirection</title> | ||
</head> | ||
<body> | ||
<p>Redirecting to <a href="../../../dummy_pin/level/index.html">../../../dummy_pin/level/index.html</a>...</p> | ||
<script>location.replace("../../../dummy_pin/level/index.html" + location.search + location.hash);</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta http-equiv="refresh" content="0;URL=../../../dummy_pin/level/struct.High.html"> | ||
<title>Redirection</title> | ||
</head> | ||
<body> | ||
<p>Redirecting to <a href="../../../dummy_pin/level/struct.High.html">../../../dummy_pin/level/struct.High.html</a>...</p> | ||
<script>location.replace("../../../dummy_pin/level/struct.High.html" + location.search + location.hash);</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta http-equiv="refresh" content="0;URL=../../../dummy_pin/level/struct.Low.html"> | ||
<title>Redirection</title> | ||
</head> | ||
<body> | ||
<p>Redirecting to <a href="../../../dummy_pin/level/struct.Low.html">../../../dummy_pin/level/struct.Low.html</a>...</p> | ||
<script>location.replace("../../../dummy_pin/level/struct.Low.html" + location.search + location.hash);</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta http-equiv="refresh" content="0;URL=../../dummy_pin/struct.DummyPin.html"> | ||
<title>Redirection</title> | ||
</head> | ||
<body> | ||
<p>Redirecting to <a href="../../dummy_pin/struct.DummyPin.html">../../dummy_pin/struct.DummyPin.html</a>...</p> | ||
<script>location.replace("../../dummy_pin/struct.DummyPin.html" + location.search + location.hash);</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="This provides dummy implementations of the input/output pin `embedded-hal` traits. This is useful when dealing with setups where a certain pin is handled by hardware in a way that the software does not need to know about, for example."><title>dummy_pin - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b0742ba02757f159.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="dummy_pin" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0 (90b35a623 2024-11-26)" data-channel="1.83.0" data-search-js="search-f0d225181b97f9a4.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-f070b9041d14864c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../dummy_pin/index.html">dummy_<wbr>pin</a><span class="version">0.1.1</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#usage-examples" title="Usage examples">Usage examples</a><ul><li><a href="#dummypin-interaction" title="`DummyPin` interaction"><code>DummyPin</code> interaction</a></li><li><a href="#pass-dummy-output-pin-to-irrelevant-driver-output" title="Pass dummy output pin to irrelevant driver output">Pass dummy output pin to irrelevant driver output</a></li><li><a href="#laststatedummypin-interaction" title="`LastStateDummyPin` interaction"><code>LastStateDummyPin</code> interaction</a></li></ul></li></ul><h3><a href="#modules">Crate Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>dummy_pin</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/dummy_pin/lib.rs.html#1-110">source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>This provides dummy implementations of the input/output pin <a href="https://github.com/rust-embedded/embedded-hal"><code>embedded-hal</code></a> traits. | ||
This is useful when dealing with setups where a certain pin is handled by hardware in a way | ||
that the software does not need to know about, for example.</p> | ||
<p>In addition to the no-op, zero-cost <code>DummyPin</code>, this crate provides an implementation of <code>LastStateDummyPin</code>, | ||
which stores the last state set at runtime and returns it when read.</p> | ||
<h3 id="usage-examples"><a class="doc-anchor" href="#usage-examples">§</a>Usage examples</h3><h4 id="dummypin-interaction"><a class="doc-anchor" href="#dummypin-interaction">§</a><code>DummyPin</code> interaction</h4> | ||
<p>A <code>DummyPin</code> does nothing and always returns the creation level when read.</p> | ||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>dummy_pin::DummyPin; | ||
|
||
<span class="comment">// This pin will always read low. | ||
</span><span class="kw">let </span><span class="kw-2">mut </span>pin = DummyPin::new_low(); | ||
|
||
<span class="comment">// Using pin as `OutpuPin` does nothing and returns `Ok(())` | ||
</span>pin.set_high().unwrap(); | ||
|
||
<span class="comment">// Using pin as `InputPin` always returns the creation level. | ||
</span><span class="macro">assert!</span>( pin.is_low().unwrap() ); | ||
<span class="macro">assert!</span>( !pin.is_high().unwrap() ); | ||
|
||
<span class="comment">// Using pin as `ToggleableOutputPin` does nothing and returns `Ok(())` | ||
</span>pin.toggle().unwrap(); | ||
|
||
<span class="comment">// Using pin as `StatefulOutputPin` always returns the creation level. | ||
</span><span class="macro">assert!</span>( pin.is_set_low().unwrap() ); | ||
<span class="macro">assert!</span>( !pin.is_set_high().unwrap() );</code></pre></div> | ||
<h4 id="pass-dummy-output-pin-to-irrelevant-driver-output"><a class="doc-anchor" href="#pass-dummy-output-pin-to-irrelevant-driver-output">§</a>Pass dummy output pin to irrelevant driver output</h4> | ||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>dummy_pin::DummyPin; | ||
<span class="kw">use </span>embedded_hal::digital::v2::OutputPin; | ||
<span class="kw">use </span>linux_embedded_hal::Pin; | ||
|
||
<span class="kw">struct </span>Driver<P> { | ||
output: P, | ||
} | ||
|
||
<span class="kw">impl</span><P, E> Driver<P> | ||
<span class="kw">where | ||
</span>P: OutputPin<Error = E>, | ||
{ | ||
<span class="kw">fn </span>new(pin: P) -> <span class="self">Self </span>{ | ||
Driver { output: pin } | ||
} | ||
|
||
<span class="kw">fn </span>do_something(<span class="kw-2">&mut </span><span class="self">self</span>) -> <span class="prelude-ty">Result</span><(), E> { | ||
<span class="comment">// ... | ||
</span><span class="self">self</span>.output.set_high() | ||
} | ||
} | ||
|
||
<span class="comment">// The same driver can operate with either a real or a dummy pin. | ||
</span><span class="kw">let </span>real_pin = Pin::new(<span class="number">25</span>); | ||
<span class="kw">let </span><span class="kw-2">mut </span>driver_with_real_pin = Driver::new(real_pin); | ||
driver_with_real_pin.do_something().unwrap(); | ||
|
||
<span class="kw">let </span>dummy_pin = DummyPin::new_low(); | ||
<span class="kw">let </span><span class="kw-2">mut </span>driver_with_dummy_pin = Driver::new(dummy_pin); | ||
driver_with_dummy_pin.do_something().unwrap();</code></pre></div> | ||
<h4 id="laststatedummypin-interaction"><a class="doc-anchor" href="#laststatedummypin-interaction">§</a><code>LastStateDummyPin</code> interaction</h4> | ||
<p>A <code>LastStateDummyPin</code> stores the last level set and returns it when read.</p> | ||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>dummy_pin::LastStateDummyPin; | ||
|
||
<span class="comment">// Initially this pin reads low. | ||
</span><span class="kw">let </span><span class="kw-2">mut </span>pin = LastStateDummyPin::new_low(); | ||
|
||
<span class="macro">assert!</span>( pin.is_low().unwrap() ); | ||
|
||
<span class="comment">// Using pin as `OutpuPin` stores the level set | ||
</span>pin.set_high().unwrap(); | ||
|
||
<span class="comment">// Using pin as `InputPin` returns the last level. | ||
</span><span class="macro">assert!</span>( pin.is_high().unwrap() ); | ||
|
||
<span class="comment">// Using pin as `ToggleableOutputPin` toggles the internal state | ||
</span>pin.toggle().unwrap(); | ||
|
||
<span class="macro">assert!</span>( pin.is_low().unwrap() ); | ||
|
||
<span class="comment">// Using pin as `StatefulOutputPin` returns the last level. | ||
</span><span class="macro">assert!</span>( pin.is_set_low().unwrap() ); | ||
<span class="macro">assert!</span>( !pin.is_set_high().unwrap() );</code></pre></div> | ||
</div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="mod" href="level/index.html" title="mod dummy_pin::level">level</a></div><div class="desc docblock-short">Pin level marker types for usage of <code>DummyPin</code> as an <code>InputPin</code> or <code>StatefulOutputPin</code>.</div></li></ul><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.DummyPin.html" title="struct dummy_pin::DummyPin">Dummy<wbr>Pin</a></div><div class="desc docblock-short">Dummy (no-op, zero-cost) pin</div></li><li><div class="item-name"><a class="struct" href="struct.LastStateDummyPin.html" title="struct dummy_pin::LastStateDummyPin">Last<wbr>State<wbr>Dummy<wbr>Pin</a></div><div class="desc docblock-short">Dummy pin implementation which stores the last level set to it and returns it when read.</div></li></ul></section></div></main></body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta http-equiv="refresh" content="0;URL=../../dummy_pin/struct.LastStateDummyPin.html"> | ||
<title>Redirection</title> | ||
</head> | ||
<body> | ||
<p>Redirecting to <a href="../../dummy_pin/struct.LastStateDummyPin.html">../../dummy_pin/struct.LastStateDummyPin.html</a>...</p> | ||
<script>location.replace("../../dummy_pin/struct.LastStateDummyPin.html" + location.search + location.hash);</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Pin level marker types for usage of `DummyPin` as an `InputPin` or `StatefulOutputPin`."><title>dummy_pin::level - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b0742ba02757f159.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="dummy_pin" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0 (90b35a623 2024-11-26)" data-channel="1.83.0" data-search-js="search-f0d225181b97f9a4.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-f070b9041d14864c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../dummy_pin/index.html">dummy_<wbr>pin</a><span class="version">0.1.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module level</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate dummy_<wbr>pin</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">dummy_pin</a></span><h1>Module <span>level</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/dummy_pin/dummy.rs.html#5">source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Pin level marker types for usage of <code>DummyPin</code> as an <code>InputPin</code> or <code>StatefulOutputPin</code>.</p> | ||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.High.html" title="struct dummy_pin::level::High">High</a></div><div class="desc docblock-short"><code>DummyPin</code> will always behave as being high when checked.</div></li><li><div class="item-name"><a class="struct" href="struct.Low.html" title="struct dummy_pin::level::Low">Low</a></div><div class="desc docblock-short"><code>DummyPin</code> will always behave as being low when checked.</div></li></ul></section></div></main></body></html> |
Oops, something went wrong.