update docs and added support to print String from heapless
This commit is contained in:
parent
2c47c3ad9a
commit
b6cf7e43c7
23 changed files with 161 additions and 122 deletions
|
@ -751,6 +751,7 @@
|
|||
<a href="#751" id="751">751</a>
|
||||
<a href="#752" id="752">752</a>
|
||||
<a href="#753" id="753">753</a>
|
||||
<a href="#754" id="754">754</a>
|
||||
</pre></div><pre class="rust"><code><span class="doccomment">//! This is the Module to interact in a save way with the Arduboy2 C++ library.
|
||||
//!
|
||||
//! All of the functions are safe wrapped inside the [Arduboy2] struct.
|
||||
|
@ -1099,6 +1100,7 @@
|
|||
///
|
||||
/// arduboy.print(b"Hello World\n\0"[..]); // Prints "Hello World" and then sets the
|
||||
/// // text cursor to the start of the next line
|
||||
/// arduboy.print(f!(b"Hello World\n")); // Prints "Hello World" but does not use the 2kb ram
|
||||
/// arduboy.print(value); // Prints "42"
|
||||
/// arduboy.print("\n\0"); // Sets the text cursor to the start of the next line
|
||||
/// arduboy.print("hello world") // Prints normal [&str]
|
||||
|
|
|
@ -244,7 +244,7 @@
|
|||
/// This automatically saves the given text to the Progmem.
|
||||
/// ## Example
|
||||
/// ```
|
||||
/// arduboy.print(f!(b"Random text to print"))
|
||||
/// arduboy.print(f!(b"Random text to print\0"))
|
||||
/// ```
|
||||
</span><span class="attr">#[macro_export]
|
||||
</span><span class="macro">macro_rules! </span>f {
|
||||
|
|
|
@ -114,6 +114,17 @@
|
|||
<a href="#114" id="114">114</a>
|
||||
<a href="#115" id="115">115</a>
|
||||
<a href="#116" id="116">116</a>
|
||||
<a href="#117" id="117">117</a>
|
||||
<a href="#118" id="118">118</a>
|
||||
<a href="#119" id="119">119</a>
|
||||
<a href="#120" id="120">120</a>
|
||||
<a href="#121" id="121">121</a>
|
||||
<a href="#122" id="122">122</a>
|
||||
<a href="#123" id="123">123</a>
|
||||
<a href="#124" id="124">124</a>
|
||||
<a href="#125" id="125">125</a>
|
||||
<a href="#126" id="126">126</a>
|
||||
<a href="#127" id="127">127</a>
|
||||
</pre></div><pre class="rust"><code><span class="kw">use </span><span class="kw">crate</span>::prelude::Pstring;
|
||||
<span class="kw">use </span>core::ffi::c_int;
|
||||
|
||||
|
@ -218,6 +229,17 @@
|
|||
|
||||
<span class="kw">fn </span>default_parameters() -> <span class="self">Self</span>::Parameters {}
|
||||
}
|
||||
<span class="kw">impl</span><<span class="kw">const </span>N: usize> Printable <span class="kw">for </span><span class="kw">crate</span>::heapless::String<N> {
|
||||
<span class="kw">type </span>Parameters = ();
|
||||
|
||||
<span class="kw">fn </span>print_2(<span class="self">self</span>, _params: <span class="self">Self</span>::Parameters) {
|
||||
<span class="kw">unsafe </span>{
|
||||
<span class="kw">crate</span>::library::arduboy2::print_chars(<span class="self">self</span>.as_bytes() <span class="kw">as </span><span class="kw-2">*const </span>[u8] <span class="kw">as </span><span class="kw-2">*const </span>i8);
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">fn </span>default_parameters() -> <span class="self">Self</span>::Parameters {}
|
||||
}
|
||||
|
||||
<span class="kw">impl </span>Printable <span class="kw">for </span>Pstring {
|
||||
<span class="kw">type </span>Parameters = ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue