This commit is contained in:
2025-07-05 17:17:50 -04:00
parent 0b86a2bb05
commit a04b090e1b
9 changed files with 84 additions and 3 deletions

View File

@@ -27,3 +27,17 @@ Struct Walkthrough
*nav_bttn* represents a joystick push-button. *nav_bttn* represents a joystick push-button.
*led* allows the transmitter to toggle an onboard LED and is used for status indication (e.g. pairing, battery warning, etc). *led* allows the transmitter to toggle an onboard LED and is used for status indication (e.g. pairing, battery warning, etc).
*motor1_rpm_pwm* to *motor4_rpm_pwm* provide individual PWM signals to four DC motors.
This enables fine-grained speed control, supports differential drive configurations, and even allows for maneuvering in multi-directional platforms like omni-wheel robots.
Why Use __attribute((packed))?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The packed attribute tells the compiler not to add any padding between fields in memory. This makes the struct:
- Compact
- Predictable for serialization over protocols like UART or ESP-NOW
- Ideal for low-latency transmission in embedded systems
This ensures the receiver interprets the exact byte layout you expect, minimizing bandwidth and maximizing compatibility across platforms.

View File

@@ -56,6 +56,20 @@ Its intended to be sent from a transmitting device (like a remote control or
<p><em>x_axis</em> and <em>y_axis</em> fields capture analog input from a joystick, determining direction and speed. <p><em>x_axis</em> and <em>y_axis</em> fields capture analog input from a joystick, determining direction and speed.
<em>nav_bttn</em> represents a joystick push-button.</p> <em>nav_bttn</em> represents a joystick push-button.</p>
<p><em>led</em> allows the transmitter to toggle an onboard LED and is used for status indication (e.g. pairing, battery warning, etc).</p> <p><em>led</em> allows the transmitter to toggle an onboard LED and is used for status indication (e.g. pairing, battery warning, etc).</p>
<p><em>motor1_rpm_pwm</em> to <em>motor4_rpm_pwm</em> provide individual PWM signals to four DC motors.
This enables fine-grained speed control, supports differential drive configurations, and even allows for maneuvering in multi-directional platforms like omni-wheel robots.</p>
</section>
<section id="why-use-attribute-packed">
<h2>Why Use __attribute((packed))?<a class="headerlink" href="#why-use-attribute-packed" title="Link to this heading"></a></h2>
<p>The packed attribute tells the compiler not to add any padding between fields in memory. This makes the struct:</p>
<blockquote>
<div><ul class="simple">
<li><p>Compact</p></li>
<li><p>Predictable for serialization over protocols like UART or ESP-NOW</p></li>
<li><p>Ideal for low-latency transmission in embedded systems</p></li>
</ul>
</div></blockquote>
<p>This ensures the receiver interprets the exact byte layout you expect, minimizing bandwidth and maximizing compatibility across platforms.</p>
</section> </section>
</section> </section>
@@ -90,6 +104,7 @@ Its intended to be sent from a transmitting device (like a remote control or
<li class="toctree-l1"><a class="reference internal" href="overview.html">HOW DOES IT WORK?</a></li> <li class="toctree-l1"><a class="reference internal" href="overview.html">HOW DOES IT WORK?</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">DATA STRUCT</a><ul> <li class="toctree-l1 current"><a class="current reference internal" href="#">DATA STRUCT</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#struct-walkthrough">Struct Walkthrough</a></li> <li class="toctree-l2"><a class="reference internal" href="#struct-walkthrough">Struct Walkthrough</a></li>
<li class="toctree-l2"><a class="reference internal" href="#why-use-attribute-packed">Why Use __attribute((packed))?</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference internal" href="transmitter.html">TRANSMITTER</a></li> <li class="toctree-l1"><a class="reference internal" href="transmitter.html">TRANSMITTER</a></li>

View File

@@ -46,6 +46,7 @@
</li> </li>
<li class="toctree-l1"><a class="reference internal" href="data.html">DATA STRUCT</a><ul> <li class="toctree-l1"><a class="reference internal" href="data.html">DATA STRUCT</a><ul>
<li class="toctree-l2"><a class="reference internal" href="data.html#struct-walkthrough">Struct Walkthrough</a></li> <li class="toctree-l2"><a class="reference internal" href="data.html#struct-walkthrough">Struct Walkthrough</a></li>
<li class="toctree-l2"><a class="reference internal" href="data.html#why-use-attribute-packed">Why Use __attribute((packed))?</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference internal" href="transmitter.html">TRANSMITTER</a><ul> <li class="toctree-l1"><a class="reference internal" href="transmitter.html">TRANSMITTER</a><ul>

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
# Sphinx build info version 1 # Sphinx build info version 1
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done. # This file records the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 4ff0b7a7d45b83bb7dd9dbbad6843002 config: b38705e9208fae3c4e0e02be9136bc77
tags: 62a1e7829a13fc7881b6498c52484ec0 tags: 62a1e7829a13fc7881b6498c52484ec0

View File

@@ -97,6 +97,11 @@
Struct Walkthrough Struct Walkthrough
</a> </a>
</li> </li>
<li class="toctree-l2">
<a class="reference internal" href="#why-use-attribute-packed">
Why Use __attribute((packed))?
</a>
</li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"> <li class="toctree-l1">
@@ -662,6 +667,52 @@ It&rsquo;s intended to be sent from a transmitting device (like a remote control
</em> </em>
allows the transmitter to toggle an onboard LED and is used for status indication (e.g. pairing, battery warning, etc). allows the transmitter to toggle an onboard LED and is used for status indication (e.g. pairing, battery warning, etc).
</p> </p>
<p>
<em>
motor1_rpm_pwm
</em>
to
<em>
motor4_rpm_pwm
</em>
provide individual PWM signals to four DC motors.
This enables fine-grained speed control, supports differential drive configurations, and even allows for maneuvering in multi-directional platforms like omni-wheel robots.
</p>
</section>
<section id="why-use-attribute-packed">
<h3>
Why Use __attribute((packed))?
<a class="headerlink" href="#why-use-attribute-packed" title="Link to this heading">
&para;
</a>
</h3>
<p>
The packed attribute tells the compiler not to add any padding between fields in memory. This makes the struct:
</p>
<blockquote>
<div>
<ul class="simple">
<li>
<p>
Compact
</p>
</li>
<li>
<p>
Predictable for serialization over protocols like UART or ESP-NOW
</p>
</li>
<li>
<p>
Ideal for low-latency transmission in embedded systems
</p>
</li>
</ul>
</div>
</blockquote>
<p>
This ensures the receiver interprets the exact byte layout you expect, minimizing bandwidth and maximizing compatibility across platforms.
</p>
</section> </section>
</section> </section>
<span id="document-transmitter"> <span id="document-transmitter">