379 lines
No EOL
60 KiB
HTML
379 lines
No EOL
60 KiB
HTML
<!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 is the struct to interact in a save way with the Arduboy2 C++ library."><title>Arduboy2 in arduboy_rust::arduboy2 - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-47e7ab555ef2818a.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="arduboy_rust" data-themes="" data-resource-suffix="" data-rustdoc-version="1.74.0-nightly (d9c8274fb 2023-09-12)" data-channel="nightly" data-search-js="search-5d3eaacf19ebf04f.js" data-settings-js="settings-74424d7eec62a23e.js" data-settings-css="settings-8c76f75bfb6bd192.css" data-theme-light-css="light-f194925aa375ae96.css" data-theme-dark-css="dark-1dd4d1ce031e15de.css" data-theme-ayu-css="ayu-49e58d069f567085.css" ><script src="../../static.files/storage-db41da1a38ea3cb8.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-8d035c8cea6edbc4.js"></script><noscript><link rel="stylesheet" media="(prefers-color-scheme:light)" href="../../static.files/light-f194925aa375ae96.css"><link rel="stylesheet" media="(prefers-color-scheme:dark)" href="../../static.files/dark-1dd4d1ce031e15de.css"><link rel="stylesheet" href="../../static.files/noscript-cffde32267a19fd6.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-16x16-8b506e7a72182f1c.png"><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 struct"><!--[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">☰</button><a class="logo-container" href="../../arduboy_rust/index.html"><img class="rust-logo" src="../../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><h2></h2></nav><nav class="sidebar"><a class="logo-container" href="../../arduboy_rust/index.html"><img class="rust-logo" src="../../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><h2 class="location"><a href="#">Arduboy2</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block"><li><a href="#method.audio_enabled">audio_enabled</a></li><li><a href="#method.audio_off">audio_off</a></li><li><a href="#method.audio_on">audio_on</a></li><li><a href="#method.audio_on_and_save">audio_on_and_save</a></li><li><a href="#method.audio_save_on_off">audio_save_on_off</a></li><li><a href="#method.audio_toggle">audio_toggle</a></li><li><a href="#method.begin">begin</a></li><li><a href="#method.clear">clear</a></li><li><a href="#method.collide_point">collide_point</a></li><li><a href="#method.collide_rect">collide_rect</a></li><li><a href="#method.digital_write_rgb">digital_write_rgb</a></li><li><a href="#method.digital_write_rgb_single">digital_write_rgb_single</a></li><li><a href="#method.display">display</a></li><li><a href="#method.display_and_clear_buffer">display_and_clear_buffer</a></li><li><a href="#method.draw_circle">draw_circle</a></li><li><a href="#method.draw_fast_hline">draw_fast_hline</a></li><li><a href="#method.draw_fast_vline">draw_fast_vline</a></li><li><a href="#method.draw_pixel">draw_pixel</a></li><li><a href="#method.draw_rect">draw_rect</a></li><li><a href="#method.draw_round_rect">draw_round_rect</a></li><li><a href="#method.draw_triangle">draw_triangle</a></li><li><a href="#method.every_x_frames">every_x_frames</a></li><li><a href="#method.fill_circle">fill_circle</a></li><li><a href="#method.fill_rect">fill_rect</a></li><li><a href="#method.fill_round_rect">fill_round_rect</a></li><li><a href="#method.fill_triangle">fill_triangle</a></li><li><a href="#method.flip_horizontal">flip_horizontal</a></li><li><a href="#method.flip_vertical">flip_vertical</a></li><li><a href="#method.get_pixel">get_pixel</a></li><li><a href="#method.idle">idle</a></li><li><a href="#method.init_random_seed">init_random_seed</a></li><li><a href="#method.invert">invert</a></li><li><a href="#method.just_pressed">just_pressed</a></li><li><a href="#method.just_released">just_released</a></li><li><a href="#method.new">new</a></li><li><a href="#method.next_frame">next_frame</a></li><li><a href="#method.not_pressed">not_pressed</a></li><li><a href="#method.poll_buttons">poll_buttons</a></li><li><a href="#method.pressed">pressed</a></li><li><a href="#method.print">print</a></li><li><a href="#method.set_cursor">set_cursor</a></li><li><a href="#method.set_cursor_x">set_cursor_x</a></li><li><a href="#method.set_cursor_y">set_cursor_y</a></li><li><a href="#method.set_frame_rate">set_frame_rate</a></li><li><a href="#method.set_rgb_led">set_rgb_led</a></li><li><a href="#method.set_rgb_led_single">set_rgb_led_single</a></li><li><a href="#method.set_text_background_color">set_text_background_color</a></li><li><a href="#method.set_text_color">set_text_color</a></li><li><a href="#method.set_text_size">set_text_size</a></li><li><a href="#method.set_text_wrap">set_text_wrap</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block"><li><a href="#impl-RefUnwindSafe-for-Arduboy2">RefUnwindSafe</a></li><li><a href="#impl-Send-for-Arduboy2">Send</a></li><li><a href="#impl-Sync-for-Arduboy2">Sync</a></li><li><a href="#impl-Unpin-for-Arduboy2">Unpin</a></li><li><a href="#impl-UnwindSafe-for-Arduboy2">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block"><li><a href="#impl-Any-for-Arduboy2">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-Arduboy2">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-Arduboy2">BorrowMut<T></a></li><li><a href="#impl-From%3CT%3E-for-Arduboy2">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-Arduboy2">Into<U></a></li><li><a href="#impl-TryFrom%3CU%3E-for-Arduboy2">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-Arduboy2">TryInto<U></a></li></ul></section><h2><a href="index.html">In arduboy_rust::arduboy2</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Struct <a href="../index.html">arduboy_rust</a>::<wbr><a href="index.html">arduboy2</a>::<wbr><a class="struct" href="#">Arduboy2</a><button id="copy-path" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="src" href="../../src/arduboy_rust/library/arduboy2.rs.html#64">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub struct Arduboy2 {}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>This is the struct to interact in a save way with the Arduboy2 C++ library.</p>
|
||
</div></details><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Arduboy2" class="impl"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#65-630">source</a><a href="#impl-Arduboy2" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="../prelude/arduboy2/struct.Arduboy2.html" title="struct arduboy_rust::prelude::arduboy2::Arduboy2">Arduboy2</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#71-73">source</a><h4 class="code-header">pub const fn <a href="#method.new" class="fn">new</a>() -> Self</h4></section></summary><div class="docblock"><p>gives you a new instance of the <a href="../prelude/arduboy2/struct.Arduboy2.html" title="struct arduboy_rust::prelude::arduboy2::Arduboy2">Arduboy2</a></p>
|
||
<h6 id="example"><a href="#example">Example</a></h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">const </span>arduboy: Arduboy2 = Arduboy2::new();</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.begin" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#76-78">source</a><h4 class="code-header">pub fn <a href="#method.begin" class="fn">begin</a>(&self)</h4></section></summary><div class="docblock"><p>Initialize the hardware, display the boot logo, provide boot utilities, etc.
|
||
This function should be called once near the start of the sketch, usually in setup(), before using any other functions in this class. It initializes the display, displays the boot logo, provides “flashlight” and system control features and initializes audio control.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.clear" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#80-82">source</a><h4 class="code-header">pub fn <a href="#method.clear" class="fn">clear</a>(&self)</h4></section></summary><div class="docblock"><p>Clear the display buffer and set the text cursor to location 0, 0.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.display" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#85-87">source</a><h4 class="code-header">pub fn <a href="#method.display" class="fn">display</a>(&self)</h4></section></summary><div class="docblock"><p>Copy the contents of the display buffer to the display.
|
||
The contents of the display buffer in RAM are copied to the display and will appear on the screen.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.display_and_clear_buffer" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#91-93">source</a><h4 class="code-header">pub fn <a href="#method.display_and_clear_buffer" class="fn">display_and_clear_buffer</a>(&self)</h4></section></summary><div class="docblock"><p>Copy the contents of the display buffer to the display. The display buffer will be cleared to zero.</p>
|
||
<p>Operation is the same as calling display() without parameters except additionally the display buffer will be cleared.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.draw_fast_hline" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#103-105">source</a><h4 class="code-header">pub fn <a href="#method.draw_fast_hline" class="fn">draw_fast_hline</a>(&self, x: i16, y: i16, w: u8, color: <a class="enum" href="../prelude/arduboy2/enum.Color.html" title="enum arduboy_rust::prelude::arduboy2::Color">Color</a>)</h4></section></summary><div class="docblock"><p>Draw a horizontal line.</p>
|
||
<h6 id="parameters"><a href="#parameters">Parameters:</a></h6>
|
||
<ul>
|
||
<li>x The X coordinate of the left start point.</li>
|
||
<li>y The Y coordinate of the left start point.</li>
|
||
<li>w The width of the line.</li>
|
||
</ul>
|
||
<p>color The color of the line (optional; defaults to WHITE).</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.draw_fast_vline" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#115-117">source</a><h4 class="code-header">pub fn <a href="#method.draw_fast_vline" class="fn">draw_fast_vline</a>(&self, x: i16, y: i16, h: u8, color: <a class="enum" href="../prelude/arduboy2/enum.Color.html" title="enum arduboy_rust::prelude::arduboy2::Color">Color</a>)</h4></section></summary><div class="docblock"><p>Draw a vertical line.</p>
|
||
<h6 id="parameters-1"><a href="#parameters-1">Parameters:</a></h6>
|
||
<ul>
|
||
<li>x The X coordinate of the left start point.</li>
|
||
<li>y The Y coordinate of the left start point.</li>
|
||
<li>h The height of the line.</li>
|
||
</ul>
|
||
<p>color The color of the line (optional; defaults to WHITE).</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.draw_pixel" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#126-128">source</a><h4 class="code-header">pub fn <a href="#method.draw_pixel" class="fn">draw_pixel</a>(&self, x: i16, y: i16, color: <a class="enum" href="../prelude/arduboy2/enum.Color.html" title="enum arduboy_rust::prelude::arduboy2::Color">Color</a>)</h4></section></summary><div class="docblock"><p>Set a single pixel in the display buffer to the specified color.</p>
|
||
<h6 id="parameters-2"><a href="#parameters-2">Parameters</a></h6>
|
||
<ul>
|
||
<li>x The X coordinate of the pixel.</li>
|
||
<li>y The Y coordinate of the pixel.</li>
|
||
<li>color The color of the pixel (optional; defaults to WHITE).</li>
|
||
</ul>
|
||
<p>The single pixel specified location in the display buffer is set to the specified color. The values WHITE or BLACK can be used for the color. If the color parameter isn’t included, the pixel will be set to WHITE.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.fill_rect" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#139-141">source</a><h4 class="code-header">pub fn <a href="#method.fill_rect" class="fn">fill_rect</a>(&self, x: i16, y: i16, w: u8, h: u8, color: <a class="enum" href="../prelude/arduboy2/enum.Color.html" title="enum arduboy_rust::prelude::arduboy2::Color">Color</a>)</h4></section></summary><div class="docblock"><p>Draw a filled-in rectangle of a specified width and height.</p>
|
||
<h6 id="parameters-3"><a href="#parameters-3">Parameters</a></h6>
|
||
<ul>
|
||
<li>x The X coordinate of the upper left corner.</li>
|
||
<li>y The Y coordinate of the upper left corner.</li>
|
||
<li>w The width of the rectangle.</li>
|
||
<li>h The height of the rectangle.</li>
|
||
</ul>
|
||
<p>color The color of the pixel (optional; defaults to WHITE).</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.draw_rect" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#150-152">source</a><h4 class="code-header">pub fn <a href="#method.draw_rect" class="fn">draw_rect</a>(&self, x: i16, y: i16, w: u8, h: u8, color: <a class="enum" href="../prelude/arduboy2/enum.Color.html" title="enum arduboy_rust::prelude::arduboy2::Color">Color</a>)</h4></section></summary><div class="docblock"><p>Draw a rectangle of a specified width and height.</p>
|
||
<p>Parameters</p>
|
||
<ul>
|
||
<li>x The X coordinate of the upper left corner.</li>
|
||
<li>y The Y coordinate of the upper left corner.</li>
|
||
<li>w The width of the rectangle.</li>
|
||
<li>h The height of the rectangle.</li>
|
||
<li>color The color of the pixel (optional; defaults to WHITE).</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.draw_circle" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#160-162">source</a><h4 class="code-header">pub fn <a href="#method.draw_circle" class="fn">draw_circle</a>(&self, x: i16, y: i16, r: u8, color: <a class="enum" href="../prelude/arduboy2/enum.Color.html" title="enum arduboy_rust::prelude::arduboy2::Color">Color</a>)</h4></section></summary><div class="docblock"><p>Draw a circle of a given radius.</p>
|
||
<p>Parameters</p>
|
||
<ul>
|
||
<li>x0 The X coordinate of the circle’s center.</li>
|
||
<li>y0 The Y coordinate of the circle’s center.</li>
|
||
<li>r The radius of the circle in pixels.</li>
|
||
<li>color The circle’s color (optional; defaults to WHITE).</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.fill_circle" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#172-174">source</a><h4 class="code-header">pub fn <a href="#method.fill_circle" class="fn">fill_circle</a>(&self, x: i16, y: i16, r: u8, color: <a class="enum" href="../prelude/arduboy2/enum.Color.html" title="enum arduboy_rust::prelude::arduboy2::Color">Color</a>)</h4></section></summary><div class="docblock"><p>Draw a filled-in circle of a given radius.</p>
|
||
<h6 id="parameters-4"><a href="#parameters-4">Parameters</a></h6>
|
||
<ul>
|
||
<li>x The X coordinate of the circle’s center.</li>
|
||
<li>y The Y coordinate of the circle’s center.</li>
|
||
<li>r The radius of the circle in pixels.</li>
|
||
</ul>
|
||
<p>color The circle’s color (optional; defaults to WHITE).</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.fill_round_rect" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#184-186">source</a><h4 class="code-header">pub fn <a href="#method.fill_round_rect" class="fn">fill_round_rect</a>(&self, x: i16, y: i16, w: u8, h: u8, r: u8, color: <a class="enum" href="../prelude/arduboy2/enum.Color.html" title="enum arduboy_rust::prelude::arduboy2::Color">Color</a>)</h4></section></summary><div class="docblock"><p>Draw a filled-in rectangle with rounded corners.</p>
|
||
<p>Parameters</p>
|
||
<ul>
|
||
<li>x The X coordinate of the left edge.</li>
|
||
<li>y The Y coordinate of the top edge.</li>
|
||
<li>w The width of the rectangle.</li>
|
||
<li>h The height of the rectangle.</li>
|
||
<li>r The radius of the semicircles forming the corners.</li>
|
||
<li>color The color of the rectangle (optional; defaults to WHITE).</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.draw_round_rect" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#196-198">source</a><h4 class="code-header">pub fn <a href="#method.draw_round_rect" class="fn">draw_round_rect</a>(&self, x: i16, y: i16, w: u8, h: u8, r: u8, color: <a class="enum" href="../prelude/arduboy2/enum.Color.html" title="enum arduboy_rust::prelude::arduboy2::Color">Color</a>)</h4></section></summary><div class="docblock"><p>Draw a rectangle with rounded corners.</p>
|
||
<p>Parameters</p>
|
||
<ul>
|
||
<li>x The X coordinate of the left edge.</li>
|
||
<li>y The Y coordinate of the top edge.</li>
|
||
<li>w The width of the rectangle.</li>
|
||
<li>h The height of the rectangle.</li>
|
||
<li>r The radius of the semicircles forming the corners.</li>
|
||
<li>color The color of the rectangle (optional; defaults to WHITE).</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.draw_triangle" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#207-218">source</a><h4 class="code-header">pub fn <a href="#method.draw_triangle" class="fn">draw_triangle</a>(
|
||
&self,
|
||
x0: i16,
|
||
y0: i16,
|
||
x1: i16,
|
||
y1: i16,
|
||
x2: i16,
|
||
y2: i16,
|
||
color: <a class="enum" href="../prelude/arduboy2/enum.Color.html" title="enum arduboy_rust::prelude::arduboy2::Color">Color</a>
|
||
)</h4></section></summary><div class="docblock"><p>Draw a triangle given the coordinates of each corner.</p>
|
||
<p>Parameters</p>
|
||
<ul>
|
||
<li>x0,x1,x2 The X coordinates of the corners.</li>
|
||
<li>y0,y1,y2 The Y coordinates of the corners.</li>
|
||
<li>color The triangle’s color (optional; defaults to WHITE).</li>
|
||
</ul>
|
||
<p>A triangle is drawn by specifying each of the three corner locations. The corners can be at any position with respect to the others.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.fill_triangle" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#227-238">source</a><h4 class="code-header">pub fn <a href="#method.fill_triangle" class="fn">fill_triangle</a>(
|
||
&self,
|
||
x0: i16,
|
||
y0: i16,
|
||
x1: i16,
|
||
y1: i16,
|
||
x2: i16,
|
||
y2: i16,
|
||
color: <a class="enum" href="../prelude/arduboy2/enum.Color.html" title="enum arduboy_rust::prelude::arduboy2::Color">Color</a>
|
||
)</h4></section></summary><div class="docblock"><p>Draw a filled-in triangle given the coordinates of each corner.</p>
|
||
<p>Parameters</p>
|
||
<ul>
|
||
<li>x0,x1,x2 The X coordinates of the corners.</li>
|
||
<li>y0,y1,y2 The Y coordinates of the corners.</li>
|
||
<li>color The triangle’s color (optional; defaults to WHITE).</li>
|
||
</ul>
|
||
<p>A triangle is drawn by specifying each of the three corner locations. The corners can be at any position with respect to the others.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_pixel" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#247-249">source</a><h4 class="code-header">pub fn <a href="#method.get_pixel" class="fn">get_pixel</a>(&self, x: u8, y: u8) -> <a class="enum" href="../prelude/arduboy2/enum.Color.html" title="enum arduboy_rust::prelude::arduboy2::Color">Color</a></h4></section></summary><div class="docblock"><p>Returns the state of the given pixel in the screen buffer.</p>
|
||
<h6 id="parameters-5"><a href="#parameters-5">Parameters</a></h6>
|
||
<ul>
|
||
<li>x The X coordinate of the pixel.</li>
|
||
<li>y The Y coordinate of the pixel.</li>
|
||
</ul>
|
||
<h6 id="returns"><a href="#returns">Returns</a></h6>
|
||
<p>WHITE if the pixel is on or BLACK if the pixel is off.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.init_random_seed" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#253-255">source</a><h4 class="code-header">pub fn <a href="#method.init_random_seed" class="fn">init_random_seed</a>(&self)</h4></section></summary><div class="docblock"><p>Seed the random number generator with a random value.</p>
|
||
<p>The Arduino pseudorandom number generator is seeded with the random value returned from a call to generateRandomSeed().</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.just_pressed" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#269-271">source</a><h4 class="code-header">pub fn <a href="#method.just_pressed" class="fn">just_pressed</a>(&self, button: <a class="struct" href="../prelude/struct.ButtonSet.html" title="struct arduboy_rust::prelude::ButtonSet">ButtonSet</a>) -> bool</h4></section></summary><div class="docblock"><p>Check if a button has just been pressed.</p>
|
||
<h6 id="parameters-6"><a href="#parameters-6">Parameters</a></h6>
|
||
<ul>
|
||
<li>button The button to test for. Only one button should be specified.</li>
|
||
</ul>
|
||
<h6 id="returns-1"><a href="#returns-1">Returns</a></h6>
|
||
<p>true if the specified button has just been pressed.</p>
|
||
<p>Return true if the given button was pressed between the latest call to pollButtons() and previous call to pollButtons(). If the button has been held down over multiple polls, this function will return false.</p>
|
||
<p>There is no need to check for the release of the button since it must have been released for this function to return true when pressed again.</p>
|
||
<p>This function should only be used to test a single button.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.just_released" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#285-287">source</a><h4 class="code-header">pub fn <a href="#method.just_released" class="fn">just_released</a>(&self, button: <a class="struct" href="../prelude/struct.ButtonSet.html" title="struct arduboy_rust::prelude::ButtonSet">ButtonSet</a>) -> bool</h4></section></summary><div class="docblock"><p>Check if a button has just been released.</p>
|
||
<h6 id="parameters-7"><a href="#parameters-7">Parameters</a></h6>
|
||
<ul>
|
||
<li>button The button to test for. Only one button should be specified.</li>
|
||
</ul>
|
||
<h6 id="returns-2"><a href="#returns-2">Returns</a></h6>
|
||
<p>true if the specified button has just been released.</p>
|
||
<p>Return true if the given button was released between the latest call to pollButtons() and previous call to pollButtons(). If the button has been held down over multiple polls, this function will return false.</p>
|
||
<p>There is no need to check for the released of the button since it must have been pressed for this function to return true when pressed again.</p>
|
||
<p>This function should only be used to test a single button.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.not_pressed" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#299-301">source</a><h4 class="code-header">pub fn <a href="#method.not_pressed" class="fn">not_pressed</a>(&self, button: <a class="struct" href="../prelude/struct.ButtonSet.html" title="struct arduboy_rust::prelude::ButtonSet">ButtonSet</a>) -> bool</h4></section></summary><div class="docblock"><p>Test if the specified buttons are not pressed.</p>
|
||
<h6 id="parameters-8"><a href="#parameters-8">Parameters</a></h6>
|
||
<ul>
|
||
<li>buttons A bit mask indicating which buttons to test. (Can be a single button)</li>
|
||
</ul>
|
||
<h6 id="returns-3"><a href="#returns-3">Returns</a></h6>
|
||
<p>True if all buttons in the provided mask are currently released.</p>
|
||
<p>Read the state of the buttons and return true if all the buttons in the specified mask are currently released.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.next_frame" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#310-312">source</a><h4 class="code-header">pub fn <a href="#method.next_frame" class="fn">next_frame</a>(&self) -> bool</h4></section></summary><div class="docblock"><p>Indicate that it’s time to render the next frame.</p>
|
||
<h6 id="returns-4"><a href="#returns-4">Returns</a></h6>
|
||
<p>true if it’s time for the next frame.</p>
|
||
<p>When this function returns true, the amount of time has elapsed to display the next frame, as specified by setFrameRate() or setFrameDuration().</p>
|
||
<p>This function will normally be called at the start of the rendering loop which would wait for true to be returned before rendering and displaying the next frame.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.poll_buttons" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#320-322">source</a><h4 class="code-header">pub fn <a href="#method.poll_buttons" class="fn">poll_buttons</a>(&self)</h4></section></summary><div class="docblock"><p>Poll the buttons and track their state over time.</p>
|
||
<p>Read and save the current state of the buttons and also keep track of the button state when this function was previously called. These states are used by the justPressed() and justReleased() functions to determine if a button has changed state between now and the previous call to pollButtons().</p>
|
||
<p>This function should be called once at the start of each new frame.</p>
|
||
<p>The justPressed() and justReleased() functions rely on this function.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.pressed" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#332-334">source</a><h4 class="code-header">pub fn <a href="#method.pressed" class="fn">pressed</a>(&self, button: <a class="struct" href="../prelude/struct.ButtonSet.html" title="struct arduboy_rust::prelude::ButtonSet">ButtonSet</a>) -> bool</h4></section></summary><div class="docblock"><p>Test if the all of the specified buttons are pressed.</p>
|
||
<h6 id="parameters-9"><a href="#parameters-9">Parameters</a></h6>
|
||
<ul>
|
||
<li>buttons A bit mask indicating which buttons to test. (Can be a single button)</li>
|
||
</ul>
|
||
<h6 id="returns-5"><a href="#returns-5">Returns</a></h6>
|
||
<p>true if all buttons in the provided mask are currently pressed.</p>
|
||
<p>Read the state of the buttons and return true if all of the buttons in the specified mask are being pressed.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.print" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#356-358">source</a><h4 class="code-header">pub fn <a href="#method.print" class="fn">print</a>(&self, x: impl <a class="trait" href="../prelude/trait.Printable.html" title="trait arduboy_rust::prelude::Printable">Printable</a>)</h4></section></summary><div class="docblock"><p>The Arduino Print class is available for writing text to the screen buffer.</p>
|
||
<p>For an Arduboy2 class object, functions provided by the Arduino Print class can be used to write text to the screen buffer, in the same manner as the Arduino Serial.print(), etc., functions.</p>
|
||
<p>Print will use the write() function to actually draw each character in the screen buffer, using the library’s font5x7 font. Two character values are handled specially:</p>
|
||
<ul>
|
||
<li>ASCII newline/line feed (\n, 0x0A, inverse white circle). This will move the text cursor position to the start of the next line, based on the current text size.</li>
|
||
<li>ASCII carriage return (\r, 0x0D, musical eighth note). This character will be ignored.</li>
|
||
</ul>
|
||
<p>Example</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>value: i16 = <span class="number">42</span>;
|
||
|
||
arduboy.print(<span class="string">b"Hello World\n\0"</span>[..]); <span class="comment">// Prints "Hello World" and then sets the
|
||
// text cursor to the start of the next line
|
||
</span>arduboy.print(<span class="macro">f!</span>(<span class="string">b"Hello World\n"</span>)); <span class="comment">// Prints "Hello World" but does not use the 2kb ram
|
||
</span>arduboy.print(value); <span class="comment">// Prints "42"
|
||
</span>arduboy.print(<span class="string">"\n\0"</span>); <span class="comment">// Sets the text cursor to the start of the next line
|
||
</span>arduboy.print(<span class="string">"hello world"</span>) <span class="comment">// Prints normal [&str]</span></code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_cursor" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#367-369">source</a><h4 class="code-header">pub fn <a href="#method.set_cursor" class="fn">set_cursor</a>(&self, x: i16, y: i16)</h4></section></summary><div class="docblock"><p>Set the location of the text cursor.</p>
|
||
<h6 id="parameters-10"><a href="#parameters-10">Parameters</a></h6>
|
||
<ul>
|
||
<li>
|
||
<p>x The X (horizontal) coordinate, in pixels, for the new location of the text cursor.</p>
|
||
</li>
|
||
<li>
|
||
<p>y The Y (vertical) coordinate, in pixels, for the new location of the text cursor.</p>
|
||
</li>
|
||
</ul>
|
||
<p>The location of the text cursor is set the the specified coordinates. The coordinates are in pixels. Since the coordinates can specify any pixel location, the text does not have to be placed on specific rows. As with all drawing functions, location 0, 0 is the top left corner of the display. The cursor location represents the top left corner of the next character written.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_frame_rate" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#376-378">source</a><h4 class="code-header">pub fn <a href="#method.set_frame_rate" class="fn">set_frame_rate</a>(&self, rate: u8)</h4></section></summary><div class="docblock"><p>Set the frame rate used by the frame control functions.</p>
|
||
<h6 id="parameters-11"><a href="#parameters-11">Parameters</a></h6>
|
||
<ul>
|
||
<li>rate The desired frame rate in frames per second.</li>
|
||
</ul>
|
||
<p>Normally, the frame rate would be set to the desired value once, at the start of the game, but it can be changed at any time to alter the frame update rate.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_text_size" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#385-387">source</a><h4 class="code-header">pub fn <a href="#method.set_text_size" class="fn">set_text_size</a>(&self, size: u8)</h4></section></summary><div class="docblock"><p>Set the text character size.</p>
|
||
<h6 id="parameters-12"><a href="#parameters-12">Parameters</a></h6>
|
||
<ul>
|
||
<li>s The text size multiplier. Must be 1 or higher.</li>
|
||
</ul>
|
||
<p>Setting a text size of 1 will result in standard size characters with one pixel for each bit in the bitmap for a character. The value specified is a multiplier. A value of 2 will double the width and height. A value of 3 will triple the dimensions, etc.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.audio_on" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#391-393">source</a><h4 class="code-header">pub fn <a href="#method.audio_on" class="fn">audio_on</a>(&self)</h4></section></summary><div class="docblock"><p>Turn sound on.</p>
|
||
<p>The system is configured to generate sound. This function sets the sound mode only until the unit is powered off.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.audio_off" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#397-399">source</a><h4 class="code-header">pub fn <a href="#method.audio_off" class="fn">audio_off</a>(&self)</h4></section></summary><div class="docblock"><p>Turn sound off (mute).</p>
|
||
<p>The system is configured to not produce sound (mute). This function sets the sound mode only until the unit is powered off.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.audio_save_on_off" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#406-408">source</a><h4 class="code-header">pub fn <a href="#method.audio_save_on_off" class="fn">audio_save_on_off</a>(&self)</h4></section></summary><div class="docblock"><p>Save the current sound state in EEPROM.</p>
|
||
<p>The current sound state, set by on() or off(), is saved to the reserved system area in EEPROM. This allows the state to carry over between power cycles and after uploading a different sketch.</p>
|
||
<p>Note
|
||
EEPROM is limited in the number of times it can be written to. Sketches should not continuously change and then save the state rapidly.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.audio_toggle" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#412-414">source</a><h4 class="code-header">pub fn <a href="#method.audio_toggle" class="fn">audio_toggle</a>(&self)</h4></section></summary><div class="docblock"><p>Toggle the sound on/off state.</p>
|
||
<p>If the system is configured for sound on, it will be changed to sound off (mute). If sound is off, it will be changed to on. This function sets the sound mode only until the unit is powered off. To save the current mode use saveOnOff().</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.audio_on_and_save" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#416-421">source</a><h4 class="code-header">pub fn <a href="#method.audio_on_and_save" class="fn">audio_on_and_save</a>(&self)</h4></section></summary><div class="docblock"><p>Combines the use function of <code>audio_on()</code> and <code>audio_save_on_off()</code></p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.audio_enabled" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#428-430">source</a><h4 class="code-header">pub fn <a href="#method.audio_enabled" class="fn">audio_enabled</a>(&self) -> bool</h4></section></summary><div class="docblock"><p>Get the current sound state.</p>
|
||
<h6 id="returns-6"><a href="#returns-6">Returns</a></h6>
|
||
<p>true if sound is currently enabled (not muted).</p>
|
||
<p>This function should be used by code that actually generates sound. If true is returned, sound can be produced. If false is returned, sound should be muted.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.invert" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#439-441">source</a><h4 class="code-header">pub fn <a href="#method.invert" class="fn">invert</a>(&self, inverse: bool)</h4></section></summary><div class="docblock"><p>Invert the entire display or set it back to normal.</p>
|
||
<h6 id="parameters-13"><a href="#parameters-13">Parameters</a></h6>
|
||
<ul>
|
||
<li>inverse true will invert the display. false will set the display to no-inverted.</li>
|
||
</ul>
|
||
<p>Calling this function with a value of true will set the display to inverted mode. A pixel with a value of 0 will be on and a pixel set to 1 will be off.</p>
|
||
<p>Once in inverted mode, the display will remain this way until it is set back to non-inverted mode by calling this function with false.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.collide_point" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#452-457">source</a><h4 class="code-header">pub fn <a href="#method.collide_point" class="fn">collide_point</a>(&self, point: <a class="struct" href="../prelude/arduboy2/struct.Point.html" title="struct arduboy_rust::prelude::arduboy2::Point">Point</a>, rect: <a class="struct" href="../prelude/arduboy2/struct.Rect.html" title="struct arduboy_rust::prelude::arduboy2::Rect">Rect</a>) -> bool</h4></section></summary><div class="docblock"><p>Test if a point falls within a rectangle.</p>
|
||
<p>Parameters</p>
|
||
<ul>
|
||
<li>point A structure describing the location of the point.</li>
|
||
<li>rect A structure describing the location and size of the rectangle.</li>
|
||
</ul>
|
||
<p>Returns
|
||
true if the specified point is within the specified rectangle.</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#467-472">source</a><h4 class="code-header">pub fn <a href="#method.collide_rect" class="fn">collide_rect</a>(&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>) -> bool</h4></section></summary><div class="docblock"><p>Test if a rectangle is intersecting with another rectangle.</p>
|
||
<p>Parameters</p>
|
||
<ul>
|
||
<li>rect1,rect2 Structures describing the size and locations of the rectangles.</li>
|
||
</ul>
|
||
<p>Returns
|
||
true if the first rectangle is intersecting the second.</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#480-482">source</a><h4 class="code-header">pub fn <a href="#method.digital_write_rgb_single" class="fn">digital_write_rgb_single</a>(&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>
|
||
<ul>
|
||
<li>color The name of the LED to set. The value given should be one of RED_LED, GREEN_LED or BLUE_LED.</li>
|
||
<li>val Indicates whether to turn the specified LED on or off. The value given should be RGB_ON or RGB_OFF.</li>
|
||
</ul>
|
||
<p>This 2 parameter version of the function will set a single LED within the RGB LED either fully on or fully off. See the description of the 3 parameter version of this function for more details on the RGB LED.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.digital_write_rgb" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#501-503">source</a><h4 class="code-header">pub fn <a href="#method.digital_write_rgb" class="fn">digital_write_rgb</a>(&self, red: u8, green: u8, blue: u8)</h4></section></summary><div class="docblock"><p>Set the RGB LEDs digitally, to either fully on or fully off.</p>
|
||
<p>Parameters</p>
|
||
<ul>
|
||
<li>red,green,blue Use value RGB_ON or RGB_OFF to set each LED.</li>
|
||
</ul>
|
||
<p>The RGB LED is actually individual red, green and blue LEDs placed very close together in a single package. This 3 parameter version of the function will set each LED either on or off, to set the RGB LED to 7 different colors at their highest brightness or turn it off.</p>
|
||
<div class="example-wrap"><pre class="language-text"><code> The colors are as follows:
|
||
RED LED GREEN LED BLUE LED COLOR
|
||
RGB_OFF RGB_OFF RGB_OFF OFF
|
||
RGB_OFF RGB_OFF RGB_ON Blue
|
||
RGB_OFF RGB_ON RGB_OFF Green
|
||
RGB_OFF RGB_ON RGB_ON Cyan
|
||
RGB_ON RGB_OFF RGB_OFF Red
|
||
RGB_ON RGB_OFF RGB_ON Magenta
|
||
RGB_ON RGB_ON RGB_OFF Yellow
|
||
RGB_ON RGB_ON RGB_ON White
|
||
</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.set_rgb_led_single" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#514-516">source</a><h4 class="code-header">pub fn <a href="#method.set_rgb_led_single" class="fn">set_rgb_led_single</a>(&self, color: u8, val: u8)</h4></section></summary><div class="docblock"><p>Set the brightness of one of the RGB LEDs without affecting the others.</p>
|
||
<p>Parameters</p>
|
||
<ul>
|
||
<li>color The name of the LED to set. The value given should be one of RED_LED, GREEN_LED or BLUE_LED.</li>
|
||
<li>val The brightness value for the LED, from 0 to 255.</li>
|
||
</ul>
|
||
<p><strong>Note</strong></p>
|
||
<blockquote>
|
||
<p>In order to use this function, the 3 parameter version must first be called at least once, in order to initialize the hardware.</p>
|
||
</blockquote>
|
||
<p>This 2 parameter version of the function will set the brightness of a single LED within the RGB LED without affecting the current brightness of the other two. See the description of the 3 parameter version of this function for more details on the RGB LED.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_rgb_led" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#530-532">source</a><h4 class="code-header">pub fn <a href="#method.set_rgb_led" class="fn">set_rgb_led</a>(&self, red: u8, green: u8, blue: u8)</h4></section></summary><div class="docblock"><p>Set the light output of the RGB LED.</p>
|
||
<p>Parameters</p>
|
||
<ul>
|
||
<li>red,green,blue The brightness value for each LED.</li>
|
||
</ul>
|
||
<p>The RGB LED is actually individual red, green and blue LEDs placed very close together in a single package. By setting the brightness of each LED, the RGB LED can show various colors and intensities. The brightness of each LED can be set to a value from 0 (fully off) to 255 (fully on).</p>
|
||
<p><strong>Note</strong></p>
|
||
<blockquote>
|
||
<p>Certain libraries that take control of the hardware timers may interfere with the ability of this function to properly control the RGB LED. ArduboyPlaytune is one such library known to do this. The <code>digital_write_rgb()</code> function will still work properly in this case.</p>
|
||
</blockquote>
|
||
<p><strong>Note</strong></p>
|
||
<blockquote>
|
||
<p>Many of the Kickstarter Arduboys were accidentally shipped with the RGB LED installed incorrectly. For these units, the green LED cannot be lit. As long as the green led is set to off, setting the red LED will actually control the blue LED and setting the blue LED will actually control the red LED. If the green LED is turned fully on, none of the LEDs will light.</p>
|
||
</blockquote>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.every_x_frames" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#552-554">source</a><h4 class="code-header">pub fn <a href="#method.every_x_frames" class="fn">every_x_frames</a>(&self, frames: u8) -> bool</h4></section></summary><div class="docblock"><p>Indicate if the specified number of frames has elapsed.</p>
|
||
<p>Parameters</p>
|
||
<ul>
|
||
<li>frames The desired number of elapsed frames.</li>
|
||
</ul>
|
||
<p>Returns
|
||
true if the specified number of frames has elapsed.</p>
|
||
<p>This function should be called with the same value each time for a given event. It will return true if the given number of frames has elapsed since the previous frame in which it returned true.</p>
|
||
<h6 id="example-1"><a href="#example-1">Example</a></h6>
|
||
<p>If you wanted to fire a shot every 5 frames while the A button is being held down:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">if </span>arduboy.everyXFrames(<span class="number">5</span>) {
|
||
<span class="kw">if </span>arduboy.pressed(A_BUTTON) {
|
||
fireShot();
|
||
}
|
||
}</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.flip_vertical" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#563-565">source</a><h4 class="code-header">pub fn <a href="#method.flip_vertical" class="fn">flip_vertical</a>(&self, flipped: bool)</h4></section></summary><div class="docblock"><p>Flip the display vertically or set it back to normal.</p>
|
||
<p>Parameters</p>
|
||
<ul>
|
||
<li>flipped true will set vertical flip mode. false will set normal vertical orientation.</li>
|
||
</ul>
|
||
<p>Calling this function with a value of true will cause the Y coordinate to start at the bottom edge of the display instead of the top, effectively flipping the display vertically.</p>
|
||
<p>Once in vertical flip mode, it will remain this way until normal vertical mode is set by calling this function with a value of false.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.flip_horizontal" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#574-576">source</a><h4 class="code-header">pub fn <a href="#method.flip_horizontal" class="fn">flip_horizontal</a>(&self, flipped: bool)</h4></section></summary><div class="docblock"><p>Flip the display horizontally or set it back to normal.</p>
|
||
<p>Parameters</p>
|
||
<ul>
|
||
<li>flipped true will set horizontal flip mode. false will set normal horizontal orientation.</li>
|
||
</ul>
|
||
<p>Calling this function with a value of true will cause the X coordinate to start at the left edge of the display instead of the right, effectively flipping the display horizontally.</p>
|
||
<p>Once in horizontal flip mode, it will remain this way until normal horizontal mode is set by calling this function with a value of false.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_text_color" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#581-583">source</a><h4 class="code-header">pub fn <a href="#method.set_text_color" class="fn">set_text_color</a>(&self, color: <a class="enum" href="../prelude/arduboy2/enum.Color.html" title="enum arduboy_rust::prelude::arduboy2::Color">Color</a>)</h4></section></summary><div class="docblock"><p>Set the text foreground color.</p>
|
||
<p>Parameters</p>
|
||
<ul>
|
||
<li>color The color to be used for following text. The values WHITE or BLACK should be used.</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_text_background_color" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#592-594">source</a><h4 class="code-header">pub fn <a href="#method.set_text_background_color" class="fn">set_text_background_color</a>(&self, color: <a class="enum" href="../prelude/arduboy2/enum.Color.html" title="enum arduboy_rust::prelude::arduboy2::Color">Color</a>)</h4></section></summary><div class="docblock"><p>Set the text background color.</p>
|
||
<p>Parameters</p>
|
||
<ul>
|
||
<li>color The background color to be used for following text. The values WHITE or BLACK should be used.</li>
|
||
</ul>
|
||
<p>The background pixels of following characters will be set to the specified color.</p>
|
||
<p>However, if the background color is set to be the same as the text color, the background will be transparent. Only the foreground pixels will be drawn. The background pixels will remain as they were before the character was drawn.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_cursor_x" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#601-603">source</a><h4 class="code-header">pub fn <a href="#method.set_cursor_x" class="fn">set_cursor_x</a>(&self, x: i16)</h4></section></summary><div class="docblock"><p>Set the X coordinate of the text cursor location.</p>
|
||
<p>Parameters</p>
|
||
<ul>
|
||
<li>x The X (horizontal) coordinate, in pixels, for the new location of the text cursor.</li>
|
||
</ul>
|
||
<p>The X coordinate for the location of the text cursor is set to the specified value, leaving the Y coordinate unchanged. For more details about the text cursor, see the setCursor() function.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_cursor_y" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#610-612">source</a><h4 class="code-header">pub fn <a href="#method.set_cursor_y" class="fn">set_cursor_y</a>(&self, y: i16)</h4></section></summary><div class="docblock"><p>Set the Y coordinate of the text cursor location.</p>
|
||
<p>Parameters</p>
|
||
<ul>
|
||
<li>y The Y (vertical) coordinate, in pixels, for the new location of the text cursor.</li>
|
||
</ul>
|
||
<p>The Y coordinate for the location of the text cursor is set to the specified value, leaving the X coordinate unchanged. For more details about the text cursor, see the setCursor() function.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_text_wrap" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#621-623">source</a><h4 class="code-header">pub fn <a href="#method.set_text_wrap" class="fn">set_text_wrap</a>(&self, w: bool)</h4></section></summary><div class="docblock"><p>Set or disable text wrap mode.</p>
|
||
<p>Parameters</p>
|
||
<ul>
|
||
<li>w true enables text wrap mode. false disables it.</li>
|
||
</ul>
|
||
<p>Text wrap mode is enabled by specifying true. In wrap mode, if a character to be drawn would end up partially or fully past the right edge of the screen (based on the current text size), it will be placed at the start of the next line. The text cursor will be adjusted accordingly.</p>
|
||
<p>If wrap mode is disabled, characters will always be written at the current text cursor position. A character near the right edge of the screen may only be partially displayed and characters drawn at a position past the right edge of the screen will remain off screen.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.idle" class="method"><a class="src rightside" href="../../src/arduboy_rust/library/arduboy2.rs.html#627-629">source</a><h4 class="code-header">pub fn <a href="#method.idle" class="fn">idle</a>(&self)</h4></section></summary><div class="docblock"><p>Idle the CPU to save power.</p>
|
||
<p>This puts the CPU in idle sleep mode. You should call this as often as you can for the best power savings. The timer 0 overflow interrupt will wake up the chip every 1ms, so even at 60 FPS a well written app should be able to sleep maybe half the time in between rendering it’s own frames.</p>
|
||
</div></details></div></details></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-Arduboy2" class="impl"><a href="#impl-RefUnwindSafe-for-Arduboy2" class="anchor">§</a><h3 class="code-header">impl RefUnwindSafe for <a class="struct" href="../prelude/arduboy2/struct.Arduboy2.html" title="struct arduboy_rust::prelude::arduboy2::Arduboy2">Arduboy2</a></h3></section><section id="impl-Send-for-Arduboy2" class="impl"><a href="#impl-Send-for-Arduboy2" class="anchor">§</a><h3 class="code-header">impl Send for <a class="struct" href="../prelude/arduboy2/struct.Arduboy2.html" title="struct arduboy_rust::prelude::arduboy2::Arduboy2">Arduboy2</a></h3></section><section id="impl-Sync-for-Arduboy2" class="impl"><a href="#impl-Sync-for-Arduboy2" class="anchor">§</a><h3 class="code-header">impl Sync for <a class="struct" href="../prelude/arduboy2/struct.Arduboy2.html" title="struct arduboy_rust::prelude::arduboy2::Arduboy2">Arduboy2</a></h3></section><section id="impl-Unpin-for-Arduboy2" class="impl"><a href="#impl-Unpin-for-Arduboy2" class="anchor">§</a><h3 class="code-header">impl Unpin for <a class="struct" href="../prelude/arduboy2/struct.Arduboy2.html" title="struct arduboy_rust::prelude::arduboy2::Arduboy2">Arduboy2</a></h3></section><section id="impl-UnwindSafe-for-Arduboy2" class="impl"><a href="#impl-UnwindSafe-for-Arduboy2" class="anchor">§</a><h3 class="code-header">impl UnwindSafe for <a class="struct" href="../prelude/arduboy2/struct.Arduboy2.html" title="struct arduboy_rust::prelude::arduboy2::Arduboy2">Arduboy2</a></h3></section></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-Arduboy2" class="impl"><a href="#impl-Any-for-Arduboy2" class="anchor">§</a><h3 class="code-header">impl<T> Any for T<span class="where fmt-newline">where
|
||
T: 'static + ?Sized,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a class="fn">type_id</a>(&self) -> TypeId</h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-Arduboy2" class="impl"><a href="#impl-Borrow%3CT%3E-for-Arduboy2" class="anchor">§</a><h3 class="code-header">impl<T> Borrow<T> for T<span class="where fmt-newline">where
|
||
T: ?Sized,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a class="fn">borrow</a>(&self) -> &T</h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-Arduboy2" class="impl"><a href="#impl-BorrowMut%3CT%3E-for-Arduboy2" class="anchor">§</a><h3 class="code-header">impl<T> BorrowMut<T> for T<span class="where fmt-newline">where
|
||
T: ?Sized,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a class="fn">borrow_mut</a>(&mut self) -> &mut T</h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-Arduboy2" class="impl"><a href="#impl-From%3CT%3E-for-Arduboy2" class="anchor">§</a><h3 class="code-header">impl<T> From<T> for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a class="fn">from</a>(t: T) -> T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-Arduboy2" class="impl"><a href="#impl-Into%3CU%3E-for-Arduboy2" class="anchor">§</a><h3 class="code-header">impl<T, U> Into<U> for T<span class="where fmt-newline">where
|
||
U: From<T>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a class="fn">into</a>(self) -> U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
|
||
<p>That is, this conversion is whatever the implementation of
|
||
<code>[From]<T> for U</code> chooses to do.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-Arduboy2" class="impl"><a href="#impl-TryFrom%3CU%3E-for-Arduboy2" class="anchor">§</a><h3 class="code-header">impl<T, U> TryFrom<U> for T<span class="where fmt-newline">where
|
||
U: Into<T>,</span></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Error</a> = Infallible</h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a class="fn">try_from</a>(value: U) -> Result<T, <T as TryFrom<U>>::Error></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-Arduboy2" class="impl"><a href="#impl-TryInto%3CU%3E-for-Arduboy2" class="anchor">§</a><h3 class="code-header">impl<T, U> TryInto<U> for T<span class="where fmt-newline">where
|
||
U: TryFrom<T>,</span></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Error</a> = <U as TryFrom<T>>::Error</h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a class="fn">try_into</a>(self) -> Result<U, <U as TryFrom<T>>::Error></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main></body></html> |