Revision: 3651
Author:
robert.d...@gmail.com
Date: Sun Jun 7 16:01:09 2015 UTC
Log: MatrixPilot_trunk: add a README.md file as requested, and commit
a few other minor updates..
https://code.google.com/p/gentlenav/source/detail?r=3651
Added:
/trunk/README.md
Modified:
/trunk/MatrixPilot/MAVLink.c
/trunk/RollPitchYaw/main.c
/trunk/Tools/Build/pyProjectCreator.py
/trunk/Tools/LedTest/Config/options.h
/trunk/Tools/LedTest/main.c
/trunk/Tools/MatrixPilot-SIL/SIL-I2C1.c
/trunk/libUDB/ConfigPX4.h
=======================================
--- /dev/null
+++ /trunk/README.md Sun Jun 7 16:01:09 2015 UTC
@@ -0,0 +1,34 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// MatrixPilot
+//
+// Firmware for Bill Premerlani's IMU based UAV Dev Board
+//
+
+Welcome to the MatrixPilot codebase. This code currently supports three
board types, the UDB4 and UDB5 from SparkFun, and the AUAV3 from Arsov RC
Technology.
+
+Projects for the three boards are provided for both the traditional
Microchip MPLAB-8 and and the new MPLAB-X Integrated Development
Environments (IDE).
+
+The main project files are in the MatrixPilot directory.
+
+MPLAB version 8:
+ MatrixPilot-udb4.mcp
+ MatrixPilot-udb5.mcp
+ MatrixPilot-auav3.mcp
+
+MPLAB-X:
+ MatrixPilot-udb4.X
+ MatrixPilot-udb5.X
+ MatrixPilot-auav3.X
+
+Similarly, the RollPitchYaw directory contains project files for an IMU
test and demonstration program.
+
+The Tools directory contains numerous programs to support MatrixPilot
setup and operation.
+
+To configure MatrixPilot for your plane, edit the configuration files in
the ./Config directory.
+
+For developers, there is also a makefile based build system
(build-all.bat) and a project generator (Tools/Build/proj_gen.bat), which
are *nix compatible.
+
+For more info about how to configure and use this autopilot firmware, go
to:
+
+
http://code.google.com/p/gentlenav/
=======================================
--- /trunk/MatrixPilot/MAVLink.c Wed May 6 15:02:33 2015 UTC
+++ /trunk/MatrixPilot/MAVLink.c Sun Jun 7 16:01:09 2015 UTC
@@ -112,10 +112,10 @@
static uint64_t usec = 0; // A measure of time in microseconds (should be
from Unix Epoch).
static uint32_t msec = 0; // A measure of time in microseconds (should be
from Unix Epoch).
-int16_t sb_index = 0;
-int16_t end_index = 0;
-char serial_interrupt_stopped = 1;
-uint8_t serial_buffer[SERIAL_BUFFER_SIZE];
+static int16_t sb_index = 0;
+static int16_t end_index = 0;
+static char serial_interrupt_stopped = 1;
+static uint8_t serial_buffer[SERIAL_BUFFER_SIZE];
static uint8_t streamRates[MAV_DATA_STREAM_ENUM_END];
static uint16_t mavlink_command_ack_command = 0;
=======================================
--- /trunk/RollPitchYaw/main.c Wed May 6 15:02:33 2015 UTC
+++ /trunk/RollPitchYaw/main.c Sun Jun 7 16:01:09 2015 UTC
@@ -49,7 +49,7 @@
udb_serial_set_rate(SERIAL_BAUDRATE);
- LED_GREEN = LED_OFF;
+ led_off(LED_GREEN);
// Start it up!
while (1)
@@ -77,7 +77,7 @@
else
{
// No longer calibrating: solid RED and send debug output
- LED_RED = LED_ON;
+ led_on(LED_RED);
}
}
=======================================
--- /trunk/Tools/Build/pyProjectCreator.py Sat May 16 14:48:20 2015 UTC
+++ /trunk/Tools/Build/pyProjectCreator.py Sun Jun 7 16:01:09 2015 UTC
@@ -100,13 +100,11 @@
config = ''
for e in config_dir:
config = config + root_sep + e + ';'
-
fixdeps = root_sep + config_dir[0]
defs = ""
for d in defines:
if d:
defs = defs + "-D" + d + " "
-
with open (script_path + "mplab8-template.txt", "r") as file:
data = file.read()
data = data.replace("%%PROJECT%%", prjname)
@@ -120,7 +118,6 @@
data = data.replace("%%FILE_INFO%%", file_info)
data = data.replace("%%EXTRA_DEFS%%", defs)
data = data.replace("%%FIXDEPS%%", fixdeps)
-
mkdirnotex(project + ".mcp")
with open (project + ".mcp", "w") as file:
print "writing: " + project + ".mcp"
@@ -181,12 +178,10 @@
config = ''
for e in config_dir:
config = config + root_sep + e + ';'
-
defs = ""
for d in defines:
if d:
defs = defs + d + " "
-
with open (script_path + "template.vcxproj", "r") as file:
data = file.read()
data = data.replace("%%CONFIG%%", config)
@@ -199,6 +194,13 @@
with open (project + ".vcxproj", "w") as file:
print "writing: " + project + ".vcxproj"
file.write(data)
+ with open (script_path + "template.sln", "r") as file:
+ data = file.read()
+ data = data.replace("%%PROJECT%%", prjname)
+ mkdirnotex(project + ".sln")
+ with open (project + ".sln", "w") as file:
+ print "writing: " + project + ".sln"
+ file.write(data)
def vs2010_filters(mcu_type, target_board, root_sep, config_dir, filters,
header_files, source_files, project):
with open (script_path + "template.vcxproj.filters", "r") as file:
@@ -208,6 +210,7 @@
data = data.replace("%%HEADER_FILES%%", header_files)
mkdirnotex(project + ".vcxproj.filters")
with open (project + ".vcxproj.filters", "w") as file:
+ print "writing: " + project + ".vcxproj.filters"
file.write(data)
#
@@ -267,12 +270,10 @@
config = ''
for e in config_dir:
config = config + root_sep + e + ';'
-
defs = ""
for d in defines:
if d:
defs = defs + d + " "
-
with open (script_path + "configurations.xml", "r") as file:
data = file.read()
data = data.replace("%%NAME%%", name)
@@ -335,14 +336,14 @@
from optparse import OptionParser
parser = OptionParser("pyProjectCreator.py [options]")
+ parser.add_option("-r", "--root", dest="root", help="project root
path", default=".")
parser.add_option("-n", "--name", dest="name", help="specify the
project name", type="string", default="MatrixPilot", metavar="MatrixPilot")
parser.add_option("-t", "--target", dest="target", help="specify the
target board", type="string", default="UDB5", metavar="UDB5")
parser.add_option("-m", "--mod", dest="modules", help="search path
for
module.mk file", default=[], action='append')
parser.add_option("-d", "--def", dest="defines", help="additional
preprocessor defines", default=[], action='append')
parser.add_option("-i", "--inc", dest="includes", help="additional
include files directory", default=[], action='append')
parser.add_option("-c", "--cfg", dest="config", help="specify
configuration files directory", default=[], action='append')
- parser.add_option("-o", "--out", dest="out", help="project files
output path", default="build")
- parser.add_option("-r", "--root", dest="root", help="project root
path", default=".")
+ parser.add_option("-o", "--out", dest="out", help="project files
output path", default="_build")
parser.add_option("-f", "--file", dest="file", help="configuration
file", default="")
(opts, args) = parser.parse_args()
=======================================
--- /trunk/Tools/LedTest/Config/options.h Wed May 6 15:02:33 2015 UTC
+++ /trunk/Tools/LedTest/Config/options.h Sun Jun 7 16:01:09 2015 UTC
@@ -236,11 +236,6 @@
#define USE_TELELOG 0
#endif
-// Set this to 1 to enable loading options settings from an initialisation
(ini) file
-#ifndef USE_CONFIGFILE
-#define USE_CONFIGFILE 0
-#endif
-
// Set this to 1 to enable the USB stack on AUAV3
#ifndef USE_USB
#define USE_USB 0
=======================================
--- /trunk/Tools/LedTest/main.c Mon Mar 30 11:24:07 2015 UTC
+++ /trunk/Tools/LedTest/main.c Sun Jun 7 16:01:09 2015 UTC
@@ -70,77 +70,78 @@
#if (BOARD_TYPE == UDB4_BOARD || BOARD_TYPE == UDB5_BOARD)
case 9:
udb_background_trigger(&udb_background_callback_triggered);
- LED_RED = LED_ON;
+ led_on(LED_RED);
break;
case 8:
- LED_RED = LED_OFF;
- LED_GREEN = LED_ON;
+ led_off(LED_RED);
+ led_on(LED_GREEN);
break;
case 7:
- LED_GREEN = LED_OFF;
- LED_ORANGE = LED_ON;
+ led_off(LED_GREEN);
+ led_on(LED_ORANGE);
break;
case 6:
- LED_ORANGE = LED_OFF;
- LED_BLUE = LED_ON;
+ led_off(LED_ORANGE);
+ led_on(LED_BLUE);
break;
case 5:
- LED_BLUE = LED_OFF;
- LED_RED = LED_ON;
+ led_off(LED_BLUE);
+ led_on(LED_RED);
break;
case 4:
- LED_RED = LED_OFF;
- LED_GREEN = LED_ON;
+ led_off(LED_RED);
+ led_on(LED_GREEN);
break;
case 3:
- LED_GREEN = LED_OFF;
- LED_ORANGE = LED_ON;
+ led_off(LED_GREEN);
+ led_on(LED_ORANGE);
break;
case 2:
- LED_BLUE = LED_ON;
- LED_ORANGE = LED_OFF;
+ led_on(LED_BLUE);
+ led_off(LED_ORANGE);
break;
case 1:
- LED_BLUE = LED_OFF;
+ led_off(LED_BLUE);
udb_a2d_record_offsets();
break;
#elif (BOARD_TYPE == AUAV3_BOARD)
case 9:
udb_background_trigger(&udb_background_callback_triggered);
- LED_BLUE = LED_ON;
+ led_on(LED_BLUE);
break;
case 8:
- LED_BLUE = LED_OFF;
- LED_RED = LED_ON;
+ led_off(LED_BLUE);
+ led_on(LED_RED);
break;
case 7:
- LED_RED = LED_OFF;
- LED_GREEN = LED_ON;
+ led_off(LED_RED);
+ led_on(LED_GREEN);
break;
case 6:
- LED_GREEN = LED_OFF;
- LED_ORANGE = LED_ON;
+ led_off(LED_GREEN);
+ led_on(LED_ORANGE);
break;
case 5:
- LED_ORANGE = LED_OFF;
- LED_BLUE = LED_ON;
+ led_off(LED_ORANGE);
+ led_on(LED_BLUE);
break;
case 4:
- LED_BLUE = LED_OFF;
- LED_RED = LED_ON;
+ led_off(LED_BLUE);
+ led_on(LED_RED);
break;
case 3:
- LED_RED = LED_OFF;
- LED_GREEN = LED_ON;
+ led_off(LED_RED);
+ led_on(LED_GREEN);
break;
case 2:
- LED_GREEN = LED_OFF;
- LED_ORANGE = LED_ON;
+ led_off(LED_GREEN);
+ led_on(LED_ORANGE);
break;
case 1:
- LED_ORANGE = LED_OFF;
+ led_off(LED_ORANGE);
udb_a2d_record_offsets();
break;
+#elif (BOARD_TYPE == PX4_BOARD)
#else
#error "unsupported BOARD_TYPE"
#endif
@@ -222,15 +223,15 @@
udb_pwOut[Z_ACCEL_OUTPUT_CHANNEL] = udb_servo_pulsesat(3000 +
accum._.W1);
if ((udb_heartbeat_counter / 600) % 2 == 0) {
- LED_RED = LED_ON;
- LED_ORANGE = ((abs(udb_pwOut[ROLL_OUTPUT_CHANNEL] - 3000) >
RATE_THRESHOLD_LED) ? LED_ON : LED_OFF);
- LED_BLUE = ((abs(udb_pwOut[PITCH_OUTPUT_CHANNEL] - 3000) >
RATE_THRESHOLD_LED) ? LED_ON : LED_OFF);
- LED_GREEN = ((abs(udb_pwOut[YAW_OUTPUT_CHANNEL] - 3000) >
RATE_THRESHOLD_LED) ? LED_ON : LED_OFF);
+ led_on(LED_RED);
+ ((abs(udb_pwOut[ROLL_OUTPUT_CHANNEL] - 3000) > RATE_THRESHOLD_LED) ?
led_on(LED_ORANGE) : led_off(LED_ORANGE));
+ ((abs(udb_pwOut[PITCH_OUTPUT_CHANNEL] - 3000) > RATE_THRESHOLD_LED) ?
led_on(LED_BLUE) : led_off(LED_BLUE));
+ ((abs(udb_pwOut[YAW_OUTPUT_CHANNEL] - 3000) > RATE_THRESHOLD_LED) ?
led_on(LED_GREEN) : led_off(LED_GREEN));
} else {
- LED_RED = LED_OFF;
- LED_ORANGE = ((abs(udb_pwOut[X_ACCEL_OUTPUT_CHANNEL] - 3000) >
ACCEL_THRESHOLD_LED) ? LED_ON : LED_OFF);
- LED_BLUE = ((abs(udb_pwOut[Y_ACCEL_OUTPUT_CHANNEL] - 3000) >
ACCEL_THRESHOLD_LED) ? LED_ON : LED_OFF);
- LED_GREEN = ((abs(udb_pwOut[Z_ACCEL_OUTPUT_CHANNEL] - 3000) >
ACCEL_THRESHOLD_LED) ? LED_ON : LED_OFF);
+ led_off(LED_RED);
+ ((abs(udb_pwOut[X_ACCEL_OUTPUT_CHANNEL] - 3000) >
ACCEL_THRESHOLD_LED) ? led_on(LED_ORANGE) : led_off(LED_ORANGE));
+ ((abs(udb_pwOut[Y_ACCEL_OUTPUT_CHANNEL] - 3000) >
ACCEL_THRESHOLD_LED) ? led_on(LED_BLUE) : led_off(LED_BLUE));
+ ((abs(udb_pwOut[Z_ACCEL_OUTPUT_CHANNEL] - 3000) >
ACCEL_THRESHOLD_LED) ? led_on(LED_GREEN) : led_off(LED_GREEN));
}
}
}
=======================================
--- /trunk/Tools/MatrixPilot-SIL/SIL-I2C1.c Sat Sep 27 09:08:25 2014 UTC
+++ /trunk/Tools/MatrixPilot-SIL/SIL-I2C1.c Sun Jun 7 16:01:09 2015 UTC
@@ -23,7 +23,6 @@
#include "../../libUDB/libUDB.h"
#include "../../libUDB/interrupt.h"
#include "../../libUDB/I2C.h"
-#include "../../libUDB/NV_memory.h"
#include "../../libUDB/events.h"
#if (USE_I2C1_DRIVER == 1)
=======================================
--- /trunk/libUDB/ConfigPX4.h Wed May 6 15:02:33 2015 UTC
+++ /trunk/libUDB/ConfigPX4.h Sun Jun 7 16:01:09 2015 UTC
@@ -61,8 +61,8 @@
#define ZACCEL_SIGN +
// Max inputs and outputs
-#define MAX_INPUTS 8
-#define MAX_OUTPUTS 8
+#define MAX_INPUTS 6
+#define MAX_OUTPUTS 6
// LED pins
#define LED_RED 0
@@ -89,22 +89,29 @@
// Input Capture module input pins: PINX is the port pin, RPINX is used
for PPS
// PINX must match RPINX for radionIn_auav3 to work properly
-#define IC_PIN1 _RD0
-#define IC_RPIN1 64
-#define IC_PIN2 _RD8
-#define IC_RPIN2 72
-#define IC_PIN3 _RD11
-#define IC_RPIN3 75
-#define IC_PIN4 _RA15
-#define IC_RPIN4 31
-#define IC_PIN5 _RA5
-#define IC_RPIN5 21
-#define IC_PIN6 _RA14
-#define IC_RPIN6 30
-#define IC_PIN7 _RA4
-#define IC_RPIN7 20
-#define IC_PIN8 _RF8
-#define IC_RPIN8 104
+//#define IC_PIN1 _RD0
+//#define IC_RPIN1 64
+//#define IC_PIN2 _RD8
+//#define IC_RPIN2 72
+//#define IC_PIN3 _RD11
+//#define IC_RPIN3 75
+//#define IC_PIN4 _RA15
+//#define IC_RPIN4 31
+//#define IC_PIN5 _RA5
+//#define IC_RPIN5 21
+//#define IC_PIN6 _RA14
+//#define IC_RPIN6 30
+//#define IC_PIN7 _RA4
+//#define IC_RPIN7 20
+//#define IC_PIN8 _RF8
+//#define IC_RPIN8 104
+
+#define IC_PIN1 GPIOA->IDR & (1 << 0) //PA0
+#define IC_PIN2 GPIOA->IDR & (1 << 1) //PA1
+#define IC_PIN3 GPIOB->IDR & (1 << 6) //PB6
+#define IC_PIN4 GPIOB->IDR & (1 << 7) //PB7
+#define IC_PIN5 GPIOB->IDR & (1 << 8) //PB8
+#define IC_PIN6 GPIOB->IDR & (1 << 9) //PB9
// OC1:8 PWM module output pins
// PINX must match RPINX