update docs

This commit is contained in:
ZennDev1337 2023-08-15 15:30:11 +02:00
parent 10236c7441
commit c4f43a0f9d
9 changed files with 39 additions and 13 deletions

View file

@ -8,6 +8,13 @@
//! ``` //! ```
//! use arduboy_rust::prelude::*; //! use arduboy_rust::prelude::*;
//! ``` //! ```
//! Inside the Wrapper-Project folder is a folder named src.
//! You can disable C++ libraries in the main.h file.
//! Just comment the unused library definition out.
//!
//! To get an idea, the ArduboyTones Library needs 2-3% of the flash memory.
//!
//! [Here is the link to the GitHub Repo](https://github.com/zenndev1337/rust-for-arduboy)
extern crate panic_halt; extern crate panic_halt;
pub mod hardware; pub mod hardware;

View file

@ -445,7 +445,7 @@ impl Arduboy2 {
///Returns ///Returns
/// true if the specified point is within the specified rectangle. /// true if the specified point is within the specified rectangle.
/// ///
///This function is intended to detemine if an object, whose boundaries are are defined by the given rectangle, is in contact with the given point. ///This function is intended to detemine if an object, whose boundaries are defined by the given rectangle, is in contact with the given point.
pub fn collide_point(&self, point: Point, rect: Rect) -> bool { pub fn collide_point(&self, point: Point, rect: Rect) -> bool {
point.x >= rect.x point.x >= rect.x
&& point.x < rect.x + rect.width as i16 && point.x < rect.x + rect.width as i16
@ -460,7 +460,7 @@ impl Arduboy2 {
///Returns ///Returns
/// true if the first rectangle is intersecting the second. /// true if the first rectangle is intersecting the second.
/// ///
///This function is intended to detemine if an object, whose boundaries are are defined by the given rectangle, is in contact with another rectangular object. ///This function is intended to detemine if an object, whose boundaries are defined by the given rectangle, is in contact with another rectangular object.
pub fn collide_rect(&self, rect1: Rect, rect2: Rect) -> bool { pub fn collide_rect(&self, rect1: Rect, rect2: Rect) -> bool {
!(rect2.x >= rect1.x + rect1.width as i16 !(rect2.x >= rect1.x + rect1.width as i16
|| rect2.x + rect2.width as i16 <= rect1.x || rect2.x + rect2.width as i16 <= rect1.x

View file

@ -245,7 +245,7 @@ EEPROM is limited in the number of times it can be written to. Sketches should n
</ul> </ul>
<p>Returns <p>Returns
true if the specified point is within the specified rectangle.</p> true if the specified point is within the specified rectangle.</p>
<p>This function is intended to detemine if an object, whose boundaries are are defined by the given rectangle, is in contact with the given point.</p> <p>This function is intended to detemine if an object, whose boundaries are defined by the given rectangle, is in contact with the given point.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.collide_rect" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#464-469">source</a><h4 class="code-header">pub fn <a href="#method.collide_rect" class="fn">collide_rect</a>(&amp;self, rect1: <a class="struct" href="../prelude/arduboy2/struct.Rect.html" title="struct arduboy_rust::prelude::arduboy2::Rect">Rect</a>, rect2: <a class="struct" href="../prelude/arduboy2/struct.Rect.html" title="struct arduboy_rust::prelude::arduboy2::Rect">Rect</a>) -&gt; bool</h4></section></summary><div class="docblock"><p>Test if a rectangle is intersecting with another rectangle.</p> </div></details><details class="toggle method-toggle" open><summary><section id="method.collide_rect" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#464-469">source</a><h4 class="code-header">pub fn <a href="#method.collide_rect" class="fn">collide_rect</a>(&amp;self, rect1: <a class="struct" href="../prelude/arduboy2/struct.Rect.html" title="struct arduboy_rust::prelude::arduboy2::Rect">Rect</a>, rect2: <a class="struct" href="../prelude/arduboy2/struct.Rect.html" title="struct arduboy_rust::prelude::arduboy2::Rect">Rect</a>) -&gt; bool</h4></section></summary><div class="docblock"><p>Test if a rectangle is intersecting with another rectangle.</p>
<p>Parameters</p> <p>Parameters</p>
<ul> <ul>
@ -253,7 +253,7 @@ true if the specified point is within the specified rectangle.</p>
</ul> </ul>
<p>Returns <p>Returns
true if the first rectangle is intersecting the second.</p> true if the first rectangle is intersecting the second.</p>
<p>This function is intended to detemine if an object, whose boundaries are are defined by the given rectangle, is in contact with another rectangular object.</p> <p>This function is intended to detemine if an object, whose boundaries are defined by the given rectangle, is in contact with another rectangular object.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.digital_write_rgb_single" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#477-479">source</a><h4 class="code-header">pub fn <a href="#method.digital_write_rgb_single" class="fn">digital_write_rgb_single</a>(&amp;self, color: u8, val: u8)</h4></section></summary><div class="docblock"><p>Set one of the RGB LEDs digitally, to either fully on or fully off.</p> </div></details><details class="toggle method-toggle" open><summary><section id="method.digital_write_rgb_single" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#477-479">source</a><h4 class="code-header">pub fn <a href="#method.digital_write_rgb_single" class="fn">digital_write_rgb_single</a>(&amp;self, color: u8, val: u8)</h4></section></summary><div class="docblock"><p>Set one of the RGB LEDs digitally, to either fully on or fully off.</p>
<p>Parameters</p> <p>Parameters</p>
<ul> <ul>

File diff suppressed because one or more lines are too long

View file

@ -245,7 +245,7 @@ EEPROM is limited in the number of times it can be written to. Sketches should n
</ul> </ul>
<p>Returns <p>Returns
true if the specified point is within the specified rectangle.</p> true if the specified point is within the specified rectangle.</p>
<p>This function is intended to detemine if an object, whose boundaries are are defined by the given rectangle, is in contact with the given point.</p> <p>This function is intended to detemine if an object, whose boundaries are defined by the given rectangle, is in contact with the given point.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.collide_rect" class="method"><a class="src rightside" href="../../../src/arduboy_rust/library/arduboy2.rs.html#464-469">source</a><h4 class="code-header">pub fn <a href="#method.collide_rect" class="fn">collide_rect</a>(&amp;self, rect1: <a class="struct" href="struct.Rect.html" title="struct arduboy_rust::prelude::arduboy2::Rect">Rect</a>, rect2: <a class="struct" href="struct.Rect.html" title="struct arduboy_rust::prelude::arduboy2::Rect">Rect</a>) -&gt; bool</h4></section></summary><div class="docblock"><p>Test if a rectangle is intersecting with another rectangle.</p> </div></details><details class="toggle method-toggle" open><summary><section id="method.collide_rect" class="method"><a class="src rightside" href="../../../src/arduboy_rust/library/arduboy2.rs.html#464-469">source</a><h4 class="code-header">pub fn <a href="#method.collide_rect" class="fn">collide_rect</a>(&amp;self, rect1: <a class="struct" href="struct.Rect.html" title="struct arduboy_rust::prelude::arduboy2::Rect">Rect</a>, rect2: <a class="struct" href="struct.Rect.html" title="struct arduboy_rust::prelude::arduboy2::Rect">Rect</a>) -&gt; bool</h4></section></summary><div class="docblock"><p>Test if a rectangle is intersecting with another rectangle.</p>
<p>Parameters</p> <p>Parameters</p>
<ul> <ul>
@ -253,7 +253,7 @@ true if the specified point is within the specified rectangle.</p>
</ul> </ul>
<p>Returns <p>Returns
true if the first rectangle is intersecting the second.</p> true if the first rectangle is intersecting the second.</p>
<p>This function is intended to detemine if an object, whose boundaries are are defined by the given rectangle, is in contact with another rectangular object.</p> <p>This function is intended to detemine if an object, whose boundaries are defined by the given rectangle, is in contact with another rectangular object.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.digital_write_rgb_single" class="method"><a class="src rightside" href="../../../src/arduboy_rust/library/arduboy2.rs.html#477-479">source</a><h4 class="code-header">pub fn <a href="#method.digital_write_rgb_single" class="fn">digital_write_rgb_single</a>(&amp;self, color: u8, val: u8)</h4></section></summary><div class="docblock"><p>Set one of the RGB LEDs digitally, to either fully on or fully off.</p> </div></details><details class="toggle method-toggle" open><summary><section id="method.digital_write_rgb_single" class="method"><a class="src rightside" href="../../../src/arduboy_rust/library/arduboy2.rs.html#477-479">source</a><h4 class="code-header">pub fn <a href="#method.digital_write_rgb_single" class="fn">digital_write_rgb_single</a>(&amp;self, color: u8, val: u8)</h4></section></summary><div class="docblock"><p>Set one of the RGB LEDs digitally, to either fully on or fully off.</p>
<p>Parameters</p> <p>Parameters</p>
<ul> <ul>

View file

@ -245,7 +245,7 @@ EEPROM is limited in the number of times it can be written to. Sketches should n
</ul> </ul>
<p>Returns <p>Returns
true if the specified point is within the specified rectangle.</p> true if the specified point is within the specified rectangle.</p>
<p>This function is intended to detemine if an object, whose boundaries are are defined by the given rectangle, is in contact with the given point.</p> <p>This function is intended to detemine if an object, whose boundaries are defined by the given rectangle, is in contact with the given point.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.collide_rect" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#464-469">source</a><h4 class="code-header">pub fn <a href="#method.collide_rect" class="fn">collide_rect</a>(&amp;self, rect1: <a class="struct" href="arduboy2/struct.Rect.html" title="struct arduboy_rust::prelude::arduboy2::Rect">Rect</a>, rect2: <a class="struct" href="arduboy2/struct.Rect.html" title="struct arduboy_rust::prelude::arduboy2::Rect">Rect</a>) -&gt; bool</h4></section></summary><div class="docblock"><p>Test if a rectangle is intersecting with another rectangle.</p> </div></details><details class="toggle method-toggle" open><summary><section id="method.collide_rect" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#464-469">source</a><h4 class="code-header">pub fn <a href="#method.collide_rect" class="fn">collide_rect</a>(&amp;self, rect1: <a class="struct" href="arduboy2/struct.Rect.html" title="struct arduboy_rust::prelude::arduboy2::Rect">Rect</a>, rect2: <a class="struct" href="arduboy2/struct.Rect.html" title="struct arduboy_rust::prelude::arduboy2::Rect">Rect</a>) -&gt; bool</h4></section></summary><div class="docblock"><p>Test if a rectangle is intersecting with another rectangle.</p>
<p>Parameters</p> <p>Parameters</p>
<ul> <ul>
@ -253,7 +253,7 @@ true if the specified point is within the specified rectangle.</p>
</ul> </ul>
<p>Returns <p>Returns
true if the first rectangle is intersecting the second.</p> true if the first rectangle is intersecting the second.</p>
<p>This function is intended to detemine if an object, whose boundaries are are defined by the given rectangle, is in contact with another rectangular object.</p> <p>This function is intended to detemine if an object, whose boundaries are defined by the given rectangle, is in contact with another rectangular object.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.digital_write_rgb_single" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#477-479">source</a><h4 class="code-header">pub fn <a href="#method.digital_write_rgb_single" class="fn">digital_write_rgb_single</a>(&amp;self, color: u8, val: u8)</h4></section></summary><div class="docblock"><p>Set one of the RGB LEDs digitally, to either fully on or fully off.</p> </div></details><details class="toggle method-toggle" open><summary><section id="method.digital_write_rgb_single" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#477-479">source</a><h4 class="code-header">pub fn <a href="#method.digital_write_rgb_single" class="fn">digital_write_rgb_single</a>(&amp;self, color: u8, val: u8)</h4></section></summary><div class="docblock"><p>Set one of the RGB LEDs digitally, to either fully on or fully off.</p>
<p>Parameters</p> <p>Parameters</p>
<ul> <ul>

View file

@ -245,7 +245,7 @@ EEPROM is limited in the number of times it can be written to. Sketches should n
</ul> </ul>
<p>Returns <p>Returns
true if the specified point is within the specified rectangle.</p> true if the specified point is within the specified rectangle.</p>
<p>This function is intended to detemine if an object, whose boundaries are are defined by the given rectangle, is in contact with the given point.</p> <p>This function is intended to detemine if an object, whose boundaries are defined by the given rectangle, is in contact with the given point.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.collide_rect" class="method"><a class="src rightside" href="../src/arduboy_rust/library/arduboy2.rs.html#464-469">source</a><h4 class="code-header">pub fn <a href="#method.collide_rect" class="fn">collide_rect</a>(&amp;self, rect1: <a class="struct" href="prelude/arduboy2/struct.Rect.html" title="struct arduboy_rust::prelude::arduboy2::Rect">Rect</a>, rect2: <a class="struct" href="prelude/arduboy2/struct.Rect.html" title="struct arduboy_rust::prelude::arduboy2::Rect">Rect</a>) -&gt; bool</h4></section></summary><div class="docblock"><p>Test if a rectangle is intersecting with another rectangle.</p> </div></details><details class="toggle method-toggle" open><summary><section id="method.collide_rect" class="method"><a class="src rightside" href="../src/arduboy_rust/library/arduboy2.rs.html#464-469">source</a><h4 class="code-header">pub fn <a href="#method.collide_rect" class="fn">collide_rect</a>(&amp;self, rect1: <a class="struct" href="prelude/arduboy2/struct.Rect.html" title="struct arduboy_rust::prelude::arduboy2::Rect">Rect</a>, rect2: <a class="struct" href="prelude/arduboy2/struct.Rect.html" title="struct arduboy_rust::prelude::arduboy2::Rect">Rect</a>) -&gt; bool</h4></section></summary><div class="docblock"><p>Test if a rectangle is intersecting with another rectangle.</p>
<p>Parameters</p> <p>Parameters</p>
<ul> <ul>
@ -253,7 +253,7 @@ true if the specified point is within the specified rectangle.</p>
</ul> </ul>
<p>Returns <p>Returns
true if the first rectangle is intersecting the second.</p> true if the first rectangle is intersecting the second.</p>
<p>This function is intended to detemine if an object, whose boundaries are are defined by the given rectangle, is in contact with another rectangular object.</p> <p>This function is intended to detemine if an object, whose boundaries are defined by the given rectangle, is in contact with another rectangular object.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.digital_write_rgb_single" class="method"><a class="src rightside" href="../src/arduboy_rust/library/arduboy2.rs.html#477-479">source</a><h4 class="code-header">pub fn <a href="#method.digital_write_rgb_single" class="fn">digital_write_rgb_single</a>(&amp;self, color: u8, val: u8)</h4></section></summary><div class="docblock"><p>Set one of the RGB LEDs digitally, to either fully on or fully off.</p> </div></details><details class="toggle method-toggle" open><summary><section id="method.digital_write_rgb_single" class="method"><a class="src rightside" href="../src/arduboy_rust/library/arduboy2.rs.html#477-479">source</a><h4 class="code-header">pub fn <a href="#method.digital_write_rgb_single" class="fn">digital_write_rgb_single</a>(&amp;self, color: u8, val: u8)</h4></section></summary><div class="docblock"><p>Set one of the RGB LEDs digitally, to either fully on or fully off.</p>
<p>Parameters</p> <p>Parameters</p>
<ul> <ul>

View file

@ -18,6 +18,13 @@
<a href="#18" id="18">18</a> <a href="#18" id="18">18</a>
<a href="#19" id="19">19</a> <a href="#19" id="19">19</a>
<a href="#20" id="20">20</a> <a href="#20" id="20">20</a>
<a href="#21" id="21">21</a>
<a href="#22" id="22">22</a>
<a href="#23" id="23">23</a>
<a href="#24" id="24">24</a>
<a href="#25" id="25">25</a>
<a href="#26" id="26">26</a>
<a href="#27" id="27">27</a>
</pre></div><pre class="rust"><code><span class="attr">#![cfg(target_arch = <span class="string">&quot;avr&quot;</span>)] </pre></div><pre class="rust"><code><span class="attr">#![cfg(target_arch = <span class="string">&quot;avr&quot;</span>)]
#![no_std] #![no_std]
#![feature(c_size_t)] #![feature(c_size_t)]
@ -28,6 +35,13 @@
//! ``` //! ```
//! use arduboy_rust::prelude::*; //! use arduboy_rust::prelude::*;
//! ``` //! ```
//! Inside the Wrapper-Project folder is a folder named src.
//! You can disable C++ libraries in the main.h file.
//! Just comment the unused library definition out.
//!
//! To get an idea, the ArduboyTones Library needs 2-3% of the flash memory.
//!
//! [Here is the link to the GitHub Repo](https://github.com/zenndev1337/rust-for-arduboy)
</span><span class="kw">extern crate </span>panic_halt; </span><span class="kw">extern crate </span>panic_halt;
<span class="kw">pub mod </span>hardware; <span class="kw">pub mod </span>hardware;

View file

@ -1198,7 +1198,7 @@
///Returns ///Returns
/// true if the specified point is within the specified rectangle. /// true if the specified point is within the specified rectangle.
/// ///
///This function is intended to detemine if an object, whose boundaries are are defined by the given rectangle, is in contact with the given point. ///This function is intended to detemine if an object, whose boundaries are defined by the given rectangle, is in contact with the given point.
</span><span class="kw">pub fn </span>collide_point(<span class="kw-2">&amp;</span><span class="self">self</span>, point: Point, rect: Rect) -&gt; bool { </span><span class="kw">pub fn </span>collide_point(<span class="kw-2">&amp;</span><span class="self">self</span>, point: Point, rect: Rect) -&gt; bool {
point.x &gt;= rect.x point.x &gt;= rect.x
&amp;&amp; point.x &lt; rect.x + rect.width <span class="kw">as </span>i16 &amp;&amp; point.x &lt; rect.x + rect.width <span class="kw">as </span>i16
@ -1213,7 +1213,7 @@
///Returns ///Returns
/// true if the first rectangle is intersecting the second. /// true if the first rectangle is intersecting the second.
/// ///
///This function is intended to detemine if an object, whose boundaries are are defined by the given rectangle, is in contact with another rectangular object. ///This function is intended to detemine if an object, whose boundaries are defined by the given rectangle, is in contact with another rectangular object.
</span><span class="kw">pub fn </span>collide_rect(<span class="kw-2">&amp;</span><span class="self">self</span>, rect1: Rect, rect2: Rect) -&gt; bool { </span><span class="kw">pub fn </span>collide_rect(<span class="kw-2">&amp;</span><span class="self">self</span>, rect1: Rect, rect2: Rect) -&gt; bool {
!(rect2.x &gt;= rect1.x + rect1.width <span class="kw">as </span>i16 !(rect2.x &gt;= rect1.x + rect1.width <span class="kw">as </span>i16
|| rect2.x + rect2.width <span class="kw">as </span>i16 &lt;= rect1.x || rect2.x + rect2.width <span class="kw">as </span>i16 &lt;= rect1.x