mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-30 21:43:34 +08:00
Merged
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
.built
|
.built
|
||||||
|
.context
|
||||||
*.context
|
*.context
|
||||||
*.bdat
|
*.bdat
|
||||||
*.pdat
|
*.pdat
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ include $(PX4_BASE)makefiles/setup.mk
|
|||||||
# Canned firmware configurations that we build.
|
# Canned firmware configurations that we build.
|
||||||
#
|
#
|
||||||
CONFIGS ?= $(subst config_,,$(basename $(notdir $(wildcard $(PX4_MK_DIR)config_*.mk))))
|
CONFIGS ?= $(subst config_,,$(basename $(notdir $(wildcard $(PX4_MK_DIR)config_*.mk))))
|
||||||
#CONFIGS ?= px4fmu_default px4io_default
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Boards that we build NuttX export kits for.
|
# Boards that we build NuttX export kits for.
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ set USB no
|
|||||||
set MODE camflyer
|
set MODE camflyer
|
||||||
|
|
||||||
#
|
#
|
||||||
# Start the ORB
|
# Start the ORB (first app to start)
|
||||||
#
|
#
|
||||||
uorb start
|
uorb start
|
||||||
|
|
||||||
@@ -27,38 +27,65 @@ fi
|
|||||||
param set MAV_TYPE 1
|
param set MAV_TYPE 1
|
||||||
|
|
||||||
#
|
#
|
||||||
# Start the sensors.
|
# Check if PX4IO Firmware should be upgraded (from Andrew Tridgell)
|
||||||
#
|
#
|
||||||
sh /etc/init.d/rc.sensors
|
if [ -f /fs/microsd/px4io.bin ]
|
||||||
|
then
|
||||||
|
echo "PX4IO Firmware found. Checking Upgrade.."
|
||||||
|
if cmp /fs/microsd/px4io.bin /fs/microsd/px4io.bin.current
|
||||||
|
then
|
||||||
|
echo "No newer version, skipping upgrade."
|
||||||
|
else
|
||||||
|
echo "Loading /fs/microsd/px4io.bin"
|
||||||
|
if px4io update /fs/microsd/px4io.bin > /fs/microsd/px4io_update.log
|
||||||
|
then
|
||||||
|
cp /fs/microsd/px4io.bin /fs/microsd/px4io.bin.current
|
||||||
|
echo "Flashed /fs/microsd/px4io.bin OK" >> /fs/microsd/px4io_update.log
|
||||||
|
else
|
||||||
|
echo "Failed flashing /fs/microsd/px4io.bin" >> /fs/microsd/px4io_update.log
|
||||||
|
echo "Failed to upgrade PX4IO firmware - check if PX4IO is in bootloader mode"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Start MAVLink
|
# Start MAVLink (depends on orb)
|
||||||
#
|
#
|
||||||
mavlink start -d /dev/ttyS1 -b 57600
|
mavlink start -d /dev/ttyS1 -b 57600
|
||||||
usleep 5000
|
usleep 5000
|
||||||
|
|
||||||
#
|
#
|
||||||
# Start the commander.
|
# Start the commander (depends on orb, mavlink)
|
||||||
#
|
#
|
||||||
commander start
|
commander start
|
||||||
|
|
||||||
#
|
#
|
||||||
# Start GPS interface
|
# Start PX4IO interface (depends on orb, commander)
|
||||||
#
|
|
||||||
gps start
|
|
||||||
|
|
||||||
#
|
|
||||||
# Start the attitude estimator
|
|
||||||
#
|
|
||||||
kalman_demo start
|
|
||||||
|
|
||||||
#
|
|
||||||
# Start PX4IO interface
|
|
||||||
#
|
#
|
||||||
px4io start
|
px4io start
|
||||||
|
|
||||||
#
|
#
|
||||||
# Load mixer and start controllers
|
# Allow PX4IO to recover from midair restarts.
|
||||||
|
# this is very unlikely, but quite safe and robust.
|
||||||
|
px4io recovery
|
||||||
|
|
||||||
|
#
|
||||||
|
# Start the sensors (depends on orb, px4io)
|
||||||
|
#
|
||||||
|
sh /etc/init.d/rc.sensors
|
||||||
|
|
||||||
|
#
|
||||||
|
# Start GPS interface (depends on orb)
|
||||||
|
#
|
||||||
|
gps start
|
||||||
|
|
||||||
|
#
|
||||||
|
# Start the attitude estimator (depends on orb)
|
||||||
|
#
|
||||||
|
kalman_demo start
|
||||||
|
|
||||||
|
#
|
||||||
|
# Load mixer and start controllers (depends on px4io)
|
||||||
#
|
#
|
||||||
mixer load /dev/pwm_output /etc/mixers/FMU_Q.mix
|
mixer load /dev/pwm_output /etc/mixers/FMU_Q.mix
|
||||||
control_demo start
|
control_demo start
|
||||||
@@ -66,8 +93,8 @@ control_demo start
|
|||||||
#
|
#
|
||||||
# Start logging
|
# Start logging
|
||||||
#
|
#
|
||||||
sdlog start -s 10
|
#sdlog start -s 4
|
||||||
|
|
||||||
#
|
#
|
||||||
# Start system state
|
# Start system state
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
#
|
#
|
||||||
# Flight startup script for PX4FMU on PX4IOAR carrier board.
|
# Flight startup script for PX4FMU on PX4IOAR carrier board.
|
||||||
#
|
#
|
||||||
|
|
||||||
# Disable the USB interface
|
# Disable the USB interface
|
||||||
set USB no
|
set USB no
|
||||||
|
|
||||||
# Disable autostarting other apps
|
# Disable autostarting other apps
|
||||||
set MODE ardrone
|
set MODE ardrone
|
||||||
|
|
||||||
@@ -25,13 +25,18 @@ if [ -f /fs/microsd/parameters ]
|
|||||||
then
|
then
|
||||||
param load /fs/microsd/parameters
|
param load /fs/microsd/parameters
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Force some key parameters to sane values
|
# Force some key parameters to sane values
|
||||||
# MAV_TYPE 1 = fixed wing, 2 = quadrotor, 13 = hexarotor
|
# MAV_TYPE 1 = fixed wing, 2 = quadrotor, 13 = hexarotor
|
||||||
# see https://pixhawk.ethz.ch/mavlink/
|
# see https://pixhawk.ethz.ch/mavlink/
|
||||||
#
|
#
|
||||||
param set MAV_TYPE 2
|
param set MAV_TYPE 2
|
||||||
|
|
||||||
|
#
|
||||||
|
# Configure PX4FMU for operation with PX4IOAR
|
||||||
|
#
|
||||||
|
fmu mode_gpio_serial
|
||||||
|
|
||||||
#
|
#
|
||||||
# Start the sensors.
|
# Start the sensors.
|
||||||
@@ -54,11 +59,6 @@ commander start
|
|||||||
#
|
#
|
||||||
attitude_estimator_ekf start
|
attitude_estimator_ekf start
|
||||||
|
|
||||||
#
|
|
||||||
# Configure PX4FMU for operation with PX4IOAR
|
|
||||||
#
|
|
||||||
fmu mode_gpio_serial
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Fire up the multi rotor attitude controller
|
# Fire up the multi rotor attitude controller
|
||||||
#
|
#
|
||||||
@@ -68,17 +68,17 @@ multirotor_att_control start
|
|||||||
# Fire up the AR.Drone interface.
|
# Fire up the AR.Drone interface.
|
||||||
#
|
#
|
||||||
ardrone_interface start -d /dev/ttyS1
|
ardrone_interface start -d /dev/ttyS1
|
||||||
|
|
||||||
#
|
|
||||||
# Start GPS capture
|
|
||||||
#
|
|
||||||
gps start
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Start logging
|
# Start logging
|
||||||
#
|
#
|
||||||
sdlog start -s 10
|
sdlog start -s 10
|
||||||
|
|
||||||
|
#
|
||||||
|
# Start GPS capture
|
||||||
|
#
|
||||||
|
gps start
|
||||||
|
|
||||||
#
|
#
|
||||||
# Start system state
|
# Start system state
|
||||||
#
|
#
|
||||||
@@ -95,4 +95,5 @@ fi
|
|||||||
# use the same UART for telemetry
|
# use the same UART for telemetry
|
||||||
#
|
#
|
||||||
echo "[init] startup done"
|
echo "[init] startup done"
|
||||||
exit
|
|
||||||
|
exit
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ set MODE autostart
|
|||||||
set USB autoconnect
|
set USB autoconnect
|
||||||
|
|
||||||
#
|
#
|
||||||
# Start playing the startup tune
|
|
||||||
#
|
#
|
||||||
tone_alarm start
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Try to mount the microSD card.
|
# Try to mount the microSD card.
|
||||||
@@ -32,8 +32,12 @@ echo "[init] looking for microSD..."
|
|||||||
if mount -t vfat /dev/mmcsd0 /fs/microsd
|
if mount -t vfat /dev/mmcsd0 /fs/microsd
|
||||||
then
|
then
|
||||||
echo "[init] card mounted at /fs/microsd"
|
echo "[init] card mounted at /fs/microsd"
|
||||||
|
# Start playing the startup tune
|
||||||
|
tone_alarm start
|
||||||
else
|
else
|
||||||
echo "[init] no microSD card found"
|
echo "[init] no microSD card found"
|
||||||
|
# Play SOS
|
||||||
|
tone_alarm 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
Multirotor mixer for PX4FMU
|
||||||
|
===========================
|
||||||
|
|
||||||
|
This file defines a single mixer for a quadrotor in the V configuration. All controls
|
||||||
|
are mixed 100%.
|
||||||
|
|
||||||
|
R: 4v 10000 10000 10000 0
|
||||||
@@ -1,107 +0,0 @@
|
|||||||
#!nsh
|
|
||||||
|
|
||||||
# Disable USB and autostart
|
|
||||||
set USB no
|
|
||||||
set MODE camflyer
|
|
||||||
|
|
||||||
#
|
|
||||||
# Start the ORB (first app to start)
|
|
||||||
#
|
|
||||||
uorb start
|
|
||||||
|
|
||||||
#
|
|
||||||
# Load microSD params
|
|
||||||
#
|
|
||||||
echo "[init] loading microSD params"
|
|
||||||
param select /fs/microsd/parameters
|
|
||||||
if [ -f /fs/microsd/parameters ]
|
|
||||||
then
|
|
||||||
param load /fs/microsd/parameters
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Force some key parameters to sane values
|
|
||||||
# MAV_TYPE 1 = fixed wing, 2 = quadrotor, 13 = hexarotor
|
|
||||||
# see https://pixhawk.ethz.ch/mavlink/
|
|
||||||
#
|
|
||||||
param set MAV_TYPE 1
|
|
||||||
|
|
||||||
#
|
|
||||||
# Check if PX4IO Firmware should be upgraded (from Andrew Tridgell)
|
|
||||||
#
|
|
||||||
if [ -f /fs/microsd/px4io.bin ]
|
|
||||||
then
|
|
||||||
echo "PX4IO Firmware found. Checking Upgrade.."
|
|
||||||
if cmp /fs/microsd/px4io.bin /fs/microsd/px4io.bin.current
|
|
||||||
then
|
|
||||||
echo "No newer version, skipping upgrade."
|
|
||||||
else
|
|
||||||
echo "Loading /fs/microsd/px4io.bin"
|
|
||||||
if px4io update /fs/microsd/px4io.bin > /fs/microsd/px4io_update.log
|
|
||||||
then
|
|
||||||
cp /fs/microsd/px4io.bin /fs/microsd/px4io.bin.current
|
|
||||||
echo "Flashed /fs/microsd/px4io.bin OK" >> /fs/microsd/px4io_update.log
|
|
||||||
else
|
|
||||||
echo "Failed flashing /fs/microsd/px4io.bin" >> /fs/microsd/px4io_update.log
|
|
||||||
echo "Failed to upgrade PX4IO firmware - check if PX4IO is in bootloader mode"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Start MAVLink (depends on orb)
|
|
||||||
#
|
|
||||||
mavlink start -d /dev/ttyS1 -b 57600
|
|
||||||
usleep 5000
|
|
||||||
|
|
||||||
#
|
|
||||||
# Start the commander (depends on orb, mavlink)
|
|
||||||
#
|
|
||||||
commander start
|
|
||||||
|
|
||||||
#
|
|
||||||
# Start PX4IO interface (depends on orb, commander)
|
|
||||||
#
|
|
||||||
px4io start
|
|
||||||
|
|
||||||
#
|
|
||||||
# Allow PX4IO to recover from midair restarts.
|
|
||||||
# this is very unlikely, but quite safe and robust.
|
|
||||||
px4io recovery
|
|
||||||
|
|
||||||
#
|
|
||||||
# Start the sensors (depends on orb, px4io)
|
|
||||||
#
|
|
||||||
sh /etc/init.d/rc.sensors
|
|
||||||
|
|
||||||
#
|
|
||||||
# Start GPS interface (depends on orb)
|
|
||||||
#
|
|
||||||
gps start
|
|
||||||
|
|
||||||
#
|
|
||||||
# Start the attitude estimator (depends on orb)
|
|
||||||
#
|
|
||||||
kalman_demo start
|
|
||||||
|
|
||||||
#
|
|
||||||
# Load mixer and start controllers (depends on px4io)
|
|
||||||
#
|
|
||||||
mixer load /dev/pwm_output /etc/mixers/FMU_Q.mix
|
|
||||||
control_demo start
|
|
||||||
|
|
||||||
#
|
|
||||||
# Start logging
|
|
||||||
#
|
|
||||||
#sdlog start -s 4
|
|
||||||
|
|
||||||
#
|
|
||||||
# Start system state
|
|
||||||
#
|
|
||||||
if blinkm start
|
|
||||||
then
|
|
||||||
echo "using BlinkM for state indication"
|
|
||||||
blinkm systemstate
|
|
||||||
else
|
|
||||||
echo "no BlinkM found, OK."
|
|
||||||
fi
|
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
#!nsh
|
|
||||||
#
|
|
||||||
# Flight startup script for PX4FMU on PX4IOAR carrier board.
|
|
||||||
#
|
|
||||||
|
|
||||||
# Disable the USB interface
|
|
||||||
set USB no
|
|
||||||
|
|
||||||
# Disable autostarting other apps
|
|
||||||
set MODE ardrone
|
|
||||||
|
|
||||||
echo "[init] doing PX4IOAR startup..."
|
|
||||||
|
|
||||||
#
|
|
||||||
# Start the ORB
|
|
||||||
#
|
|
||||||
uorb start
|
|
||||||
|
|
||||||
#
|
|
||||||
# Init the parameter storage
|
|
||||||
#
|
|
||||||
echo "[init] loading microSD params"
|
|
||||||
param select /fs/microsd/parameters
|
|
||||||
if [ -f /fs/microsd/parameters ]
|
|
||||||
then
|
|
||||||
param load /fs/microsd/parameters
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Force some key parameters to sane values
|
|
||||||
# MAV_TYPE 1 = fixed wing, 2 = quadrotor, 13 = hexarotor
|
|
||||||
# see https://pixhawk.ethz.ch/mavlink/
|
|
||||||
#
|
|
||||||
param set MAV_TYPE 2
|
|
||||||
|
|
||||||
#
|
|
||||||
# Configure PX4FMU for operation with PX4IOAR
|
|
||||||
#
|
|
||||||
fmu mode_gpio_serial
|
|
||||||
|
|
||||||
#
|
|
||||||
# Start the sensors.
|
|
||||||
#
|
|
||||||
sh /etc/init.d/rc.sensors
|
|
||||||
|
|
||||||
#
|
|
||||||
# Start MAVLink
|
|
||||||
#
|
|
||||||
mavlink start -d /dev/ttyS0 -b 57600
|
|
||||||
usleep 5000
|
|
||||||
|
|
||||||
#
|
|
||||||
# Start the commander.
|
|
||||||
#
|
|
||||||
commander start
|
|
||||||
|
|
||||||
#
|
|
||||||
# Start the attitude estimator
|
|
||||||
#
|
|
||||||
attitude_estimator_ekf start
|
|
||||||
|
|
||||||
#
|
|
||||||
# Fire up the multi rotor attitude controller
|
|
||||||
#
|
|
||||||
multirotor_att_control start
|
|
||||||
|
|
||||||
#
|
|
||||||
# Fire up the AR.Drone interface.
|
|
||||||
#
|
|
||||||
ardrone_interface start -d /dev/ttyS1
|
|
||||||
|
|
||||||
#
|
|
||||||
# Start logging
|
|
||||||
#
|
|
||||||
sdlog start -s 10
|
|
||||||
|
|
||||||
#
|
|
||||||
# Start GPS capture
|
|
||||||
#
|
|
||||||
gps start
|
|
||||||
|
|
||||||
#
|
|
||||||
# Start system state
|
|
||||||
#
|
|
||||||
if blinkm start
|
|
||||||
then
|
|
||||||
echo "using BlinkM for state indication"
|
|
||||||
blinkm systemstate
|
|
||||||
else
|
|
||||||
echo "no BlinkM found, OK."
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# startup is done; we don't want the shell because we
|
|
||||||
# use the same UART for telemetry
|
|
||||||
#
|
|
||||||
echo "[init] startup done"
|
|
||||||
|
|
||||||
exit
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
#!nsh
|
|
||||||
#
|
|
||||||
# PX4FMU startup script.
|
|
||||||
#
|
|
||||||
# This script is responsible for:
|
|
||||||
#
|
|
||||||
# - mounting the microSD card (if present)
|
|
||||||
# - running the user startup script from the microSD card (if present)
|
|
||||||
# - detecting the configuration of the system and picking a suitable
|
|
||||||
# startup script to continue with
|
|
||||||
#
|
|
||||||
# Note: DO NOT add configuration-specific commands to this script;
|
|
||||||
# add them to the per-configuration scripts instead.
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# Default to auto-start mode. An init script on the microSD card
|
|
||||||
# can change this to prevent automatic startup of the flight script.
|
|
||||||
#
|
|
||||||
set MODE autostart
|
|
||||||
set USB autoconnect
|
|
||||||
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Try to mount the microSD card.
|
|
||||||
#
|
|
||||||
echo "[init] looking for microSD..."
|
|
||||||
if mount -t vfat /dev/mmcsd0 /fs/microsd
|
|
||||||
then
|
|
||||||
echo "[init] card mounted at /fs/microsd"
|
|
||||||
# Start playing the startup tune
|
|
||||||
tone_alarm start
|
|
||||||
else
|
|
||||||
echo "[init] no microSD card found"
|
|
||||||
# Play SOS
|
|
||||||
tone_alarm 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Look for an init script on the microSD card.
|
|
||||||
#
|
|
||||||
# To prevent automatic startup in the current flight mode,
|
|
||||||
# the script should set MODE to some other value.
|
|
||||||
#
|
|
||||||
if [ -f /fs/microsd/etc/rc ]
|
|
||||||
then
|
|
||||||
echo "[init] reading /fs/microsd/etc/rc"
|
|
||||||
sh /fs/microsd/etc/rc
|
|
||||||
fi
|
|
||||||
# Also consider rc.txt files
|
|
||||||
if [ -f /fs/microsd/etc/rc.txt ]
|
|
||||||
then
|
|
||||||
echo "[init] reading /fs/microsd/etc/rc.txt"
|
|
||||||
sh /fs/microsd/etc/rc.txt
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Check for USB host
|
|
||||||
#
|
|
||||||
if [ $USB != autoconnect ]
|
|
||||||
then
|
|
||||||
echo "[init] not connecting USB"
|
|
||||||
else
|
|
||||||
if sercon
|
|
||||||
then
|
|
||||||
echo "[init] USB interface connected"
|
|
||||||
else
|
|
||||||
echo "[init] No USB connected"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if this is an APM build then there will be a rc.APM script
|
|
||||||
# from an EXTERNAL_SCRIPTS build option
|
|
||||||
if [ -f /etc/init.d/rc.APM ]
|
|
||||||
then
|
|
||||||
echo Running rc.APM
|
|
||||||
# if APM startup is successful then nsh will exit
|
|
||||||
sh /etc/init.d/rc.APM
|
|
||||||
fi
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
############################################################################
|
|
||||||
#
|
|
||||||
# Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions
|
|
||||||
# are met:
|
|
||||||
#
|
|
||||||
# 1. Redistributions of source code must retain the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer.
|
|
||||||
# 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer in
|
|
||||||
# the documentation and/or other materials provided with the
|
|
||||||
# distribution.
|
|
||||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
|
||||||
# used to endorse or promote products derived from this software
|
|
||||||
# without specific prior written permission.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
# POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
#
|
|
||||||
############################################################################
|
|
||||||
|
|
||||||
#
|
|
||||||
# Board-specific startup code for the PX4FMU
|
|
||||||
#
|
|
||||||
|
|
||||||
INCLUDES = $(TOPDIR)/arch/arm/src/stm32 $(TOPDIR)/arch/arm/src/common
|
|
||||||
LIBNAME = brd_px4fmu
|
|
||||||
|
|
||||||
include $(APPDIR)/mk/app.mk
|
|
||||||
@@ -1,141 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
*
|
|
||||||
* Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* 3. Neither the name PX4 nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file px4fmu_can.c
|
|
||||||
*
|
|
||||||
* Board-specific CAN functions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************************
|
|
||||||
* Included Files
|
|
||||||
************************************************************************************/
|
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
#include <nuttx/can.h>
|
|
||||||
#include <arch/board/board.h>
|
|
||||||
|
|
||||||
#include "chip.h"
|
|
||||||
#include "up_arch.h"
|
|
||||||
|
|
||||||
#include "stm32.h"
|
|
||||||
#include "stm32_can.h"
|
|
||||||
#include "px4fmu_internal.h"
|
|
||||||
|
|
||||||
/************************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
************************************************************************************/
|
|
||||||
/* Configuration ********************************************************************/
|
|
||||||
|
|
||||||
#if defined(CONFIG_STM32_CAN1) && defined(CONFIG_STM32_CAN2)
|
|
||||||
# warning "Both CAN1 and CAN2 are enabled. Assuming only CAN1."
|
|
||||||
# undef CONFIG_STM32_CAN2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_STM32_CAN1
|
|
||||||
# define CAN_PORT 1
|
|
||||||
#else
|
|
||||||
# define CAN_PORT 2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Debug ***************************************************************************/
|
|
||||||
/* Non-standard debug that may be enabled just for testing CAN */
|
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_CAN
|
|
||||||
# define candbg dbg
|
|
||||||
# define canvdbg vdbg
|
|
||||||
# define canlldbg lldbg
|
|
||||||
# define canllvdbg llvdbg
|
|
||||||
#else
|
|
||||||
# define candbg(x...)
|
|
||||||
# define canvdbg(x...)
|
|
||||||
# define canlldbg(x...)
|
|
||||||
# define canllvdbg(x...)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/************************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
************************************************************************************/
|
|
||||||
|
|
||||||
/************************************************************************************
|
|
||||||
* Public Functions
|
|
||||||
************************************************************************************/
|
|
||||||
|
|
||||||
/************************************************************************************
|
|
||||||
* Name: can_devinit
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* All STM32 architectures must provide the following interface to work with
|
|
||||||
* examples/can.
|
|
||||||
*
|
|
||||||
************************************************************************************/
|
|
||||||
|
|
||||||
int can_devinit(void)
|
|
||||||
{
|
|
||||||
static bool initialized = false;
|
|
||||||
struct can_dev_s *can;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* Check if we have already initialized */
|
|
||||||
|
|
||||||
if (!initialized) {
|
|
||||||
/* Call stm32_caninitialize() to get an instance of the CAN interface */
|
|
||||||
|
|
||||||
can = stm32_caninitialize(CAN_PORT);
|
|
||||||
|
|
||||||
if (can == NULL) {
|
|
||||||
candbg("ERROR: Failed to get CAN interface\n");
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Register the CAN driver at "/dev/can0" */
|
|
||||||
|
|
||||||
ret = can_register("/dev/can0", can);
|
|
||||||
|
|
||||||
if (ret < 0) {
|
|
||||||
candbg("ERROR: can_register failed: %d\n", ret);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Now we are initialized */
|
|
||||||
|
|
||||||
initialized = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
@@ -1,232 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
*
|
|
||||||
* Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* 3. Neither the name PX4 nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file px4fmu_init.c
|
|
||||||
*
|
|
||||||
* PX4FMU-specific early startup code. This file implements the
|
|
||||||
* nsh_archinitialize() function that is called early by nsh during startup.
|
|
||||||
*
|
|
||||||
* Code here is run before the rcS script is invoked; it should start required
|
|
||||||
* subsystems and perform board-specific initialisation.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Included Files
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <debug.h>
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
|
||||||
#include <nuttx/spi.h>
|
|
||||||
#include <nuttx/i2c.h>
|
|
||||||
#include <nuttx/mmcsd.h>
|
|
||||||
#include <nuttx/analog/adc.h>
|
|
||||||
|
|
||||||
#include "stm32_internal.h"
|
|
||||||
#include "px4fmu_internal.h"
|
|
||||||
#include "stm32_uart.h"
|
|
||||||
|
|
||||||
#include <arch/board/board.h>
|
|
||||||
|
|
||||||
#include <drivers/drv_hrt.h>
|
|
||||||
#include <drivers/drv_led.h>
|
|
||||||
|
|
||||||
#include <systemlib/cpuload.h>
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-Processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/* Configuration ************************************************************/
|
|
||||||
|
|
||||||
/* Debug ********************************************************************/
|
|
||||||
|
|
||||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
|
||||||
# ifdef CONFIG_DEBUG
|
|
||||||
# define message(...) lowsyslog(__VA_ARGS__)
|
|
||||||
# else
|
|
||||||
# define message(...) printf(__VA_ARGS__)
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
# ifdef CONFIG_DEBUG
|
|
||||||
# define message lowsyslog
|
|
||||||
# else
|
|
||||||
# define message printf
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Protected Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/************************************************************************************
|
|
||||||
* Name: stm32_boardinitialize
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* All STM32 architectures must provide the following entry point. This entry point
|
|
||||||
* is called early in the intitialization -- after all memory has been configured
|
|
||||||
* and mapped but before any devices have been initialized.
|
|
||||||
*
|
|
||||||
************************************************************************************/
|
|
||||||
|
|
||||||
__EXPORT void stm32_boardinitialize(void)
|
|
||||||
{
|
|
||||||
/* configure SPI interfaces */
|
|
||||||
stm32_spiinitialize();
|
|
||||||
|
|
||||||
/* configure LEDs */
|
|
||||||
up_ledinit();
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: nsh_archinitialize
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Perform architecture specific initialization
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
static struct spi_dev_s *spi1;
|
|
||||||
static struct spi_dev_s *spi3;
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
__EXPORT int matherr(struct __exception *e)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
__EXPORT int matherr(struct exception *e)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
__EXPORT int nsh_archinitialize(void)
|
|
||||||
{
|
|
||||||
int result;
|
|
||||||
|
|
||||||
/* configure the high-resolution time/callout interface */
|
|
||||||
hrt_init();
|
|
||||||
|
|
||||||
/* configure CPU load estimation */
|
|
||||||
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
|
||||||
cpuload_initialize_once();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* set up the serial DMA polling */
|
|
||||||
static struct hrt_call serial_dma_call;
|
|
||||||
struct timespec ts;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Poll at 1ms intervals for received bytes that have not triggered
|
|
||||||
* a DMA event.
|
|
||||||
*/
|
|
||||||
ts.tv_sec = 0;
|
|
||||||
ts.tv_nsec = 1000000;
|
|
||||||
|
|
||||||
hrt_call_every(&serial_dma_call,
|
|
||||||
ts_to_abstime(&ts),
|
|
||||||
ts_to_abstime(&ts),
|
|
||||||
(hrt_callout)stm32_serial_dma_poll,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
// initial LED state
|
|
||||||
drv_led_start();
|
|
||||||
up_ledoff(LED_BLUE);
|
|
||||||
up_ledoff(LED_AMBER);
|
|
||||||
up_ledon(LED_BLUE);
|
|
||||||
|
|
||||||
/* Configure SPI-based devices */
|
|
||||||
|
|
||||||
spi1 = up_spiinitialize(1);
|
|
||||||
|
|
||||||
if (!spi1) {
|
|
||||||
message("[boot] FAILED to initialize SPI port 1\r\n");
|
|
||||||
up_ledon(LED_AMBER);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Default SPI1 to 1MHz and de-assert the known chip selects.
|
|
||||||
SPI_SETFREQUENCY(spi1, 10000000);
|
|
||||||
SPI_SETBITS(spi1, 8);
|
|
||||||
SPI_SETMODE(spi1, SPIDEV_MODE3);
|
|
||||||
SPI_SELECT(spi1, PX4_SPIDEV_GYRO, false);
|
|
||||||
SPI_SELECT(spi1, PX4_SPIDEV_ACCEL, false);
|
|
||||||
SPI_SELECT(spi1, PX4_SPIDEV_MPU, false);
|
|
||||||
up_udelay(20);
|
|
||||||
|
|
||||||
message("[boot] Successfully initialized SPI port 1\r\n");
|
|
||||||
|
|
||||||
/* Get the SPI port for the microSD slot */
|
|
||||||
|
|
||||||
message("[boot] Initializing SPI port 3\n");
|
|
||||||
spi3 = up_spiinitialize(3);
|
|
||||||
|
|
||||||
if (!spi3) {
|
|
||||||
message("[boot] FAILED to initialize SPI port 3\n");
|
|
||||||
up_ledon(LED_AMBER);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
message("[boot] Successfully initialized SPI port 3\n");
|
|
||||||
|
|
||||||
/* Now bind the SPI interface to the MMCSD driver */
|
|
||||||
result = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, CONFIG_NSH_MMCSDSLOTNO, spi3);
|
|
||||||
|
|
||||||
if (result != OK) {
|
|
||||||
message("[boot] FAILED to bind SPI port 3 to the MMCSD driver\n");
|
|
||||||
up_ledon(LED_AMBER);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
message("[boot] Successfully bound SPI port 3 to the MMCSD driver\n");
|
|
||||||
|
|
||||||
stm32_configgpio(GPIO_ADC1_IN10);
|
|
||||||
stm32_configgpio(GPIO_ADC1_IN11);
|
|
||||||
stm32_configgpio(GPIO_ADC1_IN12);
|
|
||||||
stm32_configgpio(GPIO_ADC1_IN13); // jumperable to MPU6000 DRDY on some boards
|
|
||||||
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
@@ -1,161 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
*
|
|
||||||
* Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* 3. Neither the name PX4 nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file px4fmu_internal.h
|
|
||||||
*
|
|
||||||
* PX4FMU internal definitions
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
/****************************************************************************************************
|
|
||||||
* Included Files
|
|
||||||
****************************************************************************************************/
|
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
|
||||||
#include <nuttx/compiler.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
__BEGIN_DECLS
|
|
||||||
|
|
||||||
/* these headers are not C++ safe */
|
|
||||||
#include <stm32_internal.h>
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************************************
|
|
||||||
* Definitions
|
|
||||||
****************************************************************************************************/
|
|
||||||
/* Configuration ************************************************************************************/
|
|
||||||
|
|
||||||
#ifdef CONFIG_STM32_SPI2
|
|
||||||
# error "SPI2 is not supported on this board"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(CONFIG_STM32_CAN1)
|
|
||||||
# warning "CAN1 is not supported on this board"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* PX4FMU GPIOs ***********************************************************************************/
|
|
||||||
/* LEDs */
|
|
||||||
|
|
||||||
#define GPIO_LED1 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN15)
|
|
||||||
#define GPIO_LED2 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN14)
|
|
||||||
|
|
||||||
/* External interrupts */
|
|
||||||
#define GPIO_EXTI_COMPASS (GPIO_INPUT|GPIO_FLOAT|GPIO_EXTI|GPIO_PORTB|GPIO_PIN1)
|
|
||||||
// XXX MPU6000 DRDY?
|
|
||||||
|
|
||||||
/* SPI chip selects */
|
|
||||||
#define GPIO_SPI_CS_GYRO (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN14)
|
|
||||||
#define GPIO_SPI_CS_ACCEL (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN15)
|
|
||||||
#define GPIO_SPI_CS_MPU (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN0)
|
|
||||||
#define GPIO_SPI_CS_SDCARD (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN4)
|
|
||||||
|
|
||||||
/* User GPIOs
|
|
||||||
*
|
|
||||||
* GPIO0-1 are the buffered high-power GPIOs.
|
|
||||||
* GPIO2-5 are the USART2 pins.
|
|
||||||
* GPIO6-7 are the CAN2 pins.
|
|
||||||
*/
|
|
||||||
#define GPIO_GPIO0_INPUT (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTC|GPIO_PIN4)
|
|
||||||
#define GPIO_GPIO1_INPUT (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTC|GPIO_PIN5)
|
|
||||||
#define GPIO_GPIO2_INPUT (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTA|GPIO_PIN0)
|
|
||||||
#define GPIO_GPIO3_INPUT (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTA|GPIO_PIN1)
|
|
||||||
#define GPIO_GPIO4_INPUT (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTA|GPIO_PIN2)
|
|
||||||
#define GPIO_GPIO5_INPUT (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTA|GPIO_PIN3)
|
|
||||||
#define GPIO_GPIO6_INPUT (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTB|GPIO_PIN13)
|
|
||||||
#define GPIO_GPIO7_INPUT (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTB|GPIO_PIN2)
|
|
||||||
#define GPIO_GPIO0_OUTPUT (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN4)
|
|
||||||
#define GPIO_GPIO1_OUTPUT (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN5)
|
|
||||||
#define GPIO_GPIO2_OUTPUT (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN0)
|
|
||||||
#define GPIO_GPIO3_OUTPUT (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN1)
|
|
||||||
#define GPIO_GPIO4_OUTPUT (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN2)
|
|
||||||
#define GPIO_GPIO5_OUTPUT (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN3)
|
|
||||||
#define GPIO_GPIO6_OUTPUT (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN13)
|
|
||||||
#define GPIO_GPIO7_OUTPUT (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN12)
|
|
||||||
#define GPIO_GPIO_DIR (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN13)
|
|
||||||
|
|
||||||
/* USB OTG FS
|
|
||||||
*
|
|
||||||
* PA9 OTG_FS_VBUS VBUS sensing (also connected to the green LED)
|
|
||||||
*/
|
|
||||||
#define GPIO_OTGFS_VBUS (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz|GPIO_OPENDRAIN|GPIO_PORTA|GPIO_PIN9)
|
|
||||||
|
|
||||||
/* PWM
|
|
||||||
*
|
|
||||||
* The PX4FMU has five PWM outputs, of which only the output on
|
|
||||||
* pin PC8 is fixed assigned to this function. The other four possible
|
|
||||||
* pwm sources are the TX, RX, RTS and CTS pins of USART2
|
|
||||||
*
|
|
||||||
* Alternate function mapping:
|
|
||||||
* PC8 - BUZZER - TIM8_CH3/SDIO_D0 /TIM3_CH3/ USART6_CK / DCMI_D2
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef CONFIG_PWM
|
|
||||||
# if defined(CONFIG_STM32_TIM3_PWM)
|
|
||||||
# define BUZZER_PWMCHANNEL 3
|
|
||||||
# define BUZZER_PWMTIMER 3
|
|
||||||
# elif defined(CONFIG_STM32_TIM8_PWM)
|
|
||||||
# define BUZZER_PWMCHANNEL 3
|
|
||||||
# define BUZZER_PWMTIMER 8
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************************************
|
|
||||||
* Public Types
|
|
||||||
****************************************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************************************
|
|
||||||
* Public data
|
|
||||||
****************************************************************************************************/
|
|
||||||
|
|
||||||
#ifndef __ASSEMBLY__
|
|
||||||
|
|
||||||
/****************************************************************************************************
|
|
||||||
* Public Functions
|
|
||||||
****************************************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************************************
|
|
||||||
* Name: stm32_spiinitialize
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Called to configure SPI chip select GPIO pins for the PX4FMU board.
|
|
||||||
*
|
|
||||||
****************************************************************************************************/
|
|
||||||
|
|
||||||
extern void stm32_spiinitialize(void);
|
|
||||||
|
|
||||||
#endif /* __ASSEMBLY__ */
|
|
||||||
|
|
||||||
__END_DECLS
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
*
|
|
||||||
* Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* 3. Neither the name PX4 nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @file px4fmu_pwm_servo.c
|
|
||||||
*
|
|
||||||
* Configuration data for the stm32 pwm_servo driver.
|
|
||||||
*
|
|
||||||
* Note that these arrays must always be fully-sized.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include <drivers/stm32/drv_pwm_servo.h>
|
|
||||||
|
|
||||||
#include <arch/board/board.h>
|
|
||||||
#include <drivers/drv_pwm_output.h>
|
|
||||||
|
|
||||||
#include <stm32_internal.h>
|
|
||||||
#include <stm32_gpio.h>
|
|
||||||
#include <stm32_tim.h>
|
|
||||||
|
|
||||||
__EXPORT const struct pwm_servo_timer pwm_timers[PWM_SERVO_MAX_TIMERS] = {
|
|
||||||
{
|
|
||||||
.base = STM32_TIM2_BASE,
|
|
||||||
.clock_register = STM32_RCC_APB1ENR,
|
|
||||||
.clock_bit = RCC_APB1ENR_TIM2EN,
|
|
||||||
.clock_freq = STM32_APB1_TIM2_CLKIN
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
__EXPORT const struct pwm_servo_channel pwm_channels[PWM_SERVO_MAX_CHANNELS] = {
|
|
||||||
{
|
|
||||||
.gpio = GPIO_TIM2_CH1OUT,
|
|
||||||
.timer_index = 0,
|
|
||||||
.timer_channel = 1,
|
|
||||||
.default_value = 1000,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.gpio = GPIO_TIM2_CH2OUT,
|
|
||||||
.timer_index = 0,
|
|
||||||
.timer_channel = 2,
|
|
||||||
.default_value = 1000,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.gpio = GPIO_TIM2_CH3OUT,
|
|
||||||
.timer_index = 0,
|
|
||||||
.timer_channel = 3,
|
|
||||||
.default_value = 1000,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.gpio = GPIO_TIM2_CH4OUT,
|
|
||||||
.timer_index = 0,
|
|
||||||
.timer_channel = 4,
|
|
||||||
.default_value = 1000,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,136 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
*
|
|
||||||
* Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* 3. Neither the name PX4 nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file px4fmu_spi.c
|
|
||||||
*
|
|
||||||
* Board-specific SPI functions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/************************************************************************************
|
|
||||||
* Included Files
|
|
||||||
************************************************************************************/
|
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
#include <nuttx/spi.h>
|
|
||||||
#include <arch/board/board.h>
|
|
||||||
|
|
||||||
#include "up_arch.h"
|
|
||||||
#include "chip.h"
|
|
||||||
#include "stm32_internal.h"
|
|
||||||
#include "px4fmu_internal.h"
|
|
||||||
|
|
||||||
/************************************************************************************
|
|
||||||
* Public Functions
|
|
||||||
************************************************************************************/
|
|
||||||
|
|
||||||
/************************************************************************************
|
|
||||||
* Name: stm32_spiinitialize
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Called to configure SPI chip select GPIO pins for the PX4FMU board.
|
|
||||||
*
|
|
||||||
************************************************************************************/
|
|
||||||
|
|
||||||
__EXPORT void weak_function stm32_spiinitialize(void)
|
|
||||||
{
|
|
||||||
stm32_configgpio(GPIO_SPI_CS_GYRO);
|
|
||||||
stm32_configgpio(GPIO_SPI_CS_ACCEL);
|
|
||||||
stm32_configgpio(GPIO_SPI_CS_MPU);
|
|
||||||
stm32_configgpio(GPIO_SPI_CS_SDCARD);
|
|
||||||
|
|
||||||
/* De-activate all peripherals,
|
|
||||||
* required for some peripheral
|
|
||||||
* state machines
|
|
||||||
*/
|
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_GYRO, 1);
|
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_ACCEL, 1);
|
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_MPU, 1);
|
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_SDCARD, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
__EXPORT void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
|
||||||
{
|
|
||||||
/* SPI select is active low, so write !selected to select the device */
|
|
||||||
|
|
||||||
switch (devid) {
|
|
||||||
case PX4_SPIDEV_GYRO:
|
|
||||||
/* Making sure the other peripherals are not selected */
|
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_GYRO, !selected);
|
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_MPU, 1);
|
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_ACCEL, 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PX4_SPIDEV_ACCEL:
|
|
||||||
/* Making sure the other peripherals are not selected */
|
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_ACCEL, !selected);
|
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_MPU, 1);
|
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_GYRO, 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PX4_SPIDEV_MPU:
|
|
||||||
/* Making sure the other peripherals are not selected */
|
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_ACCEL, 1);
|
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_GYRO, 1);
|
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_MPU, !selected);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
__EXPORT uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
|
||||||
{
|
|
||||||
return SPI_STATUS_PRESENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
__EXPORT void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
|
||||||
{
|
|
||||||
/* there can only be one device on this bus, so always select it */
|
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_SDCARD, !selected);
|
|
||||||
}
|
|
||||||
|
|
||||||
__EXPORT uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
|
||||||
{
|
|
||||||
/* this is actually bogus, but PX4 has no way to sense the presence of an SD card */
|
|
||||||
return SPI_STATUS_PRESENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
*
|
|
||||||
* Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* 3. Neither the name PX4 nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file px4fmu_usb.c
|
|
||||||
*
|
|
||||||
* Board-specific USB functions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/************************************************************************************
|
|
||||||
* Included Files
|
|
||||||
************************************************************************************/
|
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
#include <nuttx/usb/usbdev.h>
|
|
||||||
#include <nuttx/usb/usbdev_trace.h>
|
|
||||||
|
|
||||||
#include "up_arch.h"
|
|
||||||
#include "stm32_internal.h"
|
|
||||||
#include "px4fmu_internal.h"
|
|
||||||
|
|
||||||
/************************************************************************************
|
|
||||||
* Definitions
|
|
||||||
************************************************************************************/
|
|
||||||
|
|
||||||
/************************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
************************************************************************************/
|
|
||||||
|
|
||||||
/************************************************************************************
|
|
||||||
* Public Functions
|
|
||||||
************************************************************************************/
|
|
||||||
|
|
||||||
/************************************************************************************
|
|
||||||
* Name: stm32_usbinitialize
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Called to setup USB-related GPIO pins for the PX4FMU board.
|
|
||||||
*
|
|
||||||
************************************************************************************/
|
|
||||||
|
|
||||||
__EXPORT void stm32_usbinitialize(void)
|
|
||||||
{
|
|
||||||
/* The OTG FS has an internal soft pull-up */
|
|
||||||
|
|
||||||
/* Configure the OTG FS VBUS sensing GPIO, Power On, and Overcurrent GPIOs */
|
|
||||||
|
|
||||||
#ifdef CONFIG_STM32_OTGFS
|
|
||||||
stm32_configgpio(GPIO_OTGFS_VBUS);
|
|
||||||
/* XXX We only support device mode
|
|
||||||
stm32_configgpio(GPIO_OTGFS_PWRON);
|
|
||||||
stm32_configgpio(GPIO_OTGFS_OVER);
|
|
||||||
*/
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************************************************************
|
|
||||||
* Name: stm32_usbsuspend
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
|
|
||||||
* used. This function is called whenever the USB enters or leaves suspend mode.
|
|
||||||
* This is an opportunity for the board logic to shutdown clocks, power, etc.
|
|
||||||
* while the USB is suspended.
|
|
||||||
*
|
|
||||||
************************************************************************************/
|
|
||||||
|
|
||||||
__EXPORT void stm32_usbsuspend(FAR struct usbdev_s *dev, bool resume)
|
|
||||||
{
|
|
||||||
ulldbg("resume: %d\n", resume);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
############################################################################
|
|
||||||
#
|
|
||||||
# Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions
|
|
||||||
# are met:
|
|
||||||
#
|
|
||||||
# 1. Redistributions of source code must retain the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer.
|
|
||||||
# 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer in
|
|
||||||
# the documentation and/or other materials provided with the
|
|
||||||
# distribution.
|
|
||||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
|
||||||
# used to endorse or promote products derived from this software
|
|
||||||
# without specific prior written permission.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
# POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
#
|
|
||||||
############################################################################
|
|
||||||
|
|
||||||
#
|
|
||||||
# Makefile to build assorted test cases
|
|
||||||
#
|
|
||||||
|
|
||||||
APPNAME = tests
|
|
||||||
PRIORITY = SCHED_PRIORITY_DEFAULT
|
|
||||||
STACKSIZE = 12000
|
|
||||||
|
|
||||||
include $(APPDIR)/mk/app.mk
|
|
||||||
|
|
||||||
MAXOPTIMIZATION = -Os
|
|
||||||
@@ -418,6 +418,7 @@ public:
|
|||||||
enum Geometry {
|
enum Geometry {
|
||||||
QUAD_X = 0, /**< quad in X configuration */
|
QUAD_X = 0, /**< quad in X configuration */
|
||||||
QUAD_PLUS, /**< quad in + configuration */
|
QUAD_PLUS, /**< quad in + configuration */
|
||||||
|
QUAD_V, /**< quad in V configuration */
|
||||||
HEX_X, /**< hex in X configuration */
|
HEX_X, /**< hex in X configuration */
|
||||||
HEX_PLUS, /**< hex in + configuration */
|
HEX_PLUS, /**< hex in + configuration */
|
||||||
OCTA_X,
|
OCTA_X,
|
||||||
|
|||||||
@@ -82,6 +82,12 @@ const MultirotorMixer::Rotor _config_quad_plus[] = {
|
|||||||
{ 0.000000, 1.000000, -1.00 },
|
{ 0.000000, 1.000000, -1.00 },
|
||||||
{ -0.000000, -1.000000, -1.00 },
|
{ -0.000000, -1.000000, -1.00 },
|
||||||
};
|
};
|
||||||
|
const MultirotorMixer::Rotor _config_quad_v[] = {
|
||||||
|
{ -0.927184, 0.374607, 1.00 },
|
||||||
|
{ 0.694658, -0.719340, 1.00 },
|
||||||
|
{ 0.927184, 0.374607, -1.00 },
|
||||||
|
{ -0.694658, -0.719340, -1.00 },
|
||||||
|
};
|
||||||
const MultirotorMixer::Rotor _config_hex_x[] = {
|
const MultirotorMixer::Rotor _config_hex_x[] = {
|
||||||
{ -1.000000, 0.000000, -1.00 },
|
{ -1.000000, 0.000000, -1.00 },
|
||||||
{ 1.000000, 0.000000, 1.00 },
|
{ 1.000000, 0.000000, 1.00 },
|
||||||
@@ -121,6 +127,7 @@ const MultirotorMixer::Rotor _config_octa_plus[] = {
|
|||||||
const MultirotorMixer::Rotor *_config_index[MultirotorMixer::Geometry::MAX_GEOMETRY] = {
|
const MultirotorMixer::Rotor *_config_index[MultirotorMixer::Geometry::MAX_GEOMETRY] = {
|
||||||
&_config_quad_x[0],
|
&_config_quad_x[0],
|
||||||
&_config_quad_plus[0],
|
&_config_quad_plus[0],
|
||||||
|
&_config_quad_v[0],
|
||||||
&_config_hex_x[0],
|
&_config_hex_x[0],
|
||||||
&_config_hex_plus[0],
|
&_config_hex_plus[0],
|
||||||
&_config_octa_x[0],
|
&_config_octa_x[0],
|
||||||
@@ -129,6 +136,7 @@ const MultirotorMixer::Rotor *_config_index[MultirotorMixer::Geometry::MAX_GEOME
|
|||||||
const unsigned _config_rotor_count[MultirotorMixer::Geometry::MAX_GEOMETRY] = {
|
const unsigned _config_rotor_count[MultirotorMixer::Geometry::MAX_GEOMETRY] = {
|
||||||
4, /* quad_x */
|
4, /* quad_x */
|
||||||
4, /* quad_plus */
|
4, /* quad_plus */
|
||||||
|
4, /* quad_v */
|
||||||
6, /* hex_x */
|
6, /* hex_x */
|
||||||
6, /* hex_plus */
|
6, /* hex_plus */
|
||||||
8, /* octa_x */
|
8, /* octa_x */
|
||||||
@@ -184,6 +192,9 @@ MultirotorMixer::from_text(Mixer::ControlCallback control_cb, uintptr_t cb_handl
|
|||||||
} else if (!strcmp(geomname, "4x")) {
|
} else if (!strcmp(geomname, "4x")) {
|
||||||
geometry = MultirotorMixer::QUAD_X;
|
geometry = MultirotorMixer::QUAD_X;
|
||||||
|
|
||||||
|
} else if (!strcmp(geomname, "4v")) {
|
||||||
|
geometry = MultirotorMixer::QUAD_V;
|
||||||
|
|
||||||
} else if (!strcmp(geomname, "6+")) {
|
} else if (!strcmp(geomname, "6+")) {
|
||||||
geometry = MultirotorMixer::HEX_PLUS;
|
geometry = MultirotorMixer::HEX_PLUS;
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,13 @@ set quad_plus {
|
|||||||
180 CW
|
180 CW
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set quad_v {
|
||||||
|
68 CCW
|
||||||
|
-136 CCW
|
||||||
|
-68 CW
|
||||||
|
136 CW
|
||||||
|
}
|
||||||
|
|
||||||
set hex_x {
|
set hex_x {
|
||||||
90 CW
|
90 CW
|
||||||
-90 CCW
|
-90 CCW
|
||||||
@@ -60,7 +67,7 @@ set octa_plus {
|
|||||||
90 CW
|
90 CW
|
||||||
}
|
}
|
||||||
|
|
||||||
set tables {quad_x quad_plus hex_x hex_plus octa_x octa_plus}
|
set tables {quad_x quad_plus quad_v hex_x hex_plus octa_x octa_plus}
|
||||||
|
|
||||||
proc factors {a d} { puts [format "\t{ %9.6f, %9.6f, %5.2f }," [rcos [expr $a + 90]] [rcos $a] [expr -$d]]}
|
proc factors {a d} { puts [format "\t{ %9.6f, %9.6f, %5.2f }," [rcos [expr $a + 90]] [rcos $a] [expr -$d]]}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ MODULES += systemcmds/preflight_check
|
|||||||
MODULES += systemcmds/pwm
|
MODULES += systemcmds/pwm
|
||||||
MODULES += systemcmds/reboot
|
MODULES += systemcmds/reboot
|
||||||
MODULES += systemcmds/top
|
MODULES += systemcmds/top
|
||||||
|
MODULES += systemcmds/tests
|
||||||
|
|
||||||
#
|
#
|
||||||
# General system control
|
# General system control
|
||||||
@@ -79,6 +80,5 @@ BUILTIN_COMMANDS := \
|
|||||||
$(call _B, sensors, SCHED_PRIORITY_MAX-5, 4096, sensors_main ) \
|
$(call _B, sensors, SCHED_PRIORITY_MAX-5, 4096, sensors_main ) \
|
||||||
$(call _B, sercon, , 2048, sercon_main ) \
|
$(call _B, sercon, , 2048, sercon_main ) \
|
||||||
$(call _B, serdis, , 2048, serdis_main ) \
|
$(call _B, serdis, , 2048, serdis_main ) \
|
||||||
$(call _B, tests, , 12000, tests_main ) \
|
|
||||||
$(call _B, tone_alarm, , 2048, tone_alarm_main ) \
|
$(call _B, tone_alarm, , 2048, tone_alarm_main ) \
|
||||||
$(call _B, uorb, , 4096, uorb_main )
|
$(call _B, uorb, , 4096, uorb_main )
|
||||||
|
|||||||
@@ -75,6 +75,12 @@
|
|||||||
# the list should be formatted as:
|
# the list should be formatted as:
|
||||||
# <command>.<priority>.<stacksize>.<entrypoint>
|
# <command>.<priority>.<stacksize>.<entrypoint>
|
||||||
#
|
#
|
||||||
|
# INCLUDE_DIRS (optional, must be appended)
|
||||||
|
#
|
||||||
|
# The list of directories searched for include files. If non-standard
|
||||||
|
# includes (e.g. those from another module) are required, paths to search
|
||||||
|
# can be added here.
|
||||||
|
#
|
||||||
# DEFAULT_VISIBILITY (optional)
|
# DEFAULT_VISIBILITY (optional)
|
||||||
#
|
#
|
||||||
# If not set, global symbols defined in a module will not be visible
|
# If not set, global symbols defined in a module will not be visible
|
||||||
|
|||||||
+2
-2
@@ -64,8 +64,8 @@ LDSCRIPT += $(NUTTX_EXPORT_DIR)build/ld.script
|
|||||||
# Add directories from the NuttX export to the relevant search paths
|
# Add directories from the NuttX export to the relevant search paths
|
||||||
#
|
#
|
||||||
INCLUDE_DIRS += $(NUTTX_EXPORT_DIR)include \
|
INCLUDE_DIRS += $(NUTTX_EXPORT_DIR)include \
|
||||||
+= $(NUTTX_EXPORT_DIR)arch/chip \
|
$(NUTTX_EXPORT_DIR)arch/chip \
|
||||||
+= $(NUTTX_EXPORT_DIR)arch/common
|
$(NUTTX_EXPORT_DIR)arch/common
|
||||||
|
|
||||||
LIB_DIRS += $(NUTTX_EXPORT_DIR)libs
|
LIB_DIRS += $(NUTTX_EXPORT_DIR)libs
|
||||||
LIBS += -lapps -lnuttx
|
LIBS += -lapps -lnuttx
|
||||||
|
|||||||
@@ -2797,13 +2797,14 @@ void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot)
|
|||||||
}
|
}
|
||||||
fvdbg("cdstatus OLD: %02x NEW: %02x\n", cdstatus, priv->cdstatus);
|
fvdbg("cdstatus OLD: %02x NEW: %02x\n", cdstatus, priv->cdstatus);
|
||||||
|
|
||||||
|
irqrestore(flags);
|
||||||
|
|
||||||
/* Perform any requested callback if the status has changed */
|
/* Perform any requested callback if the status has changed */
|
||||||
|
|
||||||
if (cdstatus != priv->cdstatus)
|
if (cdstatus != priv->cdstatus)
|
||||||
{
|
{
|
||||||
stm32_callback(priv);
|
stm32_callback(priv);
|
||||||
}
|
}
|
||||||
irqrestore(flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -127,7 +127,6 @@ CONFIGURED_APPS += drivers/mb12xx
|
|||||||
|
|
||||||
# Testing stuff
|
# Testing stuff
|
||||||
CONFIGURED_APPS += px4/sensors_bringup
|
CONFIGURED_APPS += px4/sensors_bringup
|
||||||
CONFIGURED_APPS += px4/tests
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_CAN),y)
|
ifeq ($(CONFIG_CAN),y)
|
||||||
#CONFIGURED_APPS += examples/can
|
#CONFIGURED_APPS += examples/can
|
||||||
|
|||||||
@@ -141,4 +141,4 @@ int can_devinit(void)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -50,4 +50,3 @@ SRCS = attitude_estimator_ekf_params.c \
|
|||||||
codegen/rtGetNaN.c \
|
codegen/rtGetNaN.c \
|
||||||
codegen/norm.c \
|
codegen/norm.c \
|
||||||
codegen/cross.c
|
codegen/cross.c
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
#
|
||||||
|
# Assorted tests and the like
|
||||||
|
#
|
||||||
|
|
||||||
|
MODULE_COMMAND = tests
|
||||||
|
MODULE_STACKSIZE = 12000
|
||||||
|
MAXOPTIMIZATION = -Os
|
||||||
|
|
||||||
|
SRCS = test_adc.c \
|
||||||
|
test_bson.c \
|
||||||
|
test_float.c \
|
||||||
|
test_gpio.c \
|
||||||
|
test_hott_telemetry.c \
|
||||||
|
test_hrt.c \
|
||||||
|
test_int.c \
|
||||||
|
test_jig_voltages.c \
|
||||||
|
test_led.c \
|
||||||
|
test_sensors.c \
|
||||||
|
test_servo.c \
|
||||||
|
test_sleep.c \
|
||||||
|
test_time.c \
|
||||||
|
test_uart_baudchange.c \
|
||||||
|
test_uart_console.c \
|
||||||
|
test_uart_loopback.c \
|
||||||
|
test_uart_send.c \
|
||||||
|
tests_file.c \
|
||||||
|
tests_main.c \
|
||||||
|
tests_param.c
|
||||||
Reference in New Issue
Block a user