├── .gitattributes ├── .gitignore ├── .travis.yml ├── GUI ├── DropDownList.pde ├── GUI.pde ├── Protocol.pde ├── README.md └── SerialPort.txt ├── LaunchPadFlightController.uvprojx ├── PCB ├── LaenPCBOrder.dru ├── LaunchPadFlightController_Schematic.brd ├── LaunchPadFlightController_Schematic.png ├── LaunchPadFlightController_Schematic.sch └── README.md ├── README.md ├── docs ├── CD-ROM │ ├── 3D_Model │ │ ├── Batteri.ipt │ │ ├── F450 Top Plate.SLDPRT │ │ ├── F450 arm.ipt │ │ ├── F450 arm.stp │ │ ├── F450 chasis.SLDPRT │ │ ├── Flight controller.ipt │ │ ├── Imported Components │ │ │ ├── F450 Top Plate │ │ │ │ ├── F450 Top Plate.ipt │ │ │ │ └── OldVersions │ │ │ │ │ └── F450 Top Plate.0002.ipt │ │ │ └── F450 chasis │ │ │ │ ├── F450 chasis.ipt │ │ │ │ └── OldVersions │ │ │ │ └── F450 chasis.0002.ipt │ │ ├── Motor │ │ │ ├── Assemblies │ │ │ │ ├── 10x4.7-clockwise-propeller.SLDPRT │ │ │ │ ├── 10x4.7-counterclockwise-propeller.SLDPRT │ │ │ │ ├── Hobby King 20A ESC 3A UBEC.SLDPRT │ │ │ │ ├── Imported Components │ │ │ │ │ ├── 10x4.7-clockwise-propeller │ │ │ │ │ │ ├── 10x4.7-clockwise-propeller.ipt │ │ │ │ │ │ ├── 10x4.7-clockwise-propeller_MIR.ipt │ │ │ │ │ │ └── OldVersions │ │ │ │ │ │ │ ├── 10x4.7-clockwise-propeller.0002.ipt │ │ │ │ │ │ │ └── 10x4.7-clockwise-propeller_MIR.0001.ipt │ │ │ │ │ ├── 10x4.7-counterclockwise-propeller │ │ │ │ │ │ ├── 10x4.7-counterclockwise-propeller.ipt │ │ │ │ │ │ ├── 10x4.7-counterclockwise-propeller_MIR.ipt │ │ │ │ │ │ └── OldVersions │ │ │ │ │ │ │ ├── 10x4.7-counterclockwise-propeller.0002.ipt │ │ │ │ │ │ │ └── 10x4.7-counterclockwise-propeller_MIR.0001.ipt │ │ │ │ │ ├── Hobby King 20A ESC 3A UBEC │ │ │ │ │ │ ├── Hobby King 20A ESC 3A UBEC.ipt │ │ │ │ │ │ └── OldVersions │ │ │ │ │ │ │ └── Hobby King 20A ESC 3A UBEC.0001.ipt │ │ │ │ │ └── SunnySky X2212_13_980kV │ │ │ │ │ │ ├── Cap.ipt │ │ │ │ │ │ ├── CapScrew.ipt │ │ │ │ │ │ ├── CrossBase.ipt │ │ │ │ │ │ ├── Housing_Bottom.ipt │ │ │ │ │ │ ├── Housing_Upper.ipt │ │ │ │ │ │ ├── Nut.ipt │ │ │ │ │ │ ├── OldVersions │ │ │ │ │ │ ├── Cap.0001.ipt │ │ │ │ │ │ ├── CapScrew.0001.ipt │ │ │ │ │ │ ├── CrossBase.0001.ipt │ │ │ │ │ │ ├── Housing_Bottom.0002.ipt │ │ │ │ │ │ ├── Housing_Upper.0001.ipt │ │ │ │ │ │ ├── Nut.0001.ipt │ │ │ │ │ │ ├── Rotor.0001.ipt │ │ │ │ │ │ ├── Stator.0002.iam │ │ │ │ │ │ ├── Stator_Coil.0001.ipt │ │ │ │ │ │ ├── Stator_Steelcore.0001.ipt │ │ │ │ │ │ ├── SunnySky X2212_13_980kV.0001.iam │ │ │ │ │ │ └── Wiring.0001.ipt │ │ │ │ │ │ ├── Rotor.ipt │ │ │ │ │ │ ├── Stator.iam │ │ │ │ │ │ ├── Stator_Coil.ipt │ │ │ │ │ │ ├── Stator_Steelcore.ipt │ │ │ │ │ │ ├── SunnySky X2212_13_980kV.iam │ │ │ │ │ │ └── Wiring.ipt │ │ │ │ ├── Motor_w_Prop.SLDASM │ │ │ │ ├── Motor_wo_Prop.SLDASM │ │ │ │ ├── Stator.SLDASM │ │ │ │ └── SunnySky X2212_13_980kV.SLDASM │ │ │ ├── Parts │ │ │ │ ├── Cap.SLDPRT │ │ │ │ ├── CapScrew.SLDPRT │ │ │ │ ├── CrossBase.SLDPRT │ │ │ │ ├── Housing_Bottom.SLDPRT │ │ │ │ ├── Housing_Upper.SLDPRT │ │ │ │ ├── Nut.SLDPRT │ │ │ │ ├── Rotor.SLDPRT │ │ │ │ ├── Stator_Coil.SLDPRT │ │ │ │ ├── Stator_Steelcore.SLDPRT │ │ │ │ └── Wiring.SLDPRT │ │ │ └── Renderings │ │ │ │ ├── Iso_w_Caps.png │ │ │ │ ├── Iso_w_Prop.png │ │ │ │ └── Iso_wo_Caps.png │ │ ├── OldVersions │ │ │ ├── Batteri.0001.ipt │ │ │ ├── F450 arm.0001.ipt │ │ │ ├── Flight controller.0002.ipt │ │ │ ├── Quad correct axis.0001.iam │ │ │ ├── Quad wring axis.0001.iam │ │ │ ├── Quad wring axis.0002.iam │ │ │ └── SunnySky X2212_13_980kV.0003.iam │ │ ├── Quad correct axis.iam │ │ ├── Quad wrong axis.iam │ │ ├── Renderings │ │ │ ├── Quad_3d_overview.png │ │ │ ├── Quad_3d_overview.xcf │ │ │ ├── Quad_3d_overview_original.png │ │ │ ├── Quad_top.png │ │ │ ├── Quad_top.xcf │ │ │ └── Quad_top_original.png │ │ ├── SunnySky X2212_13_980kV.iam │ │ ├── moment_of_inertia.png │ │ └── sunnysky-x2212-13-980kv-1.snapshot.1.zip │ ├── Bibliography │ │ ├── 28015-PING-Sensor-Product-Guide-v2.0.pdf │ │ ├── BST-BMP180-DS000-12-1.pdf │ │ ├── CE503 Rotation Matrices - Derivation of 2D Rotation Matrix. Jim Bethel.pdf │ │ ├── Chapter 6. Design of Discrete Time Controller – Input:Output Approaches. H. Peng, George T.-C Chiu & T-C. Tsao.pdf │ │ ├── Classical Mechanics - Goldstein, Poole & Safko.pdf │ │ ├── HMC5883L_3-Axis_Digital_Compass_IC.pdf │ │ ├── Implementing a Tilt-Compensated eCompass using Accelerometer and Magnetometer Sensors - AN4248.pdf │ │ ├── MPU_6500_Rev1.0.pdf │ │ ├── Modelling and L1 adaptive control of a quadcopter - Andre Bertelsen & Mikkel Thomsen.pdf │ │ ├── Quadcopter Dynamics, Simulation, and Control - Andrew Gibiansky.pdf │ │ ├── Tilt Sensing Using a Three-Axis Accelerometer - AN3461.pdf │ │ └── tm4c123gh6pm.pdf │ └── Matlab │ │ ├── altitude │ │ ├── altitude_baro.m │ │ ├── altitude_baro_10m.txt │ │ └── altitude_indoor.txt │ │ ├── model │ │ ├── model.slx │ │ └── motor_to_rad_s.xlsx │ │ └── step_response │ │ ├── acro_manual.txt │ │ ├── altitude_step.txt │ │ ├── heading_45deg_10s.txt │ │ ├── mapf.m │ │ ├── self_level_30.txt │ │ └── step.m ├── Kristian Sloth Lauszus - Flight Controller for Quad Rotor Helicopter in X-configuration.pdf └── README.md ├── gpl2.txt ├── lib ├── EULA.txt ├── MANIFEST.txt ├── TI-BSD-EULA.txt ├── docs │ ├── SW-EK-TM4C123GXL-BOOST-CAPSENSE-UG-1.1.pdf │ ├── SW-EK-TM4C123GXL-BOOST-OLIMEX-8X8-UG-1.1.pdf │ ├── SW-EK-TM4C123GXL-BOOSTXL-SENSHUB-UG-1.1.pdf │ ├── SW-EK-TM4C123GXL-UG-1.1.pdf │ ├── SW-TM4C-BOOTLDR-UG-1.1.pdf │ ├── SW-TM4C-DRL-UG-1.1.pdf │ ├── SW-TM4C-EXAMPLES-UG-1.1.pdf │ ├── SW-TM4C-IQMATH-UG-1.1.pdf │ ├── SW-TM4C-RLN-1.1.pdf │ ├── SW-TM4C-SENSORLIB-UG-1.1.pdf │ ├── SW-TM4C-TOOLS-UG-1.1.pdf │ ├── SW-TM4C-USBL-UG-1.1.pdf │ └── SW-TM4C-UTILS-UG-1.1.pdf ├── driverlib │ ├── Makefile │ ├── adc.c │ ├── adc.h │ ├── can.c │ ├── can.h │ ├── ccs │ │ ├── .ccsproject │ │ ├── .cproject │ │ ├── .project │ │ ├── .settings │ │ │ └── org.eclipse.cdt.codan.core.prefs │ │ ├── Debug │ │ │ └── driverlib.lib │ │ └── macros.ini_initial │ ├── comp.c │ ├── comp.h │ ├── cpu.c │ ├── cpu.h │ ├── debug.h │ ├── driverlib.ewp │ ├── driverlib.sgxx │ ├── driverlib.uvproj │ ├── eeprom.c │ ├── eeprom.h │ ├── ewarm │ │ └── Exe │ │ │ └── driverlib.a │ ├── flash.c │ ├── flash.h │ ├── fpu.c │ ├── fpu.h │ ├── gcc │ │ └── libdriver.a │ ├── gpio.c │ ├── gpio.h │ ├── hibernate.c │ ├── hibernate.h │ ├── i2c.c │ ├── i2c.h │ ├── interrupt.c │ ├── interrupt.h │ ├── mpu.c │ ├── mpu.h │ ├── pin_map.h │ ├── pwm.c │ ├── pwm.h │ ├── qei.c │ ├── qei.h │ ├── readme.txt │ ├── rom.h │ ├── rom_map.h │ ├── rtos_bindings.h │ ├── rvmdk │ │ └── driverlib.lib │ ├── ssi.c │ ├── ssi.h │ ├── sw_crc.c │ ├── sw_crc.h │ ├── sysctl.c │ ├── sysctl.h │ ├── sysexc.c │ ├── sysexc.h │ ├── systick.c │ ├── systick.h │ ├── timer.c │ ├── timer.h │ ├── uart.c │ ├── uart.h │ ├── udma.c │ ├── udma.h │ ├── usb.c │ ├── usb.h │ ├── watchdog.c │ └── watchdog.h ├── inc │ ├── asmdefs.h │ ├── hw_adc.h │ ├── hw_can.h │ ├── hw_comp.h │ ├── hw_eeprom.h │ ├── hw_fan.h │ ├── hw_flash.h │ ├── hw_gpio.h │ ├── hw_hibernate.h │ ├── hw_i2c.h │ ├── hw_ints.h │ ├── hw_lpc.h │ ├── hw_memmap.h │ ├── hw_nvic.h │ ├── hw_peci.h │ ├── hw_pwm.h │ ├── hw_qei.h │ ├── hw_ssi.h │ ├── hw_sysctl.h │ ├── hw_sysexc.h │ ├── hw_timer.h │ ├── hw_types.h │ ├── hw_uart.h │ ├── hw_udma.h │ ├── hw_usb.h │ ├── hw_watchdog.h │ ├── inc.sgxx │ └── tm4c123gh6pm.h ├── makedefs └── utils │ ├── cmdline.c │ ├── cmdline.h │ ├── cpu_usage.c │ ├── cpu_usage.h │ ├── flash_pb.c │ ├── flash_pb.h │ ├── isqrt.c │ ├── isqrt.h │ ├── random.c │ ├── random.h │ ├── ringbuf.c │ ├── ringbuf.h │ ├── scheduler.c │ ├── scheduler.h │ ├── sine.c │ ├── sine.h │ ├── smbus.c │ ├── smbus.h │ ├── softi2c.c │ ├── softi2c.h │ ├── softssi.c │ ├── softssi.h │ ├── softuart.c │ ├── softuart.h │ ├── speexlib.c │ ├── speexlib.h │ ├── uartstdio.c │ ├── uartstdio.h │ ├── ustdlib.c │ ├── ustdlib.h │ └── utils.sgxx ├── platformio.ini └── src ├── ADNS3080.c ├── ADNS3080.h ├── ADNS3080ImageGrabber.py ├── AK8963.c ├── AK8963.h ├── AltitudeHold.c ├── AltitudeHold.h ├── BMP180.c ├── BMP180.h ├── Bluetooth.c ├── Bluetooth.h ├── Buzzer.c ├── Buzzer.h ├── Config.h ├── EEPROM.c ├── EEPROM.h ├── HMC5883L.c ├── HMC5883L.h ├── HeadingHold.c ├── HeadingHold.h ├── I2C.c ├── I2C.h ├── IMU.c ├── IMU.h ├── LaunchPadFlightController.ld ├── LidarLiteV3.c ├── LidarLiteV3.h ├── LowPassFilter.c ├── LowPassFilter.h ├── MPU6500.c ├── MPU6500.h ├── Magnetomer.c ├── Magnetometer.h ├── Makefile ├── PID.c ├── PID.h ├── PPM.c ├── PPM.h ├── RX.c ├── RX.h ├── SPI.c ├── SPI.h ├── Sonar.c ├── Sonar.h ├── StepResponse.c ├── StepResponse.h ├── Time.c ├── Time.h ├── Types.h ├── UART.c ├── UART.h ├── main.c ├── startup_gcc.c ├── startup_rvmdk.S ├── uartstdio1.c └── uartstdio1.h /.gitattributes: -------------------------------------------------------------------------------- 1 | # Perform LF normalization 2 | * text=auto 3 | src/*.c text eol=lf 4 | src/*.h text eol=lf -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.axf 2 | *.htm 3 | *.Inp 4 | *.map 5 | *.tra 6 | *.dep 7 | *.__i 8 | *.crf 9 | *.d 10 | *.o 11 | *.lst 12 | *.lnp 13 | *.bak 14 | *.Vishwas 15 | *.bin 16 | *.fed 17 | *._2i 18 | *.l1p 19 | *.l2p 20 | *.iex 21 | .#* 22 | *.uvgui.* 23 | *.uvguix.* 24 | *.uvopt 25 | *.uvoptx 26 | *.plg 27 | src/.project 28 | src/.cproject 29 | src/.settings/ 30 | *.s#? 31 | *.b#? 32 | .pioenvs 33 | .piolibdeps 34 | .clang_complete 35 | .gcc-flags.json 36 | lib/readme.txt 37 | .idea/ 38 | .pio/ 39 | .vscode/ 40 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | 3 | # Cache PlatformIO packages using Travis CI container-based infrastructure 4 | sudo: false 5 | cache: 6 | directories: 7 | - "~/.platformio" 8 | 9 | addons: 10 | apt: 11 | packages: 12 | - libc6-i386 13 | - libusb-1.0-0-dev 14 | 15 | env: 16 | - TRAVIS_CI=1 USE_MAG=1 USE_BARO=1 USE_SONAR=1 USE_LIDAR_LITE=1 USE_FLOW_SENSOR=1 UART_DEBUG=1 ONESHOT125=1 DEBUG=1 STEP_ACRO_SELF_LEVEL=1 STEP_ALTITUDE_HOLD=1 STEP_HEADING_HOLD=1 17 | - TRAVIS_CI=1 USE_MAG=0 USE_BARO=0 USE_SONAR=0 USE_LIDAR_LITE=0 USE_FLOW_SENSOR=0 UART_DEBUG=1 ONESHOT125=1 DEBUG=1 STEP_ACRO_SELF_LEVEL=0 STEP_ALTITUDE_HOLD=0 STEP_HEADING_HOLD=0 18 | - TRAVIS_CI=1 USE_MAG=1 USE_BARO=1 USE_SONAR=1 USE_LIDAR_LITE=1 USE_FLOW_SENSOR=1 UART_DEBUG=1 ONESHOT125=1 DEBUG=0 STEP_ACRO_SELF_LEVEL=0 STEP_ALTITUDE_HOLD=0 STEP_HEADING_HOLD=0 19 | - TRAVIS_CI=1 USE_MAG=1 USE_BARO=1 USE_SONAR=1 USE_LIDAR_LITE=1 USE_FLOW_SENSOR=1 UART_DEBUG=1 ONESHOT125=0 DEBUG=0 STEP_ACRO_SELF_LEVEL=0 STEP_ALTITUDE_HOLD=0 STEP_HEADING_HOLD=0 20 | - TRAVIS_CI=1 USE_MAG=0 USE_BARO=0 USE_SONAR=0 USE_LIDAR_LITE=0 USE_FLOW_SENSOR=0 UART_DEBUG=1 ONESHOT125=1 DEBUG=0 STEP_ACRO_SELF_LEVEL=0 STEP_ALTITUDE_HOLD=0 STEP_HEADING_HOLD=0 21 | - TRAVIS_CI=1 USE_MAG=1 USE_BARO=1 USE_SONAR=1 USE_LIDAR_LITE=1 USE_FLOW_SENSOR=1 UART_DEBUG=0 ONESHOT125=1 DEBUG=0 STEP_ACRO_SELF_LEVEL=0 STEP_ALTITUDE_HOLD=0 STEP_HEADING_HOLD=0 22 | - TRAVIS_CI=1 USE_MAG=0 USE_BARO=0 USE_SONAR=0 USE_LIDAR_LITE=0 USE_FLOW_SENSOR=0 UART_DEBUG=0 ONESHOT125=1 DEBUG=0 STEP_ACRO_SELF_LEVEL=0 STEP_ALTITUDE_HOLD=0 STEP_HEADING_HOLD=0 23 | - TRAVIS_CI=1 USE_MAG=1 USE_BARO=1 USE_SONAR=0 USE_LIDAR_LITE=0 USE_FLOW_SENSOR=0 UART_DEBUG=1 ONESHOT125=1 DEBUG=0 STEP_ACRO_SELF_LEVEL=0 STEP_ALTITUDE_HOLD=0 STEP_HEADING_HOLD=0 24 | - TRAVIS_CI=1 USE_MAG=1 USE_BARO=0 USE_SONAR=1 USE_LIDAR_LITE=0 USE_FLOW_SENSOR=0 UART_DEBUG=1 ONESHOT125=1 DEBUG=0 STEP_ACRO_SELF_LEVEL=0 STEP_ALTITUDE_HOLD=0 STEP_HEADING_HOLD=0 25 | - TRAVIS_CI=1 USE_MAG=1 USE_BARO=0 USE_SONAR=0 USE_LIDAR_LITE=1 USE_FLOW_SENSOR=0 UART_DEBUG=1 ONESHOT125=1 DEBUG=0 STEP_ACRO_SELF_LEVEL=0 STEP_ALTITUDE_HOLD=0 STEP_HEADING_HOLD=0 26 | - TRAVIS_CI=1 USE_MAG=1 USE_BARO=0 USE_SONAR=0 USE_LIDAR_LITE=0 USE_FLOW_SENSOR=1 UART_DEBUG=1 ONESHOT125=1 DEBUG=0 STEP_ACRO_SELF_LEVEL=0 STEP_ALTITUDE_HOLD=0 STEP_HEADING_HOLD=0 27 | 28 | install: 29 | - wget "https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q3-update/+download/gcc-arm-none-eabi-4_8-2014q3-20140805-linux.tar.bz2" 30 | - tar -xf gcc-arm-none-eabi-4_8-2014q3-20140805-linux.tar.bz2 31 | - export PATH=$PATH:$PWD/gcc-arm-none-eabi-4_8-2014q3/bin 32 | - git clone https://github.com/utzig/lm4tools.git 33 | - make -j2 -C lm4tools/lm4flash all 34 | - export PATH=$PATH:$PWD/lm4tools/lm4flash 35 | - pip install -U platformio 36 | 37 | before_script: 38 | - arm-none-eabi-gcc --version 39 | - lm4flash -V 40 | 41 | script: 42 | - platformio run -e lptm4c1230c3pm_ci 43 | - make -j2 -C src/ 44 | -------------------------------------------------------------------------------- /GUI/GUI.pde: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | import processing.serial.*; 19 | import controlP5.*; 20 | import java.awt.event.*; 21 | import java.awt.Image; 22 | 23 | Serial serial; 24 | 25 | float roll, pitch, yaw; 26 | float yawStart; 27 | 28 | boolean resetYaw = true; 29 | boolean drawValues = false; 30 | 31 | final int width = 600; 32 | final int height = 600; 33 | 34 | void setup() { 35 | /*frame.setTitle("Balanduino Processing App"); 36 | frame.setIconImage((Image) loadImage("data/logo.png").getNative());*/ 37 | 38 | controlP5 = new ControlP5(this); 39 | size(width, height, P3D); 40 | 41 | initDropdownlist(); 42 | } 43 | 44 | void draw() { 45 | if (!connectedSerial || drawValues) { 46 | background(250); 47 | lights(); 48 | } 49 | 50 | if (drawValues) { // Draw plane 51 | drawValues = false; 52 | 53 | pushMatrix(); 54 | translate(width/2, height/2, 0); 55 | float radRoll = radians(roll); 56 | float radPitch = radians(pitch); 57 | float radYaw = radians(yaw); 58 | rotateX(radPitch * cos(radYaw) - radRoll * sin(radYaw) + HALF_PI); 59 | rotateY(radRoll * cos(radYaw) + radPitch * sin(radYaw)); 60 | rotateZ(radYaw * cos(radPitch) + radRoll * sin(radPitch)); 61 | box(200, 200, 30); 62 | popMatrix(); 63 | 64 | System.out.printf("%.02f, %.02f, %.02f\n", roll, pitch, yaw); 65 | } 66 | } 67 | 68 | byte[] buffer; 69 | boolean append; 70 | 71 | void serialEvent (Serial serial) { 72 | if (append) 73 | buffer = concat(buffer, serial.readBytes()); 74 | else 75 | buffer = serial.readBytes(); 76 | int[] data = new int[buffer.length]; 77 | for (int i = 0; i < data.length; i++) 78 | data[i] = buffer[i] & 0xFF; // Cast to unsigned value 79 | //println(data); 80 | 81 | if (new String(buffer).startsWith(responseHeader)) { 82 | int cmd = data[responseHeader.length()]; 83 | int length = data[responseHeader.length() + 1]; 84 | if (length != (data.length - responseHeader.length() - 5)) { 85 | append = true; // If it's not the correct length, then the rest will come in the next package 86 | return; 87 | } 88 | int input[] = new int[length]; 89 | int i; 90 | for (i = 0; i < length; i++) 91 | input[i] = data[i + responseHeader.length() + 2]; 92 | int checksum = data[i + responseHeader.length() + 2]; 93 | 94 | if (checksum == (cmd ^ length ^ getChecksum(input))) { 95 | switch(cmd) { 96 | case SEND_ANGLES: 97 | int rollInt = input[0] | ((byte) input[1] << 8); // This can be negative as well 98 | int pitchInt = input[2] | ((byte) input[3] << 8); // This can be negative as well 99 | int yawInt = input[4] | (input[5] << 8); // This is always positive 100 | //println(rollInt + " " + pitchInt + " " + yawInt); 101 | 102 | roll = (float) rollInt / 100.0f; // Convert values to floating point numbers 103 | pitch = (float) pitchInt / 100.0f; // Convert values to floating point numbers 104 | yaw = (float) yawInt / 100.0f; // Convert values to floating point numbers 105 | 106 | if (resetYaw) { 107 | resetYaw = false; 108 | yawStart = yaw; 109 | } 110 | yaw -= yawStart; // Subtract starting angle 111 | if (yaw < 0) // Convert heading range to 0-360 112 | yaw += 360; 113 | break; 114 | default: 115 | println("Unknown command"); 116 | break; 117 | } 118 | } else 119 | println("Checksum error!"); 120 | } else { 121 | println("Wrong header!"); 122 | println(new String(buffer)); 123 | } 124 | 125 | serial.clear(); // Clear buffer 126 | drawValues = true; // Draw the plane 127 | append = false; 128 | } 129 | 130 | void reset() { 131 | resetYaw = true; // Reset yaw position 132 | } 133 | 134 | void keyPressed() { 135 | if (key == 'r') 136 | reset(); 137 | else if (key == ENTER || key == 'c') 138 | connect(); // Connect to serial port 139 | else if (key == ESC || key == 'd' ) { 140 | disconnect(); // Disconnect serial connection 141 | key = 0; // Disable Processing from quiting when pressing ESC 142 | } 143 | } 144 | 145 | -------------------------------------------------------------------------------- /GUI/Protocol.pde: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | String commandHeader = "$S>"; // Standard command header 19 | String responseHeader = "$S<"; // Standard response header 20 | 21 | static final byte SEND_ANGLES = 8; 22 | 23 | void sendCommand(byte output[]) { 24 | if (connectedSerial) { 25 | serial.write(commandHeader); 26 | serial.write(output); 27 | serial.write(getChecksum(output)); 28 | } else 29 | println("Establish a serial connection first!"); 30 | } 31 | 32 | void sendAngles(boolean enable) { 33 | byte output[] = { 34 | SEND_ANGLES, // Cmd 35 | 1, // Length 36 | (byte) (enable ? 1 : 0), 37 | }; 38 | sendCommand(output); // Send output 39 | } 40 | 41 | byte getChecksum(byte data[]) { 42 | byte checksum = 0; 43 | for (byte val : data) 44 | checksum ^= val; 45 | return checksum; 46 | } 47 | 48 | int getChecksum(int data[]) { 49 | int checksum = 0; 50 | for (int val : data) 51 | checksum ^= val; 52 | return checksum; 53 | } 54 | -------------------------------------------------------------------------------- /GUI/README.md: -------------------------------------------------------------------------------- 1 | #### Developed by Kristian Sloth Lauszus, 2015 2 | 3 | The code is released under the GNU General Public License. 4 | _________ 5 | 6 | This is a [Processing](http://processing.org/) application I made to visualize the orientation of the flight controller. 7 | 8 | For more information send me an email at . -------------------------------------------------------------------------------- /GUI/SerialPort.txt: -------------------------------------------------------------------------------- 1 | /dev/tty.LaunchPad-DevB -------------------------------------------------------------------------------- /PCB/LaenPCBOrder.dru: -------------------------------------------------------------------------------- 1 | description[de] = EAGLE Design Rules\n

\nDie Standard-Design-Rules sind so gewählt, dass sie für \ndie meisten Anwendungen passen. Sollte ihre Platine \nbesondere Anforderungen haben, treffen Sie die erforderlichen\nEinstellungen hier und speichern die Design Rules unter \neinem neuen Namen ab. 2 | description[en] = Laen's PCB Order Design Rules\n

\nPlease make sure your boards conform to these design rules. 3 | layerSetup = (1*16) 4 | mtCopper = 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 5 | mtIsolate = 1.5011mm 0.1499mm 0.2007mm 0.1499mm 0.2007mm 0.1499mm 0.2007mm 0.1499mm 0.2007mm 0.1499mm 0.2007mm 0.1499mm 0.2007mm 0.1499mm 0.2007mm 6 | mdWireWire = 6mil 7 | mdWirePad = 6mil 8 | mdWireVia = 6mil 9 | mdPadPad = 6mil 10 | mdPadVia = 6mil 11 | mdViaVia = 6mil 12 | mdSmdPad = 6mil 13 | mdSmdVia = 6mil 14 | mdSmdSmd = 6mil 15 | mdViaViaSameLayer = 8mil 16 | mnLayersViaInSmd = 2 17 | mdCopperDimension = 15mil 18 | mdDrill = 6mil 19 | mdSmdStop = 0mil 20 | msWidth = 6mil 21 | msDrill = 13mil 22 | msMicroVia = 13mil 23 | msBlindViaRatio = 0.500000 24 | rvPadTop = 0.250000 25 | rvPadInner = 0.250000 26 | rvPadBottom = 0.250000 27 | rvViaOuter = 0.250000 28 | rvViaInner = 0.250000 29 | rvMicroViaOuter = 0.250000 30 | rvMicroViaInner = 0.250000 31 | rlMinPadTop = 7mil 32 | rlMaxPadTop = 20mil 33 | rlMinPadInner = 7mil 34 | rlMaxPadInner = 20mil 35 | rlMinPadBottom = 7mil 36 | rlMaxPadBottom = 20mil 37 | rlMinViaOuter = 7mil 38 | rlMaxViaOuter = 20mil 39 | rlMinViaInner = 7mil 40 | rlMaxViaInner = 20mil 41 | rlMinMicroViaOuter = 4mil 42 | rlMaxMicroViaOuter = 20mil 43 | rlMinMicroViaInner = 4mil 44 | rlMaxMicroViaInner = 20mil 45 | psTop = -1 46 | psBottom = -1 47 | psFirst = -1 48 | psElongationLong = 100 49 | psElongationOffset = 100 50 | mvStopFrame = 1.000000 51 | mvCreamFrame = 0.000000 52 | mlMinStopFrame = 3mil 53 | mlMaxStopFrame = 3mil 54 | mlMinCreamFrame = 0mil 55 | mlMaxCreamFrame = 0mil 56 | mlViaStopLimit = 0mil 57 | srRoundness = 0.000000 58 | srMinRoundness = 0mil 59 | srMaxRoundness = 0mil 60 | slThermalGap = 0.500000 61 | slMinThermalGap = 20mil 62 | slMaxThermalGap = 100mil 63 | slAnnulusIsolate = 20mil 64 | slThermalIsolate = 10mil 65 | slAnnulusRestring = 0 66 | slThermalRestring = 1 67 | slThermalsForVias = 0 68 | checkGrid = 0 69 | checkAngle = 0 70 | checkFont = 1 71 | checkRestrict = 1 72 | useDiameter = 13 73 | maxErrors = 50 74 | -------------------------------------------------------------------------------- /PCB/LaunchPadFlightController_Schematic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/PCB/LaunchPadFlightController_Schematic.png -------------------------------------------------------------------------------- /PCB/README.md: -------------------------------------------------------------------------------- 1 | # LaunchPad Flight Controller 2 | #### Developed by Kristian Sloth Lauszus, 2015 3 | _________ 4 | 5 | This is the design files for the PCB that is designed to plug onto the headers on the Tiva LaunchPad. You can order the PCB directly from the following link: . 6 | -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Batteri.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Batteri.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/F450 Top Plate.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/F450 Top Plate.SLDPRT -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/F450 arm.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/F450 arm.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/F450 chasis.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/F450 chasis.SLDPRT -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Flight controller.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Flight controller.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Imported Components/F450 Top Plate/F450 Top Plate.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Imported Components/F450 Top Plate/F450 Top Plate.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Imported Components/F450 Top Plate/OldVersions/F450 Top Plate.0002.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Imported Components/F450 Top Plate/OldVersions/F450 Top Plate.0002.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Imported Components/F450 chasis/F450 chasis.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Imported Components/F450 chasis/F450 chasis.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Imported Components/F450 chasis/OldVersions/F450 chasis.0002.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Imported Components/F450 chasis/OldVersions/F450 chasis.0002.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/10x4.7-clockwise-propeller.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/10x4.7-clockwise-propeller.SLDPRT -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/10x4.7-counterclockwise-propeller.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/10x4.7-counterclockwise-propeller.SLDPRT -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Hobby King 20A ESC 3A UBEC.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Hobby King 20A ESC 3A UBEC.SLDPRT -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/10x4.7-clockwise-propeller/10x4.7-clockwise-propeller.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/10x4.7-clockwise-propeller/10x4.7-clockwise-propeller.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/10x4.7-clockwise-propeller/10x4.7-clockwise-propeller_MIR.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/10x4.7-clockwise-propeller/10x4.7-clockwise-propeller_MIR.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/10x4.7-clockwise-propeller/OldVersions/10x4.7-clockwise-propeller.0002.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/10x4.7-clockwise-propeller/OldVersions/10x4.7-clockwise-propeller.0002.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/10x4.7-clockwise-propeller/OldVersions/10x4.7-clockwise-propeller_MIR.0001.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/10x4.7-clockwise-propeller/OldVersions/10x4.7-clockwise-propeller_MIR.0001.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/10x4.7-counterclockwise-propeller/10x4.7-counterclockwise-propeller.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/10x4.7-counterclockwise-propeller/10x4.7-counterclockwise-propeller.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/10x4.7-counterclockwise-propeller/10x4.7-counterclockwise-propeller_MIR.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/10x4.7-counterclockwise-propeller/10x4.7-counterclockwise-propeller_MIR.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/10x4.7-counterclockwise-propeller/OldVersions/10x4.7-counterclockwise-propeller.0002.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/10x4.7-counterclockwise-propeller/OldVersions/10x4.7-counterclockwise-propeller.0002.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/10x4.7-counterclockwise-propeller/OldVersions/10x4.7-counterclockwise-propeller_MIR.0001.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/10x4.7-counterclockwise-propeller/OldVersions/10x4.7-counterclockwise-propeller_MIR.0001.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/Hobby King 20A ESC 3A UBEC/Hobby King 20A ESC 3A UBEC.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/Hobby King 20A ESC 3A UBEC/Hobby King 20A ESC 3A UBEC.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/Hobby King 20A ESC 3A UBEC/OldVersions/Hobby King 20A ESC 3A UBEC.0001.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/Hobby King 20A ESC 3A UBEC/OldVersions/Hobby King 20A ESC 3A UBEC.0001.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/Cap.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/Cap.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/CapScrew.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/CapScrew.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/CrossBase.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/CrossBase.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/Housing_Bottom.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/Housing_Bottom.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/Housing_Upper.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/Housing_Upper.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/Nut.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/Nut.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/OldVersions/Cap.0001.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/OldVersions/Cap.0001.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/OldVersions/CapScrew.0001.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/OldVersions/CapScrew.0001.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/OldVersions/CrossBase.0001.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/OldVersions/CrossBase.0001.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/OldVersions/Housing_Bottom.0002.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/OldVersions/Housing_Bottom.0002.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/OldVersions/Housing_Upper.0001.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/OldVersions/Housing_Upper.0001.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/OldVersions/Nut.0001.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/OldVersions/Nut.0001.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/OldVersions/Rotor.0001.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/OldVersions/Rotor.0001.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/OldVersions/Stator.0002.iam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/OldVersions/Stator.0002.iam -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/OldVersions/Stator_Coil.0001.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/OldVersions/Stator_Coil.0001.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/OldVersions/Stator_Steelcore.0001.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/OldVersions/Stator_Steelcore.0001.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/OldVersions/SunnySky X2212_13_980kV.0001.iam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/OldVersions/SunnySky X2212_13_980kV.0001.iam -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/OldVersions/Wiring.0001.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/OldVersions/Wiring.0001.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/Rotor.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/Rotor.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/Stator.iam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/Stator.iam -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/Stator_Coil.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/Stator_Coil.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/Stator_Steelcore.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/Stator_Steelcore.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/SunnySky X2212_13_980kV.iam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/SunnySky X2212_13_980kV.iam -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/Wiring.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Imported Components/SunnySky X2212_13_980kV/Wiring.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Motor_w_Prop.SLDASM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Motor_w_Prop.SLDASM -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Motor_wo_Prop.SLDASM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Motor_wo_Prop.SLDASM -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/Stator.SLDASM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/Stator.SLDASM -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Assemblies/SunnySky X2212_13_980kV.SLDASM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Assemblies/SunnySky X2212_13_980kV.SLDASM -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Parts/Cap.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Parts/Cap.SLDPRT -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Parts/CapScrew.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Parts/CapScrew.SLDPRT -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Parts/CrossBase.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Parts/CrossBase.SLDPRT -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Parts/Housing_Bottom.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Parts/Housing_Bottom.SLDPRT -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Parts/Housing_Upper.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Parts/Housing_Upper.SLDPRT -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Parts/Nut.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Parts/Nut.SLDPRT -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Parts/Rotor.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Parts/Rotor.SLDPRT -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Parts/Stator_Coil.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Parts/Stator_Coil.SLDPRT -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Parts/Stator_Steelcore.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Parts/Stator_Steelcore.SLDPRT -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Parts/Wiring.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Parts/Wiring.SLDPRT -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Renderings/Iso_w_Caps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Renderings/Iso_w_Caps.png -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Renderings/Iso_w_Prop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Renderings/Iso_w_Prop.png -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Motor/Renderings/Iso_wo_Caps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Motor/Renderings/Iso_wo_Caps.png -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/OldVersions/Batteri.0001.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/OldVersions/Batteri.0001.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/OldVersions/F450 arm.0001.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/OldVersions/F450 arm.0001.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/OldVersions/Flight controller.0002.ipt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/OldVersions/Flight controller.0002.ipt -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/OldVersions/Quad correct axis.0001.iam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/OldVersions/Quad correct axis.0001.iam -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/OldVersions/Quad wring axis.0001.iam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/OldVersions/Quad wring axis.0001.iam -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/OldVersions/Quad wring axis.0002.iam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/OldVersions/Quad wring axis.0002.iam -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/OldVersions/SunnySky X2212_13_980kV.0003.iam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/OldVersions/SunnySky X2212_13_980kV.0003.iam -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Quad correct axis.iam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Quad correct axis.iam -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Quad wrong axis.iam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Quad wrong axis.iam -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Renderings/Quad_3d_overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Renderings/Quad_3d_overview.png -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Renderings/Quad_3d_overview.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Renderings/Quad_3d_overview.xcf -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Renderings/Quad_3d_overview_original.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Renderings/Quad_3d_overview_original.png -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Renderings/Quad_top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Renderings/Quad_top.png -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Renderings/Quad_top.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Renderings/Quad_top.xcf -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/Renderings/Quad_top_original.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/Renderings/Quad_top_original.png -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/SunnySky X2212_13_980kV.iam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/SunnySky X2212_13_980kV.iam -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/moment_of_inertia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/moment_of_inertia.png -------------------------------------------------------------------------------- /docs/CD-ROM/3D_Model/sunnysky-x2212-13-980kv-1.snapshot.1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/3D_Model/sunnysky-x2212-13-980kv-1.snapshot.1.zip -------------------------------------------------------------------------------- /docs/CD-ROM/Bibliography/28015-PING-Sensor-Product-Guide-v2.0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/Bibliography/28015-PING-Sensor-Product-Guide-v2.0.pdf -------------------------------------------------------------------------------- /docs/CD-ROM/Bibliography/BST-BMP180-DS000-12-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/Bibliography/BST-BMP180-DS000-12-1.pdf -------------------------------------------------------------------------------- /docs/CD-ROM/Bibliography/CE503 Rotation Matrices - Derivation of 2D Rotation Matrix. Jim Bethel.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/Bibliography/CE503 Rotation Matrices - Derivation of 2D Rotation Matrix. Jim Bethel.pdf -------------------------------------------------------------------------------- /docs/CD-ROM/Bibliography/Chapter 6. Design of Discrete Time Controller – Input:Output Approaches. H. Peng, George T.-C Chiu & T-C. Tsao.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/Bibliography/Chapter 6. Design of Discrete Time Controller – Input:Output Approaches. H. Peng, George T.-C Chiu & T-C. Tsao.pdf -------------------------------------------------------------------------------- /docs/CD-ROM/Bibliography/Classical Mechanics - Goldstein, Poole & Safko.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/Bibliography/Classical Mechanics - Goldstein, Poole & Safko.pdf -------------------------------------------------------------------------------- /docs/CD-ROM/Bibliography/HMC5883L_3-Axis_Digital_Compass_IC.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/Bibliography/HMC5883L_3-Axis_Digital_Compass_IC.pdf -------------------------------------------------------------------------------- /docs/CD-ROM/Bibliography/Implementing a Tilt-Compensated eCompass using Accelerometer and Magnetometer Sensors - AN4248.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/Bibliography/Implementing a Tilt-Compensated eCompass using Accelerometer and Magnetometer Sensors - AN4248.pdf -------------------------------------------------------------------------------- /docs/CD-ROM/Bibliography/MPU_6500_Rev1.0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/Bibliography/MPU_6500_Rev1.0.pdf -------------------------------------------------------------------------------- /docs/CD-ROM/Bibliography/Modelling and L1 adaptive control of a quadcopter - Andre Bertelsen & Mikkel Thomsen.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/Bibliography/Modelling and L1 adaptive control of a quadcopter - Andre Bertelsen & Mikkel Thomsen.pdf -------------------------------------------------------------------------------- /docs/CD-ROM/Bibliography/Quadcopter Dynamics, Simulation, and Control - Andrew Gibiansky.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/Bibliography/Quadcopter Dynamics, Simulation, and Control - Andrew Gibiansky.pdf -------------------------------------------------------------------------------- /docs/CD-ROM/Bibliography/Tilt Sensing Using a Three-Axis Accelerometer - AN3461.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/Bibliography/Tilt Sensing Using a Three-Axis Accelerometer - AN3461.pdf -------------------------------------------------------------------------------- /docs/CD-ROM/Bibliography/tm4c123gh6pm.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/Bibliography/tm4c123gh6pm.pdf -------------------------------------------------------------------------------- /docs/CD-ROM/Matlab/altitude/altitude_baro.m: -------------------------------------------------------------------------------- 1 | clear all 2 | close all 3 | clc 4 | 5 | if 1 6 | data = load('altitude_indoor.txt'); 7 | else 8 | data = load('altitude_baro_10m.txt'); 9 | end 10 | 11 | time = data(:,2) / 1e6; % Convert to seconds 12 | time = time - time(1); % Subtract first value, so it starts at 0s 13 | 14 | input_lpf = data(:,3); 15 | input = data(:,4); 16 | 17 | figure(1) 18 | hold on 19 | plot(time, input, 'g+'); 20 | figure1 = plot(time, input_lpf, 'b+'); 21 | legend('Input', 'Input LPF') 22 | xlim([min(time) max(time)]) 23 | xlabel('Time [s]', 'fontsize', 15); 24 | ylabel('Altitude cm', 'fontsize', 15); 25 | hold off 26 | 27 | saveas(figure1, strcat(pwd, '/img/figure1'),'epsc') % Save figure -------------------------------------------------------------------------------- /docs/CD-ROM/Matlab/model/model.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/Matlab/model/model.slx -------------------------------------------------------------------------------- /docs/CD-ROM/Matlab/model/motor_to_rad_s.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/CD-ROM/Matlab/model/motor_to_rad_s.xlsx -------------------------------------------------------------------------------- /docs/CD-ROM/Matlab/step_response/mapf.m: -------------------------------------------------------------------------------- 1 | function val = mapf(x, in_min, in_max, out_min, out_max) 2 | 3 | val = (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; 4 | if (val < out_min) 5 | val = out_min; 6 | elseif (val > out_max) 7 | val = out_max; 8 | end -------------------------------------------------------------------------------- /docs/CD-ROM/Matlab/step_response/step.m: -------------------------------------------------------------------------------- 1 | clear all 2 | close all 3 | clc 4 | 5 | hold on 6 | if 0 7 | data = load('acro/acro_manual.txt'); 8 | ylabel('Rate [deg/s]', 'fontsize', 15); 9 | elseif 0 10 | data = load('self_level/self_level_30.txt'); 11 | ylabel('Angle [deg]', 'fontsize', 15); 12 | elseif 1 13 | data = load('heading/heading_45deg_10s.txt'); 14 | for i=1:length(data(:,4)) % Normalize data 15 | if (data(i,4) < -180) 16 | data(i,4) = data(i,4) + 360; 17 | elseif (data(i,4) > 180) 18 | data(i,4) = data(i,4) - 360; 19 | end 20 | end 21 | ylabel('Angle [deg]', 'fontsize', 15); 22 | else 23 | convert = 1; 24 | if convert == 1 25 | data = load('altitude/altitude_step.txt'); 26 | ylabel('Height [mm]', 'fontsize', 15); 27 | 28 | % Used to convert the values back to height 29 | MIN_MOTOR_OUT = -100; 30 | MAX_MOTOR_OUT = 100; 31 | SONAR_MIN_DIST = 50; 32 | SONAR_MAX_DIST = 1500; 33 | data(:,3) = mapf(data(:,3), MIN_MOTOR_OUT, MAX_MOTOR_OUT,... 34 | SONAR_MIN_DIST, SONAR_MAX_DIST); 35 | data(:,4) = mapf(data(:,4), MIN_MOTOR_OUT, MAX_MOTOR_OUT,... 36 | SONAR_MIN_DIST, SONAR_MAX_DIST); 37 | else 38 | data = load('altitude/altitude_step.txt'); 39 | end 40 | end 41 | 42 | time = data(:,2) / 1e6; % Convert to seconds 43 | setPoint = data(:,3); 44 | input = data(:,4); 45 | 46 | figure(1) 47 | plot(time, setPoint, 'r'); 48 | figure1 = plot(time, input, 'b+'); 49 | legend('Set point', 'Input') 50 | xlim([min(time) max(time)]) 51 | xlabel('Time [s]', 'fontsize', 15); 52 | hold off 53 | 54 | saveas(figure1, strcat(pwd, '/img/figure1'),'epsc') % Save figure -------------------------------------------------------------------------------- /docs/Kristian Sloth Lauszus - Flight Controller for Quad Rotor Helicopter in X-configuration.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/docs/Kristian Sloth Lauszus - Flight Controller for Quad Rotor Helicopter in X-configuration.pdf -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # LaunchPad Flight Controller 2 | #### Developed by Kristian Sloth Lauszus, 2015 3 | _________ 4 | 5 | This is the report I wrote for my bachelor thesis including the appendix I attached as a [CD-ROM](CD-ROM). 6 | -------------------------------------------------------------------------------- /lib/EULA.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/lib/EULA.txt -------------------------------------------------------------------------------- /lib/TI-BSD-EULA.txt: -------------------------------------------------------------------------------- 1 | Software License Agreement 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | 7 | Redistributions of source code must retain the original copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 10 | Redistributions in binary form must reproduce the original copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the 13 | distribution. 14 | 15 | Neither the name of Texas Instruments Incorporated nor the names of 16 | its contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /lib/docs/SW-EK-TM4C123GXL-BOOST-CAPSENSE-UG-1.1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/lib/docs/SW-EK-TM4C123GXL-BOOST-CAPSENSE-UG-1.1.pdf -------------------------------------------------------------------------------- /lib/docs/SW-EK-TM4C123GXL-BOOST-OLIMEX-8X8-UG-1.1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/lib/docs/SW-EK-TM4C123GXL-BOOST-OLIMEX-8X8-UG-1.1.pdf -------------------------------------------------------------------------------- /lib/docs/SW-EK-TM4C123GXL-BOOSTXL-SENSHUB-UG-1.1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/lib/docs/SW-EK-TM4C123GXL-BOOSTXL-SENSHUB-UG-1.1.pdf -------------------------------------------------------------------------------- /lib/docs/SW-EK-TM4C123GXL-UG-1.1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/lib/docs/SW-EK-TM4C123GXL-UG-1.1.pdf -------------------------------------------------------------------------------- /lib/docs/SW-TM4C-BOOTLDR-UG-1.1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/lib/docs/SW-TM4C-BOOTLDR-UG-1.1.pdf -------------------------------------------------------------------------------- /lib/docs/SW-TM4C-DRL-UG-1.1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/lib/docs/SW-TM4C-DRL-UG-1.1.pdf -------------------------------------------------------------------------------- /lib/docs/SW-TM4C-EXAMPLES-UG-1.1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/lib/docs/SW-TM4C-EXAMPLES-UG-1.1.pdf -------------------------------------------------------------------------------- /lib/docs/SW-TM4C-IQMATH-UG-1.1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/lib/docs/SW-TM4C-IQMATH-UG-1.1.pdf -------------------------------------------------------------------------------- /lib/docs/SW-TM4C-RLN-1.1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/lib/docs/SW-TM4C-RLN-1.1.pdf -------------------------------------------------------------------------------- /lib/docs/SW-TM4C-SENSORLIB-UG-1.1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/lib/docs/SW-TM4C-SENSORLIB-UG-1.1.pdf -------------------------------------------------------------------------------- /lib/docs/SW-TM4C-TOOLS-UG-1.1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/lib/docs/SW-TM4C-TOOLS-UG-1.1.pdf -------------------------------------------------------------------------------- /lib/docs/SW-TM4C-USBL-UG-1.1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/lib/docs/SW-TM4C-USBL-UG-1.1.pdf -------------------------------------------------------------------------------- /lib/docs/SW-TM4C-UTILS-UG-1.1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/lib/docs/SW-TM4C-UTILS-UG-1.1.pdf -------------------------------------------------------------------------------- /lib/driverlib/Makefile: -------------------------------------------------------------------------------- 1 | #****************************************************************************** 2 | # 3 | # Makefile - Rules for building the driver library. 4 | # 5 | # Copyright (c) 2005-2013 Texas Instruments Incorporated. All rights reserved. 6 | # Software License Agreement 7 | # 8 | # Redistribution and use in source and binary forms, with or without 9 | # modification, are permitted provided that the following conditions 10 | # are met: 11 | # 12 | # Redistributions of source code must retain the above copyright 13 | # notice, this list of conditions and the following disclaimer. 14 | # 15 | # Redistributions in binary form must reproduce the above copyright 16 | # notice, this list of conditions and the following disclaimer in the 17 | # documentation and/or other materials provided with the 18 | # distribution. 19 | # 20 | # Neither the name of Texas Instruments Incorporated nor the names of 21 | # its contributors may be used to endorse or promote products derived 22 | # from this software without specific prior written permission. 23 | # 24 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | # 36 | # This is part of revision 1.1 of the Tiva Peripheral Driver Library. 37 | # 38 | #****************************************************************************** 39 | 40 | # 41 | # The base directory for TivaWare. 42 | # 43 | ROOT=.. 44 | 45 | # 46 | # Include the common make definitions. 47 | # 48 | include ${ROOT}/makedefs 49 | 50 | # 51 | # Where to find header files that do not live in the source directory. 52 | # 53 | IPATH=.. 54 | 55 | # 56 | # The default rule, which causes the driver library to be built. 57 | # 58 | all: ${COMPILER} 59 | all: ${COMPILER}/libdriver.a 60 | 61 | # 62 | # The rule to clean out all the build products. 63 | # 64 | clean: 65 | @rm -rf ${COMPILER} ${wildcard *~} 66 | 67 | # 68 | # The rule to create the target directory. 69 | # 70 | ${COMPILER}: 71 | @mkdir -p ${COMPILER} 72 | 73 | # 74 | # Rules for building the driver library. 75 | # 76 | ${COMPILER}/libdriver.a: ${COMPILER}/adc.o 77 | ${COMPILER}/libdriver.a: ${COMPILER}/can.o 78 | ${COMPILER}/libdriver.a: ${COMPILER}/comp.o 79 | ${COMPILER}/libdriver.a: ${COMPILER}/cpu.o 80 | ${COMPILER}/libdriver.a: ${COMPILER}/eeprom.o 81 | ${COMPILER}/libdriver.a: ${COMPILER}/flash.o 82 | ${COMPILER}/libdriver.a: ${COMPILER}/fpu.o 83 | ${COMPILER}/libdriver.a: ${COMPILER}/gpio.o 84 | ${COMPILER}/libdriver.a: ${COMPILER}/hibernate.o 85 | ${COMPILER}/libdriver.a: ${COMPILER}/i2c.o 86 | ${COMPILER}/libdriver.a: ${COMPILER}/interrupt.o 87 | ${COMPILER}/libdriver.a: ${COMPILER}/mpu.o 88 | ${COMPILER}/libdriver.a: ${COMPILER}/pwm.o 89 | ${COMPILER}/libdriver.a: ${COMPILER}/qei.o 90 | ${COMPILER}/libdriver.a: ${COMPILER}/ssi.o 91 | ${COMPILER}/libdriver.a: ${COMPILER}/sw_crc.o 92 | ${COMPILER}/libdriver.a: ${COMPILER}/sysctl.o 93 | ${COMPILER}/libdriver.a: ${COMPILER}/sysexc.o 94 | ${COMPILER}/libdriver.a: ${COMPILER}/systick.o 95 | ${COMPILER}/libdriver.a: ${COMPILER}/timer.o 96 | ${COMPILER}/libdriver.a: ${COMPILER}/uart.o 97 | ${COMPILER}/libdriver.a: ${COMPILER}/udma.o 98 | ${COMPILER}/libdriver.a: ${COMPILER}/usb.o 99 | ${COMPILER}/libdriver.a: ${COMPILER}/watchdog.o 100 | 101 | # 102 | # Include the automatically generated dependency files. 103 | # 104 | ifneq (${MAKECMDGOALS},clean) 105 | -include ${wildcard ${COMPILER}/*.d} __dummy__ 106 | endif 107 | -------------------------------------------------------------------------------- /lib/driverlib/ccs/.ccsproject: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /lib/driverlib/ccs/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | driverlib 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 15 | full,incremental, 16 | 17 | 18 | 19 | 20 | 21 | com.ti.ccstudio.core.ccsNature 22 | org.eclipse.cdt.core.cnature 23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 24 | org.eclipse.cdt.core.ccnature 25 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 26 | 27 | 28 | 29 | adc.c 30 | 1 31 | SW_ROOT/driverlib/adc.c 32 | 33 | 34 | can.c 35 | 1 36 | SW_ROOT/driverlib/can.c 37 | 38 | 39 | comp.c 40 | 1 41 | SW_ROOT/driverlib/comp.c 42 | 43 | 44 | cpu.c 45 | 1 46 | SW_ROOT/driverlib/cpu.c 47 | 48 | 49 | eeprom.c 50 | 1 51 | SW_ROOT/driverlib/eeprom.c 52 | 53 | 54 | flash.c 55 | 1 56 | SW_ROOT/driverlib/flash.c 57 | 58 | 59 | fpu.c 60 | 1 61 | SW_ROOT/driverlib/fpu.c 62 | 63 | 64 | gpio.c 65 | 1 66 | SW_ROOT/driverlib/gpio.c 67 | 68 | 69 | hibernate.c 70 | 1 71 | SW_ROOT/driverlib/hibernate.c 72 | 73 | 74 | i2c.c 75 | 1 76 | SW_ROOT/driverlib/i2c.c 77 | 78 | 79 | interrupt.c 80 | 1 81 | SW_ROOT/driverlib/interrupt.c 82 | 83 | 84 | mpu.c 85 | 1 86 | SW_ROOT/driverlib/mpu.c 87 | 88 | 89 | pwm.c 90 | 1 91 | SW_ROOT/driverlib/pwm.c 92 | 93 | 94 | qei.c 95 | 1 96 | SW_ROOT/driverlib/qei.c 97 | 98 | 99 | ssi.c 100 | 1 101 | SW_ROOT/driverlib/ssi.c 102 | 103 | 104 | sw_crc.c 105 | 1 106 | SW_ROOT/driverlib/sw_crc.c 107 | 108 | 109 | sysctl.c 110 | 1 111 | SW_ROOT/driverlib/sysctl.c 112 | 113 | 114 | sysexc.c 115 | 1 116 | SW_ROOT/driverlib/sysexc.c 117 | 118 | 119 | systick.c 120 | 1 121 | SW_ROOT/driverlib/systick.c 122 | 123 | 124 | timer.c 125 | 1 126 | SW_ROOT/driverlib/timer.c 127 | 128 | 129 | uart.c 130 | 1 131 | SW_ROOT/driverlib/uart.c 132 | 133 | 134 | udma.c 135 | 1 136 | SW_ROOT/driverlib/udma.c 137 | 138 | 139 | usb.c 140 | 1 141 | SW_ROOT/driverlib/usb.c 142 | 143 | 144 | watchdog.c 145 | 1 146 | SW_ROOT/driverlib/watchdog.c 147 | 148 | 149 | 150 | 151 | SW_ROOT 152 | $%7BPARENT-2-PROJECT_LOC%7D 153 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /lib/driverlib/ccs/.settings/org.eclipse.cdt.codan.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | inEditor=false 3 | onBuild=false 4 | -------------------------------------------------------------------------------- /lib/driverlib/ccs/Debug/driverlib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/lib/driverlib/ccs/Debug/driverlib.lib -------------------------------------------------------------------------------- /lib/driverlib/ccs/macros.ini_initial: -------------------------------------------------------------------------------- 1 | SW_ROOT = ../.. 2 | -------------------------------------------------------------------------------- /lib/driverlib/cpu.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // cpu.h - Prototypes for the CPU instruction wrapper functions. 4 | // 5 | // Copyright (c) 2006-2013 Texas Instruments Incorporated. All rights reserved. 6 | // Software License Agreement 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // Redistributions of source code must retain the above copyright 13 | // notice, this list of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright 16 | // notice, this list of conditions and the following disclaimer in the 17 | // documentation and/or other materials provided with the 18 | // distribution. 19 | // 20 | // Neither the name of Texas Instruments Incorporated nor the names of 21 | // its contributors may be used to endorse or promote products derived 22 | // from this software without specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | // 36 | // This is part of revision 1.1 of the Tiva Peripheral Driver Library. 37 | // 38 | //***************************************************************************** 39 | 40 | #ifndef __DRIVERLIB_CPU_H__ 41 | #define __DRIVERLIB_CPU_H__ 42 | 43 | //***************************************************************************** 44 | // 45 | // If building with a C++ compiler, make all of the definitions in this header 46 | // have a C binding. 47 | // 48 | //***************************************************************************** 49 | #ifdef __cplusplus 50 | extern "C" 51 | { 52 | #endif 53 | 54 | //***************************************************************************** 55 | // 56 | // Prototypes. 57 | // 58 | //***************************************************************************** 59 | extern uint32_t CPUcpsid(void); 60 | extern uint32_t CPUcpsie(void); 61 | extern uint32_t CPUprimask(void); 62 | extern void CPUwfi(void); 63 | extern uint32_t CPUbasepriGet(void); 64 | extern void CPUbasepriSet(uint32_t ui32NewBasepri); 65 | 66 | //***************************************************************************** 67 | // 68 | // Mark the end of the C bindings section for C++ compilers. 69 | // 70 | //***************************************************************************** 71 | #ifdef __cplusplus 72 | } 73 | #endif 74 | 75 | #endif // __DRIVERLIB_CPU_H__ 76 | -------------------------------------------------------------------------------- /lib/driverlib/debug.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // debug.h - Macros for assisting debug of the driver library. 4 | // 5 | // Copyright (c) 2006-2013 Texas Instruments Incorporated. All rights reserved. 6 | // Software License Agreement 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // Redistributions of source code must retain the above copyright 13 | // notice, this list of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright 16 | // notice, this list of conditions and the following disclaimer in the 17 | // documentation and/or other materials provided with the 18 | // distribution. 19 | // 20 | // Neither the name of Texas Instruments Incorporated nor the names of 21 | // its contributors may be used to endorse or promote products derived 22 | // from this software without specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | // 36 | // This is part of revision 1.1 of the Tiva Peripheral Driver Library. 37 | // 38 | //***************************************************************************** 39 | 40 | #ifndef __DRIVERLIB_DEBUG_H__ 41 | #define __DRIVERLIB_DEBUG_H__ 42 | 43 | //***************************************************************************** 44 | // 45 | // Prototype for the function that is called when an invalid argument is passed 46 | // to an API. This is only used when doing a DEBUG build. 47 | // 48 | //***************************************************************************** 49 | extern void __error__(char *pcFilename, uint32_t ui32Line); 50 | 51 | //***************************************************************************** 52 | // 53 | // The ASSERT macro, which does the actual assertion checking. Typically, this 54 | // will be for procedure arguments. 55 | // 56 | //***************************************************************************** 57 | #ifdef DEBUG 58 | #define ASSERT(expr) do \ 59 | { \ 60 | if(!(expr)) \ 61 | { \ 62 | __error__(__FILE__, __LINE__); \ 63 | } \ 64 | } \ 65 | while(0) 66 | #else 67 | #define ASSERT(expr) 68 | #endif 69 | 70 | #endif // __DRIVERLIB_DEBUG_H__ 71 | -------------------------------------------------------------------------------- /lib/driverlib/driverlib.sgxx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/lib/driverlib/driverlib.sgxx -------------------------------------------------------------------------------- /lib/driverlib/ewarm/Exe/driverlib.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/lib/driverlib/ewarm/Exe/driverlib.a -------------------------------------------------------------------------------- /lib/driverlib/gcc/libdriver.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/lib/driverlib/gcc/libdriver.a -------------------------------------------------------------------------------- /lib/driverlib/interrupt.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // interrupt.h - Prototypes for the NVIC Interrupt Controller Driver. 4 | // 5 | // Copyright (c) 2005-2013 Texas Instruments Incorporated. All rights reserved. 6 | // Software License Agreement 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // Redistributions of source code must retain the above copyright 13 | // notice, this list of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright 16 | // notice, this list of conditions and the following disclaimer in the 17 | // documentation and/or other materials provided with the 18 | // distribution. 19 | // 20 | // Neither the name of Texas Instruments Incorporated nor the names of 21 | // its contributors may be used to endorse or promote products derived 22 | // from this software without specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | // 36 | // This is part of revision 1.1 of the Tiva Peripheral Driver Library. 37 | // 38 | //***************************************************************************** 39 | 40 | #ifndef __DRIVERLIB_INTERRUPT_H__ 41 | #define __DRIVERLIB_INTERRUPT_H__ 42 | 43 | //***************************************************************************** 44 | // 45 | // If building with a C++ compiler, make all of the definitions in this header 46 | // have a C binding. 47 | // 48 | //***************************************************************************** 49 | #ifdef __cplusplus 50 | extern "C" 51 | { 52 | #endif 53 | 54 | //***************************************************************************** 55 | // 56 | // Macro to generate an interrupt priority mask based on the number of bits 57 | // of priority supported by the hardware. 58 | // 59 | //***************************************************************************** 60 | #define INT_PRIORITY_MASK ((0xFF << (8 - NUM_PRIORITY_BITS)) & 0xFF) 61 | 62 | //***************************************************************************** 63 | // 64 | // Prototypes for the APIs. 65 | // 66 | //***************************************************************************** 67 | extern bool IntMasterEnable(void); 68 | extern bool IntMasterDisable(void); 69 | extern void IntRegister(uint32_t ui32Interrupt, void (*pfnHandler)(void)); 70 | extern void IntUnregister(uint32_t ui32Interrupt); 71 | extern void IntPriorityGroupingSet(uint32_t ui32Bits); 72 | extern uint32_t IntPriorityGroupingGet(void); 73 | extern void IntPrioritySet(uint32_t ui32Interrupt, 74 | uint8_t ui8Priority); 75 | extern int32_t IntPriorityGet(uint32_t ui32Interrupt); 76 | extern void IntEnable(uint32_t ui32Interrupt); 77 | extern void IntDisable(uint32_t ui32Interrupt); 78 | extern uint32_t IntIsEnabled(uint32_t ui32Interrupt); 79 | extern void IntPendSet(uint32_t ui32Interrupt); 80 | extern void IntPendClear(uint32_t ui32Interrupt); 81 | extern void IntPriorityMaskSet(uint32_t ui32PriorityMask); 82 | extern uint32_t IntPriorityMaskGet(void); 83 | extern void IntTrigger(uint32_t ui32Interrupt); 84 | 85 | //***************************************************************************** 86 | // 87 | // Mark the end of the C bindings section for C++ compilers. 88 | // 89 | //***************************************************************************** 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | 94 | #endif // __DRIVERLIB_INTERRUPT_H__ 95 | -------------------------------------------------------------------------------- /lib/driverlib/readme.txt: -------------------------------------------------------------------------------- 1 | This project will build the TivaWare Peripheral Driver Library. 2 | 3 | ------------------------------------------------------------------------------- 4 | 5 | Copyright (c) 2006-2013 Texas Instruments Incorporated. All rights reserved. 6 | Software License Agreement 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions 10 | are met: 11 | 12 | Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | 15 | Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in the 17 | documentation and/or other materials provided with the 18 | distribution. 19 | 20 | Neither the name of Texas Instruments Incorporated nor the names of 21 | its contributors may be used to endorse or promote products derived 22 | from this software without specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | 36 | This is part of revision 1.1 of the Tiva Peripheral Driver Library. 37 | -------------------------------------------------------------------------------- /lib/driverlib/rvmdk/driverlib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/lib/driverlib/rvmdk/driverlib.lib -------------------------------------------------------------------------------- /lib/driverlib/sw_crc.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // sw_crc.h - Prototypes for the software CRC functions. 4 | // 5 | // Copyright (c) 2010-2013 Texas Instruments Incorporated. All rights reserved. 6 | // Software License Agreement 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // Redistributions of source code must retain the above copyright 13 | // notice, this list of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright 16 | // notice, this list of conditions and the following disclaimer in the 17 | // documentation and/or other materials provided with the 18 | // distribution. 19 | // 20 | // Neither the name of Texas Instruments Incorporated nor the names of 21 | // its contributors may be used to endorse or promote products derived 22 | // from this software without specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | // 36 | // This is part of revision 1.1 of the Tiva Peripheral Driver Library. 37 | // 38 | //***************************************************************************** 39 | 40 | #ifndef __DRIVERLIB_SW_CRC_H__ 41 | #define __DRIVERLIB_SW_CRC_H__ 42 | 43 | //***************************************************************************** 44 | // 45 | // If building with a C++ compiler, make all of the definitions in this header 46 | // have a C binding. 47 | // 48 | //***************************************************************************** 49 | #ifdef __cplusplus 50 | extern "C" 51 | { 52 | #endif 53 | 54 | //***************************************************************************** 55 | // 56 | // Prototypes for the functions. 57 | // 58 | //***************************************************************************** 59 | extern uint8_t Crc8CCITT(uint8_t ui8Crc, const uint8_t *pui8Data, 60 | uint32_t ui32Count); 61 | extern uint16_t Crc16(uint16_t ui16Crc, const uint8_t *pui8Data, 62 | uint32_t ui32Count); 63 | extern uint16_t Crc16Array(uint32_t ui32WordLen, const uint32_t *pui32Data); 64 | extern void Crc16Array3(uint32_t ui32WordLen, const uint32_t *pui32Data, 65 | uint16_t *pui16Crc3); 66 | extern uint32_t Crc32(uint32_t ui32Crc, const uint8_t *pui8Data, 67 | uint32_t ui32Count); 68 | 69 | //***************************************************************************** 70 | // 71 | // Mark the end of the C bindings section for C++ compilers. 72 | // 73 | //***************************************************************************** 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | 78 | #endif // __DRIVERLIB_SW_CRC_H__ 79 | -------------------------------------------------------------------------------- /lib/driverlib/sysexc.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // sysexc.h - Prototypes for the System Exception Module routines. 4 | // 5 | // Copyright (c) 2011-2013 Texas Instruments Incorporated. All rights reserved. 6 | // Software License Agreement 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // Redistributions of source code must retain the above copyright 13 | // notice, this list of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright 16 | // notice, this list of conditions and the following disclaimer in the 17 | // documentation and/or other materials provided with the 18 | // distribution. 19 | // 20 | // Neither the name of Texas Instruments Incorporated nor the names of 21 | // its contributors may be used to endorse or promote products derived 22 | // from this software without specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | // 36 | // This is part of revision 1.1 of the Tiva Peripheral Driver Library. 37 | // 38 | //***************************************************************************** 39 | 40 | #ifndef __DRIVERLIB_SYSEXC_H__ 41 | #define __DRIVERLIB_SYSEXC_H__ 42 | 43 | //***************************************************************************** 44 | // 45 | // If building with a C++ compiler, make all of the definitions in this header 46 | // have a C binding. 47 | // 48 | //***************************************************************************** 49 | #ifdef __cplusplus 50 | extern "C" 51 | { 52 | #endif 53 | 54 | //***************************************************************************** 55 | // 56 | // Values that can be passed to SysExcIntEnable, SysExcIntDisable, and 57 | // SysExcIntClear as the ui32IntFlags parameter, and returned from 58 | // SysExcIntStatus. 59 | // 60 | //***************************************************************************** 61 | #define SYSEXC_INT_FP_IXC 0x00000020 // FP Inexact exception interrupt 62 | #define SYSEXC_INT_FP_OFC 0x00000010 // FP Overflow exception interrupt 63 | #define SYSEXC_INT_FP_UFC 0x00000008 // FP Underflow exception interrupt 64 | #define SYSEXC_INT_FP_IOC 0x00000004 // FP Invalid operation interrupt 65 | #define SYSEXC_INT_FP_DZC 0x00000002 // FP Divide by zero exception int 66 | #define SYSEXC_INT_FP_IDC 0x00000001 // FP Input denormal exception int 67 | 68 | //***************************************************************************** 69 | // 70 | // Prototypes. 71 | // 72 | //***************************************************************************** 73 | extern void SysExcIntRegister(void (*pfnHandler)(void)); 74 | extern void SysExcIntUnregister(void); 75 | extern void SysExcIntEnable(uint32_t ui32IntFlags); 76 | extern void SysExcIntDisable(uint32_t ui32IntFlags); 77 | extern uint32_t SysExcIntStatus(bool bMasked); 78 | extern void SysExcIntClear(uint32_t ui32IntFlags); 79 | 80 | //***************************************************************************** 81 | // 82 | // Mark the end of the C bindings section for C++ compilers. 83 | // 84 | //***************************************************************************** 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif // __DRIVERLIB_SYSEXC_H__ 90 | -------------------------------------------------------------------------------- /lib/driverlib/systick.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // systick.h - Prototypes for the SysTick driver. 4 | // 5 | // Copyright (c) 2005-2013 Texas Instruments Incorporated. All rights reserved. 6 | // Software License Agreement 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // Redistributions of source code must retain the above copyright 13 | // notice, this list of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright 16 | // notice, this list of conditions and the following disclaimer in the 17 | // documentation and/or other materials provided with the 18 | // distribution. 19 | // 20 | // Neither the name of Texas Instruments Incorporated nor the names of 21 | // its contributors may be used to endorse or promote products derived 22 | // from this software without specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | // 36 | // This is part of revision 1.1 of the Tiva Peripheral Driver Library. 37 | // 38 | //***************************************************************************** 39 | 40 | #ifndef __DRIVERLIB_SYSTICK_H__ 41 | #define __DRIVERLIB_SYSTICK_H__ 42 | 43 | //***************************************************************************** 44 | // 45 | // If building with a C++ compiler, make all of the definitions in this header 46 | // have a C binding. 47 | // 48 | //***************************************************************************** 49 | #ifdef __cplusplus 50 | extern "C" 51 | { 52 | #endif 53 | 54 | //***************************************************************************** 55 | // 56 | // Prototypes for the APIs. 57 | // 58 | //***************************************************************************** 59 | extern void SysTickEnable(void); 60 | extern void SysTickDisable(void); 61 | extern void SysTickIntRegister(void (*pfnHandler)(void)); 62 | extern void SysTickIntUnregister(void); 63 | extern void SysTickIntEnable(void); 64 | extern void SysTickIntDisable(void); 65 | extern void SysTickPeriodSet(uint32_t ui32Period); 66 | extern uint32_t SysTickPeriodGet(void); 67 | extern uint32_t SysTickValueGet(void); 68 | 69 | //***************************************************************************** 70 | // 71 | // Mark the end of the C bindings section for C++ compilers. 72 | // 73 | //***************************************************************************** 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | 78 | #endif // __DRIVERLIB_SYSTICK_H__ 79 | -------------------------------------------------------------------------------- /lib/driverlib/watchdog.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // watchdog.h - Prototypes for the Watchdog Timer API 4 | // 5 | // Copyright (c) 2005-2013 Texas Instruments Incorporated. All rights reserved. 6 | // Software License Agreement 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // Redistributions of source code must retain the above copyright 13 | // notice, this list of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright 16 | // notice, this list of conditions and the following disclaimer in the 17 | // documentation and/or other materials provided with the 18 | // distribution. 19 | // 20 | // Neither the name of Texas Instruments Incorporated nor the names of 21 | // its contributors may be used to endorse or promote products derived 22 | // from this software without specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | // 36 | // This is part of revision 1.1 of the Tiva Peripheral Driver Library. 37 | // 38 | //***************************************************************************** 39 | 40 | #ifndef __DRIVERLIB_WATCHDOG_H__ 41 | #define __DRIVERLIB_WATCHDOG_H__ 42 | 43 | //***************************************************************************** 44 | // 45 | // If building with a C++ compiler, make all of the definitions in this header 46 | // have a C binding. 47 | // 48 | //***************************************************************************** 49 | #ifdef __cplusplus 50 | extern "C" 51 | { 52 | #endif 53 | 54 | //***************************************************************************** 55 | // 56 | // The type of interrupt that can be generated by the watchdog. 57 | // 58 | //***************************************************************************** 59 | #define WATCHDOG_INT_TYPE_INT 0x00000000 60 | #define WATCHDOG_INT_TYPE_NMI 0x00000004 61 | 62 | //***************************************************************************** 63 | // 64 | // Prototypes for the APIs. 65 | // 66 | //***************************************************************************** 67 | extern bool WatchdogRunning(uint32_t ui32Base); 68 | extern void WatchdogEnable(uint32_t ui32Base); 69 | extern void WatchdogResetEnable(uint32_t ui32Base); 70 | extern void WatchdogResetDisable(uint32_t ui32Base); 71 | extern void WatchdogLock(uint32_t ui32Base); 72 | extern void WatchdogUnlock(uint32_t ui32Base); 73 | extern bool WatchdogLockState(uint32_t ui32Base); 74 | extern void WatchdogReloadSet(uint32_t ui32Base, uint32_t ui32LoadVal); 75 | extern uint32_t WatchdogReloadGet(uint32_t ui32Base); 76 | extern uint32_t WatchdogValueGet(uint32_t ui32Base); 77 | extern void WatchdogIntRegister(uint32_t ui32Base, void (*pfnHandler)(void)); 78 | extern void WatchdogIntUnregister(uint32_t ui32Base); 79 | extern void WatchdogIntEnable(uint32_t ui32Base); 80 | extern uint32_t WatchdogIntStatus(uint32_t ui32Base, bool bMasked); 81 | extern void WatchdogIntClear(uint32_t ui32Base); 82 | extern void WatchdogIntTypeSet(uint32_t ui32Base, uint32_t ui32Type); 83 | extern void WatchdogStallEnable(uint32_t ui32Base); 84 | extern void WatchdogStallDisable(uint32_t ui32Base); 85 | 86 | //***************************************************************************** 87 | // 88 | // Mark the end of the C bindings section for C++ compilers. 89 | // 90 | //***************************************************************************** 91 | #ifdef __cplusplus 92 | } 93 | #endif 94 | 95 | #endif // __DRIVERLIB_WATCHDOG_H__ 96 | -------------------------------------------------------------------------------- /lib/inc/hw_fan.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // hw_fan.h - Macros used when accessing the fan control hardware. 4 | // 5 | // Copyright (c) 2010-2013 Texas Instruments Incorporated. All rights reserved. 6 | // Software License Agreement 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // Redistributions of source code must retain the above copyright 13 | // notice, this list of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright 16 | // notice, this list of conditions and the following disclaimer in the 17 | // documentation and/or other materials provided with the 18 | // distribution. 19 | // 20 | // Neither the name of Texas Instruments Incorporated nor the names of 21 | // its contributors may be used to endorse or promote products derived 22 | // from this software without specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | // 36 | // This is part of revision 1.1 of the Tiva Firmware Development Package. 37 | // 38 | //***************************************************************************** 39 | 40 | #ifndef __HW_FAN_H__ 41 | #define __HW_FAN_H__ 42 | 43 | //***************************************************************************** 44 | // 45 | // The following are defines for the Fan Control register offsets. 46 | // 47 | //***************************************************************************** 48 | 49 | #endif // __HW_FAN_H__ 50 | -------------------------------------------------------------------------------- /lib/inc/hw_lpc.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // hw_lpc.h - Macros used when accessing the LPC hardware. 4 | // 5 | // Copyright (c) 2010-2013 Texas Instruments Incorporated. All rights reserved. 6 | // Software License Agreement 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // Redistributions of source code must retain the above copyright 13 | // notice, this list of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright 16 | // notice, this list of conditions and the following disclaimer in the 17 | // documentation and/or other materials provided with the 18 | // distribution. 19 | // 20 | // Neither the name of Texas Instruments Incorporated nor the names of 21 | // its contributors may be used to endorse or promote products derived 22 | // from this software without specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | // 36 | // This is part of revision 1.1 of the Tiva Firmware Development Package. 37 | // 38 | //***************************************************************************** 39 | 40 | #ifndef __HW_LPC_H__ 41 | #define __HW_LPC_H__ 42 | 43 | //***************************************************************************** 44 | // 45 | // The following are defines for the LPC register addresses. 46 | // 47 | //***************************************************************************** 48 | 49 | #endif // __HW_LPC_H__ 50 | -------------------------------------------------------------------------------- /lib/inc/hw_peci.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // hw_peci.h - Macros used when accessing the PECI hardware. 4 | // 5 | // Copyright (c) 2010-2013 Texas Instruments Incorporated. All rights reserved. 6 | // Software License Agreement 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // Redistributions of source code must retain the above copyright 13 | // notice, this list of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright 16 | // notice, this list of conditions and the following disclaimer in the 17 | // documentation and/or other materials provided with the 18 | // distribution. 19 | // 20 | // Neither the name of Texas Instruments Incorporated nor the names of 21 | // its contributors may be used to endorse or promote products derived 22 | // from this software without specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | // 36 | // This is part of revision 1.1 of the Tiva Firmware Development Package. 37 | // 38 | //***************************************************************************** 39 | 40 | #ifndef __HW_PECI_H__ 41 | #define __HW_PECI_H__ 42 | 43 | //***************************************************************************** 44 | // 45 | // The following are defines for the PECI register addresses. 46 | // 47 | //***************************************************************************** 48 | 49 | #endif // __HW_PECI_H__ 50 | -------------------------------------------------------------------------------- /lib/inc/inc.sgxx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/lib/inc/inc.sgxx -------------------------------------------------------------------------------- /lib/utils/cpu_usage.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // cpu_usage.h - Prototypes for the CPU utilization routines. 4 | // 5 | // Copyright (c) 2007-2013 Texas Instruments Incorporated. All rights reserved. 6 | // Software License Agreement 7 | // 8 | // Texas Instruments (TI) is supplying this software for use solely and 9 | // exclusively on TI's microcontroller products. The software is owned by 10 | // TI and/or its suppliers, and is protected under applicable copyright 11 | // laws. You may not combine this software with "viral" open-source 12 | // software in order to form a larger program. 13 | // 14 | // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 15 | // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 16 | // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 18 | // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 19 | // DAMAGES, FOR ANY REASON WHATSOEVER. 20 | // 21 | // This is part of revision 1.1 of the Tiva Utility Library. 22 | // 23 | //***************************************************************************** 24 | 25 | #ifndef __CPU_USAGE_H__ 26 | #define __CPU_USAGE_H__ 27 | 28 | //***************************************************************************** 29 | // 30 | // If building with a C++ compiler, make all of the definitions in this header 31 | // have a C binding. 32 | // 33 | //***************************************************************************** 34 | #ifdef __cplusplus 35 | extern "C" 36 | { 37 | #endif 38 | 39 | //***************************************************************************** 40 | // 41 | // Prototypes for the CPU utilization routines. 42 | // 43 | //***************************************************************************** 44 | extern uint32_t CPUUsageTick(void); 45 | extern void CPUUsageInit(uint32_t ui32ClockRate, uint32_t ui32Rate, 46 | uint32_t ui32Timer); 47 | 48 | //***************************************************************************** 49 | // 50 | // Mark the end of the C bindings section for C++ compilers. 51 | // 52 | //***************************************************************************** 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif // __CPU_USAGE_H__ 58 | -------------------------------------------------------------------------------- /lib/utils/flash_pb.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // flash_pb.h - Prototypes for the flash parameter block functions. 4 | // 5 | // Copyright (c) 2008-2013 Texas Instruments Incorporated. All rights reserved. 6 | // Software License Agreement 7 | // 8 | // Texas Instruments (TI) is supplying this software for use solely and 9 | // exclusively on TI's microcontroller products. The software is owned by 10 | // TI and/or its suppliers, and is protected under applicable copyright 11 | // laws. You may not combine this software with "viral" open-source 12 | // software in order to form a larger program. 13 | // 14 | // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 15 | // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 16 | // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 18 | // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 19 | // DAMAGES, FOR ANY REASON WHATSOEVER. 20 | // 21 | // This is part of revision 1.1 of the Tiva Utility Library. 22 | // 23 | //***************************************************************************** 24 | 25 | #ifndef __FLASH_PB_H__ 26 | #define __FLASH_PB_H__ 27 | 28 | //***************************************************************************** 29 | // 30 | // If building with a C++ compiler, make all of the definitions in this header 31 | // have a C binding. 32 | // 33 | //***************************************************************************** 34 | #ifdef __cplusplus 35 | extern "C" 36 | { 37 | #endif 38 | 39 | //***************************************************************************** 40 | // 41 | // Prototype for the flash parameter block functions. 42 | // 43 | //***************************************************************************** 44 | extern uint8_t *FlashPBGet(void); 45 | extern void FlashPBSave(uint8_t *pui8Buffer); 46 | extern void FlashPBInit(uint32_t ui32Start, uint32_t ui32End, 47 | uint32_t ui32Size); 48 | 49 | //***************************************************************************** 50 | // 51 | // Mark the end of the C bindings section for C++ compilers. 52 | // 53 | //***************************************************************************** 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif // __FLASH_PB_H__ 59 | -------------------------------------------------------------------------------- /lib/utils/isqrt.c: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // isqrt.c - Integer square root. 4 | // 5 | // Copyright (c) 2005-2013 Texas Instruments Incorporated. All rights reserved. 6 | // Software License Agreement 7 | // 8 | // Texas Instruments (TI) is supplying this software for use solely and 9 | // exclusively on TI's microcontroller products. The software is owned by 10 | // TI and/or its suppliers, and is protected under applicable copyright 11 | // laws. You may not combine this software with "viral" open-source 12 | // software in order to form a larger program. 13 | // 14 | // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 15 | // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 16 | // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 18 | // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 19 | // DAMAGES, FOR ANY REASON WHATSOEVER. 20 | // 21 | // This is part of revision 1.1 of the Tiva Utility Library. 22 | // 23 | //***************************************************************************** 24 | 25 | #include 26 | #include "utils/isqrt.h" 27 | 28 | //***************************************************************************** 29 | // 30 | //! \addtogroup isqrt_api 31 | //! @{ 32 | // 33 | //***************************************************************************** 34 | 35 | //***************************************************************************** 36 | // 37 | //! Compute the integer square root of an integer. 38 | //! 39 | //! \param ui32Value is the value whose square root is desired. 40 | //! 41 | //! This function will compute the integer square root of the given input 42 | //! value. Since the value returned is also an integer, it is actually better 43 | //! defined as the largest integer whose square is less than or equal to the 44 | //! input value. 45 | //! 46 | //! \return Returns the square root of the input value. 47 | // 48 | //***************************************************************************** 49 | uint32_t 50 | isqrt(uint32_t ui32Value) 51 | { 52 | uint32_t ui32Rem, ui32Root, ui32Idx; 53 | 54 | // 55 | // Initialize the remainder and root to zero. 56 | // 57 | ui32Rem = 0; 58 | ui32Root = 0; 59 | 60 | // 61 | // Loop over the sixteen bits in the root. 62 | // 63 | for(ui32Idx = 0; ui32Idx < 16; ui32Idx++) 64 | { 65 | // 66 | // Shift the root up by a bit to make room for the new bit that is 67 | // about to be computed. 68 | // 69 | ui32Root <<= 1; 70 | 71 | // 72 | // Get two more bits from the input into the remainder. 73 | // 74 | ui32Rem = ((ui32Rem << 2) + (ui32Value >> 30)); 75 | ui32Value <<= 2; 76 | 77 | // 78 | // Make the test root be 2n + 1. 79 | // 80 | ui32Root++; 81 | 82 | // 83 | // See if the root is greater than the remainder. 84 | // 85 | if(ui32Root <= ui32Rem) 86 | { 87 | // 88 | // Subtract the test root from the remainder. 89 | // 90 | ui32Rem -= ui32Root; 91 | 92 | // 93 | // Increment the root, setting the second LSB. 94 | // 95 | ui32Root++; 96 | } 97 | else 98 | { 99 | // 100 | // The root is greater than the remainder, so the new bit of the 101 | // root is actually zero. 102 | // 103 | ui32Root--; 104 | } 105 | } 106 | 107 | // 108 | // Return the computed root. 109 | // 110 | return(ui32Root >> 1); 111 | } 112 | 113 | //***************************************************************************** 114 | // 115 | // Close the Doxygen group. 116 | //! @} 117 | // 118 | //***************************************************************************** 119 | -------------------------------------------------------------------------------- /lib/utils/isqrt.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // isqrt.h - Prototype for the integer square root function. 4 | // 5 | // Copyright (c) 2006-2013 Texas Instruments Incorporated. All rights reserved. 6 | // Software License Agreement 7 | // 8 | // Texas Instruments (TI) is supplying this software for use solely and 9 | // exclusively on TI's microcontroller products. The software is owned by 10 | // TI and/or its suppliers, and is protected under applicable copyright 11 | // laws. You may not combine this software with "viral" open-source 12 | // software in order to form a larger program. 13 | // 14 | // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 15 | // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 16 | // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 18 | // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 19 | // DAMAGES, FOR ANY REASON WHATSOEVER. 20 | // 21 | // This is part of revision 1.1 of the Tiva Utility Library. 22 | // 23 | //***************************************************************************** 24 | 25 | #ifndef __ISQRT_H__ 26 | #define __ISQRT_H__ 27 | 28 | //***************************************************************************** 29 | // 30 | // If building with a C++ compiler, make all of the definitions in this header 31 | // have a C binding. 32 | // 33 | //***************************************************************************** 34 | #ifdef __cplusplus 35 | extern "C" 36 | { 37 | #endif 38 | 39 | //***************************************************************************** 40 | // 41 | // The prototype for the integer square root function. 42 | // 43 | //***************************************************************************** 44 | extern uint32_t isqrt(uint32_t ui32Value); 45 | 46 | //***************************************************************************** 47 | // 48 | // Mark the end of the C bindings section for C++ compilers. 49 | // 50 | //***************************************************************************** 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /lib/utils/random.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // random.h - Header for random number generation functions. 4 | // 5 | // Copyright (c) 2011-2013 Texas Instruments Incorporated. All rights reserved. 6 | // Software License Agreement 7 | // 8 | // Texas Instruments (TI) is supplying this software for use solely and 9 | // exclusively on TI's microcontroller products. The software is owned by 10 | // TI and/or its suppliers, and is protected under applicable copyright 11 | // laws. You may not combine this software with "viral" open-source 12 | // software in order to form a larger program. 13 | // 14 | // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 15 | // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 16 | // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 18 | // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 19 | // DAMAGES, FOR ANY REASON WHATSOEVER. 20 | // 21 | // This is part of revision 1.1 of the Tiva Utility Library. 22 | // 23 | //***************************************************************************** 24 | 25 | #ifndef __RANDOM_H__ 26 | #define __RANDOM_H__ 27 | 28 | //***************************************************************************** 29 | // 30 | // If building with a C++ compiler, make all of the definitions in this header 31 | // have a C binding. 32 | // 33 | //***************************************************************************** 34 | #ifdef __cplusplus 35 | extern "C" 36 | { 37 | #endif 38 | //***************************************************************************** 39 | // 40 | // Prototypes for the random number generator functions. 41 | // 42 | //***************************************************************************** 43 | extern void RandomAddEntropy(uint32_t ui32Entropy); 44 | extern uint32_t RandomSeed(void); 45 | 46 | //***************************************************************************** 47 | // 48 | // Mark the end of the C bindings section for C++ compilers. 49 | // 50 | //***************************************************************************** 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif // __RANDOM_H__ 56 | -------------------------------------------------------------------------------- /lib/utils/ringbuf.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // ringbuf.h - Defines and Macros for the ring buffer utilities. 4 | // 5 | // Copyright (c) 2008-2013 Texas Instruments Incorporated. All rights reserved. 6 | // Software License Agreement 7 | // 8 | // Texas Instruments (TI) is supplying this software for use solely and 9 | // exclusively on TI's microcontroller products. The software is owned by 10 | // TI and/or its suppliers, and is protected under applicable copyright 11 | // laws. You may not combine this software with "viral" open-source 12 | // software in order to form a larger program. 13 | // 14 | // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 15 | // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 16 | // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 18 | // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 19 | // DAMAGES, FOR ANY REASON WHATSOEVER. 20 | // 21 | // This is part of revision 1.1 of the Tiva Utility Library. 22 | // 23 | //***************************************************************************** 24 | 25 | #ifndef __RINGBUF_H__ 26 | #define __RINGBUF_H__ 27 | 28 | //***************************************************************************** 29 | // 30 | // If building with a C++ compiler, make all of the definitions in this header 31 | // have a C binding. 32 | // 33 | //***************************************************************************** 34 | #ifdef __cplusplus 35 | extern "C" 36 | { 37 | #endif 38 | 39 | //***************************************************************************** 40 | // 41 | // The structure used for encapsulating all the items associated with a 42 | // ring buffer. 43 | // 44 | //***************************************************************************** 45 | typedef struct 46 | { 47 | // 48 | // The ring buffer size. 49 | // 50 | uint32_t ui32Size; 51 | 52 | // 53 | // The ring buffer write index. 54 | // 55 | volatile uint32_t ui32WriteIndex; 56 | 57 | // 58 | // The ring buffer read index. 59 | // 60 | volatile uint32_t ui32ReadIndex; 61 | 62 | // 63 | // The ring buffer. 64 | // 65 | uint8_t *pui8Buf; 66 | 67 | } 68 | tRingBufObject; 69 | 70 | //***************************************************************************** 71 | // 72 | // API Function prototypes 73 | // 74 | //***************************************************************************** 75 | extern bool RingBufFull(tRingBufObject *psRingBuf); 76 | extern bool RingBufEmpty(tRingBufObject *psRingBuf); 77 | extern void RingBufFlush(tRingBufObject *psRingBuf); 78 | extern uint32_t RingBufUsed(tRingBufObject *psRingBuf); 79 | extern uint32_t RingBufFree(tRingBufObject *psRingBuf); 80 | extern uint32_t RingBufContigUsed(tRingBufObject *psRingBuf); 81 | extern uint32_t RingBufContigFree(tRingBufObject *psRingBuf); 82 | extern uint32_t RingBufSize(tRingBufObject *psRingBuf); 83 | extern uint8_t RingBufReadOne(tRingBufObject *psRingBuf); 84 | extern void RingBufRead(tRingBufObject *psRingBuf, uint8_t *pui8Data, 85 | uint32_t ui32Length); 86 | extern void RingBufWriteOne(tRingBufObject *psRingBuf, uint8_t ui8Data); 87 | extern void RingBufWrite(tRingBufObject *psRingBuf, uint8_t *pui8Data, 88 | uint32_t ui32Length); 89 | extern void RingBufAdvanceWrite(tRingBufObject *psRingBuf, 90 | uint32_t ui32NumBytes); 91 | extern void RingBufAdvanceRead(tRingBufObject *psRingBuf, 92 | uint32_t ui32NumBytes); 93 | extern void RingBufInit(tRingBufObject *psRingBuf, uint8_t *pui8Buf, 94 | uint32_t ui32Size); 95 | 96 | //***************************************************************************** 97 | // 98 | // Mark the end of the C bindings section for C++ compilers. 99 | // 100 | //***************************************************************************** 101 | #ifdef __cplusplus 102 | } 103 | #endif 104 | 105 | #endif // __RINGBUF_H__ 106 | -------------------------------------------------------------------------------- /lib/utils/sine.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // sine.h - Prototypes for the fixed point sine trigonometric function. 4 | // 5 | // Copyright (c) 2006-2013 Texas Instruments Incorporated. All rights reserved. 6 | // Software License Agreement 7 | // 8 | // Texas Instruments (TI) is supplying this software for use solely and 9 | // exclusively on TI's microcontroller products. The software is owned by 10 | // TI and/or its suppliers, and is protected under applicable copyright 11 | // laws. You may not combine this software with "viral" open-source 12 | // software in order to form a larger program. 13 | // 14 | // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 15 | // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 16 | // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 18 | // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 19 | // DAMAGES, FOR ANY REASON WHATSOEVER. 20 | // 21 | // This is part of revision 1.1 of the Tiva Utility Library. 22 | // 23 | //***************************************************************************** 24 | 25 | #ifndef __SINE_H__ 26 | #define __SINE_H__ 27 | 28 | //***************************************************************************** 29 | // 30 | // If building with a C++ compiler, make all of the definitions in this header 31 | // have a C binding. 32 | // 33 | //***************************************************************************** 34 | #ifdef __cplusplus 35 | extern "C" 36 | { 37 | #endif 38 | 39 | //***************************************************************************** 40 | // 41 | //! \addtogroup sine_api 42 | //! @{ 43 | // 44 | //***************************************************************************** 45 | 46 | //***************************************************************************** 47 | // 48 | //! Computes an approximation of the cosine of the input angle. 49 | //! 50 | //! \param ui32Angle is an angle expressed as a 0.32 fixed-point value that is 51 | //! the percentage of the way around a circle. 52 | //! 53 | //! This function computes the cosine for the given input angle. The angle is 54 | //! specified in 0.32 fixed point format, and is therefore always between 0 and 55 | //! 360 degrees, inclusive of 0 and exclusive of 360. 56 | //! 57 | //! \return Returns the cosine of the angle, in 16.16 fixed point format. 58 | // 59 | //***************************************************************************** 60 | #define cosine(ui32Angle) sine((ui32Angle) + 0x40000000) 61 | 62 | //***************************************************************************** 63 | // 64 | // Close the Doxygen group. 65 | //! @} 66 | // 67 | //***************************************************************************** 68 | 69 | //***************************************************************************** 70 | // 71 | // Prototype for the fixed point sine function. 72 | // 73 | //***************************************************************************** 74 | extern int32_t sine(uint32_t ui32Angle); 75 | 76 | //***************************************************************************** 77 | // 78 | // Mark the end of the C bindings section for C++ compilers. 79 | // 80 | //***************************************************************************** 81 | #ifdef __cplusplus 82 | } 83 | #endif 84 | 85 | #endif // __SINE_H__ 86 | -------------------------------------------------------------------------------- /lib/utils/speexlib.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // speexlib.h - interface to the speex coder/encoder library. 4 | // 5 | // Copyright (c) 2009-2013 Texas Instruments Incorporated. All rights reserved. 6 | // Software License Agreement 7 | // 8 | // Texas Instruments (TI) is supplying this software for use solely and 9 | // exclusively on TI's microcontroller products. The software is owned by 10 | // TI and/or its suppliers, and is protected under applicable copyright 11 | // laws. You may not combine this software with "viral" open-source 12 | // software in order to form a larger program. 13 | // 14 | // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 15 | // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 16 | // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 18 | // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 19 | // DAMAGES, FOR ANY REASON WHATSOEVER. 20 | // 21 | // This is part of revision 1.1 of the Tiva Utility Library. 22 | // 23 | //***************************************************************************** 24 | 25 | #ifndef __SPEEXLIB_H__ 26 | #define __SPEEXLIB_H__ 27 | 28 | //***************************************************************************** 29 | // 30 | // If building with a C++ compiler, make all of the definitions in this header 31 | // have a C binding. 32 | // 33 | //***************************************************************************** 34 | #ifdef __cplusplus 35 | extern "C" 36 | { 37 | #endif 38 | 39 | //***************************************************************************** 40 | // 41 | // Prototypes. 42 | // 43 | //***************************************************************************** 44 | extern int32_t SpeexEncodeInit(int iSampleRate, int iComplexity, int iQuality); 45 | extern int32_t SpeexEncode(int16_t *pui16InBuffer, uint32_t ui32InSize, 46 | uint8_t *pui8OutBuffer, uint32_t ui32OutSize); 47 | extern int32_t SpeexEncodeQualitySet(int iQuality); 48 | extern int32_t SpeexEncodeFrameSizeGet(void); 49 | extern int32_t SpeexDecodeFrameSizeGet(void); 50 | extern int32_t SpeexDecodeInit(void); 51 | extern int32_t SpeexDecode(uint8_t *pui8InBuffer, uint32_t ui32InSize, 52 | uint8_t *pui8OutBuffer, uint32_t ui32OutSize); 53 | 54 | //***************************************************************************** 55 | // 56 | // Mark the end of the C bindings section for C++ compilers. 57 | // 58 | //***************************************************************************** 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | 63 | #endif // __SPEEXLIB_H__ 64 | -------------------------------------------------------------------------------- /lib/utils/uartstdio.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // uartstdio.h - Prototypes for the UART console functions. 4 | // 5 | // Copyright (c) 2007-2013 Texas Instruments Incorporated. All rights reserved. 6 | // Software License Agreement 7 | // 8 | // Texas Instruments (TI) is supplying this software for use solely and 9 | // exclusively on TI's microcontroller products. The software is owned by 10 | // TI and/or its suppliers, and is protected under applicable copyright 11 | // laws. You may not combine this software with "viral" open-source 12 | // software in order to form a larger program. 13 | // 14 | // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 15 | // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 16 | // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 18 | // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 19 | // DAMAGES, FOR ANY REASON WHATSOEVER. 20 | // 21 | // This is part of revision 1.1 of the Tiva Utility Library. 22 | // 23 | //***************************************************************************** 24 | 25 | #ifndef __UARTSTDIO_H__ 26 | #define __UARTSTDIO_H__ 27 | 28 | #include 29 | 30 | //***************************************************************************** 31 | // 32 | // If building with a C++ compiler, make all of the definitions in this header 33 | // have a C binding. 34 | // 35 | //***************************************************************************** 36 | #ifdef __cplusplus 37 | extern "C" 38 | { 39 | #endif 40 | 41 | //***************************************************************************** 42 | // 43 | // If built for buffered operation, the following labels define the sizes of 44 | // the transmit and receive buffers respectively. 45 | // 46 | //***************************************************************************** 47 | #ifdef UART_BUFFERED 48 | #ifndef UART_RX_BUFFER_SIZE 49 | #define UART_RX_BUFFER_SIZE 128 50 | #endif 51 | #ifndef UART_TX_BUFFER_SIZE 52 | #define UART_TX_BUFFER_SIZE 1024 53 | #endif 54 | #endif 55 | 56 | //***************************************************************************** 57 | // 58 | // Prototypes for the APIs. 59 | // 60 | //***************************************************************************** 61 | extern void UARTStdioConfig(uint32_t ui32Port, uint32_t ui32Baud, 62 | uint32_t ui32SrcClock); 63 | extern int UARTgets(char *pcBuf, uint32_t ui32Len); 64 | extern unsigned char UARTgetc(void); 65 | extern void UARTprintf(const char *pcString, ...); 66 | extern void UARTvprintf(const char *pcString, va_list vaArgP); 67 | extern int UARTwrite(const char *pcBuf, uint32_t ui32Len); 68 | #ifdef UART_BUFFERED 69 | extern int UARTPeek(unsigned char ucChar); 70 | extern void UARTFlushTx(bool bDiscard); 71 | extern void UARTFlushRx(void); 72 | extern int UARTRxBytesAvail(void); 73 | extern int UARTTxBytesFree(void); 74 | extern void UARTEchoSet(bool bEnable); 75 | #endif 76 | 77 | //***************************************************************************** 78 | // 79 | // Mark the end of the C bindings section for C++ compilers. 80 | // 81 | //***************************************************************************** 82 | #ifdef __cplusplus 83 | } 84 | #endif 85 | 86 | #endif // __UARTSTDIO_H__ 87 | -------------------------------------------------------------------------------- /lib/utils/ustdlib.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // ustdlib.h - Prototypes for simple standard library functions. 4 | // 5 | // Copyright (c) 2007-2013 Texas Instruments Incorporated. All rights reserved. 6 | // Software License Agreement 7 | // 8 | // Texas Instruments (TI) is supplying this software for use solely and 9 | // exclusively on TI's microcontroller products. The software is owned by 10 | // TI and/or its suppliers, and is protected under applicable copyright 11 | // laws. You may not combine this software with "viral" open-source 12 | // software in order to form a larger program. 13 | // 14 | // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 15 | // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 16 | // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 18 | // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 19 | // DAMAGES, FOR ANY REASON WHATSOEVER. 20 | // 21 | // This is part of revision 1.1 of the Tiva Utility Library. 22 | // 23 | //***************************************************************************** 24 | 25 | #ifndef __USTDLIB_H__ 26 | #define __USTDLIB_H__ 27 | 28 | //***************************************************************************** 29 | // 30 | // Include the standard C headers upon which these replacements are based. 31 | // 32 | //***************************************************************************** 33 | #include 34 | #include 35 | 36 | //***************************************************************************** 37 | // 38 | // If building with a C++ compiler, make all of the definitions in this header 39 | // have a C binding. 40 | // 41 | //***************************************************************************** 42 | #ifdef __cplusplus 43 | extern "C" 44 | { 45 | #endif 46 | 47 | //***************************************************************************** 48 | // 49 | // Prototypes for the APIs. 50 | // 51 | //***************************************************************************** 52 | extern void ulocaltime(time_t timer, struct tm *tm); 53 | extern time_t umktime(struct tm *timeptr); 54 | extern int urand(void); 55 | extern int usnprintf(char * restrict s, size_t n, const char * restrict format, 56 | ...); 57 | extern int usprintf(char * restrict s, const char * restrict format, ...); 58 | extern void usrand(unsigned int seed); 59 | extern int ustrcasecmp(const char *s1, const char *s2); 60 | extern int ustrcmp(const char *s1, const char *s2); 61 | extern size_t ustrlen(const char *s); 62 | extern int ustrncasecmp(const char *s1, const char *s2, size_t n); 63 | extern int ustrncmp(const char *s1, const char *s2, size_t n); 64 | extern char *ustrncpy(char * restrict s1, const char * restrict s2, size_t n); 65 | extern char *ustrstr(const char *s1, const char *s2); 66 | extern float ustrtof(const char * restrict nptr, 67 | const char ** restrict endptr); 68 | extern unsigned long int ustrtoul(const char * restrict nptr, 69 | const char ** restrict endptr, int base); 70 | extern int uvsnprintf(char * restrict s, size_t n, 71 | const char * restrict format, va_list arg); 72 | 73 | //***************************************************************************** 74 | // 75 | // Mark the end of the C bindings section for C++ compilers. 76 | // 77 | //***************************************************************************** 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | 82 | #endif // __USTDLIB_H__ 83 | -------------------------------------------------------------------------------- /lib/utils/utils.sgxx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauszus/LaunchPadFlightController/c60021a68732923caad1c1f6ecee80f375fc14a4/lib/utils/utils.sgxx -------------------------------------------------------------------------------- /platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter, extra scripting 4 | ; Upload options: custom port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; 7 | ; Please visit documentation for the other options and examples 8 | ; http://docs.platformio.org/page/projectconf.html 9 | 10 | ; Only run the standard build by default 11 | [platformio] 12 | default_envs = lptm4c1230c3pm 13 | 14 | ; Common settings 15 | [env] 16 | platform = titiva 17 | board = lptm4c1230c3pm 18 | src_filter = +<*> +<../lib/utils/uartstdio.c> -<.git/> - 19 | build_unflags = -std=gnu11 20 | build_flags = -Wl,-T./src/LaunchPadFlightController.ld -Wl,--entry=ResetISR -Wl,--gc-sections -I./lib -L./lib/driverlib/gcc -llibdriver.a -Wdouble-promotion -MD -std=c99 -pedantic -c -Wunsafe-loop-optimizations -Wunused-parameter -Woverflow -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -Dgcc -DPART_TM4C123GH6PM -DTARGET_IS_BLIZZARD_RB1 -DUART_BUFFERED -DUART_BUFFERED1 21 | 22 | ; Default environment settings for the project 23 | [env:lptm4c1230c3pm] 24 | build_flags = ${env.build_flags} -DUART_DEBUG=0 -DUSE_MAG=1 -DUSE_BARO=1 -DUSE_SONAR=1 -DUSE_LIDAR_LITE=1 -DUSE_FLOW_SENSOR=0 -DONESHOT125=1 25 | 26 | ; Environment used by the Travis CI 27 | [env:lptm4c1230c3pm_ci] 28 | build_flags = ${env.build_flags} -Werror -DUART_DEBUG=${sysenv.UART_DEBUG} -DUSE_MAG=${sysenv.USE_MAG} -DUSE_BARO=${sysenv.USE_BARO} -DUSE_SONAR=${sysenv.USE_SONAR} -DUSE_LIDAR_LITE=${sysenv.USE_LIDAR_LITE} -DUSE_FLOW_SENSOR=${sysenv.USE_FLOW_SENSOR} -DONESHOT125=${sysenv.ONESHOT125} -DDEBUG=${sysenv.DEBUG} -DSTEP_ACRO_SELF_LEVEL=${sysenv.STEP_ACRO_SELF_LEVEL} -DSTEP_ALTITUDE_HOLD=${sysenv.STEP_ALTITUDE_HOLD} -DSTEP_HEADING_HOLD=${sysenv.STEP_HEADING_HOLD} 29 | 30 | ; Basic commands: 31 | ; platformio run 32 | ; platformio run -t upload 33 | ; platformio run -t clean 34 | -------------------------------------------------------------------------------- /src/ADNS3080.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #if !defined(__adns3080_h__) && USE_FLOW_SENSOR 19 | #define __adns3080_h__ 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | void initADNS3080(void); 26 | bool dataReadyADNS3080(void); 27 | void getADNS3080Data(int32_t *x, int32_t *y); 28 | void clearMotion(int32_t *x, int32_t *y); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/AK8963.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #include 19 | #include 20 | 21 | #if USE_MAG 22 | 23 | #include "AK8963.h" 24 | #include "Buzzer.h" 25 | #include "EEPROM.h" 26 | #include "I2C.h" 27 | #include "MPU6500.h" 28 | #include "Time.h" 29 | 30 | #if UART_DEBUG 31 | #include "utils/uartstdio.h" // Add "UART_BUFFERED" to preprocessor 32 | #endif 33 | 34 | #define AK8963_ADDRESS 0x0C 35 | 36 | #define AK8963_WIA 0x00 37 | #define AK8963_WIA_ID 0x48 38 | 39 | #define AK8963_STATUS_1 0x02 40 | #define AK8963_STATUS_1_DRDY_BIT (1 << 0) 41 | 42 | #define AK8963_HXL 0x03 43 | #define AK8963_DATA_LENGTH 7 // Length of magnetometer data + ST2 (Status 2) register 44 | #define AK8963_STATUS_2_HOFL_BIT (1 << 3) 45 | 46 | #define AK8963_CONTROL_1 0x0A 47 | #define AK8963_CONTROL_1_CONT_2_BIT (6 << 0) // Continuous measurement mode 2 (100 Hz) 48 | #define AK8963_CONTROL_1_16_OUTPUT_BIT (1 << 4) // 16-bit output 49 | 50 | #define AK8963_CONTROL_2 0x0B 51 | #define AK8963_CONTROL_2_SRST_BIT (1 << 0) // Soft reset 52 | 53 | bool dataReadyAK8963(void) { 54 | return i2cRead(AK8963_ADDRESS, AK8963_STATUS_1) & AK8963_STATUS_1_DRDY_BIT; // Read DRDY bit 55 | } 56 | 57 | bool initAK8963(void) { 58 | uint8_t id = i2cRead(AK8963_ADDRESS, AK8963_WIA); // Read "WIA" register 59 | if (id != AK8963_WIA_ID) { 60 | #if 0 && UART_DEBUG 61 | UARTprintf("Could not find AK8963: %02X\n", id); 62 | #endif 63 | return false; 64 | } 65 | 66 | i2cWrite(AK8963_ADDRESS, AK8963_CONTROL_2, AK8963_CONTROL_2_SRST_BIT); // Reset device, this resets all internal registers to their default values 67 | delay(100); 68 | while (i2cRead(AK8963_ADDRESS, AK8963_CONTROL_2) & AK8963_CONTROL_2_SRST_BIT) { 69 | // Wait for the bit to clear 70 | } 71 | delay(100); 72 | 73 | i2cWrite(AK8963_ADDRESS, AK8963_CONTROL_1, AK8963_CONTROL_1_CONT_2_BIT | AK8963_CONTROL_1_16_OUTPUT_BIT); // Set to continuous measurement mode 2 (100 Hz) and 16-bit output 74 | 75 | return true; 76 | } 77 | 78 | // X-axis should be facing forward 79 | // Y-axis should be facing to the right 80 | // Z-axis should be facing downward 81 | static void ak8963BoardOrientation(sensorRaw_t *sensorRaw) { 82 | // Note that the AK8963 is aligned differently compared to the MPU-9250 - see: http://store.invensense.com/datasheets/invensense/MPU9250REV1.0.pdf page 38 83 | // x -> y 84 | // y -> x 85 | // z-> -z 86 | sensorRaw_t sensorRawTemp = *sensorRaw; 87 | sensorRaw->axis.X = sensorRawTemp.axis.Y; // Note: Do not change these, change the orientation in the MPU-6500 driver if needed 88 | sensorRaw->axis.Y = sensorRawTemp.axis.X; 89 | sensorRaw->axis.Z = -sensorRawTemp.axis.Z; 90 | mpu6500BoardOrientation(sensorRaw); 91 | } 92 | 93 | void getAK8963Data(sensor_t *mag, bool calibrating) { 94 | uint8_t buf[AK8963_DATA_LENGTH]; 95 | i2cReadData(AK8963_ADDRESS, AK8963_HXL, buf, AK8963_DATA_LENGTH); // Get magnetometer values 96 | 97 | sensorRaw_t magRaw; 98 | magRaw.axis.X = (int16_t)((buf[1] << 8) | buf[0]); 99 | magRaw.axis.Y = (int16_t)((buf[3] << 8) | buf[2]); 100 | magRaw.axis.Z = (int16_t)((buf[5] << 8) | buf[4]); 101 | 102 | if (buf[6] & AK8963_STATUS_2_HOFL_BIT) { // ST2 register must be read! 103 | #if UART_DEBUG 104 | UARTprintf("Magnetic sensor overflow occurred\n"); 105 | #endif 106 | buzzer(true); 107 | } 108 | 109 | ak8963BoardOrientation(&magRaw); // Apply board orientation 110 | /* 111 | // The value should be positive when pointing at north 112 | UARTprintf("%d\t%d\t%d\n", magRaw.axis.X, magRaw.axis.Y, magRaw.axis.Z); 113 | UARTFlushTx(false); 114 | */ 115 | for (uint8_t axis = 0; axis < 3; axis++) { 116 | mag->data[axis] = magRaw.data[axis]; 117 | if (!calibrating) // If we are not calibrating, then subtract zero values 118 | mag->data[axis] -= cfg.magZero.data[axis]; // Subtract zero value stored in EEPROM 119 | } 120 | } 121 | 122 | #endif // USE_MAG 123 | 124 | -------------------------------------------------------------------------------- /src/AK8963.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #if !defined(__ak8963_h__) && USE_MAG 19 | #define __ak8963_h__ 20 | 21 | #include 22 | 23 | #include "Types.h" 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | bool initAK8963(void); 30 | bool dataReadyAK8963(void); 31 | void getAK8963Data(sensor_t *mag, bool calibrating); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/AltitudeHold.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #if !defined(__altitude_h__) && (USE_SONAR || USE_BARO || USE_LIDAR_LITE) 19 | #define __altitude_h__ 20 | 21 | #include "MPU6500.h" 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | typedef struct { 28 | #if USE_BARO 29 | float altitude, velocity, acceleration; // Values are in cm 30 | float altitudeLpf; // Low-pass filtered altitude estimate 31 | #endif 32 | #if USE_SONAR 33 | int16_t sonarDistance; // Distance in mm 34 | #endif 35 | #if USE_LIDAR_LITE 36 | int32_t lidarLiteDistance; // Distance in mm 37 | #endif 38 | #if USE_SONAR || USE_LIDAR_LITE 39 | float distance; // Fusioned distance from sonar and LIDAR-Lite v3 in mm 40 | #endif 41 | } altitude_t; 42 | 43 | void initAltitudeHold(void); 44 | void getAltitude(angle_t *angle, mpu6500_t *mpu6500, altitude_t *altitude, uint32_t now, float dt); 45 | float updateAltitudeHold(float aux, altitude_t *altitude, float throttle, uint32_t now, float dt); 46 | void resetAltitudeHold(altitude_t *altitude); 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/BMP180.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #if !defined(__bmp180_h__) && USE_BARO 19 | #define __bmp180_h__ 20 | 21 | #include "Types.h" 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | typedef struct { 28 | int16_t AC1; 29 | int16_t AC2; 30 | int16_t AC3; 31 | uint16_t AC4; 32 | uint16_t AC5; 33 | uint16_t AC6; 34 | int16_t B1; 35 | int16_t B2; 36 | // The MB calibration value is never used 37 | int16_t MC; 38 | int16_t MD; 39 | } bmp180_cal_t; 40 | 41 | typedef struct { 42 | int32_t pressure; // Pressure in Pa 43 | int32_t temperature; // Temperature in 0.1 C 44 | float absoluteAltitude; // Absolute altitude in cm 45 | float groundAltitude; // Ground altitude in cm 46 | uint8_t mode; // The oversampling mode to be used by the BMP180 47 | bmp180_cal_t cal; // Calibration data 48 | } bmp180_t; 49 | 50 | void initBMP180(bmp180_t *bmp180); 51 | bool getBMP180Data(bmp180_t *bmp180); 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/Bluetooth.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #ifndef __bluetooth_h__ 19 | #define __bluetooth_h__ 20 | 21 | #include "HMC5883L.h" 22 | #include "MPU6500.h" 23 | #include "Types.h" 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | void initBluetooth(void); 30 | bool readBluetoothData(mpu6500_t *mpu6500, angle_t *angle); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/Buzzer.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #include 19 | #include 20 | 21 | #include "Buzzer.h" 22 | #include "Config.h" 23 | #include "Time.h" 24 | 25 | #include "driverlib/gpio.h" 26 | #include "driverlib/sysctl.h" 27 | 28 | void initBuzzer(void) { 29 | SysCtlPeripheralEnable(SYSCTL_PERIPH_BUZZER); // Enable peripheral 30 | SysCtlDelay(2); // Insert a few cycles after enabling the peripheral to allow the clock to be fully activated 31 | GPIOPinTypeGPIOOutput(GPIO_BUZZER_BASE, GPIO_PIN_BUZZER); 32 | } 33 | 34 | inline void buzzer(bool enable) { 35 | GPIOPinWrite(GPIO_BUZZER_BASE, GPIO_PIN_BUZZER, enable ? GPIO_PIN_BUZZER : 0); 36 | } 37 | 38 | void beepBuzzer(void) { 39 | buzzer(true); 40 | delay(100); 41 | buzzer(false); 42 | } 43 | 44 | void beepLongBuzzer(void) { 45 | buzzer(true); 46 | delay(1000); 47 | buzzer(false); 48 | } 49 | -------------------------------------------------------------------------------- /src/Buzzer.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #ifndef __buzzer_h__ 19 | #define __buzzer_h__ 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | void initBuzzer(void); 26 | void buzzer(bool enable); 27 | void beepBuzzer(void); 28 | void beepLongBuzzer(void); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/EEPROM.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #include 19 | #include 20 | 21 | #include "Buzzer.h" 22 | #include "EEPROM.h" 23 | 24 | #include "driverlib/eeprom.h" 25 | #include "driverlib/sysctl.h" 26 | #if UART_DEBUG 27 | #include "utils/uartstdio.h" // Add "UART_BUFFERED" to preprocessor 28 | #endif 29 | 30 | static const uint32_t configVersion = 21; // Must be bumped every time config_t is changed 31 | config_t cfg; 32 | 33 | void initEEPROM(void) { 34 | SysCtlPeripheralEnable(SYSCTL_PERIPH_EEPROM0); // Enable EEPROM peripheral 35 | SysCtlDelay(2); // Insert a few cycles after enabling the peripheral to allow the clock to be fully activated 36 | 37 | // Make sure config_t is a multiple of 4 - the compiler should pack structs to 4 bytes, but I added this check to be 100% sure 38 | if (sizeof(config_t) % 4 != 0) { 39 | #if UART_DEBUG 40 | UARTprintf("Config size error: %u\n", sizeof(config_t)); 41 | #endif 42 | buzzer(true); 43 | while (1); 44 | } 45 | 46 | uint32_t rcode = EEPROMInit(); 47 | if (rcode) { 48 | #if UART_DEBUG 49 | UARTprintf("EEPROMInit error: %u\n", rcode); 50 | #endif 51 | buzzer(true); 52 | while (1); 53 | } 54 | 55 | uint32_t version; 56 | EEPROMRead(&version, 0, sizeof(version)); 57 | if (version != configVersion) { 58 | setDefaultConfig(); 59 | beepLongBuzzer(); 60 | } else 61 | EEPROMRead((uint32_t*)&cfg, sizeof(configVersion), sizeof(config_t)); // Read config from EEPROM 62 | } 63 | 64 | void setDefaultConfig(void) { 65 | cfg.pidRollPitchValues.Kp = 0.310f; 66 | cfg.pidRollPitchValues.Ki = 1.65f; 67 | cfg.pidRollPitchValues.Kd = 0.00040f * 3.0f; 68 | cfg.pidRollPitchValues.integrationLimit = 5.85f; // Prevent windup 69 | cfg.pidRollPitchValues.Fc = 150.0f; // 150 Hz 70 | 71 | cfg.pidYawValues.Kp = 1.000f; 72 | cfg.pidYawValues.Ki = 6.00f; 73 | cfg.pidYawValues.Kd = 0.00040f * 3.0f; 74 | cfg.pidYawValues.integrationLimit = 10.0f; // Prevent windup 75 | cfg.pidYawValues.Fc = 150.0f; // 150 Hz 76 | 77 | cfg.pidSonarAltHoldValues.Kp = 0.040f; 78 | cfg.pidSonarAltHoldValues.Ki = 0.03f; 79 | cfg.pidSonarAltHoldValues.Kd = 0.00330f * 3.0f; 80 | cfg.pidSonarAltHoldValues.integrationLimit = 10.0f; // Prevent windup 81 | cfg.pidSonarAltHoldValues.Fc = 150.0f; // 150 Hz 82 | 83 | cfg.pidBaroAltHoldValues.Kp = 0.006f; 84 | cfg.pidBaroAltHoldValues.Ki = 0.00f; 85 | cfg.pidBaroAltHoldValues.Kd = 0.00450f * 3.0f; 86 | cfg.pidBaroAltHoldValues.integrationLimit = 10.0f; // Prevent windup 87 | cfg.pidBaroAltHoldValues.Fc = 150.0f; // 150 Hz 88 | 89 | resetPIDRollPitchYaw(); 90 | resetPIDAltHold(); 91 | 92 | cfg.angleKp = 4.50f; 93 | cfg.headKp = 0.65f; 94 | cfg.maxAngleInclination = 50; // Max angle in self level mode 95 | cfg.maxAngleInclinationDistSensor = 25; // Max angle when using sonar or LIDAR-Lite v3 in altitude hold mode 96 | cfg.stickScalingRollPitch = 4.69f; 97 | cfg.stickScalingYaw = 2.0f; 98 | 99 | cfg.calibrateESCs = false; 100 | 101 | for (uint8_t axis = 0; axis < 3; axis++) { 102 | cfg.accZero.data[axis] = 0; 103 | cfg.magZero.data[axis] = 0; 104 | } 105 | 106 | cfg.configureBtModule = true; 107 | 108 | uint32_t rcode = EEPROMProgram((uint32_t*)&configVersion, 0, sizeof(configVersion)); // Write version number to EEPROM 109 | if (rcode) { 110 | #if UART_DEBUG 111 | UARTprintf("Error writing version number to EEPROM: %u\n", rcode); 112 | #endif 113 | buzzer(true); 114 | } else 115 | updateConfig(); // Write values to EEPROM 116 | } 117 | 118 | void updateConfig(void) { 119 | uint32_t rcode = EEPROMProgram((uint32_t*)&cfg, sizeof(configVersion), sizeof(config_t)); // Write config to EEPROM 120 | if (rcode) { 121 | #if UART_DEBUG 122 | UARTprintf("Error writing config to EEPROM: %u\n", rcode); 123 | #endif 124 | buzzer(true); 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /src/EEPROM.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #ifndef __eeprom_h__ 19 | #define __eeprom_h__ 20 | 21 | #include "PID.h" 22 | #include "Types.h" 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | typedef struct { 29 | // Can be set by the user 30 | pid_values_t pidRollPitchValues, pidYawValues; // Use same PID values for both pitch and roll, but different values for yaw 31 | pid_values_t pidSonarAltHoldValues, pidBaroAltHoldValues; // PID values for altitude hold 32 | float angleKp; // Self level mode Kp value 33 | float headKp; // Heading mode Kp value 34 | uint8_t maxAngleInclination; // Max angle in self level mode 35 | uint8_t maxAngleInclinationDistSensor; // Max angle when using sonar or LIDAR-Lite v3 in altitude hold mode 36 | float stickScalingRollPitch, stickScalingYaw; // Stick scaling values 37 | 38 | // Will be set by the microcontroller 39 | bool calibrateESCs; // Flag used to tell if it should calibrate ESCs at next power cycle 40 | sensorRaw_t accZero; // Accelerometer calibration values 41 | sensor_t magZero; // Magnetometer calibration values 42 | bool configureBtModule; // Used in order to configure the Bluetooth module the first time it is powered on 43 | } config_t; 44 | 45 | extern config_t cfg; 46 | 47 | void initEEPROM(void); 48 | void setDefaultConfig(void); 49 | void updateConfig(void); 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/HMC5883L.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #if !defined(__hmc5883l_h__) && USE_MAG 19 | #define __hmc5883l_h__ 20 | 21 | #include 22 | 23 | #include "Types.h" 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | bool initHMC5883L(void); 30 | bool dataReadyHMC5883L(void); 31 | void getHMC5883LData(sensor_t *mag, bool calibrating); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/HeadingHold.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #if USE_MAG 23 | 24 | #include "EEPROM.h" 25 | #include "HeadingHold.h" 26 | #include "StepResponse.h" 27 | #include "RX.h" 28 | 29 | #if !(STEP_ACRO_SELF_LEVEL || STEP_ALTITUDE_HOLD || STEP_HEADING_HOLD) // The logger will use the blue LED as indicator instead 30 | #include "Config.h" 31 | #include "driverlib/gpio.h" 32 | #include "inc/hw_memmap.h" 33 | #endif 34 | 35 | static float magHold; // Heading using for heading hold 36 | 37 | float updateHeadingHold(angle_t *angle, float rudder, uint32_t __attribute__((unused)) now) { 38 | static const uint8_t headMaxAngle = 25; 39 | if (fmaxf(fabsf(angle->axis.roll), fabsf(angle->axis.pitch)) < headMaxAngle) { // Check that we are not tilted too much 40 | #if STEP_HEADING_HOLD 41 | static const float step1 = 0; // Start at 0 degrees (North) 42 | static const float step2 = 45; // Rotate 45 degrees (East) 43 | static const uint32_t interval = 10e6; // 10 seconds between steps 44 | magHold = stepResponse(getRXChannel(RX_AUX2_CHAN) > 0, magHold, angle->axis.yaw, step1, step2, interval, now); 45 | #endif 46 | float error = magHold - angle->axis.yaw; 47 | if (error < -180.0f) // Normalize difference, so 0 is forward and -180 and 180 is backward 48 | error += 360.0f; 49 | else if (error > 180.0f) 50 | error -= 360.0f; 51 | rudder += error * cfg.headKp; // Add the output from the P controller to the rudder input 52 | #if !(STEP_ACRO_SELF_LEVEL || STEP_ALTITUDE_HOLD || STEP_HEADING_HOLD) 53 | GPIOPinWrite(GPIO_LED_BASE, GPIO_BLUE_LED, GPIO_BLUE_LED); // Turn on blue LED 54 | #endif 55 | } 56 | #if !(STEP_ACRO_SELF_LEVEL || STEP_ALTITUDE_HOLD || STEP_HEADING_HOLD) 57 | else 58 | GPIOPinWrite(GPIO_LED_BASE, GPIO_BLUE_LED, 0); // Turn off blue LED 59 | #endif 60 | 61 | return rudder; 62 | } 63 | 64 | void resetHeadingHold(angle_t *angle) { 65 | #if !(STEP_ACRO_SELF_LEVEL || STEP_ALTITUDE_HOLD || STEP_HEADING_HOLD) 66 | GPIOPinWrite(GPIO_LED_BASE, GPIO_BLUE_LED, 0); // Turn off blue LED 67 | #endif 68 | magHold = angle->axis.yaw; // Reset heading hold value 69 | } 70 | 71 | #endif // USE_MAG 72 | -------------------------------------------------------------------------------- /src/HeadingHold.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #if !defined(__headinghold_h__) && USE_MAG 19 | #define __headinghold_h__ 20 | 21 | #include "Types.h" 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | float updateHeadingHold(angle_t *angle, float rudder, uint32_t now); 28 | void resetHeadingHold(angle_t *angle); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/I2C.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #ifndef __i2c_h__ 19 | #define __i2c_h__ 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | void initI2C(void); 26 | void i2cWrite(uint8_t addr, uint8_t regAddr, uint8_t data); 27 | void i2cWriteData(uint8_t addr, uint8_t regAddr, uint8_t *data, uint8_t length); 28 | uint8_t i2cRead(uint8_t addr, uint8_t regAddr); 29 | void i2cReadData(uint8_t addr, uint8_t regAddr, uint8_t *data, uint8_t length); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/IMU.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #ifndef __imu_h__ 19 | #define __imu_h__ 20 | 21 | #include "MPU6500.h" 22 | 23 | #define DEG_TO_RAD 0.017453292519943295769236907684886f 24 | #define RAD_TO_DEG 57.295779513082320876798154814105f 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | void getAngles(mpu6500_t *mpu6500, sensor_t *mag, angle_t *angle, float dt); 31 | void rotateV(sensor_t *v, const angle_t *angle); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/LaunchPadFlightController.ld: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (c) 2012-2013 Texas Instruments Incorporated. All rights reserved. 4 | * Software License Agreement 5 | * 6 | * Texas Instruments (TI) is supplying this software for use solely and 7 | * exclusively on TI's microcontroller products. The software is owned by 8 | * TI and/or its suppliers, and is protected under applicable copyright 9 | * laws. You may not combine this software with "viral" open-source 10 | * software in order to form a larger program. 11 | * 12 | * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 13 | * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 14 | * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 15 | * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 16 | * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 17 | * DAMAGES, FOR ANY REASON WHATSOEVER. 18 | * 19 | * This is part of revision 1.1 of the EK-TM4C123GXL Firmware Package. 20 | * 21 | *****************************************************************************/ 22 | 23 | MEMORY 24 | { 25 | FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 26 | SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 27 | } 28 | 29 | SECTIONS 30 | { 31 | .text : 32 | { 33 | _text = .; 34 | KEEP(*(.isr_vector)) 35 | *(.text*) 36 | *(.rodata*) 37 | _etext = .; 38 | } > FLASH 39 | 40 | .data : AT(ADDR(.text) + SIZEOF(.text)) 41 | { 42 | _data = .; 43 | *(vtable) 44 | *(.data*) 45 | _edata = .; 46 | } > SRAM 47 | 48 | .bss : 49 | { 50 | _bss = .; 51 | *(.bss*) 52 | *(COMMON) 53 | _ebss = .; 54 | } > SRAM 55 | } 56 | -------------------------------------------------------------------------------- /src/LidarLiteV3.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2016 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #if USE_LIDAR_LITE 23 | 24 | #include "EEPROM.h" 25 | #include "I2C.h" 26 | #include "IMU.h" 27 | #include "LidarLiteV3.h" 28 | #include "Time.h" 29 | 30 | #if UART_DEBUG 31 | #include "utils/uartstdio.h" // Add "UART_BUFFERED" to preprocessor 32 | #endif 33 | 34 | #define LIDAR_LITE_ADDRESS 0x62 35 | 36 | #define LIDAR_LITE_ACQ_COMMAND 0x00 37 | #define LIDAR_LITE_STATUS 0x01 38 | #define LIDAR_LITE_SIG_COUNT_VAL 0x02 39 | #define LIDAR_LITE_ACQ_CONFIG_REG 0x04 40 | #define LIDAR_LITE_THRESHOLD_BYPASS 0x1C 41 | 42 | #define LIDAR_LITE_DATA 0x8F 43 | 44 | // Implemented based on: http://static.garmin.com/pumac/LIDAR_Lite_v3_Operation_Manual_and_Technical_Specifications.pdf 45 | 46 | void initLidarLite(void) { 47 | uint8_t status = i2cRead(LIDAR_LITE_ADDRESS, LIDAR_LITE_STATUS); 48 | if (!(status & (1 << 6)) && (status & (1 << 5))) { // Read process error and health flag 49 | #if UART_DEBUG 50 | UARTprintf("LIDAR-Lite v3 found\n"); 51 | #endif 52 | } else { 53 | #if UART_DEBUG 54 | UARTprintf("Could not find LIDAR-Lite v3: %02X\n", status); 55 | #endif 56 | while (1); 57 | } 58 | 59 | i2cWrite(LIDAR_LITE_ADDRESS, LIDAR_LITE_ACQ_COMMAND, 0x00); // Reset FPGA, all registers return to default values 60 | delay(22); // Wait 22 ms after reset according to datasheet 61 | 62 | // Default configuration 63 | i2cWrite(LIDAR_LITE_ADDRESS, LIDAR_LITE_SIG_COUNT_VAL, 0x80); // Maximum acquisition count 64 | i2cWrite(LIDAR_LITE_ADDRESS, LIDAR_LITE_ACQ_CONFIG_REG, 0x08); // Disable measurement quick termination 65 | i2cWrite(LIDAR_LITE_ADDRESS, LIDAR_LITE_THRESHOLD_BYPASS, 0x00); // Use default valid measurement detection algorithm 66 | } 67 | 68 | bool triggerLidarLite(void) { 69 | static bool busyFlag = false; 70 | 71 | if (!busyFlag) { 72 | static uint8_t biasCounter = 0; 73 | if (biasCounter == 0) 74 | i2cWrite(LIDAR_LITE_ADDRESS, LIDAR_LITE_ACQ_COMMAND, 0x04); // Take acquisition & correlation processing with receiver bias correction 75 | else 76 | i2cWrite(LIDAR_LITE_ADDRESS, LIDAR_LITE_ACQ_COMMAND, 0x03); // Take acquisition & correlation processing without receiver bias correction 77 | if (++biasCounter >= 100) // Receive bias correction every 100th measurement according to the datasheet 78 | biasCounter = 0; 79 | } 80 | 81 | busyFlag = i2cRead(LIDAR_LITE_ADDRESS, LIDAR_LITE_STATUS) & 0x01; // Read status register to check busy flag 82 | return !busyFlag; // Return true if new measurement is ready 83 | } 84 | 85 | // Returns the distance in mm. Range is 0-40000 mm or -1 if the value is invalid. 86 | int32_t getLidarLiteDistance(angle_t *angle) { 87 | if (fmaxf(fabsf(angle->axis.roll), fabsf(angle->axis.pitch)) > cfg.maxAngleInclinationDistSensor) // Return -1 if it is tilted more than the maximum tilt angle 88 | return -1; 89 | 90 | uint8_t i2cBuffer[2]; // Buffer for I2C data 91 | i2cReadData(LIDAR_LITE_ADDRESS, LIDAR_LITE_DATA, i2cBuffer, 2); // Read distance measurement 92 | 93 | int32_t distance = (int16_t)((i2cBuffer[0] << 8) | i2cBuffer[1]); // Return the distance in cm 94 | distance *= 10; // Convert to mm 95 | distance *= cosf(angle->axis.roll * DEG_TO_RAD) * cosf(angle->axis.pitch * DEG_TO_RAD); // Calculate adjacent side 96 | 97 | return distance; 98 | } 99 | 100 | #endif // USE_LIDAR_LITE 101 | -------------------------------------------------------------------------------- /src/LidarLiteV3.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2016 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #if !defined(__lidarlitev3_h__) && USE_LIDAR_LITE 19 | #define __lidarlitev3_h__ 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | #include "Types.h" 26 | 27 | void initLidarLite(void); 28 | bool triggerLidarLite(void); 29 | int32_t getLidarLiteDistance(angle_t *angle); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/LowPassFilter.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #include "LowPassFilter.h" 19 | 20 | #define M_PIf 3.14159265358979323846f 21 | 22 | /* Approximates first order low-pass filter: H(s) = 1/(tau*s + 1) 23 | * See: https://en.wikipedia.org/wiki/Exponential_smoothing 24 | * Also read: http://techteach.no/simview/lowpass_filter/doc/filter_algorithm.pdf 25 | * prevOutput is the previous output from the filter 26 | * Input is the new input to the filter 27 | * Fc is the cutoff frequency in Hz 28 | * dt is the time between last filter time 29 | */ 30 | float applyLowPass(low_pass_t *low_pass, float input, float dt) { 31 | const float tau = 1.0f/(2.0f*M_PIf*low_pass->Fc); // Time constant 32 | const float alpha = dt/(tau + dt); // See (10) in http://techteach.no/simview/lowpass_filter/doc/filter_algorithm.pdf 33 | 34 | // y(n) = y(n-1) + alpha*(u(n) - y(n-1)) 35 | float output = low_pass->prevOutput + alpha*(input - low_pass->prevOutput); 36 | low_pass->prevOutput = output; 37 | return output; 38 | } 39 | -------------------------------------------------------------------------------- /src/LowPassFilter.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #ifndef __low_pass_filter__ 19 | #define __low_pass_filter__ 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct { 26 | float prevOutput, Fc; // Previous output and cutoff frequency in Hz 27 | } low_pass_t; 28 | 29 | float applyLowPass(low_pass_t *low_pass, float input, float dt); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/MPU6500.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #ifndef __mpu6500_h__ 19 | #define __mpu6500_h__ 20 | 21 | #include 22 | 23 | #include "Types.h" 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | typedef struct { 30 | sensorRaw_t acc, gyro; // Raw accelerometer and gyroscope readings 31 | sensor_t accBodyFrame; // Magnitude of the acceleration in the body frame 32 | float accScaleFactor, gyroScaleFactor; // Gyroscope and accelerometer scale factor 33 | angle_t gyroRate; // Gyroscope readings in deg/s 34 | } mpu6500_t; 35 | 36 | void initMPU6500(mpu6500_t *mpu6500); 37 | void mpu6500BoardOrientation(sensorRaw_t *sensorRaw); 38 | bool dataReadyMPU6500(void); 39 | void getMPU6500Data(mpu6500_t *mpu6500); 40 | bool calibrateMPU6500Acc(mpu6500_t *mpu6500); 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/Magnetomer.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #include 19 | #include 20 | 21 | #if USE_MAG 22 | 23 | #include "AK8963.h" 24 | #include "Buzzer.h" 25 | #include "Config.h" 26 | #include "EEPROM.h" 27 | #include "HMC5883L.h" 28 | #include "Magnetometer.h" 29 | #include "Time.h" 30 | 31 | #include "driverlib/gpio.h" 32 | #include "inc/hw_memmap.h" 33 | #if UART_DEBUG 34 | #include "utils/uartstdio.h" // Add "UART_BUFFERED" to preprocessor 35 | #endif 36 | 37 | // Function pointer used to call the low-level magnetometer drivers 38 | static bool (*dataReady)(void); 39 | static void (*getData)(sensor_t *mag, bool calibrating); 40 | 41 | void initMag(void) { 42 | if (initHMC5883L()) { // The HMC5883L update rate is very slow (15 Hz) 43 | #if UART_DEBUG 44 | UARTprintf("HMC5883L found\n"); 45 | #endif 46 | dataReady = &dataReadyHMC5883L; 47 | getData = &getHMC5883LData; 48 | return; 49 | } else if (initAK8963()) { // The AK8963 update rate is set to 100 Hz 50 | #if UART_DEBUG 51 | UARTprintf("AK8963 found\n"); 52 | #endif 53 | dataReady = &dataReadyAK8963; 54 | getData = &getAK8963Data; 55 | return; 56 | } 57 | 58 | #if UART_DEBUG 59 | UARTprintf("No magnetometer found!\n"); 60 | #endif 61 | GPIOPinWrite(GPIO_LED_BASE, GPIO_BLUE_LED, GPIO_BLUE_LED); // Turn on blue LED, so user knows something is up 62 | beepLongBuzzer(); 63 | } 64 | 65 | bool getMagData(sensor_t *mag, bool calibrating) { 66 | if (dataReady) { // Make sure pointer is not NULL 67 | if (dataReady()) { 68 | getData(mag, calibrating); 69 | return true; 70 | } 71 | } 72 | return false; 73 | } 74 | 75 | void calibrateMag(void) { 76 | if (!dataReady) 77 | return; // Return in case no magnetometer was detected 78 | 79 | GPIOPinWrite(GPIO_LED_BASE, GPIO_BLUE_LED, GPIO_BLUE_LED); // Turn on blue LED 80 | sensor_t mag; 81 | while (!getMagData(&mag, true)) { // Get magnetometer values without zero values subtracted 82 | delay(1); // Wait for data to get ready 83 | } 84 | sensor_t magZeroMin = mag, magZeroMax = mag; // Get initial reading 85 | 86 | uint32_t now = millis(); 87 | while ((int32_t)(millis() - now) < 30000) { // Calibrate for 30s 88 | while (!getMagData(&mag, true)) { // Get magnetometer values without zero values subtracted 89 | delay(1); // Wait for data to get ready 90 | } 91 | for (uint8_t axis = 0; axis < 3; axis++) { 92 | if (mag.data[axis] < magZeroMin.data[axis]) 93 | magZeroMin.data[axis] = mag.data[axis]; 94 | if (mag.data[axis] > magZeroMax.data[axis]) 95 | magZeroMax.data[axis] = mag.data[axis]; 96 | } 97 | } 98 | 99 | for (uint8_t axis = 0; axis < 3; axis++) 100 | cfg.magZero.data[axis] = (magZeroMax.data[axis] + magZeroMin.data[axis]) / 2.0f; 101 | updateConfig(); // Save new values in EEPROM 102 | GPIOPinWrite(GPIO_LED_BASE, GPIO_BLUE_LED, 0); // Turn off blue LED 103 | } 104 | 105 | #endif // USE_MAG 106 | -------------------------------------------------------------------------------- /src/Magnetometer.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #if !defined(__magnetometer_h__) && USE_MAG 19 | #define __magnetometer_h__ 20 | 21 | #include "Types.h" 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | void initMag(void); 28 | bool getMagData(sensor_t *mag, bool calibrating); 29 | void calibrateMag(void); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/Makefile: -------------------------------------------------------------------------------- 1 | #****************************************************************************** 2 | # 3 | # Makefile - Rules for building the interrupts example. 4 | # 5 | # Copyright (c) 2012-2013 Texas Instruments Incorporated. All rights reserved. 6 | # Software License Agreement 7 | # 8 | # Texas Instruments (TI) is supplying this software for use solely and 9 | # exclusively on TI's microcontroller products. The software is owned by 10 | # TI and/or its suppliers, and is protected under applicable copyright 11 | # laws. You may not combine this software with "viral" open-source 12 | # software in order to form a larger program. 13 | # 14 | # THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 15 | # NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 16 | # NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | # A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 18 | # CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 19 | # DAMAGES, FOR ANY REASON WHATSOEVER. 20 | # 21 | # This is part of revision 1.1 of the EK-TM4C123GXL Firmware Package. 22 | # 23 | #****************************************************************************** 24 | 25 | # 26 | # Defines the part type that this project uses. 27 | # 28 | PART ?= TM4C123GH6PM 29 | 30 | # 31 | # Set target name. 32 | # 33 | TARGET ?= LaunchPadFlightController 34 | 35 | # 36 | # Preprocessor directives. 37 | # 38 | UART_DEBUG ?= 0 39 | USE_MAG ?= 1 40 | USE_BARO ?= 1 41 | USE_SONAR ?= 1 42 | USE_LIDAR_LITE ?= 1 43 | USE_FLOW_SENSOR ?= 0 44 | ONESHOT125 ?= 1 45 | STEP_ACRO_SELF_LEVEL ?= 0 46 | STEP_ALTITUDE_HOLD ?= 0 47 | STEP_HEADING_HOLD ?= 0 48 | 49 | BUILD_FLAGS = -DUART_DEBUG=$(UART_DEBUG) -DUSE_MAG=$(USE_MAG) -DUSE_BARO=$(USE_BARO) -DUSE_SONAR=$(USE_SONAR) -DUSE_LIDAR_LITE=$(USE_LIDAR_LITE) -DUSE_FLOW_SENSOR=$(USE_FLOW_SENSOR) -DONESHOT125=$(ONESHOT125) 50 | 51 | # 52 | # The base directory for TivaWare. 53 | # 54 | ROOT = ../lib 55 | 56 | # 57 | # Include the common make definitions. 58 | # 59 | include $(ROOT)/makedefs 60 | 61 | # 62 | # Where to find header files that do not live in the source directory. 63 | # 64 | IPATH = $(ROOT) 65 | 66 | # 67 | # Path to project object file. 68 | # 69 | PROJECT_OBJ = $(COMPILER)/$(TARGET).axf 70 | 71 | # 72 | # The default rule, which causes the project to be built. 73 | # 74 | all: $(COMPILER) $(PROJECT_OBJ) 75 | @echo "\n Build flags: $(BUILD_FLAGS)\n" 76 | @$(PREFIX)-size $(PROJECT_OBJ) 77 | 78 | # 79 | # The rule to clean out all the build products. 80 | # 81 | clean: 82 | @rm -rf $(COMPILER) $(wildcard *~) 83 | @rm -f $(ROOT)/utils/*.{o,d} 84 | 85 | # 86 | # The rule to build and flash the object file. 87 | # 88 | flash: all 89 | ifeq ($(OS),Windows_NT) 90 | @LMFlash -r -v $(COMPILER)/$(TARGET).bin 91 | else 92 | @lm4flash -v $(COMPILER)/$(TARGET).bin 93 | endif 94 | 95 | # 96 | # The rule to create the target directory. 97 | # 98 | $(COMPILER): 99 | @mkdir -p $(COMPILER) 100 | 101 | # 102 | # Create a list of all object files. 103 | # 104 | TARGET_OBJS = $(addsuffix .o,$(addprefix $(COMPILER)/,$(basename $(notdir $(wildcard *.c))))) 105 | 106 | # 107 | # Rules for building the project. 108 | # 109 | $(PROJECT_OBJ): $(TARGET_OBJS) 110 | $(PROJECT_OBJ): $(ROOT)/utils/uartstdio.o 111 | $(PROJECT_OBJ): $(ROOT)/driverlib/$(COMPILER)/libdriver.a 112 | $(PROJECT_OBJ): $(TARGET).ld 113 | 114 | SCATTERgcc_$(TARGET) = $(TARGET).ld 115 | ENTRY_$(TARGET) = ResetISR 116 | 117 | # 118 | # CFLAGS passed to the compiler. 119 | # 120 | CFLAGSgcc = -DTARGET_IS_BLIZZARD_RB1 -DUART_BUFFERED -DUART_BUFFERED1 121 | CFLAGSgcc += $(BUILD_FLAGS) 122 | CFLAGSgcc += -DSTEP_ACRO_SELF_LEVEL=$(STEP_ACRO_SELF_LEVEL) -DSTEP_ALTITUDE_HOLD=$(STEP_ALTITUDE_HOLD) -DSTEP_HEADING_HOLD=$(STEP_HEADING_HOLD) 123 | CFLAGSgcc += -Wdouble-promotion -Wunsafe-loop-optimizations -Wunused-parameter -Woverflow 124 | 125 | # 126 | # Make all warnings into errors when building using Travis CI 127 | # 128 | ifdef TRAVIS_CI 129 | CFLAGSgcc += -Werror 130 | endif 131 | 132 | # 133 | # Rebuild everything when makefile changes. 134 | # 135 | $(TARGET_OBJS): Makefile 136 | 137 | # 138 | # Include the automatically generated dependency files. 139 | # 140 | ifneq ($(MAKECMDGOALS),clean) 141 | -include $(wildcard $(COMPILER)/*.d) __dummy__ 142 | endif 143 | -------------------------------------------------------------------------------- /src/PID.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #include 19 | #include 20 | 21 | #include "EEPROM.h" 22 | #include "PID.h" 23 | 24 | pid_t pidRoll, pidPitch, pidYaw, pidSonarAltHold, pidBaroAltHold; 25 | 26 | void initPID(void) { 27 | // Set PID values to point at values read from EEPROM 28 | pidRoll.values = &cfg.pidRollPitchValues; 29 | pidPitch.values = &cfg.pidRollPitchValues; 30 | pidYaw.values = &cfg.pidYawValues; 31 | pidSonarAltHold.values = &cfg.pidSonarAltHoldValues; 32 | pidBaroAltHold.values = &cfg.pidBaroAltHoldValues; 33 | } 34 | 35 | float updatePID(pid_t *pid, float setpoint, float input, float dt) { 36 | float error = setpoint - input; 37 | 38 | // P-term 39 | float pTerm = pid->values->Kp * error; 40 | 41 | // I-term 42 | // Use Trapezoidal Integration, see: http://ecee.colorado.edu/shalom/Emulations.pdf 43 | pid->iTerm += pid->values->Ki * (error + pid->lastError) / 2.0f * dt; // Multiplication with Ki is done before integration limit, to make it independent from integration limit value 44 | pid->iTerm = constrain(pid->iTerm, -pid->values->integrationLimit, pid->values->integrationLimit); // Limit the integrated error - prevents windup 45 | 46 | // D-term 47 | float deltaError = (error - pid->lastError) / dt; // Calculate difference and compensate for difference in time by dividing by dt 48 | pid->lastError = error; 49 | 50 | // Use exponential smoothing on the derivative to reduce the impact of noise: https://en.wikipedia.org/wiki/Exponential_smoothing 51 | pid->low_pass.Fc = pid->values->Fc; // Set cutoff-frequency in case it has changed 52 | float derivative = applyLowPass(&pid->low_pass, deltaError, dt); 53 | float dTerm = pid->values->Kd * derivative; 54 | 55 | return pTerm + pid->iTerm + dTerm; // Return sum 56 | } 57 | 58 | void resetPIDRollPitchYaw(void) { 59 | pidRoll.iTerm = pidRoll.lastError = pidRoll.low_pass.prevOutput = 0.0f; 60 | pidPitch.iTerm = pidPitch.lastError = pidPitch.low_pass.prevOutput = 0.0f; 61 | pidYaw.iTerm = pidYaw.lastError = pidYaw.low_pass.prevOutput = 0.0f; 62 | } 63 | 64 | void resetPIDAltHold(void) { 65 | pidSonarAltHold.iTerm = pidSonarAltHold.lastError = pidSonarAltHold.low_pass.prevOutput = 0.0f; 66 | pidBaroAltHold.iTerm = pidBaroAltHold.lastError = pidBaroAltHold.low_pass.prevOutput = 0.0f; 67 | } 68 | -------------------------------------------------------------------------------- /src/PID.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #ifndef __pid_h__ 19 | #define __pid_h__ 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | #include "LowPassFilter.h" 26 | 27 | // From Arduino source code 28 | #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) 29 | 30 | typedef struct { 31 | float Kp, Ki, Kd; // PID variables 32 | float integrationLimit; 33 | float Fc; // Cutoff frequency in Hz 34 | } pid_values_t; 35 | 36 | typedef struct { 37 | pid_values_t *values; // Use pointer to pid_values_t struct that are saved in the EEPROM 38 | float iTerm, lastError; 39 | low_pass_t low_pass; // First order low-pass filter for the D-term 40 | } pid_t; 41 | 42 | void initPID(void); 43 | float updatePID(pid_t *pid, float setpoint, float input, float dt); 44 | void resetPIDRollPitchYaw(void); 45 | void resetPIDAltHold(void); 46 | 47 | extern pid_t pidRoll, pidPitch, pidYaw, pidSonarAltHold, pidBaroAltHold; 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /src/PPM.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #ifndef __ppm_h__ 19 | #define __ppm_h__ 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | // Internal motor values are in the range [-100:100] 26 | #define MIN_MOTOR_OUT (-100.0f) 27 | #define MAX_MOTOR_OUT (100.0f) 28 | 29 | void initPPM(void); 30 | void writePPMAllOff(void); 31 | void updateMotorsAll(float *values); 32 | 33 | float mapf(float x, float in_min, float in_max, float out_min, float out_max); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/RX.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #ifndef __rx_h__ 19 | #define __rx_h__ 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | // Used to check for min and max value of a specific channel 26 | #define CHANNEL_MIN_CHECK (-95.0f) 27 | #define CHANNEL_MAX_CHECK (95.0f) 28 | 29 | typedef enum { 30 | RX_AILERON_CHAN = 0, 31 | RX_ELEVATOR_CHAN, 32 | RX_THROTTLE_CHAN, 33 | RX_RUDDER_CHAN, 34 | RX_AUX1_CHAN, 35 | RX_AUX2_CHAN, 36 | RX_NUM_CHANNELS, 37 | } rxChannel_e; 38 | 39 | void initRX(void); 40 | float getRXChannel(rxChannel_e channel); 41 | 42 | extern volatile bool validRXData; 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/SPI.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #if USE_FLOW_SENSOR 23 | 24 | #include "SPI.h" 25 | #include "Time.h" 26 | 27 | #include "inc/hw_memmap.h" 28 | #include "driverlib/gpio.h" 29 | #include "driverlib/pin_map.h" 30 | #include "driverlib/ssi.h" 31 | #include "driverlib/sysctl.h" 32 | 33 | static void spiSelect(bool enable) { 34 | GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_3, enable ? 0 : GPIO_PIN_3); // The SS pin is active low 35 | } 36 | 37 | void initSPI(void) { 38 | SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0); // Enable SSI0 peripheral 39 | SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); // Enable GPIOA peripheral 40 | SysCtlDelay(2); // Insert a few cycles after enabling the peripheral to allow the clock to be fully activated 41 | 42 | // Use alternate function 43 | GPIOPinConfigure(GPIO_PA2_SSI0CLK); 44 | GPIOPinConfigure(GPIO_PA4_SSI0RX); 45 | GPIOPinConfigure(GPIO_PA5_SSI0TX); 46 | 47 | GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_3); // Set SS as output 48 | spiSelect(false); 49 | GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_4 | GPIO_PIN_5); // Use pins with SSI peripheral 50 | 51 | SSIClockSourceSet(SSI0_BASE, SSI_CLOCK_SYSTEM); // Use system clock 52 | 53 | // Configure the SSI to MODE3, 2 MHz, and 8-bit data 54 | SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_3, SSI_MODE_MASTER, 2e6, 8); 55 | SSIEnable(SSI0_BASE); // Enable the SSI module 56 | 57 | uint32_t buf; 58 | while (SSIDataGetNonBlocking(SSI0_BASE, &buf)) { 59 | // Read any residual data from the SSI port. This makes sure the receive 60 | // FIFOs are empty, so we don't read any unwanted junk. This is done here 61 | // because the SPI SSI mode is full-duplex, which allows you to send and 62 | // receive at the same time. The SSIDataGetNonBlocking function returns 63 | // "true" when data was returned, and "false" when no data was returned. 64 | // The "non-blocking" function checks if there is any data in the receive 65 | // FIFO and does not "hang" if there isn't. 66 | } 67 | } 68 | 69 | void spiWrite(uint8_t regAddr, uint8_t data) { 70 | spiTransfer(®Addr, 1, &data, NULL, 1); 71 | } 72 | 73 | void spiWriteData(uint8_t regAddr, const uint8_t *data, uint32_t length) { 74 | spiTransfer(®Addr, 1, data, NULL, length); 75 | } 76 | 77 | uint8_t spiRead(uint8_t regAddr) { 78 | uint8_t data; 79 | spiTransfer(®Addr, 1, NULL, &data, 1); 80 | return data; 81 | } 82 | 83 | void spiReadData(uint8_t regAddr, uint8_t *data, uint32_t length) { 84 | spiTransfer(®Addr, 1, NULL, data, length); 85 | } 86 | 87 | void spiTransfer(const uint8_t *header, uint16_t headerLength, const uint8_t *sendData, uint8_t *recvData, uint32_t dataLength) { 88 | spiSelect(true); 89 | 90 | // First send header 91 | uint32_t buf; 92 | for (uint16_t i = 0; i < headerLength; i++) { 93 | SSIDataPut(SSI0_BASE, header[i]); 94 | SSIDataGet(SSI0_BASE, &buf); // Throw away response 95 | #if USE_FLOW_SENSOR 96 | delayMicroseconds(75); // Wait minimum 75 us in case writing to Motion or Motion_Burst registers 97 | #endif 98 | } 99 | 100 | // Send data and read response 101 | for (uint32_t i = 0; i < dataLength; i++) { 102 | if (sendData) 103 | SSIDataPut(SSI0_BASE, sendData[i]); // Send data the pointer is not NULL 104 | else 105 | SSIDataPut(SSI0_BASE, 0); // Send 0 106 | SSIDataGet(SSI0_BASE, &buf); // Receive response 107 | if (recvData) 108 | recvData[i] = buf; // Store response in the buffer 109 | } 110 | 111 | spiSelect(false); 112 | } 113 | 114 | #endif // USE_FLOW_SENSOR 115 | -------------------------------------------------------------------------------- /src/SPI.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #if !defined(__spi_h__) && USE_FLOW_SENSOR 19 | #define __spi_h__ 20 | 21 | #include 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | void initSPI(void); 28 | 29 | void spiWrite(uint8_t regAddr, uint8_t data); 30 | void spiWriteData(uint8_t regAddr, const uint8_t *data, uint32_t length); 31 | 32 | uint8_t spiRead(uint8_t regAddr); 33 | void spiReadData(uint8_t regAddr, uint8_t *data, uint32_t length); 34 | 35 | void spiTransfer(const uint8_t *header, uint16_t headerLength, const uint8_t *sendData, uint8_t *recvData, uint32_t dataLength); 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/Sonar.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #if !defined(__sonar_h__) && USE_SONAR 19 | #define __sonar_h__ 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | #include "Types.h" 26 | 27 | void initSonar(void); 28 | bool triggerSonar(void); 29 | 30 | #if USE_BARO 31 | int16_t getSonarDistance(angle_t *angle, int32_t temperature); 32 | #else 33 | int16_t getSonarDistance(angle_t *angle); 34 | #endif 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/StepResponse.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #if STEP_ACRO_SELF_LEVEL || STEP_ALTITUDE_HOLD || STEP_HEADING_HOLD 23 | 24 | #include "Config.h" 25 | #include "StepResponse.h" 26 | #include "Time.h" 27 | #include "uartstdio1.h" // Add "UART_BUFFERED1" to preprocessor - it uses a modified version of uartstdio, so it can be used with another UART interface 28 | 29 | #include "driverlib/gpio.h" 30 | #include "inc/hw_memmap.h" 31 | 32 | typedef struct { 33 | uint32_t counter; 34 | uint32_t timeStamp; 35 | float setpoint; 36 | float input; 37 | } step_t; 38 | 39 | static void logData(step_t *step) { 40 | UARTprintf1("%u,%u,%d.%02u,%d.%02u\n", 41 | step->counter, 42 | step->timeStamp, 43 | (int16_t)step->setpoint, (uint16_t)(abs(step->setpoint * 100.0f) % 100), 44 | (int16_t)step->input, (uint16_t)(abs(step->input * 100.0f) % 100)); 45 | UARTFlushTx1(false); 46 | } 47 | 48 | float stepResponse(bool active, float setpoint, float input, float step1, float step2, uint32_t interval, uint32_t now) { 49 | static uint8_t state; 50 | 51 | if (active) { 52 | static step_t step; 53 | static uint32_t startTime, stateTimer; 54 | 55 | switch (state) { 56 | case 0: 57 | startTime = stateTimer = now; // Set initial value 58 | step.counter = 0; // Reset counter 59 | setpoint = step1; 60 | state = 1; 61 | break; 62 | case 1: 63 | setpoint = step1; 64 | if ((int32_t)(now - stateTimer) >= interval) { 65 | stateTimer = now; 66 | state = 2; 67 | } 68 | break; 69 | case 2: 70 | setpoint = step2; 71 | if ((int32_t)(now - stateTimer) >= interval) { 72 | stateTimer = now; 73 | state = 3; 74 | } 75 | break; 76 | case 3: 77 | setpoint = step1; 78 | if ((int32_t)(now - stateTimer) >= interval) 79 | state = 4; 80 | break; 81 | case 4: 82 | // Do nothing! 83 | break; 84 | default: 85 | break; 86 | } 87 | 88 | if (state < 4) { // Log data if state machine is running 89 | GPIOPinWrite(GPIO_LED_BASE, GPIO_BLUE_LED, GPIO_BLUE_LED); // Turn on blue LED 90 | 91 | step.counter++; 92 | step.timeStamp = now - startTime; 93 | step.setpoint = setpoint; 94 | step.input = input; 95 | 96 | logData(&step); 97 | } else 98 | GPIOPinWrite(GPIO_LED_BASE, GPIO_BLUE_LED, 0); // Turn off blue LED 99 | } else { 100 | state = 0; 101 | GPIOPinWrite(GPIO_LED_BASE, GPIO_BLUE_LED, 0); // Turn off blue LED 102 | } 103 | 104 | return setpoint; 105 | } 106 | 107 | #endif 108 | -------------------------------------------------------------------------------- /src/StepResponse.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #if !defined(__logger_h__) && (STEP_ACRO_SELF_LEVEL || STEP_ALTITUDE_HOLD || STEP_HEADING_HOLD) 19 | #define __logger_h__ 20 | 21 | #include "Types.h" 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | float stepResponse(bool active, float setpoint, float input, float step1, float step2, uint32_t interval, uint32_t now); 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/Time.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #include 19 | #include 20 | 21 | #include "Time.h" 22 | 23 | #include "driverlib/sysctl.h" 24 | #include "driverlib/systick.h" 25 | 26 | static volatile uint32_t counter; 27 | 28 | static void SycTickHandler(void) { 29 | counter++; 30 | } 31 | 32 | void initTime(void) { 33 | SysTickPeriodSet(SysCtlClockGet() / 1000000UL); // 1000 for milliseconds & 1000000 for microseconds 34 | SysTickIntRegister(SycTickHandler); 35 | SysTickIntEnable(); 36 | SysTickEnable(); 37 | } 38 | 39 | void delay(uint32_t ms) { 40 | delayMicroseconds(ms * 1000UL); 41 | } 42 | 43 | void delayMicroseconds(uint32_t us) { 44 | uint32_t start = micros(); 45 | while ((int32_t)(micros() - start) < us) { 46 | // Do nothing 47 | }; 48 | } 49 | 50 | uint32_t millis(void) { 51 | return counter / 1000UL; 52 | } 53 | 54 | uint32_t micros(void) { 55 | return counter; 56 | } 57 | -------------------------------------------------------------------------------- /src/Time.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #ifndef __time_h__ 19 | #define __time_h__ 20 | 21 | #include 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | void initTime(void); 28 | void delay(uint32_t ms); 29 | void delayMicroseconds(uint32_t us); 30 | uint32_t millis(void); 31 | uint32_t micros(void); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/Types.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #ifndef __types_h__ 19 | #define __types_h__ 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef union { 26 | struct { 27 | int16_t X, Y, Z; 28 | } __attribute__((packed)) axis; 29 | int16_t data[3]; 30 | } sensorRaw_t; 31 | 32 | typedef union { 33 | struct { 34 | float X, Y, Z; 35 | } __attribute__((packed)) axis; 36 | float data[3]; 37 | } sensor_t; 38 | 39 | typedef union { 40 | struct { 41 | float roll, pitch, yaw; 42 | } __attribute__((packed)) axis; 43 | float data[3]; 44 | } angle_t; 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/UART.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #if UART_DEBUG 23 | 24 | #include "Config.h" 25 | #include "EEPROM.h" 26 | #include "Time.h" 27 | #include "UART.h" 28 | 29 | #include "driverlib/gpio.h" 30 | #include "driverlib/uart.h" 31 | #if UART_DEBUG 32 | #include "utils/uartstdio.h" // Add "UART_BUFFERED" to preprocessor 33 | #endif 34 | 35 | void initUART(void) { 36 | SysCtlPeripheralEnable(SYSCTL_PERIPH_UART); // Enable the GPIO port containing the pins that will be used. 37 | SysCtlDelay(2); // Insert a few cycles after enabling the peripheral to allow the clock to be fully activated 38 | 39 | // Configure the GPIO pin muxing for the UART function. 40 | // This is only necessary if your part supports GPIO pin function muxing. 41 | // Study the data sheet to see which functions are allocated per pin. 42 | GPIOPinConfigure(GPIO_RX_UART); 43 | GPIOPinConfigure(GPIO_TX_UART); 44 | 45 | // Configure for use as a peripheral function (instead of GPIO). 46 | GPIOPinTypeUART(GPIO_UART_PIN_BASE, GPIO_RX_PIN_UART | GPIO_TX_PIN_UART); 47 | 48 | UARTStdioConfig(UART_NR_UART, 115200, SysCtlClockGet()); // Mode is set to 8N1 at 115200 49 | UARTEchoSet(false); 50 | 51 | while (UARTBusy(UART_BASE_UART)) { 52 | // Wait until UART is ready 53 | } 54 | 55 | UARTprintf("\nStarted\n"); 56 | } 57 | 58 | void printPIDValues(pid_values_t *pidValues) { 59 | UARTprintf("PID: %d.%04u\t%d.%04u\t%d.%05u\t%d.%04u\n", 60 | (int16_t)pidValues->Kp, (uint16_t)(abs(pidValues->Kp * 10000.0f) % 10000), 61 | (int16_t)pidValues->Ki, (uint16_t)(abs(pidValues->Ki * 10000.0f) % 10000), 62 | (int16_t)pidValues->Kd, (uint16_t)(abs(pidValues->Kd * 100000.0f) % 100000), 63 | (int16_t)pidValues->integrationLimit, (uint16_t)(abs(pidValues->integrationLimit * 10000.0f) % 10000)); 64 | UARTFlushTx(false); 65 | } 66 | 67 | void printSettings(void) { 68 | UARTprintf("Settings: %d.%02u\t%d.%02u\t%u\t%u\t%d.%02u\t%d.%02u\n", 69 | (int16_t)cfg.angleKp, (uint16_t)(abs(cfg.angleKp * 100.0f) % 100), 70 | (int16_t)cfg.headKp, (uint16_t)(abs(cfg.headKp * 100.0f) % 100), 71 | cfg.maxAngleInclination, cfg.maxAngleInclinationDistSensor, 72 | (int16_t)cfg.stickScalingRollPitch, (uint16_t)(abs(cfg.stickScalingRollPitch * 100.0f) % 100), 73 | (int16_t)cfg.stickScalingYaw, (uint16_t)(abs(cfg.stickScalingYaw * 100.0f) % 100)); 74 | UARTFlushTx(false); 75 | } 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /src/UART.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Kristian Sloth Lauszus. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Kristian Sloth Lauszus 14 | Web : http://www.lauszus.com 15 | e-mail : lauszus@gmail.com 16 | */ 17 | 18 | #if !defined(__uart_h__) && UART_DEBUG 19 | #define __uart_h__ 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | void initUART(void); 26 | void printPIDValues(pid_values_t *pid); 27 | void printSettings(void); 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/uartstdio1.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // uartstdio.h - Prototypes for the UART console functions. 4 | // 5 | // Copyright (c) 2007-2013 Texas Instruments Incorporated. All rights reserved. 6 | // Software License Agreement 7 | // 8 | // Texas Instruments (TI) is supplying this software for use solely and 9 | // exclusively on TI's microcontroller products. The software is owned by 10 | // TI and/or its suppliers, and is protected under applicable copyright 11 | // laws. You may not combine this software with "viral" open-source 12 | // software in order to form a larger program. 13 | // 14 | // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 15 | // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 16 | // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 18 | // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 19 | // DAMAGES, FOR ANY REASON WHATSOEVER. 20 | // 21 | // This is part of revision 1.1 of the Tiva Utility Library. 22 | // 23 | //***************************************************************************** 24 | 25 | #ifndef __UARTSTDIO1_H__ 26 | #define __UARTSTDIO1_H__ 27 | 28 | #include 29 | 30 | //***************************************************************************** 31 | // 32 | // If building with a C++ compiler, make all of the definitions in this header 33 | // have a C binding. 34 | // 35 | //***************************************************************************** 36 | #ifdef __cplusplus 37 | extern "C" 38 | { 39 | #endif 40 | 41 | //***************************************************************************** 42 | // 43 | // If built for buffered operation, the following labels define the sizes of 44 | // the transmit and receive buffers respectively. 45 | // 46 | //***************************************************************************** 47 | #ifdef UART_BUFFERED1 48 | #ifndef UART_RX_BUFFER_SIZE1 49 | #define UART_RX_BUFFER_SIZE1 128 50 | #endif 51 | #ifndef UART_TX_BUFFER_SIZE1 52 | #define UART_TX_BUFFER_SIZE1 1024 53 | #endif 54 | #endif 55 | 56 | //***************************************************************************** 57 | // 58 | // Prototypes for the APIs. 59 | // 60 | //***************************************************************************** 61 | extern void UARTStdioConfig1(uint32_t ui32Port, uint32_t ui32Baud, 62 | uint32_t ui32SrcClock); 63 | extern int UARTgets1(char *pcBuf, uint32_t ui32Len); 64 | extern unsigned char UARTgetc1(void); 65 | extern void UARTprintf1(const char *pcString, ...); 66 | extern void UARTvprintf1(const char *pcString, va_list vaArgP); 67 | extern int UARTwrite1(const char *pcBuf, uint32_t ui32Len); 68 | #ifdef UART_BUFFERED1 69 | extern int UARTPeek1(unsigned char ucChar); 70 | extern void UARTFlushTx1(bool bDiscard); 71 | extern void UARTFlushRx1(void); 72 | extern int UARTRxBytesAvail1(void); 73 | extern int UARTTxBytesFree1(void); 74 | extern void UARTEchoSet1(bool bEnable); 75 | #endif 76 | 77 | //***************************************************************************** 78 | // 79 | // Mark the end of the C bindings section for C++ compilers. 80 | // 81 | //***************************************************************************** 82 | #ifdef __cplusplus 83 | } 84 | #endif 85 | 86 | #endif // __UARTSTDIO_H__ 87 | --------------------------------------------------------------------------------