<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to CodeOrganization</title><link>https://sourceforge.net/p/matrixpilot/wiki/CodeOrganization/</link><description>Recent changes to CodeOrganization</description><atom:link href="https://sourceforge.net/p/matrixpilot/wiki/CodeOrganization/feed" rel="self"/><language>en</language><lastBuildDate>Sun, 03 May 2015 01:27:24 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/matrixpilot/wiki/CodeOrganization/feed" rel="self" type="application/rss+xml"/><item><title>CodeOrganization modified by Anonymous</title><link>https://sourceforge.net/p/matrixpilot/wiki/CodeOrganization/</link><description>&lt;div class="markdown_content"&gt;&lt;h1 id="code-organization"&gt;Code Organization&lt;/h1&gt;
&lt;p&gt;Here's some brief info on how to get started digging into the &lt;a class="" href="/p/matrixpilot/wiki/MatrixPilot"&gt;MatrixPilot&lt;/a&gt; code base. &lt;/p&gt;
&lt;p&gt;First of all, as of &lt;a class="" href="/p/matrixpilot/wiki/MatrixPilot"&gt;MatrixPilot&lt;/a&gt; 3.0, the code is divided into a few sections: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;libUDB&lt;/strong&gt; is the library that interfaces with the UAVDevBoard hardware, and gives you easy access to things like RC inputs, servo outputs, serial ports, LEDs, and gyro and accelerometer data. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;libDCM&lt;/strong&gt; is a library that uses libUDB, and implements a Direction Cosine Matrix, which keeps track of the attitude/orientation and location of the plane. It is used by &lt;a class="" href="/p/matrixpilot/wiki/MatrixPilot"&gt;MatrixPilot&lt;/a&gt;, as well as by the &lt;a class="" href="../RollPitchYaw"&gt;RollPitchYaw&lt;/a&gt; demo app, and the LED-Test app used for testing the board and sensors. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a class="" href="/p/matrixpilot/wiki/MatrixPilot"&gt;MatrixPilot&lt;/a&gt;&lt;/strong&gt; is an application that uses the above 2 libraries to control an RC plane. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;One of the best ways to learn about the architecture of &lt;a class="" href="/p/matrixpilot/wiki/MatrixPilot"&gt;MatrixPilot&lt;/a&gt; is to study the interrupt service routines in libUDB. &lt;a class="" href="/p/matrixpilot/wiki/MatrixPilot"&gt;MatrixPilot&lt;/a&gt; is run almost completely from interrupts and their timers. The interrupts are described in &lt;a class="" href="https://docs.google.com/document/pub?id=133ByuhulBTqxOuNHdbLf0cYfeiKzBoP4jNg_rGOAYpM" rel="nofollow"&gt;an online document here&lt;/a&gt; ( &lt;a class="" href="http://code.google.com/p/gentlenav/downloads/detail?name=AnIntroductiontoMatrixPilotInterrupts.pdf&amp;amp;can=2&amp;amp;q=" rel="nofollow"&gt;PDF version here&lt;/a&gt;). &lt;/p&gt;
&lt;h2 id="portability"&gt;Portability&lt;/h2&gt;
&lt;p&gt;As of &lt;a class="" href="/p/matrixpilot/wiki/MatrixPilot"&gt;MatrixPilot&lt;/a&gt; 3.4 we're targeting not just the dsPIC based controller boards, but also other platforms when building the code for Software-In-the-Loop &lt;a class="" href="../SoftwareInLoop"&gt;(SILSIM)&lt;/a&gt; Simulation. This means that we need to keep the code portable. Things to keep in mind: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;All code that accesses hardware-specific data (timers, interrupts, RCON, etc.) needs to live in libUDB, which keeps the other sections of the code as portable as possible. &lt;/li&gt;
&lt;li&gt;And we also need to keep as much non-hardware-specific code as we can out of libUDB, to avoid needing to reimplement those parts when porting to a new platform. &lt;/li&gt;
&lt;li&gt;We now use the more specific types int8_t, int16_t, int32_t, etc from stdint.h instead of char, short, int, long, etc., to make sure we end up with the same-sized variables on all platforms. &lt;/li&gt;
&lt;li&gt;We also can't assume the size of pointers. &lt;/li&gt;
&lt;li&gt;We've created a C implementation of some dsPIC assembly instructions, and parts of the microchip DSP library, and as we use more of these functions in the code, we'll need to add C-implementations of these functions as well. &lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Anonymous</dc:creator><pubDate>Sun, 03 May 2015 01:27:24 -0000</pubDate><guid>https://sourceforge.net1593d42b1564b7b42a96e138e138a43aca787b56</guid></item></channel></rss>