<!DOCTYPE html><htmllang="en"><head><metacharset="utf-8"><metaname="viewport"content="width=device-width, initial-scale=1.0"><metaname="generator"content="rustdoc"><metaname="description"content="This is the struct to interact in a save way with the ArduboyTones C++ library."><title>ArduboyTones in arduboy_rust - Rust</title><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><linkrel="stylesheet"href="../static.files/normalize-76eba96aa4d2e634.css"><linkrel="stylesheet"href="../static.files/rustdoc-cb6f1f67f1bcd037.css"id="mainThemeStyle"><metaname="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.73.0-nightly (8131b9774 2023-08-02)"data-channel="nightly"data-search-js="search-6dfdfced5eff6596.js"data-settings-js="settings-de11bff964e9d4e5.js"data-settings-css="settings-8c76f75bfb6bd192.css"data-theme-light-css="light-6d2c9675f3d09c26.css"data-theme-dark-css="dark-45ceb8f2e522f4d1.css"data-theme-ayu-css="ayu-fd19013d6ce078bf.css"><scriptsrc="../static.files/storage-db41da1a38ea3cb8.js"></script><scriptdefersrc="sidebar-items.js"></script><scriptdefersrc="../static.files/main-0795b7d26be81095.js"></script><noscript><linkrel="stylesheet"media="(prefers-color-scheme:light)"href="../static.files/light-6d2c9675f3d09c26.css"><linkrel="stylesheet"media="(prefers-color-scheme:dark)"href="../static.files/dark-45ceb8f2e522f4d1.css"><linkrel="stylesheet"href="../static.files/noscript-cffde32267a19fd6.css"></noscript><linkrel="alternate icon"type="image/png"href="../static.files/favicon-16x16-8b506e7a72182f1c.png"><linkrel="alternate icon"type="image/png"href="../static.files/favicon-32x32-422f7d1d52889060.png"><linkrel="icon"type="image/svg+xml"href="../static.files/favicon-2c020d218678b618.svg"></head><bodyclass="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><navclass="mobile-topbar"><buttonclass="sidebar-menu-toggle">☰</button><aclass="logo-container"href="../arduboy_rust/index.html"><imgclass="rust-logo"src="../static.files/rust-logo-151179464ae7ed46.svg"alt="logo"></a><h2></h2></nav><navclass="sidebar"><aclass="logo-container"href="../arduboy_rust/index.html"><imgclass="rust-logo"src="../static.files/rust-logo-151179464ae7ed46.svg"alt="logo"></a><h2class="location"><ahref="#">ArduboyTones</a></h2><divclass="sidebar-elems"><section><h3><ahref="#implementations">Methods</a></h3><ulclass="block"><li><ahref="#method.new">new</a></li><li><ahref="#method.no_tone">no_tone</a></li><li><ahref="#method.playing">playing</a></li><li><ahref="#method.tone">tone</a></li><li><ahref="#method.tone2">tone2</a></li><li><ahref="#method.tone3">tone3</a></li><li><ahref="#method.tones">tones</a></li><li><ahref="#method.tones_in_ram">tones_in_ram</a></li><li><ahref="#method.volume_mode">volume_mode</a></li></ul><h3><ahref="#synthetic-implementations">Auto Trait Implementations</a></h3><ulclass="block"><li><ahref="#impl-RefUnwindSafe-for-ArduboyTones">RefUnwindSafe</a></li><li><ahref="#impl-Send-for-ArduboyTones">Send</a></li><li><ahref="#impl-Sync-for-ArduboyTones">Sync</a></li><li><ahref="#impl-Unpin-for-ArduboyTones">Unpin</a></li><li><ahre
)</h4></section></summary><divclass="docblock"><p>Play three tones in sequence.</p>
<ul>
<li>freq1,freq2,freq3 The frequency of the tone, in hertz.</li>
<li>dur1,dur2,dur3 The duration to play the tone for, in 1024ths of a
second (very close to milliseconds).</li>
</ul>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.tones"class="method"><aclass="src rightside"href="../src/arduboy_rust/library/arduboy_tone.rs.html#99-101">source</a><h4class="code-header">pub fn <ahref="#method.tones"class="fn">tones</a>(&self, tones: *const u16)</h4></section></summary><divclass="docblock"><p>Play a tone sequence from frequency/duration pairs in a PROGMEM array.</p>
<ul>
<li>tones A pointer to an array of frequency/duration pairs.</li>
</ul>
<p>The array must be placed in code space using <code>PROGMEM</code>.</p>
<p>See the <code>tone()</code> function for details on the frequency and duration values.
A frequency of 0 for any tone means silence (a musical rest).</p>
<p>The last element of the array must be <code>TONES_END</code> or <code>TONES_REPEAT</code>.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.no_tone"class="method"><aclass="src rightside"href="../src/arduboy_rust/library/arduboy_tone.rs.html#106-108">source</a><h4class="code-header">pub fn <ahref="#method.no_tone"class="fn">no_tone</a>(&self)</h4></section></summary><divclass="docblock"><p>Stop playing the tone or sequence.</p>
<p>If a tone or sequence is playing, it will stop. If nothing
is playing, this function will do nothing.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.playing"class="method"><aclass="src rightside"href="../src/arduboy_rust/library/arduboy_tone.rs.html#112-114">source</a><h4class="code-header">pub fn <ahref="#method.playing"class="fn">playing</a>(&self) -> bool</h4></section></summary><divclass="docblock"><p>Check if a tone or tone sequence is playing.</p>
<ul>
<li>return boolean <code>true</code> if playing (even if sound is muted).</li>
</ul>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.tones_in_ram"class="method"><aclass="src rightside"href="../src/arduboy_rust/library/arduboy_tone.rs.html#134-136">source</a><h4class="code-header">pub fn <ahref="#method.tones_in_ram"class="fn">tones_in_ram</a>(&self, tones: *mut u32)</h4></section></summary><divclass="docblock"><p>Play a tone sequence from frequency/duration pairs in an array in RAM.</p>
<ul>
<li>tones A pointer to an array of frequency/duration pairs.</li>
</ul>
<p>The array must be located in RAM.</p>
<p>See the <code>tone()</code> function for details on the frequency and duration values.
A frequency of 0 for any tone means silence (a musical rest).</p>
<p>The last element of the array must be <code>TONES_END</code> or <code>TONES_REPEAT</code>.</p>
<p>Using <code>tones()</code>, with the data in PROGMEM, is normally a better
choice. The only reason to use tonesInRAM() would be if dynamically
altering the contents of the array is required.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.volume_mode"class="method"><aclass="src rightside"href="../src/arduboy_rust/library/arduboy_tone.rs.html#145-147">source</a><h4class="code-header">pub fn <ahref="#method.volume_mode"class="fn">volume_mode</a>(&self, mode: u8)</h4></section></summary><divclass="docblock"><p>Set the volume to always normal, always high, or tone controlled.</p>
<p>One of the following values should be used:</p>
<ul>
<li><code>VOLUME_IN_TONE</code> The volume of each tone will be specified in the tone
itself.</li>
<li><code>VOLUME_ALWAYS_NORMAL</code> All tones will play at the normal volume level.</li>
<li><code>VOLUME_ALWAYS_HIGH</code> All tones will play at the high volume level.</li>
</ul>
</div></details></div></details></div><h2id="synthetic-implementations"class="small-section-header">Auto Trait Implementations<ahref="#synthetic-implementations"class="anchor">§</a></h2><divid="synthetic-implementations-list"><sectionid="impl-RefUnwindSafe-for-ArduboyTones"class="impl"><ahref="#impl-RefUnwindSafe-for-ArduboyTones"class="anchor">§</a><h3class="code-header">impl RefUnwindSafe for <aclass="struct"href="prelude/arduboy_tone/struct.ArduboyTones.html"title="struct arduboy_rust::prelude::arduboy_tone::ArduboyTones">ArduboyTones</a></h3></section><sectionid="impl-Send-for-ArduboyTones"class="impl"><ahref="#impl-Send-for-ArduboyTones"class="anchor">§</a><h3class="code-header">impl Send for <aclass="struct"href="prelude/arduboy_tone/struct.ArduboyTones.html"title="struct arduboy_rust::prelude::arduboy_tone::ArduboyTones">ArduboyTones</a></h3></section><sectionid="impl-Sync-for-ArduboyTones"class="impl"><ahref="#impl-Sync-for-ArduboyTones"class="anchor">§</a><h3class="code-header">impl Sync for <aclass="struct"href="prelude/arduboy_tone/struct.ArduboyTones.html"title="struct arduboy_rust::prelude::arduboy_tone::ArduboyTones">ArduboyTones</a></h3></section><sectionid="impl-Unpin-for-ArduboyTones"class="impl"><ahref="#impl-Unpin-for-ArduboyTones"class="anchor">§</a><h3class="code-header">impl Unpin for <aclass="struct"href="prelude/arduboy_tone/struct.ArduboyTones.html"title="struct arduboy_rust::prelude::arduboy_tone::ArduboyTones">ArduboyTones</a></h3></section><sectionid="impl-UnwindSafe-for-ArduboyTones"class="impl"><ahref="#impl-UnwindSafe-for-ArduboyTones"class="anchor">§</a><h3class="code-header">impl UnwindSafe for <aclass="struct"href="prelude/arduboy_tone/struct.ArduboyTones.html"title="struct arduboy_rust::prelude::arduboy_tone::ArduboyTones">ArduboyTones</a></h3></section></div><h2id="blanket-implementations"class="small-section-header">Blanket Implementations<ahref="#blanket-implementations"class="anchor">§</a></h2><divid="blanket-implementations-list"><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-Any-for-ArduboyTones"class="impl"><ahref="#impl-Any-for-ArduboyTones"class="anchor">§</a><h3class="code-header">impl<T> Any for T<spanclass="where fmt-newline">where
T: 'static + ?Sized,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.type_id"class="method trait-impl"><ahref="#method.type_id"class="anchor">§</a><h4class="code-header">fn <aclass="fn">type_id</a>(&self) -> TypeId</h4></section></summary><divclass='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-Borrow%3CT%3E-for-ArduboyTones"class="impl"><ahref="#impl-Borrow%3CT%3E-for-ArduboyTones"class="anchor">§</a><h3class="code-header">impl<T> Borrow<T> for T<spanclass="where fmt-newline">where
T: ?Sized,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.borrow"class="method trait-impl"><ahref="#method.borrow"class="anchor">§</a><h4class="code-header">fn <aclass="fn">borrow</a>(&self) ->&T</h4></section></summary><divclass='docblock'>Immutably borrows from an owned value. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-BorrowMut%3CT%3E-for-ArduboyTones"class="impl"><ahref="#impl-BorrowMut%3CT%3E-for-ArduboyTones"class="anchor">§</a><h3class="code-header">impl<T> BorrowMut<T> for T<spanclass="where fmt-newline">where
T: ?Sized,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.borrow_mut"class="method trait-impl"><ahref="#method.borrow_mut"class="anchor">§</a><h4class="code-header">fn <aclass="fn">borrow_mut</a>(&mut self) ->&mut T</h4></section></summary><divclass='docblock'>Mutably borrows from an owned value. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-From%3CT%3E-for-ArduboyTones"class="impl"><ahref="#impl-From%3CT%3E-for-ArduboyTones"class="anchor">§</a><h3class="code-header">impl<T> From<T> for T</h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.from"class="method trait-impl"><ahref="#method.from"class="anchor">§</a><h4class="code-header">fn <aclass="fn">from</a>(t: T) -> T</h4></section></summary><divclass="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-Into%3CU%3E-for-ArduboyTones"class="impl"><ahref="#impl-Into%3CU%3E-for-ArduboyTones"class="anchor">§</a><h3class="code-header">impl<T, U> Into<U> for T<spanclass="where fmt-newline">where
<p>That is, this conversion is whatever the implementation of
<code>[From]<T> for U</code> chooses to do.</p>
</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-TryFrom%3CU%3E-for-ArduboyTones"class="impl"><ahref="#impl-TryFrom%3CU%3E-for-ArduboyTones"class="anchor">§</a><h3class="code-header">impl<T, U> TryFrom<U> for T<spanclass="where fmt-newline">where
U: Into<T>,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Error-1"class="associatedtype trait-impl"><ahref="#associatedtype.Error-1"class="anchor">§</a><h4class="code-header">type <aclass="associatedtype">Error</a> = Infallible</h4></section></summary><divclass='docblock'>The type returned in the event of a conversion error.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_from"class="method trait-impl"><ahref="#method.try_from"class="anchor">§</a><h4class="code-header">fn <aclass="fn">try_from</a>(value: U) -> Result<T, <T as TryFrom<U>>::Error></h4></section></summary><divclass='docblock'>Performs the conversion.</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-TryInto%3CU%3E-for-ArduboyTones"class="impl"><ahref="#impl-TryInto%3CU%3E-for-ArduboyTones"class="anchor">§</a><h3class="code-header">impl<T, U> TryInto<U> for T<spanclass="where fmt-newline">where
U: TryFrom<T>,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Error"class="associatedtype trait-impl"><ahref="#associatedtype.Error"class="anchor">§</a><h4class="code-header">type <aclass="associatedtype">Error</a> = <U as TryFrom<T>>::Error</h4></section></summary><divclass='docblock'>The type returned in the event of a conversion error.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_into"class="method trait-impl"><ahref="#method.try_into"class="anchor">§</a><h4class="code-header">fn <aclass="fn">try_into</a>(self) -> Result<U, <U as TryFrom<T>>::Error></h4></section></summary><divclass='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main></body></html>