mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-05 15:30:08 +08:00
Merge branch 'master' of https://github.com/paparazzi/paparazzi into ardrone_mag_freeze
This commit is contained in:
@@ -33,9 +33,9 @@ upload_extra:
|
|||||||
|
|
||||||
# Program the device and start it.
|
# Program the device and start it.
|
||||||
load upload program: upload_extra $(OBJDIR)/$(TARGET).elf
|
load upload program: upload_extra $(OBJDIR)/$(TARGET).elf
|
||||||
$(Q)$(DRONE) insmod $(PAPARAZZI_SRC)/sw/ext/ardrone2_drivers/cdc-acm.ko
|
$(Q)$(DRONE) --host=$(HOST) insmod $(PAPARAZZI_SRC)/sw/ext/ardrone2_drivers/cdc-acm.ko
|
||||||
$(Q)$(DRONE) upload_paparazzi $(OBJDIR)/$(TARGET).elf $(SUB_DIR)
|
$(Q)$(DRONE) --host=$(HOST) upload_file_and_run $(OBJDIR)/$(TARGET).elf $(SUB_DIR)
|
||||||
$(Q)$(DRONE) status
|
$(Q)$(DRONE) --host=$(HOST) status
|
||||||
|
|
||||||
|
|
||||||
# Program the device and start it.
|
# Program the device and start it.
|
||||||
|
|||||||
@@ -121,4 +121,5 @@ target CDATA #IMPLIED>
|
|||||||
|
|
||||||
<!ATTLIST load
|
<!ATTLIST load
|
||||||
name CDATA #REQUIRED
|
name CDATA #REQUIRED
|
||||||
target CDATA #IMPLIED>
|
target CDATA #IMPLIED
|
||||||
|
dir CDATA #IMPLIED>
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
<firmware name="test_progs">
|
<firmware name="test_progs">
|
||||||
<target name="test_sys_time_timer" board="lisa_mx_2.0"/>
|
<target name="test_sys_time_timer" board="lisa_mx_2.0"/>
|
||||||
|
<target name="test_adc" board="lisa_mx_2.0"/>
|
||||||
<target name="test_telemetry" board="lisa_mx_2.0"/>
|
<target name="test_telemetry" board="lisa_mx_2.0"/>
|
||||||
<target name="test_radio_control" board="lisa_mx_2.0">
|
<target name="test_radio_control" board="lisa_mx_2.0">
|
||||||
<subsystem name="radio_control" type="spektrum">
|
<subsystem name="radio_control" type="spektrum">
|
||||||
@@ -50,6 +51,8 @@
|
|||||||
</target>
|
</target>
|
||||||
</firmware>
|
</firmware>
|
||||||
|
|
||||||
|
<autopilot name="rotorcraft_autopilot.xml" freq="512"/>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<load name="adc_generic.xml">
|
<load name="adc_generic.xml">
|
||||||
<configure name="ADC_CHANNEL_GENERIC1" value="ADC_1"/>
|
<configure name="ADC_CHANNEL_GENERIC1" value="ADC_1"/>
|
||||||
|
|||||||
@@ -0,0 +1,212 @@
|
|||||||
|
<!DOCTYPE airframe SYSTEM "../airframe.dtd">
|
||||||
|
|
||||||
|
<!-- this is a quadrotor frame in X-configuration equiped with
|
||||||
|
* Autopilot: Navstik http://wiki.paparazziuav.org/wiki/Navstik
|
||||||
|
* IMU: Navstik http://wiki.paparazziuav.org/wiki/Navstik
|
||||||
|
* Actuators: Asctec V2 http://wiki.paparazziuav.org/wiki/Subsystem/actuators#Asctec_v2
|
||||||
|
* GPS: Ublox http://wiki.paparazziuav.org/wiki/Subsystem/gps
|
||||||
|
* RC: one Spektrum sat http://wiki.paparazziuav.org/wiki/Subsystem/radio_control#Spektrum
|
||||||
|
-->
|
||||||
|
|
||||||
|
<airframe name="Quadrotor Navstik">
|
||||||
|
|
||||||
|
<firmware name="rotorcraft">
|
||||||
|
<target name="ap" board="navstik_1.0">
|
||||||
|
<subsystem name="radio_control" type="spektrum"/>
|
||||||
|
<configure name="ACTUATORS_ASCTEC_V2_I2C_DEV" value="i2c3"/>
|
||||||
|
<define name="RADIO_KILL_SWITCH" value="RADIO_GEAR"/>
|
||||||
|
<define name="RADIO_MODE" value="RADIO_AUX1"/>
|
||||||
|
<define name="ACTUATORS_START_DELAY" value="1"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="nps" board="pc">
|
||||||
|
<subsystem name="fdm" type="jsbsim"/>
|
||||||
|
<subsystem name="radio_control" type="ppm"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<subsystem name="motor_mixing"/>
|
||||||
|
<subsystem name="actuators" type="asctec_v2"/>
|
||||||
|
<subsystem name="telemetry" type="xbee_api"/>
|
||||||
|
<subsystem name="imu" type="navstik"/>
|
||||||
|
<subsystem name="gps" type="ublox"/>
|
||||||
|
<subsystem name="stabilization" type="int_quat"/>
|
||||||
|
<subsystem name="ahrs" type="int_cmpl_quat"/>
|
||||||
|
<subsystem name="ins" type="hff"/>
|
||||||
|
</firmware>
|
||||||
|
|
||||||
|
<firmware name="test_progs">
|
||||||
|
<configure name="MODEM_PORT" value="UART1"/>
|
||||||
|
|
||||||
|
<target name="test_sys_time_timer" board="navstik_1.0"/>
|
||||||
|
<target name="test_telemetry" board="navstik_1.0"/>
|
||||||
|
<target name="test_actuators_pwm_sin" board="navstik_1.0"/>
|
||||||
|
</firmware>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<load name="gps_ubx_ucenter.xml"/>
|
||||||
|
<!-- load name="airspeed_ms45xx.xml"/ -->
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
<servos driver="Asctec_v2">
|
||||||
|
<servo name="FRONT" no="0" min="0" neutral="3" max="200"/>
|
||||||
|
<servo name="BACK" no="1" min="0" neutral="3" max="200"/>
|
||||||
|
<servo name="LEFT" no="2" min="0" neutral="3" max="200"/>
|
||||||
|
<servo name="RIGHT" no="3" min="0" neutral="3" max="200"/>
|
||||||
|
</servos>
|
||||||
|
|
||||||
|
<commands>
|
||||||
|
<axis name="ROLL" failsafe_value="0"/>
|
||||||
|
<axis name="PITCH" failsafe_value="0"/>
|
||||||
|
<axis name="YAW" failsafe_value="0"/>
|
||||||
|
<axis name="THRUST" failsafe_value="0"/>
|
||||||
|
</commands>
|
||||||
|
|
||||||
|
<section name="MIXING" prefix="MOTOR_MIXING_">
|
||||||
|
<define name="TRIM_ROLL" value="0"/>
|
||||||
|
<define name="TRIM_PITCH" value="0"/>
|
||||||
|
<define name="TRIM_YAW" value="0"/>
|
||||||
|
<define name="NB_MOTOR" value="4"/>
|
||||||
|
<define name="SCALE" value="256"/>
|
||||||
|
<!-- order (and rotation direction) : NE (CW), SE (CCW), SW (CW), NW (CCW) -->
|
||||||
|
<define name="ROLL_COEF" value="{ -256, -256, 256, 256 }"/>
|
||||||
|
<define name="PITCH_COEF" value="{ 256, -256, -256, 256 }"/>
|
||||||
|
<define name="YAW_COEF" value="{ -256, 256, -256, 256 }"/>
|
||||||
|
<define name="THRUST_COEF" value="{ 256, 256, 256, 256 }"/>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<command_laws>
|
||||||
|
<call fun="motor_mixing_run(autopilot_motors_on,FALSE,values)"/>
|
||||||
|
<set servo="FRONT" value="motor_mixing.commands[0]"/>
|
||||||
|
<set servo="BACK" value="motor_mixing.commands[1]"/>
|
||||||
|
<set servo="LEFT" value="motor_mixing.commands[2]"/>
|
||||||
|
<set servo="RIGHT" value="motor_mixing.commands[3]"/>
|
||||||
|
</command_laws>
|
||||||
|
|
||||||
|
<section name="IMU" prefix="IMU_">
|
||||||
|
<define name="ACCEL_X_NEUTRAL" value="11"/>
|
||||||
|
<define name="ACCEL_Y_NEUTRAL" value="11"/>
|
||||||
|
<define name="ACCEL_Z_NEUTRAL" value="-25"/>
|
||||||
|
|
||||||
|
<!-- replace this with your own calibration -->
|
||||||
|
<define name="MAG_X_NEUTRAL" value="-179"/>
|
||||||
|
<define name="MAG_Y_NEUTRAL" value="-21"/>
|
||||||
|
<define name="MAG_Z_NEUTRAL" value="79"/>
|
||||||
|
<define name="MAG_X_SENS" value="4.17334785618" integer="16"/>
|
||||||
|
<define name="MAG_Y_SENS" value="3.98885954135" integer="16"/>
|
||||||
|
<define name="MAG_Z_SENS" value="4.40442339014" integer="16"/>
|
||||||
|
|
||||||
|
<define name="BODY_TO_IMU_PHI" value="0." unit="deg"/>
|
||||||
|
<define name="BODY_TO_IMU_THETA" value="0." unit="deg"/>
|
||||||
|
<define name="BODY_TO_IMU_PSI" value="0." unit="deg"/>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section name="AHRS" prefix="AHRS_">
|
||||||
|
<define name="H_X" value="0.3770441"/>
|
||||||
|
<define name="H_Y" value="0.0193986"/>
|
||||||
|
<define name="H_Z" value="0.9259921"/>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section name="STABILIZATION_RATE" prefix="STABILIZATION_RATE_">
|
||||||
|
<!-- setpoints -->
|
||||||
|
<define name="SP_MAX_P" value="10000"/>
|
||||||
|
<define name="SP_MAX_Q" value="10000"/>
|
||||||
|
<define name="SP_MAX_R" value="10000"/>
|
||||||
|
<define name="DEADBAND_P" value="20"/>
|
||||||
|
<define name="DEADBAND_Q" value="20"/>
|
||||||
|
<define name="DEADBAND_R" value="200"/>
|
||||||
|
<define name="REF_TAU" value="4"/>
|
||||||
|
|
||||||
|
<!-- feedback -->
|
||||||
|
<define name="GAIN_P" value="400"/>
|
||||||
|
<define name="GAIN_Q" value="400"/>
|
||||||
|
<define name="GAIN_R" value="350"/>
|
||||||
|
|
||||||
|
<define name="IGAIN_P" value="75"/>
|
||||||
|
<define name="IGAIN_Q" value="75"/>
|
||||||
|
<define name="IGAIN_R" value="50"/>
|
||||||
|
|
||||||
|
<!-- feedforward -->
|
||||||
|
<define name="DDGAIN_P" value="300"/>
|
||||||
|
<define name="DDGAIN_Q" value="300"/>
|
||||||
|
<define name="DDGAIN_R" value="300"/>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
<section name="STABILIZATION_ATTITUDE" prefix="STABILIZATION_ATTITUDE_">
|
||||||
|
<!-- setpoints -->
|
||||||
|
<define name="SP_MAX_PHI" value="45." unit="deg"/>
|
||||||
|
<define name="SP_MAX_THETA" value="45." unit="deg"/>
|
||||||
|
<define name="SP_MAX_R" value="90." unit="deg/s"/>
|
||||||
|
<define name="DEADBAND_R" value="250"/>
|
||||||
|
<!-- reference -->
|
||||||
|
<define name="REF_OMEGA_P" value="800" unit="deg/s"/>
|
||||||
|
<define name="REF_ZETA_P" value="0.85"/>
|
||||||
|
<define name="REF_MAX_P" value="300." unit="deg/s"/>
|
||||||
|
<define name="REF_MAX_PDOT" value="RadOfDeg(7000.)"/>
|
||||||
|
<define name="REF_OMEGA_Q" value="800" unit="deg/s"/>
|
||||||
|
<define name="REF_ZETA_Q" value="0.85"/>
|
||||||
|
<define name="REF_MAX_Q" value="300." unit="deg/s"/>
|
||||||
|
<define name="REF_MAX_QDOT" value="RadOfDeg(7000.)"/>
|
||||||
|
<define name="REF_OMEGA_R" value="500" unit="deg/s"/>
|
||||||
|
<define name="REF_ZETA_R" value="0.85"/>
|
||||||
|
<define name="REF_MAX_R" value="180." unit="deg/s"/>
|
||||||
|
<define name="REF_MAX_RDOT" value="RadOfDeg(1800.)"/>
|
||||||
|
<!-- feedback -->
|
||||||
|
<define name="PHI_PGAIN" value="900"/>
|
||||||
|
<define name="PHI_DGAIN" value="200"/>
|
||||||
|
<define name="PHI_IGAIN" value="200"/>
|
||||||
|
<define name="THETA_PGAIN" value="900"/>
|
||||||
|
<define name="THETA_DGAIN" value="200"/>
|
||||||
|
<define name="THETA_IGAIN" value="200"/>
|
||||||
|
<define name="PSI_PGAIN" value="900"/>
|
||||||
|
<define name="PSI_DGAIN" value="200"/>
|
||||||
|
<define name="PSI_IGAIN" value="10"/>
|
||||||
|
<!-- feedforward -->
|
||||||
|
<define name="PHI_DDGAIN" value="75"/>
|
||||||
|
<define name="THETA_DDGAIN" value="75"/>
|
||||||
|
<define name="PSI_DDGAIN" value="75"/>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section name="GUIDANCE_V" prefix="GUIDANCE_V_">
|
||||||
|
<define name="MIN_ERR_Z" value="POS_BFP_OF_REAL(-10.)"/>
|
||||||
|
<define name="MAX_ERR_Z" value="POS_BFP_OF_REAL( 10.)"/>
|
||||||
|
<define name="MIN_ERR_ZD" value="SPEED_BFP_OF_REAL(-10.)"/>
|
||||||
|
<define name="MAX_ERR_ZD" value="SPEED_BFP_OF_REAL( 10.)"/>
|
||||||
|
<define name="MAX_SUM_ERR" value="2000000"/>
|
||||||
|
<define name="HOVER_KP" value="150"/>
|
||||||
|
<define name="HOVER_KD" value="80"/>
|
||||||
|
<define name="HOVER_KI" value="20"/>
|
||||||
|
<define name="NOMINAL_HOVER_THROTTLE" value="0.5"/>
|
||||||
|
<define name="ADAPT_THROTTLE_ENABLED" value="TRUE"/>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section name="GUIDANCE_H" prefix="GUIDANCE_H_">
|
||||||
|
<define name="MAX_BANK" value="20" unit="deg"/>
|
||||||
|
<define name="USE_SPEED_REF" value="TRUE"/>
|
||||||
|
<define name="PGAIN" value="50"/>
|
||||||
|
<define name="DGAIN" value="100"/>
|
||||||
|
<define name="AGAIN" value="100"/>
|
||||||
|
<define name="IGAIN" value="20"/>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section name="SIMULATOR" prefix="NPS_">
|
||||||
|
<define name="ACTUATOR_NAMES" value="{"ne_motor", "se_motor", "sw_motor", "nw_motor"}"/>
|
||||||
|
<define name="JSBSIM_INIT" value=""reset00""/>
|
||||||
|
<define name="JSBSIM_MODEL" value=""simple_x_quad""/>
|
||||||
|
<define name="SENSORS_PARAMS" value=""nps_sensors_params_default.h""/>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section name="AUTOPILOT">
|
||||||
|
<define name="MODE_MANUAL" value="AP_MODE_ATTITUDE_DIRECT"/>
|
||||||
|
<define name="MODE_AUTO1" value="AP_MODE_ATTITUDE_DIRECT"/>
|
||||||
|
<define name="MODE_AUTO2" value="AP_MODE_ATTITUDE_DIRECT"/>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section name="BAT">
|
||||||
|
<define name="CATASTROPHIC_BAT_LEVEL" value="9.3" unit="V"/>
|
||||||
|
<define name="CRITIC_BAT_LEVEL" value="9.6" unit="V"/>
|
||||||
|
<define name="LOW_BAT_LEVEL" value="10.1" unit="V"/>
|
||||||
|
<define name="MAX_BAT_LEVEL" value="12.4" unit="V"/>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
</airframe>
|
||||||
@@ -1,17 +1,22 @@
|
|||||||
<!DOCTYPE autopilot SYSTEM "autopilot.dtd">
|
<!DOCTYPE autopilot SYSTEM "autopilot.dtd">
|
||||||
|
|
||||||
<autopilot name="Booz Quadrotor Autopilot (Basic version)">
|
<autopilot name="Quadrotor Autopilot (Basic version)">
|
||||||
|
|
||||||
|
<control_block name="set_actuators">
|
||||||
|
<call fun="SetRotorcraftCommands(stabilization_cmd, autopilot_in_flight, autopilot_motors_on)"/>
|
||||||
|
<call fun="SetActuatorsFromCommands(commands, autopilot_mode)"/>
|
||||||
|
</control_block>
|
||||||
|
|
||||||
<control_block name="attitude_loop">
|
<control_block name="attitude_loop">
|
||||||
<call fun="SetAttitudeFromRC(rc_values)"/>
|
<call fun="SetAttitudeFromRC(rc_values)"/>
|
||||||
<call fun="AddAttitudeFromFMS()" cond="fms.enabled"/>
|
<call fun="AddAttitudeFromFMS()" cond="fms.enabled"/>
|
||||||
<call fun="booz_stabilization_attitude_run(booz2_autopilot_in_flight)"/>
|
<call fun="stabilization_attitude_run(autopilot_in_flight)"/>
|
||||||
</control_block>
|
</control_block>
|
||||||
|
|
||||||
<control_block name="altitude_loop">
|
<control_block name="altitude_loop">
|
||||||
<call fun="SetAltitudeFromFMS()" cond="fms.enabled"/>
|
<call fun="SetAltitudeFromFMS()" cond="fms.enabled"/>
|
||||||
<call fun="b2_gv_update_ref_from_z_sp(booz2_guidance_v_z_sp)"/>
|
<call fun="gv_update_ref_from_z_sp(guidance_v_z_sp)"/>
|
||||||
<call fun="run_hover_loop(booz2_autopilot_in_flight)"/>
|
<call fun="run_hover_loop(autopilot_in_flight)"/>
|
||||||
<call fun="SaturateThrottle(rc_values)"/>
|
<call fun="SaturateThrottle(rc_values)"/>
|
||||||
</control_block>
|
</control_block>
|
||||||
|
|
||||||
@@ -19,28 +24,28 @@
|
|||||||
<exception cond="too_far_from_home" deroute="HOME"/>
|
<exception cond="too_far_from_home" deroute="HOME"/>
|
||||||
</exceptions>
|
</exceptions>
|
||||||
|
|
||||||
<mode name="ATTITUDE" start="booz_stabilization_attitude_enter()">
|
<mode name="ATTITUDE" start="stabilization_attitude_enter()">
|
||||||
<select cond="$DEFAULT_MODE"/>
|
<select cond="$DEFAULT_MODE"/>
|
||||||
<select cond="RCMode0()"/>
|
<select cond="RCMode0()"/>
|
||||||
<control freq="512">
|
<control freq="512">
|
||||||
<call_block name="attitude_loop"/>
|
<call_block name="attitude_loop"/>
|
||||||
<call fun="SetThrottleFromRC(rc_values)"/>
|
<call fun="SetThrottleFromRC(rc_values)"/>
|
||||||
<call fun="actuators_set(booz2_autopilot_motors_on)"/>
|
<call_block name="set_actuators"/>
|
||||||
</control>
|
</control>
|
||||||
<exception cond="RCLost()" deroute="FAILSAFE"/>
|
<exception cond="RCLost()" deroute="FAILSAFE"/>
|
||||||
</mode>
|
</mode>
|
||||||
|
|
||||||
<mode name="VERTICAL" start="booz_stabilization_attitude_enter()|booz_guidance_v_enter()">
|
<mode name="VERTICAL" start="stabilization_attitude_enter()|guidance_v_enter()">
|
||||||
<select cond="RCMode1()"/>
|
<select cond="RCMode1()"/>
|
||||||
<control freq="512">
|
<control freq="512">
|
||||||
<call_block name="attitude_loop"/>
|
<call_block name="attitude_loop"/>
|
||||||
<call_block name="altitude_loop"/>
|
<call_block name="altitude_loop"/>
|
||||||
<call fun="actuators_set(booz2_autopilot_motors_on)"/>
|
<call_block name="set_actuators"/>
|
||||||
</control>
|
</control>
|
||||||
<exception cond="RCLost()" deroute="FAILSAFE"/>
|
<exception cond="RCLost()" deroute="FAILSAFE"/>
|
||||||
</mode>
|
</mode>
|
||||||
|
|
||||||
<mode name="NAV" start="booz_guidance_h_nav_enter()|booz_guidance_v_enter()">
|
<mode name="NAV" start="guidance_h_nav_enter()|guidance_v_enter()">
|
||||||
<select cond="RCMode2()" exception="HOME"/>
|
<select cond="RCMode2()" exception="HOME"/>
|
||||||
<select cond="RCMode2() && DLModeNav()"/>
|
<select cond="RCMode2() && DLModeNav()"/>
|
||||||
<control freq="32">
|
<control freq="32">
|
||||||
@@ -51,15 +56,14 @@
|
|||||||
<call fun="GuidanceNavHorizontal()"/>
|
<call fun="GuidanceNavHorizontal()"/>
|
||||||
<call fun="GuidanceNavVertical()"/>
|
<call fun="GuidanceNavVertical()"/>
|
||||||
<call fun="AddAttitudeFromRC(rc_values)" cond="!RCLost()"/>
|
<call fun="AddAttitudeFromRC(rc_values)" cond="!RCLost()"/>
|
||||||
<call fun="booz_stabilization_attitude_run(booz2_autopilot_in_flight)"/>
|
<call fun="stabilization_attitude_run(autopilot_in_flight)"/>
|
||||||
<call fun="SaturateThrottle(rc_values)" cond="!RCLost()"/>
|
<call fun="SaturateThrottle(rc_values)" cond="!RCLost()"/>
|
||||||
<call fun="actuators_set(booz2_autopilot_motors_on)"/>
|
<call_block name="set_actuators"/>
|
||||||
<call_block name="actuators_ap"/>
|
|
||||||
</control>
|
</control>
|
||||||
<exception cond="GPSLost()" deroute="FAILSAFE"/>
|
<exception cond="GPSLost()" deroute="FAILSAFE"/>
|
||||||
</mode>
|
</mode>
|
||||||
|
|
||||||
<mode name="HOME" start="booz_guidance_h_nav_enter()|booz_guidance_v_enter()">
|
<mode name="HOME" start="guidance_h_nav_enter()|guidance_v_enter()">
|
||||||
<control freq="32">
|
<control freq="32">
|
||||||
<call fun="nav_home()"/>
|
<call fun="nav_home()"/>
|
||||||
</control>
|
</control>
|
||||||
@@ -67,20 +71,20 @@
|
|||||||
<call fun="SetCommandFromAP()"/>
|
<call fun="SetCommandFromAP()"/>
|
||||||
<call fun="GuidanceNavHorizontal()"/>
|
<call fun="GuidanceNavHorizontal()"/>
|
||||||
<call fun="GuidanceNavVertical()"/>
|
<call fun="GuidanceNavVertical()"/>
|
||||||
<call fun="booz_stabilization_attitude_run(booz2_autopilot_in_flight)"/>
|
<call fun="stabilization_attitude_run(autopilot_in_flight)"/>
|
||||||
<call fun="actuators_set(booz2_autopilot_motors_on)"/>
|
<call_block name="set_actuators"/>
|
||||||
</control>
|
</control>
|
||||||
<exception cond="GPSLost()" deroute="FAILSAFE"/>
|
<exception cond="GPSLost()" deroute="FAILSAFE"/>
|
||||||
</mode>
|
</mode>
|
||||||
|
|
||||||
<!-- Safe landing -->
|
<!-- Safe landing -->
|
||||||
<mode name="FAILSAFE" start="failsafe_enter()|booz_stabilization_attitude_enter()|booz_guidance_v_enter()" stop="failsafe_exit()">
|
<mode name="FAILSAFE" start="stabilization_attitude_set_failsafe_setpoint()|guidance_v_mode_changed(GUIDANCE_V_MODE_CLIMB)|guidance_v_zd_sp = SPEED_BFP_OF_REAL(FAILSAFE_DESCENT_SPEED)">
|
||||||
<control freq="512">
|
<control freq="512">
|
||||||
<call fun="SetFailsafeCommand()"/>
|
<call fun="SetFailsafeCommand()"/>
|
||||||
<call fun="booz_stabilization_attitude_run(booz2_autopilot_in_flight)"/>
|
<call fun="stabilization_attitude_run(autopilot_in_flight)"/>
|
||||||
<call fun="b2_gv_update_ref_from_zd_sp(booz2_guidance_v_zd_sp)"/>
|
<call fun="gv_update_ref_from_zd_sp(guidance_v_zd_sp)"/>
|
||||||
<call fun="run_hover_loop(booz2_autopilot_in_flight)"/>
|
<call fun="run_hover_loop(autopilot_in_flight)"/>
|
||||||
<call fun="actuators_set(booz2_autopilot_motors_on)"/>
|
<call fun="actuators_set(autopilot_motors_on)"/>
|
||||||
</control>
|
</control>
|
||||||
<exception cond="!GPSLost()" deroute="$LAST_MODE"/>
|
<exception cond="!GPSLost()" deroute="$LAST_MODE"/>
|
||||||
</mode>
|
</mode>
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
# Hey Emacs, this is a -*- makefile -*-
|
||||||
|
#
|
||||||
|
# navstik_1.0.makefile
|
||||||
|
#
|
||||||
|
# http://paparazzi.enac.fr/wiki/Navstik
|
||||||
|
#
|
||||||
|
|
||||||
|
BOARD=navstik
|
||||||
|
BOARD_VERSION=1.0
|
||||||
|
BOARD_CFG=\"boards/$(BOARD)_$(BOARD_VERSION).h\"
|
||||||
|
|
||||||
|
ARCH=stm32
|
||||||
|
ARCH_L=f4
|
||||||
|
HARD_FLOAT=yes
|
||||||
|
$(TARGET).ARCHDIR = $(ARCH)
|
||||||
|
$(TARGET).OOCD_INTERFACE=ftdi/ivygs
|
||||||
|
$(TARGET).OOCD_BOARD=navstik
|
||||||
|
$(TARGET).LDSCRIPT=$(SRC_ARCH)/navstik.ld
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# default flash mode is via usb dfu bootloader
|
||||||
|
# other possibilities: DFU-UTIL, JTAG
|
||||||
|
FLASH_MODE ?= JTAG
|
||||||
|
|
||||||
|
#
|
||||||
|
# default LED configuration
|
||||||
|
#
|
||||||
|
RADIO_CONTROL_LED ?= none
|
||||||
|
BARO_LED ?= none
|
||||||
|
AHRS_ALIGNER_LED ?= 2
|
||||||
|
GPS_LED ?= none
|
||||||
|
SYS_TIME_LED ?= 1
|
||||||
|
|
||||||
|
#
|
||||||
|
# default uart configuration
|
||||||
|
#
|
||||||
|
RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT ?= UART6
|
||||||
|
|
||||||
|
MODEM_PORT ?= UART5
|
||||||
|
MODEM_BAUD ?= B57600
|
||||||
|
|
||||||
|
GPS_PORT ?= UART2
|
||||||
|
GPS_BAUD ?= B57600
|
||||||
|
|
||||||
|
#
|
||||||
|
# default actuator configuration
|
||||||
|
#
|
||||||
|
# you can use different actuators by adding a configure option to your firmware section
|
||||||
|
# e.g. <configure name="ACTUATORS" value="actuators_ppm/>
|
||||||
|
# and by setting the correct "driver" attribute in servo section
|
||||||
|
# e.g. <servo driver="Ppm">
|
||||||
|
#
|
||||||
|
ACTUATORS ?= actuators_pwm
|
||||||
@@ -109,6 +109,16 @@
|
|||||||
settings=" settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_att_int.xml settings/modules/rotorcraft_cam.xml settings/modules/servo_switch.xml"
|
settings=" settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_att_int.xml settings/modules/rotorcraft_cam.xml settings/modules/servo_switch.xml"
|
||||||
gui_color="white"
|
gui_color="white"
|
||||||
/>
|
/>
|
||||||
|
<aircraft
|
||||||
|
name="Quad_Navstik"
|
||||||
|
ac_id="180"
|
||||||
|
airframe="airframes/examples/quadrotor_navstik.xml"
|
||||||
|
radio="radios/cockpitSX.xml"
|
||||||
|
telemetry="telemetry/default_rotorcraft.xml"
|
||||||
|
flight_plan="flight_plans/rotorcraft_basic.xml"
|
||||||
|
settings=" settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_att_int.xml settings/control/stabilization_rate.xml settings/estimation/ahrs_int_cmpl_quat.xml"
|
||||||
|
gui_color="#710080"
|
||||||
|
/>
|
||||||
<aircraft
|
<aircraft
|
||||||
name="Twinjet"
|
name="Twinjet"
|
||||||
ac_id="6"
|
ac_id="6"
|
||||||
|
|||||||
@@ -189,6 +189,16 @@
|
|||||||
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_att_int.xml settings/control/stabilization_rate.xml"
|
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_att_int.xml settings/control/stabilization_rate.xml"
|
||||||
gui_color="white"
|
gui_color="white"
|
||||||
/>
|
/>
|
||||||
|
<aircraft
|
||||||
|
name="Quad_Navstik"
|
||||||
|
ac_id="180"
|
||||||
|
airframe="airframes/examples/quadrotor_navstik.xml"
|
||||||
|
radio="radios/cockpitSX.xml"
|
||||||
|
telemetry="telemetry/default_rotorcraft.xml"
|
||||||
|
flight_plan="flight_plans/rotorcraft_basic.xml"
|
||||||
|
settings=" settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_att_int.xml settings/control/stabilization_rate.xml settings/estimation/ahrs_int_cmpl_quat.xml"
|
||||||
|
gui_color="#710080"
|
||||||
|
/>
|
||||||
<aircraft
|
<aircraft
|
||||||
name="Quad_NavGo"
|
name="Quad_NavGo"
|
||||||
ac_id="151"
|
ac_id="151"
|
||||||
|
|||||||
@@ -18,6 +18,13 @@ else ifeq ($(BOARD), lisa_l)
|
|||||||
BARO_BOARD_CFLAGS += -DUSE_I2C2
|
BARO_BOARD_CFLAGS += -DUSE_I2C2
|
||||||
BARO_BOARD_SRCS += $(SRC_BOARD)/baro_board.c
|
BARO_BOARD_SRCS += $(SRC_BOARD)/baro_board.c
|
||||||
|
|
||||||
|
# Navstik baro
|
||||||
|
else ifeq ($(BOARD), navstik)
|
||||||
|
BARO_BOARD_CFLAGS += -DUSE_I2C3
|
||||||
|
BARO_BOARD_CFLAGS += -DBARO_BOARD=BARO_BOARD_BMP085
|
||||||
|
BARO_BOARD_SRCS += peripherals/bmp085.c
|
||||||
|
BARO_BOARD_SRCS += $(SRC_BOARD)/baro_board.c
|
||||||
|
|
||||||
# Ardrone baro
|
# Ardrone baro
|
||||||
else ifeq ($(BOARD)$(BOARD_TYPE), ardroneraw)
|
else ifeq ($(BOARD)$(BOARD_TYPE), ardroneraw)
|
||||||
BARO_BOARD_SRCS += $(SRC_BOARD)/baro_board.c
|
BARO_BOARD_SRCS += $(SRC_BOARD)/baro_board.c
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
# Hey Emacs, this is a -*- makefile -*-
|
||||||
|
#
|
||||||
|
# Navstik onboard IMU
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# if ACCEL and GYRO SENS/NEUTRAL are not defined,
|
||||||
|
# the defaults from the datasheet will be used
|
||||||
|
#
|
||||||
|
# required xml:
|
||||||
|
# <section name="IMU" prefix="IMU_">
|
||||||
|
#
|
||||||
|
# <define name="MAG_X_NEUTRAL" value="2358"/>
|
||||||
|
# <define name="MAG_Y_NEUTRAL" value="2362"/>
|
||||||
|
# <define name="MAG_Z_NEUTRAL" value="2119"/>
|
||||||
|
#
|
||||||
|
# <define name="MAG_X_SENS" value="3.4936416" integer="16"/>
|
||||||
|
# <define name="MAG_Y_SENS" value="3.607713" integer="16"/>
|
||||||
|
# <define name="MAG_Z_SENS" value="4.90788848" integer="16"/>
|
||||||
|
#
|
||||||
|
# </section>
|
||||||
|
#
|
||||||
|
|
||||||
|
IMU_CFLAGS = -DUSE_IMU -DIMU_NAVSTIK -DIMU_TYPE_H=\"imu/imu_navstik.h\"
|
||||||
|
IMU_SRCS = $(SRC_SUBSYSTEMS)/imu.c $(SRC_SUBSYSTEMS)/imu/imu_navstik.c
|
||||||
|
IMU_SRCS += peripherals/hmc58xx.c
|
||||||
|
IMU_SRCS += peripherals/mpu60x0.c peripherals/mpu60x0_i2c.c
|
||||||
|
|
||||||
|
|
||||||
|
NAVSTIK_MAG_I2C_DEV ?= i2c3
|
||||||
|
NAVSTIK_MPU_I2C_DEV ?= i2c1
|
||||||
|
|
||||||
|
NAVSTIK_MAG_I2C_DEV_UPPER=$(shell echo $(NAVSTIK_MAG_I2C_DEV) | tr a-z A-Z)
|
||||||
|
NAVSTIK_MAG_I2C_DEV_LOWER=$(shell echo $(NAVSTIK_MAG_I2C_DEV) | tr A-Z a-z)
|
||||||
|
NAVSTIK_MPU_I2C_DEV_UPPER=$(shell echo $(NAVSTIK_MPU_I2C_DEV) | tr a-z A-Z)
|
||||||
|
NAVSTIK_MPU_I2C_DEV_LOWER=$(shell echo $(NAVSTIK_MPU_I2C_DEV) | tr A-Z a-z)
|
||||||
|
|
||||||
|
IMU_CFLAGS += -DNAVSTIK_MAG_I2C_DEV=$(NAVSTIK_MAG_I2C_DEV_LOWER) -DNAVSTIK_MPU_I2C_DEV=$(NAVSTIK_MPU_I2C_DEV_LOWER)
|
||||||
|
IMU_CFLAGS += -DUSE_$(NAVSTIK_MAG_I2C_DEV_UPPER)=1 -DUSE_$(NAVSTIK_MPU_I2C_DEV_UPPER)=1
|
||||||
|
|
||||||
|
ap.CFLAGS += $(IMU_CFLAGS)
|
||||||
|
ap.srcs += $(IMU_SRCS)
|
||||||
|
|
||||||
|
test_imu.CFLAGS += $(IMU_CFLAGS)
|
||||||
|
test_imu.srcs += $(IMU_SRCS)
|
||||||
|
|
||||||
|
#
|
||||||
|
# NPS simulator
|
||||||
|
#
|
||||||
|
include $(CFG_SHARED)/imu_nps.makefile
|
||||||
@@ -86,6 +86,9 @@ ifeq ($(BOARD_VERSION), 2.0)
|
|||||||
LED_DEFINES = -DLED_BLUE=3 -DLED_RED=4 -DLED_GREEN=5
|
LED_DEFINES = -DLED_BLUE=3 -DLED_RED=4 -DLED_GREEN=5
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(BOARD), navstik)
|
||||||
|
LED_DEFINES = -DLED_RED=1 -DLED_GREEN=2
|
||||||
|
endif
|
||||||
LED_DEFINES ?= -DLED_RED=2 -DLED_GREEN=3
|
LED_DEFINES ?= -DLED_RED=2 -DLED_GREEN=3
|
||||||
|
|
||||||
test_sys_time_timer.ARCHDIR = $(ARCH)
|
test_sys_time_timer.ARCHDIR = $(ARCH)
|
||||||
|
|||||||
@@ -53,6 +53,7 @@
|
|||||||
<board name="apogee_.*"/>
|
<board name="apogee_.*"/>
|
||||||
<board name="stm32f4_discovery"/>
|
<board name="stm32f4_discovery"/>
|
||||||
<board name="li[s]?a_mx_.*"/>
|
<board name="li[s]?a_mx_.*"/>
|
||||||
|
<board name="navstik_.*"/>
|
||||||
</boards>
|
</boards>
|
||||||
</mode>
|
</mode>
|
||||||
<mode name="STLink (SWD)">
|
<mode name="STLink (SWD)">
|
||||||
@@ -88,6 +89,7 @@
|
|||||||
<boards>
|
<boards>
|
||||||
<board name="krooz_sd"/>
|
<board name="krooz_sd"/>
|
||||||
<board name="li[s]?a_[lm]?_.*"/>
|
<board name="li[s]?a_[lm]?_.*"/>
|
||||||
|
<board name="navstik_.*"/>
|
||||||
</boards>
|
</boards>
|
||||||
</mode>
|
</mode>
|
||||||
</flash_modes>
|
</flash_modes>
|
||||||
|
|||||||
+16
-16
@@ -33,26 +33,26 @@
|
|||||||
</block>
|
</block>
|
||||||
|
|
||||||
<block name="Preset cubical lines" strip_button="CubeInit">
|
<block name="Preset cubical lines" strip_button="CubeInit">
|
||||||
<set var="cube_sect" value="1"/>
|
<set var="nav_cube.sect" value="1"/>
|
||||||
<set var="cube_nsect_x" value="3"/>
|
<set var="nav_cube.nsect_x" value="3"/>
|
||||||
<set var="cube_nsect_z" value="2"/>
|
<set var="nav_cube.nsect_z" value="2"/>
|
||||||
<set var="cube_alpha" value="60"/>
|
<set var="nav_cube.alpha" value="60"/>
|
||||||
<set var="cube_size_x" value="70"/>
|
<set var="nav_cube.size.x" value="70"/>
|
||||||
<set var="cube_size_y" value="50"/>
|
<set var="nav_cube.size.y" value="50"/>
|
||||||
<set var="cube_size_z" value="40"/>
|
<set var="nav_cube.size.z" value="40"/>
|
||||||
<set var="cube_grid_x" value="10"/>
|
<set var="nav_cube.grid_x" value="10"/>
|
||||||
<set var="cube_grid_z" value="10"/>
|
<set var="nav_cube.grid_z" value="10"/>
|
||||||
<set var="cube_offs_x" value="0"/>
|
<set var="nav_cube.offset.x" value="0"/>
|
||||||
<set var="cube_offs_y" value="30"/>
|
<set var="nav_cube.offset.y" value="30"/>
|
||||||
<set var="cube_offs_z" value="10"/>
|
<set var="nav_cube.offset.z" value="10"/>
|
||||||
<deroute block="Fly lines in cubical"/>
|
<deroute block="Fly lines in cubical"/>
|
||||||
</block>
|
</block>
|
||||||
|
|
||||||
<block name="Fly lines in cubical" strip_button="Cube">
|
<block name="Fly lines in cubical" strip_button="Cube">
|
||||||
<call fun="nav_cube_init(WP_CENTER, WP_B0, WP_E0)"/>
|
<call fun="nav_cube_setup(WP_CENTER, WP_B0, WP_E0)"/>
|
||||||
<for from="0" to="cube_nline_z" var="j">
|
<for from="0" to="nav_cube.nline_z" var="j">
|
||||||
<for from="0" to="cube_nline_x" var="i">
|
<for from="0" to="nav_cube.nline_x" var="i">
|
||||||
<call fun="nav_cube(_var_j, _var_i, WP__B, WP__E, WP_B0, WP_E0)"/>
|
<call fun="nav_cube_run(_var_j, _var_i, WP__B, WP__E, WP_B0, WP_E0)"/>
|
||||||
<oval p1="_B" p2="_E" radius="-nav_radius" until="(oval_status == OC1)"/>
|
<oval p1="_B" p2="_E" radius="-nav_radius" until="(oval_status == OC1)"/>
|
||||||
<go approaching_time="0" from="_B" hmode="route" wp="_E"/>
|
<go approaching_time="0" from="_B" hmode="route" wp="_E"/>
|
||||||
</for>
|
</for>
|
||||||
|
|||||||
+5
-5
@@ -215,7 +215,7 @@
|
|||||||
<field name="msg" type="uint8[]"/>
|
<field name="msg" type="uint8[]"/>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
<message name="SURVEY" ID="27">
|
<message name="SURVEY" id="27">
|
||||||
<field name="east" type="float" unit="m"/>
|
<field name="east" type="float" unit="m"/>
|
||||||
<field name="north" type="float" unit="m"/>
|
<field name="north" type="float" unit="m"/>
|
||||||
<field name="west" type="float" unit="m"/>
|
<field name="west" type="float" unit="m"/>
|
||||||
@@ -916,7 +916,7 @@
|
|||||||
<field name="itow" type="uint32" unit="ms"/>
|
<field name="itow" type="uint32" unit="ms"/>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
<message name="TEST_BOARD_RESULTS" ID="111">
|
<message name="TEST_BOARD_RESULTS" id="111">
|
||||||
<field name="uart" type="uint8"/>
|
<field name="uart" type="uint8"/>
|
||||||
<field name="ppm" type="uint8"/>
|
<field name="ppm" type="uint8"/>
|
||||||
<field name="servo" type="uint16[]"/>
|
<field name="servo" type="uint16[]"/>
|
||||||
@@ -996,7 +996,7 @@
|
|||||||
<field name="dn_t9" type="uint16"/>
|
<field name="dn_t9" type="uint16"/>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
<message name="TCAS_TA" ID="120">
|
<message name="TCAS_TA" id="120">
|
||||||
<field name="ac_id" type="uint8"/>
|
<field name="ac_id" type="uint8"/>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
@@ -1005,7 +1005,7 @@
|
|||||||
<field name="resolve" type="uint8" values="NONE|LEVEL|CLIMB|DESCEND"/>
|
<field name="resolve" type="uint8" values="NONE|LEVEL|CLIMB|DESCEND"/>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
<message name="TCAS_RESOLVED" ID="122">
|
<message name="TCAS_RESOLVED" id="122">
|
||||||
<field name="ac_id" type="uint8"/>
|
<field name="ac_id" type="uint8"/>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
@@ -1973,7 +1973,7 @@
|
|||||||
<field name="rc_status" type="uint8" values="OK|LOST|REALLY_LOST"/>
|
<field name="rc_status" type="uint8" values="OK|LOST|REALLY_LOST"/>
|
||||||
<field name="frame_rate" type="uint8" unit="Hz"/>
|
<field name="frame_rate" type="uint8" unit="Hz"/>
|
||||||
<field name="gps_status" type="uint8" values="NO_FIX|NA|NA|3Dfix"/>
|
<field name="gps_status" type="uint8" values="NO_FIX|NA|NA|3Dfix"/>
|
||||||
<field name="ap_mode" type="uint8" values="KILL|FAILSAFE|HOME|RATE_DIRECT|ATTITUDE_DIRECT|RATE_RC_CLIMB|ATTITUDE_RC_CLIMB|ATTITUDE_CLIMB|RATE_Z_HOLD|ATTITUDE_Z_HOLD|HOVER_DIRECT|HOVER_CLIMB|HOVER_Z_HOLD|NAV|RC_DIRECT|CARE_FREE"/>
|
<field name="ap_mode" type="uint8" values="KILL|FAILSAFE|HOME|RATE_DIRECT|ATTITUDE_DIRECT|RATE_RC_CLIMB|ATTITUDE_RC_CLIMB|ATTITUDE_CLIMB|RATE_Z_HOLD|ATTITUDE_Z_HOLD|HOVER_DIRECT|HOVER_CLIMB|HOVER_Z_HOLD|NAV|RC_DIRECT|CARE_FREE|FORWARD"/>
|
||||||
<field name="ap_in_flight" type="uint8" values="ON_GROUND|IN_FLIGHT"/>
|
<field name="ap_in_flight" type="uint8" values="ON_GROUND|IN_FLIGHT"/>
|
||||||
<field name="ap_motors_on" type="uint8" values="MOTORS_OFF|MOTORS_ON"/>
|
<field name="ap_motors_on" type="uint8" values="MOTORS_OFF|MOTORS_ON"/>
|
||||||
<field name="ap_h_mode" type="uint8" values="KILL|RATE|ATTITUDE|HOVER|NAV|CF"/>
|
<field name="ap_h_mode" type="uint8" values="KILL|RATE|ATTITUDE|HOVER|NAV|CF"/>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,50 @@
|
|||||||
|
<!DOCTYPE module SYSTEM "module.dtd">
|
||||||
|
|
||||||
|
<module name="mf_ptu" dir="meteo">
|
||||||
|
<doc>
|
||||||
|
<description>
|
||||||
|
PTU board from Meteo France (pressure, temperature, humidity).
|
||||||
|
|
||||||
|
Raw meteo data:
|
||||||
|
- Pressure in ADC
|
||||||
|
- Temperature in ADC
|
||||||
|
- Humidity in micro-seconds (period of the input signal)
|
||||||
|
|
||||||
|
When using SEND_PTU flag, scaled pressure, temperature and humidity data are sent over telemetry with the PAYLOAD_FLOAT message (array of float).
|
||||||
|
If scale factors and offset are not specified, raw values are sent (scale=1.0, offset=0).
|
||||||
|
|
||||||
|
When using LOG_PTU flag, raw pressure, temperature and humidity data are stored with raw gps data (position, speed, time, status).
|
||||||
|
Field names and units are in the first line of the log file.
|
||||||
|
</description>
|
||||||
|
<configure name="ADC_PRESSURE" value="ADC_X" description="Select ADC channel for pressure sensor"/>
|
||||||
|
<configure name="ADC_TEMPERATURE" value="ADC_X" description="Select ADC channel for temperature sensor"/>
|
||||||
|
<configure name="PWM_INPUT_HUMIDITY" value="PWM_INPUTX" description="Select PWM input channel for humidity sensor"/>
|
||||||
|
<section name="MF_PTU">
|
||||||
|
<define name="PTU_POWER_GPIO" value="GPIOX,GPIOYY" description="If defined, enable power by setting the specified GPIO to 1 at starup"/>
|
||||||
|
<define name="PTU_PRESSURE_OFFSET" value="0" description="Offset in ADC of the pressure sensor"/>
|
||||||
|
<define name="PTU_PRESSURE_SCALE" value="1." description="Scale factor of the pressure sensor"/>
|
||||||
|
<define name="PTU_TEMPERATURE_OFFSET" value="0" description="Offset in ADC of the temperature sensor"/>
|
||||||
|
<define name="PTU_TEMPERATURE_SCALE" value="1." description="Scale factor of the temperature sensor"/>
|
||||||
|
<define name="PTU_HUMIDITY_OFFSET" value="0" description="Offset in micro seconds of the humidity sensor"/>
|
||||||
|
<define name="PTU_HUMIDITY_SCALE" value="1." description="Scale factor of the pressure sensor"/>
|
||||||
|
<define name="LOG_PTU" value="TRUE|FALSE" description="Log data on SD card (ascii format, raw PTU data + GPS data)"/>
|
||||||
|
<define name="SEND_PTU" value="TRU|FALSE" description="Send data over telemetry (PAYLOAD_FLOAT message, scaled PTU data)"/>
|
||||||
|
</section>
|
||||||
|
</doc>
|
||||||
|
<depend require="pwm_meas"/>
|
||||||
|
<header>
|
||||||
|
<file name="mf_ptu.h"/>
|
||||||
|
</header>
|
||||||
|
<init fun="mf_ptu_init()"/>
|
||||||
|
<periodic fun="mf_ptu_periodic()" freq="10" autorun="TRUE"/>
|
||||||
|
<makefile target="ap">
|
||||||
|
<file name="mf_ptu.c"/>
|
||||||
|
<define name="ADC_CHANNEL_PRESSURE" value="$(ADC_PRESSURE)"/>
|
||||||
|
<define name="USE_$(ADC_PRESSURE)"/>
|
||||||
|
<define name="ADC_CHANNEL_TEMPERATURE" value="$(ADC_TEMPERATURE)"/>
|
||||||
|
<define name="USE_$(ADC_TEMPERATURE)"/>
|
||||||
|
<define name="PWM_INPUT_CHANNEL_HUMIDITY" value="$(PWM_INPUT_HUMIDITY)"/>
|
||||||
|
<define name="USE_$(PWM_INPUT_HUMIDITY)" value="PWM_PULSE_TYPE_ACTIVE_LOW"/>
|
||||||
|
</makefile>
|
||||||
|
</module>
|
||||||
|
|
||||||
@@ -9,11 +9,12 @@
|
|||||||
<!ELEMENT event (handler*)>
|
<!ELEMENT event (handler*)>
|
||||||
<!ELEMENT handler EMPTY>
|
<!ELEMENT handler EMPTY>
|
||||||
<!ELEMENT datalink EMPTY>
|
<!ELEMENT datalink EMPTY>
|
||||||
<!ELEMENT makefile (configure|define|file|file_arch|raw)*>
|
<!ELEMENT makefile (configure|define|flag|file|file_arch|raw)*>
|
||||||
<!ELEMENT section (define|configure)*>
|
<!ELEMENT section (define|configure)*>
|
||||||
<!ELEMENT description (#PCDATA)>
|
<!ELEMENT description (#PCDATA)>
|
||||||
<!ELEMENT configure EMPTY>
|
<!ELEMENT configure EMPTY>
|
||||||
<!ELEMENT define EMPTY>
|
<!ELEMENT define EMPTY>
|
||||||
|
<!ELEMENT flag EMPTY>
|
||||||
<!ELEMENT file EMPTY>
|
<!ELEMENT file EMPTY>
|
||||||
<!ELEMENT file_arch EMPTY>
|
<!ELEMENT file_arch EMPTY>
|
||||||
<!ELEMENT raw (#PCDATA)>
|
<!ELEMENT raw (#PCDATA)>
|
||||||
@@ -69,6 +70,10 @@ unit CDATA #IMPLIED
|
|||||||
type CDATA #IMPLIED
|
type CDATA #IMPLIED
|
||||||
description CDATA #IMPLIED>
|
description CDATA #IMPLIED>
|
||||||
|
|
||||||
|
<!ATTLIST flag
|
||||||
|
name CDATA #REQUIRED
|
||||||
|
value CDATA #REQUIRED>
|
||||||
|
|
||||||
<!ATTLIST file
|
<!ATTLIST file
|
||||||
name CDATA #REQUIRED
|
name CDATA #REQUIRED
|
||||||
dir CDATA #IMPLIED>
|
dir CDATA #IMPLIED>
|
||||||
|
|||||||
@@ -11,8 +11,12 @@
|
|||||||
- INPUT CAPTURE CAP0.3 on P0.29 (TWOG ADC5, 5V to 3.3V voltage divider)
|
- INPUT CAPTURE CAP0.3 on P0.29 (TWOG ADC5, 5V to 3.3V voltage divider)
|
||||||
- INPUT CAPTURE CAP0.0 on P0.30 (TWOG ADC4, no voltage divider)
|
- INPUT CAPTURE CAP0.0 on P0.30 (TWOG ADC4, no voltage divider)
|
||||||
|
|
||||||
Currently only available on LPC21xx arch
|
For STM32:
|
||||||
|
- each board (or airframe file) has to define the PWM input pin and parameters
|
||||||
|
- example can be found in sw/airborne/boards/apogee_1.0.h board file
|
||||||
</description>
|
</description>
|
||||||
|
<define name="USE_PWM_INPUT1" value="PWM_PULSE_TYPE_ACTIVE_LOW|PWM_PULSE_TYPE_ACTIVE_HIGH" description="Activate PWM input 1 and select polarity"/>
|
||||||
|
<define name="USE_PWM_INPUT2" value="PWM_PULSE_TYPE_ACTIVE_LOW|PWM_PULSE_TYPE_ACTIVE_HIGH" description="Activate PWM input 2 and select polarity"/>
|
||||||
</doc>
|
</doc>
|
||||||
<header>
|
<header>
|
||||||
<file name="pwm_meas.h"/>
|
<file name="pwm_meas.h"/>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<settings>
|
<settings>
|
||||||
<dl_settings>
|
<dl_settings>
|
||||||
<dl_settings NAME="invariant">
|
<dl_settings NAME="invariant">
|
||||||
|
<dl_setting MAX="1" MIN="1" STEP="1" VAR="ins_impl.reset" shortname="reset"/>
|
||||||
<dl_setting MAX="10" MIN="0." STEP="0.001" VAR="ins_impl.gains.lv" shortname="lv" module="subsystems/ins/ins_float_invariant"/>
|
<dl_setting MAX="10" MIN="0." STEP="0.001" VAR="ins_impl.gains.lv" shortname="lv" module="subsystems/ins/ins_float_invariant"/>
|
||||||
<dl_setting MAX="10" MIN="0." STEP="0.001" VAR="ins_impl.gains.lb" shortname="lb"/>
|
<dl_setting MAX="10" MIN="0." STEP="0.001" VAR="ins_impl.gains.lb" shortname="lb"/>
|
||||||
<dl_setting MAX="10" MIN="0." STEP="0.001" VAR="ins_impl.gains.mv" shortname="mv"/>
|
<dl_setting MAX="10" MIN="0." STEP="0.001" VAR="ins_impl.gains.mv" shortname="mv"/>
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ SUBSYSTEM=="tty", ATTRS{product}=="FT232R USB UART", SYMLINK+="paparazzi/serial"
|
|||||||
# MaxStream xbee pro box
|
# MaxStream xbee pro box
|
||||||
SUBSYSTEM=="tty", ATTRS{product}=="MaxStream PKG-U", SYMLINK+="paparazzi/xbee", GROUP="plugdev"
|
SUBSYSTEM=="tty", ATTRS{product}=="MaxStream PKG-U", SYMLINK+="paparazzi/xbee", GROUP="plugdev"
|
||||||
|
|
||||||
|
# Navstik Xbee port
|
||||||
|
SUBSYSTEMS=="usb", ENV{.LOCAL_ifNum}="$attr{bInterfaceNumber}"
|
||||||
|
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ATTRS{product}=="Quad RS232-HS", ENV{.LOCAL_ifNum}=="02", SYMLINK+="paparazzi/xbee", GROUP="plugdev"
|
||||||
|
|
||||||
# Recent Digi XBee pro modems (XBP24-PKC-001-UA)
|
# Recent Digi XBee pro modems (XBP24-PKC-001-UA)
|
||||||
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{product}=="USB <-> Serial", SYMLINK+="paparazzi/xbee", GROUP="plugdev"
|
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{product}=="USB <-> Serial", SYMLINK+="paparazzi/xbee", GROUP="plugdev"
|
||||||
|
|
||||||
@@ -27,6 +31,9 @@ ATTRS{idVendor}=="0403", ATTRS{idProduct}=="cff8", GROUP="plugdev"
|
|||||||
# FTDI 2232 based jtag for Lisa/L and usb upload
|
# FTDI 2232 based jtag for Lisa/L and usb upload
|
||||||
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="0666", GROUP="plugdev"
|
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="0666", GROUP="plugdev"
|
||||||
|
|
||||||
|
# FTDI 2232 based jtag for Navstik
|
||||||
|
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", MODE="0666", GROUP="plugdev"
|
||||||
|
|
||||||
# dfu devices
|
# dfu devices
|
||||||
ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0666", GROUP="plugdev"
|
ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0666", GROUP="plugdev"
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ VARINCLUDE = $(PAPARAZZI_HOME)/var/include
|
|||||||
|
|
||||||
INCLUDES = -I$(PAPARAZZI_SRC)/sw/include -I$(PAPARAZZI_SRC)/sw/airborne -I$(PAPARAZZI_SRC)/conf/autopilot -I$(PAPARAZZI_SRC)/sw/airborne/arch/$($(TARGET).ARCHDIR) -I$(VARINCLUDE) -I$(ACINCLUDE)
|
INCLUDES = -I$(PAPARAZZI_SRC)/sw/include -I$(PAPARAZZI_SRC)/sw/airborne -I$(PAPARAZZI_SRC)/conf/autopilot -I$(PAPARAZZI_SRC)/sw/airborne/arch/$($(TARGET).ARCHDIR) -I$(VARINCLUDE) -I$(ACINCLUDE)
|
||||||
|
|
||||||
|
VPATH = .
|
||||||
|
|
||||||
ifneq ($(MAKECMDGOALS),clean)
|
ifneq ($(MAKECMDGOALS),clean)
|
||||||
include $(AIRCRAFT_BUILD_DIR)/Makefile.ac
|
include $(AIRCRAFT_BUILD_DIR)/Makefile.ac
|
||||||
|
|||||||
@@ -34,7 +34,11 @@
|
|||||||
#include "LPC21xx.h"
|
#include "LPC21xx.h"
|
||||||
#include "interrupt_hw.h"
|
#include "interrupt_hw.h"
|
||||||
|
|
||||||
#define PWM_INPUT_NB 2 //this is architecture dependent
|
enum pwm_input_channels {
|
||||||
|
PWM_INPUT1,
|
||||||
|
PWM_INPUT2,
|
||||||
|
PWM_INPUT_NB
|
||||||
|
};
|
||||||
|
|
||||||
#include "mcu_periph/pwm_input.h"
|
#include "mcu_periph/pwm_input.h"
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,23 @@
|
|||||||
|
|
||||||
#include "std.h"
|
#include "std.h"
|
||||||
|
|
||||||
|
#if defined(STM32F4)
|
||||||
|
/** 25MHz external clock to PLL it to 168MHz */
|
||||||
|
const clock_scale_t hse_25mhz_3v3_168mhz = { /* 168MHz */
|
||||||
|
.pllm = 25,
|
||||||
|
.plln = 336,
|
||||||
|
.pllp = 2,
|
||||||
|
.pllq = 7,
|
||||||
|
.hpre = RCC_CFGR_HPRE_DIV_NONE,
|
||||||
|
.ppre1 = RCC_CFGR_PPRE_DIV_4,
|
||||||
|
.ppre2 = RCC_CFGR_PPRE_DIV_2,
|
||||||
|
.flash_config = FLASH_ACR_ICE | FLASH_ACR_DCE |
|
||||||
|
FLASH_ACR_LATENCY_5WS,
|
||||||
|
.apb1_frequency = 42000000,
|
||||||
|
.apb2_frequency = 84000000,
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
void mcu_arch_init(void) {
|
void mcu_arch_init(void) {
|
||||||
#if LUFTBOOT
|
#if LUFTBOOT
|
||||||
PRINT_CONFIG_MSG("We are running luftboot, the interrupt vector is being relocated.")
|
PRINT_CONFIG_MSG("We are running luftboot, the interrupt vector is being relocated.")
|
||||||
@@ -65,6 +82,11 @@ PRINT_CONFIG_MSG("Using 12MHz external clock to PLL it to 168MHz.")
|
|||||||
PRINT_CONFIG_MSG("Using 16MHz external clock to PLL it to 168MHz.")
|
PRINT_CONFIG_MSG("Using 16MHz external clock to PLL it to 168MHz.")
|
||||||
rcc_clock_setup_hse_3v3(&hse_16mhz_3v3[CLOCK_3V3_168MHZ]);
|
rcc_clock_setup_hse_3v3(&hse_16mhz_3v3[CLOCK_3V3_168MHZ]);
|
||||||
#endif
|
#endif
|
||||||
|
#elif EXT_CLK == 25000000
|
||||||
|
#if defined(STM32F4)
|
||||||
|
PRINT_CONFIG_MSG("Using 25MHz external clock to PLL it to 168MHz.")
|
||||||
|
rcc_clock_setup_hse_3v3(&hse_25mhz_3v3_168mhz);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#error EXT_CLK is either set to an unsupported frequency or not defined at all. Please check!
|
#error EXT_CLK is either set to an unsupported frequency or not defined at all. Please check!
|
||||||
#endif
|
#endif
|
||||||
@@ -118,10 +140,8 @@ uint32_t timer_get_frequency(uint32_t timer_peripheral)
|
|||||||
{
|
{
|
||||||
switch (timer_peripheral) {
|
switch (timer_peripheral) {
|
||||||
// Timers on APB1
|
// Timers on APB1
|
||||||
#if ADVANCED_TIMERS
|
|
||||||
case TIM1:
|
case TIM1:
|
||||||
case TIM8:
|
case TIM8:
|
||||||
#endif
|
|
||||||
#ifdef TIM9
|
#ifdef TIM9
|
||||||
case TIM9:
|
case TIM9:
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -97,7 +97,6 @@
|
|||||||
#include "mcu_periph/gpio.h"
|
#include "mcu_periph/gpio.h"
|
||||||
#include "mcu_arch.h"
|
#include "mcu_arch.h"
|
||||||
#include "std.h"
|
#include "std.h"
|
||||||
#include "led.h"
|
|
||||||
#include BOARD_CONFIG
|
#include BOARD_CONFIG
|
||||||
|
|
||||||
|
|
||||||
@@ -190,8 +189,6 @@ static inline void adc_init_irq( void );
|
|||||||
* for the particular adc converter.
|
* for the particular adc converter.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
volatile uint8_t adc_new_data_trigger;
|
|
||||||
|
|
||||||
static uint8_t nb_adc1_channels = 0;
|
static uint8_t nb_adc1_channels = 0;
|
||||||
static uint8_t nb_adc2_channels = 0;
|
static uint8_t nb_adc2_channels = 0;
|
||||||
static uint8_t nb_adc3_channels = 0;
|
static uint8_t nb_adc3_channels = 0;
|
||||||
@@ -350,8 +347,6 @@ void adc_init( void ) {
|
|||||||
adc_init_single(ADC3, nb_adc3_channels, adc_channel_map);
|
adc_init_single(ADC3, nb_adc3_channels, adc_channel_map);
|
||||||
#endif // USE_AD3
|
#endif // USE_AD3
|
||||||
|
|
||||||
adc_new_data_trigger = FALSE;
|
|
||||||
|
|
||||||
#if USE_ADC_WATCHDOG
|
#if USE_ADC_WATCHDOG
|
||||||
adc_watchdog.cb = NULL;
|
adc_watchdog.cb = NULL;
|
||||||
adc_watchdog.timeStamp=0;
|
adc_watchdog.timeStamp=0;
|
||||||
@@ -614,12 +609,9 @@ void adc1_2_isr(void)
|
|||||||
#if USE_ADC_WATCHDOG
|
#if USE_ADC_WATCHDOG
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !USE_AD2 && !USE_AD3
|
|
||||||
adc_new_data_trigger = TRUE;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif // USE_AD1
|
||||||
|
|
||||||
#if USE_AD2
|
#if USE_AD2
|
||||||
if (adc_eoc_injected(ADC2)){
|
if (adc_eoc_injected(ADC2)){
|
||||||
ADC_SR(ADC2) &= ~ADC_SR_JEOC;
|
ADC_SR(ADC2) &= ~ADC_SR_JEOC;
|
||||||
@@ -635,12 +627,10 @@ void adc1_2_isr(void)
|
|||||||
}
|
}
|
||||||
#if USE_ADC_WATCHDOG
|
#if USE_ADC_WATCHDOG
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if !USE_AD3
|
|
||||||
adc_new_data_trigger = TRUE;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif // USE_AD2
|
||||||
|
|
||||||
#if USE_AD3
|
#if USE_AD3
|
||||||
if (adc_eoc_injected(ADC3)){
|
if (adc_eoc_injected(ADC3)){
|
||||||
ADC_SR(ADC3) &= ~ADC_SR_JEOC;
|
ADC_SR(ADC3) &= ~ADC_SR_JEOC;
|
||||||
@@ -657,10 +647,8 @@ void adc1_2_isr(void)
|
|||||||
#if USE_ADC_WATCHDOG
|
#if USE_ADC_WATCHDOG
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
adc_new_data_trigger = TRUE;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif // USE_AD3
|
||||||
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ void gpio_setup_input(uint32_t port, uint16_t gpios) {
|
|||||||
gpio_set_mode(port, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, gpios);
|
gpio_set_mode(port, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, gpios);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpio_setup_pin_af(uint32_t port, uint16_t pin, uint8_t af, bool_t is_output) {
|
void gpio_setup_pin_af(uint32_t port, uint16_t pin, uint32_t af, bool_t is_output) {
|
||||||
gpio_enable_clock(port);
|
gpio_enable_clock(port);
|
||||||
/* remap alternate function if needed */
|
/* remap alternate function if needed */
|
||||||
if (af) {
|
if (af) {
|
||||||
|
|||||||
@@ -51,7 +51,11 @@ extern void gpio_setup_input(uint32_t port, uint16_t gpios);
|
|||||||
* Setup a gpio for input or output with alternate function.
|
* Setup a gpio for input or output with alternate function.
|
||||||
* This is an STM32 specific helper funtion and should only be used in stm32 arch code.
|
* This is an STM32 specific helper funtion and should only be used in stm32 arch code.
|
||||||
*/
|
*/
|
||||||
|
#if defined(STM32F1)
|
||||||
|
extern void gpio_setup_pin_af(uint32_t port, uint16_t pin, uint32_t af, bool_t is_output);
|
||||||
|
#else
|
||||||
extern void gpio_setup_pin_af(uint32_t port, uint16_t pin, uint8_t af, bool_t is_output);
|
extern void gpio_setup_pin_af(uint32_t port, uint16_t pin, uint8_t af, bool_t is_output);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup a gpio for analog use.
|
* Setup a gpio for analog use.
|
||||||
|
|||||||
@@ -982,7 +982,7 @@ void i2c1_hw_init(void) {
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
/* reset peripheral to default state ( sometimes not achieved on reset :( ) */
|
/* reset peripheral to default state ( sometimes not achieved on reset :( ) */
|
||||||
//i2c_reset(I2C1);
|
//rcc_periph_reset_pulse(RST_I2C1);
|
||||||
|
|
||||||
/* Configure and enable I2C1 event interrupt --------------------------------*/
|
/* Configure and enable I2C1 event interrupt --------------------------------*/
|
||||||
nvic_set_priority(NVIC_I2C1_EV_IRQ, NVIC_I2C1_IRQ_PRIO);
|
nvic_set_priority(NVIC_I2C1_EV_IRQ, NVIC_I2C1_IRQ_PRIO);
|
||||||
@@ -998,7 +998,7 @@ void i2c1_hw_init(void) {
|
|||||||
/* setup gpio clock and pins */
|
/* setup gpio clock and pins */
|
||||||
i2c_setup_gpio(I2C1);
|
i2c_setup_gpio(I2C1);
|
||||||
|
|
||||||
i2c_reset(I2C1);
|
rcc_periph_reset_pulse(RST_I2C1);
|
||||||
|
|
||||||
// enable peripheral
|
// enable peripheral
|
||||||
i2c_peripheral_enable(I2C1);
|
i2c_peripheral_enable(I2C1);
|
||||||
@@ -1056,7 +1056,7 @@ void i2c2_hw_init(void) {
|
|||||||
ZEROS_ERR_COUNTER(i2c2_errors);
|
ZEROS_ERR_COUNTER(i2c2_errors);
|
||||||
|
|
||||||
/* reset peripheral to default state ( sometimes not achieved on reset :( ) */
|
/* reset peripheral to default state ( sometimes not achieved on reset :( ) */
|
||||||
//i2c_reset(I2C2);
|
//rcc_periph_reset_pulse(RST_I2C2);
|
||||||
|
|
||||||
/* Configure and enable I2C2 event interrupt --------------------------------*/
|
/* Configure and enable I2C2 event interrupt --------------------------------*/
|
||||||
nvic_set_priority(NVIC_I2C2_EV_IRQ, NVIC_I2C2_IRQ_PRIO);
|
nvic_set_priority(NVIC_I2C2_EV_IRQ, NVIC_I2C2_IRQ_PRIO);
|
||||||
@@ -1073,7 +1073,7 @@ void i2c2_hw_init(void) {
|
|||||||
/* setup gpio clock and pins */
|
/* setup gpio clock and pins */
|
||||||
i2c_setup_gpio(I2C2);
|
i2c_setup_gpio(I2C2);
|
||||||
|
|
||||||
i2c_reset(I2C2);
|
rcc_periph_reset_pulse(RST_I2C2);
|
||||||
|
|
||||||
// enable peripheral
|
// enable peripheral
|
||||||
i2c_peripheral_enable(I2C2);
|
i2c_peripheral_enable(I2C2);
|
||||||
@@ -1131,7 +1131,7 @@ void i2c3_hw_init(void) {
|
|||||||
ZEROS_ERR_COUNTER(i2c3_errors);
|
ZEROS_ERR_COUNTER(i2c3_errors);
|
||||||
|
|
||||||
/* reset peripheral to default state ( sometimes not achieved on reset :( ) */
|
/* reset peripheral to default state ( sometimes not achieved on reset :( ) */
|
||||||
//i2c_reset(I2C3);
|
//rcc_periph_reset_pulse(RST_I2C3);
|
||||||
|
|
||||||
/* Configure and enable I2C3 event interrupt --------------------------------*/
|
/* Configure and enable I2C3 event interrupt --------------------------------*/
|
||||||
nvic_set_priority(NVIC_I2C3_EV_IRQ, NVIC_I2C3_IRQ_PRIO);
|
nvic_set_priority(NVIC_I2C3_EV_IRQ, NVIC_I2C3_IRQ_PRIO);
|
||||||
@@ -1148,7 +1148,7 @@ void i2c3_hw_init(void) {
|
|||||||
/* setup gpio clock and pins */
|
/* setup gpio clock and pins */
|
||||||
i2c_setup_gpio(I2C3);
|
i2c_setup_gpio(I2C3);
|
||||||
|
|
||||||
i2c_reset(I2C3);
|
rcc_periph_reset_pulse(RST_I2C3);
|
||||||
|
|
||||||
// enable peripheral
|
// enable peripheral
|
||||||
i2c_peripheral_enable(I2C3);
|
i2c_peripheral_enable(I2C3);
|
||||||
|
|||||||
@@ -0,0 +1,235 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 Gautier Hattenberger
|
||||||
|
*
|
||||||
|
* This file is part of paparazzi.
|
||||||
|
*
|
||||||
|
* paparazzi is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* paparazzi is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with paparazzi; see the file COPYING. If not, write to
|
||||||
|
* the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file arch/stm32/mcu_periph/pwm_input_arch.c
|
||||||
|
* @ingroup stm32_arch
|
||||||
|
*
|
||||||
|
* handling of smt32 PWM input using a timer with capture.
|
||||||
|
*/
|
||||||
|
#include "mcu_periph/pwm_input_arch.h"
|
||||||
|
|
||||||
|
#include BOARD_CONFIG
|
||||||
|
#include "generated/airframe.h"
|
||||||
|
|
||||||
|
#include <libopencm3/stm32/rcc.h>
|
||||||
|
#include <libopencm3/stm32/gpio.h>
|
||||||
|
#include <libopencm3/stm32/timer.h>
|
||||||
|
#include <libopencm3/cm3/nvic.h>
|
||||||
|
|
||||||
|
#include "mcu_periph/sys_time.h"
|
||||||
|
#include "mcu_periph/gpio.h"
|
||||||
|
|
||||||
|
// for timer_get_frequency
|
||||||
|
#include "mcu_arch.h"
|
||||||
|
|
||||||
|
#define ONE_MHZ_CLK 1000000
|
||||||
|
#ifdef NVIC_TIM_IRQ_PRIO
|
||||||
|
#define PWM_INPUT_IRQ_PRIO NVIC_TIM_IRQ_PRIO
|
||||||
|
#else
|
||||||
|
#define PWM_INPUT_IRQ_PRIO 2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static inline void pwm_input_set_timer(uint32_t tim) {
|
||||||
|
timer_reset(tim);
|
||||||
|
timer_set_mode(tim, TIM_CR1_CKD_CK_INT, TIM_CR1_CMS_EDGE, TIM_CR1_DIR_UP);
|
||||||
|
timer_set_period(tim, 0xFFFF);
|
||||||
|
uint32_t timer_clk = timer_get_frequency(tim);
|
||||||
|
timer_set_prescaler(tim, (timer_clk / (PWM_INPUT_TICKS_PER_USEC*ONE_MHZ_CLK)) - 1);
|
||||||
|
timer_enable_counter(tim);
|
||||||
|
}
|
||||||
|
|
||||||
|
void pwm_input_init ( void )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
// initialize the arrays to 0
|
||||||
|
for (i = 0; i < PWM_INPUT_NB; i++) {
|
||||||
|
pwm_input_duty_tics[i] = 0;
|
||||||
|
pwm_input_duty_valid[i] = 0;
|
||||||
|
pwm_input_period_tics[i] = 0;
|
||||||
|
pwm_input_period_valid[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Configure timers
|
||||||
|
* - timer clock enable
|
||||||
|
* - base configuration
|
||||||
|
* - enable counter
|
||||||
|
*/
|
||||||
|
#if USE_PWM_INPUT_TIM1
|
||||||
|
rcc_periph_clock_enable(RCC_TIM1);
|
||||||
|
pwm_input_set_timer(TIM1);
|
||||||
|
#endif
|
||||||
|
#if USE_PWM_INPUT_TIM2
|
||||||
|
rcc_periph_clock_enable(RCC_TIM2);
|
||||||
|
pwm_input_set_timer(TIM2);
|
||||||
|
#endif
|
||||||
|
#if USE_PWM_INPUT_TIM3
|
||||||
|
rcc_periph_clock_enable(RCC_TIM3);
|
||||||
|
pwm_input_set_timer(TIM3);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_PWM_INPUT1
|
||||||
|
/* GPIO configuration as input capture for timer */
|
||||||
|
gpio_setup_pin_af(PWM_INPUT1_GPIO_PORT, PWM_INPUT1_GPIO_PIN, PWM_INPUT1_GPIO_AF, FALSE);
|
||||||
|
|
||||||
|
/** TIM configuration: Input Capture mode
|
||||||
|
* Two IC signals are mapped to the same TI input
|
||||||
|
*/
|
||||||
|
timer_ic_set_input(PWM_INPUT1_TIMER, PWM_INPUT1_CHANNEL_PERIOD, PWM_INPUT1_TIMER_INPUT);
|
||||||
|
timer_ic_set_input(PWM_INPUT1_TIMER, PWM_INPUT1_CHANNEL_DUTY, PWM_INPUT1_TIMER_INPUT);
|
||||||
|
#if USE_PWM_INPUT1 == PWM_PULSE_TYPE_ACTIVE_LOW
|
||||||
|
timer_ic_set_polarity(PWM_INPUT1_TIMER, PWM_INPUT1_CHANNEL_PERIOD, TIM_IC_RISING);
|
||||||
|
timer_ic_set_polarity(PWM_INPUT1_TIMER, PWM_INPUT1_CHANNEL_DUTY, TIM_IC_FALLING);
|
||||||
|
#elif USE_PWM_INPUT1 == PWM_PULSE_TYPE_ACTIVE_HIGH
|
||||||
|
timer_ic_set_polarity(PWM_INPUT1_TIMER, PWM_INPUT1_CHANNEL_PERIOD, TIM_IC_FALLING);
|
||||||
|
timer_ic_set_polarity(PWM_INPUT1_TIMER, PWM_INPUT1_CHANNEL_DUTY, TIM_IC_RISING);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Select the valid trigger input */
|
||||||
|
timer_slave_set_trigger(PWM_INPUT1_TIMER, PWM_INPUT1_SLAVE_TRIG);
|
||||||
|
/* Configure the slave mode controller in reset mode */
|
||||||
|
timer_slave_set_mode(PWM_INPUT1_TIMER, TIM_SMCR_SMS_RM);
|
||||||
|
|
||||||
|
/* Enable timer Interrupt(s). */
|
||||||
|
nvic_set_priority(PWM_INPUT1_IRQ, PWM_INPUT_IRQ_PRIO);
|
||||||
|
nvic_enable_irq(PWM_INPUT1_IRQ);
|
||||||
|
#ifdef PWM_INPUT1_IRQ2
|
||||||
|
nvic_set_priority(PWM_INPUT1_IRQ2, PWM_INPUT_IRQ_PRIO);
|
||||||
|
nvic_enable_irq(PWM_INPUT1_IRQ2);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Enable the Capture/Compare and Update interrupt requests. */
|
||||||
|
timer_enable_irq(PWM_INPUT1_TIMER, (PWM_INPUT1_CC_IE | TIM_DIER_UIE));
|
||||||
|
|
||||||
|
/* Enable capture channel. */
|
||||||
|
timer_ic_enable(PWM_INPUT1_TIMER, PWM_INPUT1_CHANNEL_PERIOD);
|
||||||
|
timer_ic_enable(PWM_INPUT1_TIMER, PWM_INPUT1_CHANNEL_DUTY);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_PWM_INPUT2
|
||||||
|
/* GPIO configuration as input capture for timer */
|
||||||
|
gpio_setup_pin_af(PWM_INPUT2_GPIO_PORT, PWM_INPUT2_GPIO_PIN, PWM_INPUT2_GPIO_AF, FALSE);
|
||||||
|
|
||||||
|
/** TIM configuration: Input Capture mode
|
||||||
|
* Two IC signals are mapped to the same TI input
|
||||||
|
*/
|
||||||
|
timer_ic_set_input(PWM_INPUT2_TIMER, PWM_INPUT2_CHANNEL_PERIOD, PWM_INPUT2_TIMER_INPUT);
|
||||||
|
timer_ic_set_input(PWM_INPUT2_TIMER, PWM_INPUT2_CHANNEL_DUTY, PWM_INPUT2_TIMER_INPUT);
|
||||||
|
#if USE_PWM_INPUT2 == PWM_PULSE_TYPE_ACTIVE_LOW
|
||||||
|
timer_ic_set_polarity(PWM_INPUT2_TIMER, PWM_INPUT2_CHANNEL_PERIOD, TIM_IC_RISING);
|
||||||
|
timer_ic_set_polarity(PWM_INPUT2_TIMER, PWM_INPUT2_CHANNEL_DUTY, TIM_IC_FALLING);
|
||||||
|
#elif USE_PWM_INPUT2 == PWM_PULSE_TYPE_ACTIVE_HIGH
|
||||||
|
timer_ic_set_polarity(PWM_INPUT2_TIMER, PWM_INPUT2_CHANNEL_PERIOD, TIM_IC_FALLING);
|
||||||
|
timer_ic_set_polarity(PWM_INPUT2_TIMER, PWM_INPUT2_CHANNEL_DUTY, TIM_IC_RISING);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Select the valid trigger input */
|
||||||
|
timer_slave_set_trigger(PWM_INPUT2_TIMER, PWM_INPUT2_SLAVE_TRIG);
|
||||||
|
/* Configure the slave mode controller in reset mode */
|
||||||
|
timer_slave_set_mode(PWM_INPUT2_TIMER, TIM_SMCR_SMS_RM);
|
||||||
|
|
||||||
|
/* Enable timer Interrupt(s). */
|
||||||
|
nvic_set_priority(PWM_INPUT2_IRQ, PWM_INPUT_IRQ_PRIO);
|
||||||
|
nvic_enable_irq(PWM_INPUT2_IRQ);
|
||||||
|
#ifdef PWM_INPUT2_IRQ2
|
||||||
|
nvic_set_priority(PWM_INPUT2_IRQ2, PWM_INPUT_IRQ_PRIO);
|
||||||
|
nvic_enable_irq(PWM_INPUT2_IRQ2);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Enable the Capture/Compare and Update interrupt requests. */
|
||||||
|
timer_enable_irq(PWM_INPUT2_TIMER, (PWM_INPUT2_CC_IE | TIM_DIER_UIE));
|
||||||
|
|
||||||
|
/* Enable capture channel. */
|
||||||
|
timer_ic_enable(PWM_INPUT2_TIMER, PWM_INPUT2_CHANNEL_PERIOD);
|
||||||
|
timer_ic_enable(PWM_INPUT2_TIMER, PWM_INPUT2_CHANNEL_DUTY);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#if USE_PWM_INPUT_TIM1
|
||||||
|
|
||||||
|
#if defined(STM32F1)
|
||||||
|
void tim1_up_isr(void) {
|
||||||
|
#elif defined(STM32F4)
|
||||||
|
void tim1_up_tim10_isr(void) {
|
||||||
|
#endif
|
||||||
|
if((TIM1_SR & TIM_SR_UIF) != 0) {
|
||||||
|
timer_clear_flag(TIM1, TIM_SR_UIF);
|
||||||
|
// FIXME clear overflow interrupt but what else ?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void tim1_cc_isr(void) {
|
||||||
|
if((TIM1_SR & TIM1_CC_IF_PERIOD) != 0) {
|
||||||
|
timer_clear_flag(TIM1, TIM1_CC_IF_PERIOD);
|
||||||
|
pwm_input_period_tics[TIM1_PWM_INPUT_IDX] = TIM1_CCR_PERIOD;
|
||||||
|
pwm_input_period_valid[TIM1_PWM_INPUT_IDX] = TRUE;
|
||||||
|
}
|
||||||
|
if((TIM1_SR & TIM1_CC_IF_DUTY) != 0) {
|
||||||
|
timer_clear_flag(TIM1, TIM1_CC_IF_DUTY);
|
||||||
|
pwm_input_duty_tics[TIM1_PWM_INPUT_IDX] = TIM1_CCR_DUTY;
|
||||||
|
pwm_input_duty_valid[TIM1_PWM_INPUT_IDX] = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if USE_PWM_INPUT_TIM2
|
||||||
|
|
||||||
|
void tim2_isr(void) {
|
||||||
|
if((TIM2_SR & TIM2_CC_IF_PERIOD) != 0) {
|
||||||
|
timer_clear_flag(TIM2, TIM2_CC_IF_PERIOD);
|
||||||
|
pwm_input_period_tics[TIM2_PWM_INPUT_IDX] = TIM2_CCR_PERIOD;
|
||||||
|
pwm_input_period_valid[TIM2_PWM_INPUT_IDX] = TRUE;
|
||||||
|
}
|
||||||
|
if((TIM2_SR & TIM2_CC_IF_DUTY) != 0) {
|
||||||
|
timer_clear_flag(TIM2, TIM2_CC_IF_DUTY);
|
||||||
|
pwm_input_duty_tics[TIM2_PWM_INPUT_IDX] = TIM2_CCR_DUTY;
|
||||||
|
pwm_input_duty_valid[TIM2_PWM_INPUT_IDX] = TRUE;
|
||||||
|
}
|
||||||
|
if((TIM2_SR & TIM_SR_UIF) != 0) {
|
||||||
|
timer_clear_flag(TIM2, TIM_SR_UIF);
|
||||||
|
// FIXME clear overflow interrupt but what else ?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if USE_PWM_INPUT_TIM3
|
||||||
|
|
||||||
|
void tim3_isr(void) {
|
||||||
|
if((TIM3_SR & TIM3_CC_IF_PERIOD) != 0) {
|
||||||
|
timer_clear_flag(TIM3, TIM3_CC_IF_PERIOD);
|
||||||
|
pwm_input_period_tics[TIM3_PWM_INPUT_IDX] = TIM3_CCR_PERIOD;
|
||||||
|
pwm_input_period_valid[TIM3_PWM_INPUT_IDX] = TRUE;
|
||||||
|
}
|
||||||
|
if((TIM3_SR & TIM3_CC_IF_DUTY) != 0) {
|
||||||
|
timer_clear_flag(TIM3, TIM3_CC_IF_DUTY);
|
||||||
|
pwm_input_duty_tics[TIM3_PWM_INPUT_IDX] = TIM3_CCR_DUTY;
|
||||||
|
pwm_input_duty_valid[TIM3_PWM_INPUT_IDX] = TRUE;
|
||||||
|
}
|
||||||
|
if((TIM3_SR & TIM_SR_UIF) != 0) {
|
||||||
|
timer_clear_flag(TIM3, TIM_SR_UIF);
|
||||||
|
// FIXME clear overflow interrupt but what else ?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 Gautier Hattenberger
|
||||||
|
*
|
||||||
|
* This file is part of paparazzi.
|
||||||
|
*
|
||||||
|
* paparazzi is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* paparazzi is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with paparazzi; see the file COPYING. If not, write to
|
||||||
|
* the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file arch/stm32/mcu_periph/pwm_input_arch.h
|
||||||
|
* @ingroup stm32_arch
|
||||||
|
*
|
||||||
|
* handling of smt32 PWM input using a timer with capture.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PWM_INPUT_ARCH_H
|
||||||
|
#define PWM_INPUT_ARCH_H
|
||||||
|
|
||||||
|
#include "std.h"
|
||||||
|
|
||||||
|
enum pwm_input_channels {
|
||||||
|
PWM_INPUT1,
|
||||||
|
PWM_INPUT2,
|
||||||
|
PWM_INPUT_NB
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The pwm counter is set-up to have 1/6 us resolution.
|
||||||
|
*
|
||||||
|
* The timer clock frequency (before prescaling):
|
||||||
|
* STM32F1:
|
||||||
|
* TIM1 -> APB2 = HCLK = 72MHz
|
||||||
|
* TIM2 -> 2 * APB1 = 2 * 36MHz = 72MHz
|
||||||
|
* STM32F4:
|
||||||
|
* TIM1 -> 2 * APB2 = 2 * 84MHz = 168MHz
|
||||||
|
* TIM2 -> 2 * APB1 = 2 * 42MHz = 84MHz
|
||||||
|
*/
|
||||||
|
#define PWM_INPUT_TICKS_PER_USEC 6
|
||||||
|
|
||||||
|
#define PWM_INPUT_TICKS_OF_USEC(_v) ((_v)*PWM_INPUT_TICKS_PER_USEC)
|
||||||
|
#define PWM_INPUT_SIGNED_TICKS_OF_USEC(_v) (int32_t)((_v)*PWM_INPUT_TICKS_PER_USEC)
|
||||||
|
#define USEC_OF_PWM_INPUT_TICKS(_v) ((_v)/PWM_INPUT_TICKS_PER_USEC)
|
||||||
|
|
||||||
|
#include "mcu_periph/pwm_input.h"
|
||||||
|
|
||||||
|
#endif /* PWM_INPUT_ARCH_H */
|
||||||
|
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Hey Emacs, this is a -*- makefile -*-
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014 Freek van Tienen <freek.v.tienen@gmail.com>
|
||||||
|
*
|
||||||
|
* This file is part of Paparazzi.
|
||||||
|
*
|
||||||
|
* Paparazzi is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* Paparazzi is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Paparazzi; see the file COPYING. If not, write to
|
||||||
|
* the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Linker script for Navstik (STM32F415, 1024K flash, 192K RAM). */
|
||||||
|
|
||||||
|
/* Define memory regions. */
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
|
||||||
|
/* TODO: Pages on stm32f4 are not just 2k in size, stored settings have to deal with that correctly. */
|
||||||
|
rom (rx) : ORIGIN = 0x08000000, LENGTH = 1022K
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Include the common ld script. */
|
||||||
|
INCLUDE libopencm3_stm32f4.ld
|
||||||
@@ -34,6 +34,7 @@
|
|||||||
#include <libopencm3/stm32/timer.h>
|
#include <libopencm3/stm32/timer.h>
|
||||||
#include <libopencm3/cm3/nvic.h>
|
#include <libopencm3/cm3/nvic.h>
|
||||||
|
|
||||||
|
#include "mcu_periph/gpio_arch.h"
|
||||||
|
|
||||||
uint32_t ratio_4ms, ratio_16ms;
|
uint32_t ratio_4ms, ratio_16ms;
|
||||||
|
|
||||||
@@ -75,16 +76,11 @@ void actuators_dualpwm_arch_init(void) {
|
|||||||
/*----------------
|
/*----------------
|
||||||
* Configure GPIO
|
* Configure GPIO
|
||||||
*----------------*/
|
*----------------*/
|
||||||
#if defined(STM32F1)
|
|
||||||
/* TIM3 GPIO for PWM1..4 */
|
|
||||||
AFIO_MAPR |= AFIO_MAPR_TIM3_REMAP_FULL_REMAP;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DUAL_PWM_SERVO_5
|
#ifdef DUAL_PWM_SERVO_5
|
||||||
set_servo_gpio(DUAL_PWM_SERVO_5_GPIO, DUAL_PWM_SERVO_5_PIN, DUAL_PWM_SERVO_5_AF, DUAL_PWM_SERVO_5_RCC);
|
gpio_setup_pin_af(DUAL_PWM_SERVO_5_GPIO, DUAL_PWM_SERVO_5_PIN, DUAL_PWM_SERVO_5_AF, TRUE);
|
||||||
#endif
|
#endif
|
||||||
#ifdef DUAL_PWM_SERVO_6
|
#ifdef DUAL_PWM_SERVO_6
|
||||||
set_servo_gpio(DUAL_PWM_SERVO_6_GPIO, DUAL_PWM_SERVO_6_PIN, DUAL_PWM_SERVO_6_AF, DUAL_PWM_SERVO_6_RCC);
|
gpio_setup_pin_af(DUAL_PWM_SERVO_6_GPIO, DUAL_PWM_SERVO_6_PIN, DUAL_PWM_SERVO_6_AF, TRUE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if DUAL_PWM_USE_TIM5
|
#if DUAL_PWM_USE_TIM5
|
||||||
|
|||||||
@@ -33,6 +33,8 @@
|
|||||||
#include <libopencm3/stm32/rcc.h>
|
#include <libopencm3/stm32/rcc.h>
|
||||||
#include <libopencm3/stm32/timer.h>
|
#include <libopencm3/stm32/timer.h>
|
||||||
|
|
||||||
|
#include "mcu_periph/gpio_arch.h"
|
||||||
|
|
||||||
|
|
||||||
int32_t actuators_pwm_values[ACTUATORS_PWM_NB];
|
int32_t actuators_pwm_values[ACTUATORS_PWM_NB];
|
||||||
|
|
||||||
@@ -72,49 +74,43 @@ void actuators_pwm_arch_init(void) {
|
|||||||
/*----------------
|
/*----------------
|
||||||
* Configure GPIO
|
* Configure GPIO
|
||||||
*----------------*/
|
*----------------*/
|
||||||
#if defined(STM32F1)
|
|
||||||
/* TIM3 GPIO for PWM1..4 */
|
|
||||||
AFIO_MAPR |= AFIO_MAPR_TIM3_REMAP_FULL_REMAP;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PWM_SERVO_0
|
#ifdef PWM_SERVO_0
|
||||||
set_servo_gpio(PWM_SERVO_0_GPIO, PWM_SERVO_0_PIN, PWM_SERVO_0_AF, PWM_SERVO_0_RCC);
|
gpio_setup_pin_af(PWM_SERVO_0_GPIO, PWM_SERVO_0_PIN, PWM_SERVO_0_AF, TRUE);
|
||||||
#endif
|
#endif
|
||||||
#ifdef PWM_SERVO_1
|
#ifdef PWM_SERVO_1
|
||||||
set_servo_gpio(PWM_SERVO_1_GPIO, PWM_SERVO_1_PIN, PWM_SERVO_1_AF, PWM_SERVO_1_RCC);
|
gpio_setup_pin_af(PWM_SERVO_1_GPIO, PWM_SERVO_1_PIN, PWM_SERVO_1_AF, TRUE);
|
||||||
#endif
|
#endif
|
||||||
#ifdef PWM_SERVO_2
|
#ifdef PWM_SERVO_2
|
||||||
set_servo_gpio(PWM_SERVO_2_GPIO, PWM_SERVO_2_PIN, PWM_SERVO_2_AF, PWM_SERVO_2_RCC);
|
gpio_setup_pin_af(PWM_SERVO_2_GPIO, PWM_SERVO_2_PIN, PWM_SERVO_2_AF, TRUE);
|
||||||
#endif
|
#endif
|
||||||
#ifdef PWM_SERVO_3
|
#ifdef PWM_SERVO_3
|
||||||
set_servo_gpio(PWM_SERVO_3_GPIO, PWM_SERVO_3_PIN, PWM_SERVO_3_AF, PWM_SERVO_3_RCC);
|
gpio_setup_pin_af(PWM_SERVO_3_GPIO, PWM_SERVO_3_PIN, PWM_SERVO_3_AF, TRUE);
|
||||||
#endif
|
#endif
|
||||||
#ifdef PWM_SERVO_4
|
#ifdef PWM_SERVO_4
|
||||||
set_servo_gpio(PWM_SERVO_4_GPIO, PWM_SERVO_4_PIN, PWM_SERVO_4_AF, PWM_SERVO_4_RCC);
|
gpio_setup_pin_af(PWM_SERVO_4_GPIO, PWM_SERVO_4_PIN, PWM_SERVO_4_AF, TRUE);
|
||||||
#endif
|
#endif
|
||||||
#ifdef PWM_SERVO_5
|
#ifdef PWM_SERVO_5
|
||||||
set_servo_gpio(PWM_SERVO_5_GPIO, PWM_SERVO_5_PIN, PWM_SERVO_5_AF, PWM_SERVO_5_RCC);
|
gpio_setup_pin_af(PWM_SERVO_5_GPIO, PWM_SERVO_5_PIN, PWM_SERVO_5_AF, TRUE);
|
||||||
#endif
|
#endif
|
||||||
#ifdef PWM_SERVO_6
|
#ifdef PWM_SERVO_6
|
||||||
set_servo_gpio(PWM_SERVO_6_GPIO, PWM_SERVO_6_PIN, PWM_SERVO_6_AF, PWM_SERVO_6_RCC);
|
gpio_setup_pin_af(PWM_SERVO_6_GPIO, PWM_SERVO_6_PIN, PWM_SERVO_6_AF, TRUE);
|
||||||
#endif
|
#endif
|
||||||
#ifdef PWM_SERVO_7
|
#ifdef PWM_SERVO_7
|
||||||
set_servo_gpio(PWM_SERVO_7_GPIO, PWM_SERVO_7_PIN, PWM_SERVO_7_AF, PWM_SERVO_7_RCC);
|
gpio_setup_pin_af(PWM_SERVO_7_GPIO, PWM_SERVO_7_PIN, PWM_SERVO_7_AF, TRUE);
|
||||||
#endif
|
#endif
|
||||||
#ifdef PWM_SERVO_8
|
#ifdef PWM_SERVO_8
|
||||||
set_servo_gpio(PWM_SERVO_8_GPIO, PWM_SERVO_8_PIN, PWM_SERVO_8_AF, PWM_SERVO_8_RCC);
|
gpio_setup_pin_af(PWM_SERVO_8_GPIO, PWM_SERVO_8_PIN, PWM_SERVO_8_AF, TRUE);
|
||||||
#endif
|
#endif
|
||||||
#ifdef PWM_SERVO_9
|
#ifdef PWM_SERVO_9
|
||||||
set_servo_gpio(PWM_SERVO_9_GPIO, PWM_SERVO_9_PIN, PWM_SERVO_9_AF, PWM_SERVO_9_RCC);
|
gpio_setup_pin_af(PWM_SERVO_9_GPIO, PWM_SERVO_9_PIN, PWM_SERVO_9_AF, TRUE);
|
||||||
#endif
|
#endif
|
||||||
#ifdef PWM_SERVO_10
|
#ifdef PWM_SERVO_10
|
||||||
set_servo_gpio(PWM_SERVO_10_GPIO, PWM_SERVO_10_PIN, PWM_SERVO_10_AF, PWM_SERVO_10_RCC);
|
gpio_setup_pin_af(PWM_SERVO_10_GPIO, PWM_SERVO_10_PIN, PWM_SERVO_10_AF, TRUE);
|
||||||
#endif
|
#endif
|
||||||
#ifdef PWM_SERVO_11
|
#ifdef PWM_SERVO_11
|
||||||
set_servo_gpio(PWM_SERVO_11_GPIO, PWM_SERVO_11_PIN, PWM_SERVO_11_AF, PWM_SERVO_11_RCC);
|
gpio_setup_pin_af(PWM_SERVO_11_GPIO, PWM_SERVO_11_PIN, PWM_SERVO_11_AF, TRUE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if PWM_USE_TIM1
|
#if PWM_USE_TIM1
|
||||||
set_servo_timer(TIM1, TIM1_SERVO_HZ, PWM_TIM1_CHAN_MASK);
|
set_servo_timer(TIM1, TIM1_SERVO_HZ, PWM_TIM1_CHAN_MASK);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -28,24 +28,6 @@
|
|||||||
// for timer_get_frequency
|
// for timer_get_frequency
|
||||||
#include "mcu_arch.h"
|
#include "mcu_arch.h"
|
||||||
|
|
||||||
/** Set GPIO configuration
|
|
||||||
*/
|
|
||||||
#if defined(STM32F4)
|
|
||||||
void set_servo_gpio(uint32_t gpioport, uint16_t pin, uint8_t af_num, enum rcc_periph_clken clken) {
|
|
||||||
rcc_periph_clock_enable(clken);
|
|
||||||
gpio_mode_setup(gpioport, GPIO_MODE_AF, GPIO_PUPD_NONE, pin);
|
|
||||||
gpio_set_af(gpioport, af_num, pin);
|
|
||||||
}
|
|
||||||
#elif defined(STM32F1)
|
|
||||||
void set_servo_gpio(uint32_t gpioport, uint16_t pin, uint8_t none __attribute__((unused)), enum rcc_periph_clken clken) {
|
|
||||||
rcc_periph_clock_enable(clken);
|
|
||||||
rcc_periph_clock_enable(RCC_AFIO);
|
|
||||||
gpio_set_mode(gpioport, GPIO_MODE_OUTPUT_50_MHZ,
|
|
||||||
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, pin);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Set PWM channel configuration
|
/** Set PWM channel configuration
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -36,15 +36,6 @@
|
|||||||
#include <libopencm3/cm3/nvic.h>
|
#include <libopencm3/cm3/nvic.h>
|
||||||
#include "mcu_arch.h"
|
#include "mcu_arch.h"
|
||||||
|
|
||||||
|
|
||||||
#if defined(STM32F1)
|
|
||||||
//#define PCLK 72000000
|
|
||||||
#define PCLK AHB_CLK
|
|
||||||
#elif defined(STM32F4)
|
|
||||||
//#define PCLK 84000000
|
|
||||||
#define PCLK AHB_CLK/2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ONE_MHZ_CLK 1000000
|
#define ONE_MHZ_CLK 1000000
|
||||||
|
|
||||||
/* Default timer base frequency is 1MHz */
|
/* Default timer base frequency is 1MHz */
|
||||||
@@ -74,6 +65,9 @@
|
|||||||
#ifndef TIM5_SERVO_HZ
|
#ifndef TIM5_SERVO_HZ
|
||||||
#define TIM5_SERVO_HZ SERVO_HZ
|
#define TIM5_SERVO_HZ SERVO_HZ
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef TIM8_SERVO_HZ
|
||||||
|
#define TIM8_SERVO_HZ SERVO_HZ
|
||||||
|
#endif
|
||||||
#ifndef TIM9_SERVO_HZ
|
#ifndef TIM9_SERVO_HZ
|
||||||
#define TIM9_SERVO_HZ SERVO_HZ
|
#define TIM9_SERVO_HZ SERVO_HZ
|
||||||
#endif
|
#endif
|
||||||
@@ -81,15 +75,7 @@
|
|||||||
#define TIM12_SERVO_HZ SERVO_HZ
|
#define TIM12_SERVO_HZ SERVO_HZ
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(STM32F4)
|
|
||||||
extern void set_servo_gpio(uint32_t gpioport, uint16_t pin, uint8_t af_num, enum rcc_periph_clken clken);
|
|
||||||
#elif defined(STM32F1)
|
|
||||||
extern void set_servo_gpio(uint32_t gpioport, uint16_t pin, uint8_t none __attribute__((unused)), enum rcc_periph_clken clken);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern void actuators_pwm_arch_channel_init(uint32_t timer_peripheral, enum tim_oc_id oc_id);
|
extern void actuators_pwm_arch_channel_init(uint32_t timer_peripheral, enum tim_oc_id oc_id);
|
||||||
|
|
||||||
extern void set_servo_timer(uint32_t timer, uint32_t period, uint8_t channels_mask);
|
extern void set_servo_timer(uint32_t timer, uint32_t period, uint8_t channels_mask);
|
||||||
|
|
||||||
#endif /* ACTUATORS_PWM_SHARED_ARCH_H */
|
#endif /* ACTUATORS_PWM_SHARED_ARCH_H */
|
||||||
|
|||||||
@@ -691,8 +691,13 @@ void radio_control_spektrum_try_bind(void) {
|
|||||||
|
|
||||||
/* exit if the BIND_PIN is high, it needs to
|
/* exit if the BIND_PIN is high, it needs to
|
||||||
be pulled low at startup to initiate bind */
|
be pulled low at startup to initiate bind */
|
||||||
|
#ifdef SPEKTRUM_BIND_PIN_HIGH
|
||||||
|
if (gpio_get(SPEKTRUM_BIND_PIN_PORT, SPEKTRUM_BIND_PIN) == 0)
|
||||||
|
return;
|
||||||
|
#else
|
||||||
if (gpio_get(SPEKTRUM_BIND_PIN_PORT, SPEKTRUM_BIND_PIN) != 0)
|
if (gpio_get(SPEKTRUM_BIND_PIN_PORT, SPEKTRUM_BIND_PIN) != 0)
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Master receiver Rx push-pull */
|
/* Master receiver Rx push-pull */
|
||||||
gpio_setup_output(SPEKTRUM_PRIMARY_BIND_CONF_PORT, SPEKTRUM_PRIMARY_BIND_CONF_PIN);
|
gpio_setup_output(SPEKTRUM_PRIMARY_BIND_CONF_PORT, SPEKTRUM_PRIMARY_BIND_CONF_PIN);
|
||||||
|
|||||||
@@ -165,7 +165,6 @@
|
|||||||
#if USE_PWM0
|
#if USE_PWM0
|
||||||
#define PWM_SERVO_0 0
|
#define PWM_SERVO_0 0
|
||||||
#define PWM_SERVO_0_TIMER TIM2
|
#define PWM_SERVO_0_TIMER TIM2
|
||||||
#define PWM_SERVO_0_RCC RCC_GPIOA
|
|
||||||
#define PWM_SERVO_0_GPIO GPIOA
|
#define PWM_SERVO_0_GPIO GPIOA
|
||||||
#define PWM_SERVO_0_PIN GPIO3
|
#define PWM_SERVO_0_PIN GPIO3
|
||||||
#define PWM_SERVO_0_AF GPIO_AF1
|
#define PWM_SERVO_0_AF GPIO_AF1
|
||||||
@@ -178,7 +177,6 @@
|
|||||||
#if USE_PWM1
|
#if USE_PWM1
|
||||||
#define PWM_SERVO_1 1
|
#define PWM_SERVO_1 1
|
||||||
#define PWM_SERVO_1_TIMER TIM2
|
#define PWM_SERVO_1_TIMER TIM2
|
||||||
#define PWM_SERVO_1_RCC RCC_GPIOA
|
|
||||||
#define PWM_SERVO_1_GPIO GPIOA
|
#define PWM_SERVO_1_GPIO GPIOA
|
||||||
#define PWM_SERVO_1_PIN GPIO2
|
#define PWM_SERVO_1_PIN GPIO2
|
||||||
#define PWM_SERVO_1_AF GPIO_AF1
|
#define PWM_SERVO_1_AF GPIO_AF1
|
||||||
@@ -191,7 +189,6 @@
|
|||||||
#if USE_PWM2
|
#if USE_PWM2
|
||||||
#define PWM_SERVO_2 2
|
#define PWM_SERVO_2 2
|
||||||
#define PWM_SERVO_2_TIMER TIM3
|
#define PWM_SERVO_2_TIMER TIM3
|
||||||
#define PWM_SERVO_2_RCC RCC_GPIOB
|
|
||||||
#define PWM_SERVO_2_GPIO GPIOB
|
#define PWM_SERVO_2_GPIO GPIOB
|
||||||
#define PWM_SERVO_2_PIN GPIO5
|
#define PWM_SERVO_2_PIN GPIO5
|
||||||
#define PWM_SERVO_2_AF GPIO_AF2
|
#define PWM_SERVO_2_AF GPIO_AF2
|
||||||
@@ -204,7 +201,6 @@
|
|||||||
#if USE_PWM3
|
#if USE_PWM3
|
||||||
#define PWM_SERVO_3_IDX 3
|
#define PWM_SERVO_3_IDX 3
|
||||||
#define PWM_SERVO_3_TIMER TIM3
|
#define PWM_SERVO_3_TIMER TIM3
|
||||||
#define PWM_SERVO_3_RCC RCC_GPIOB
|
|
||||||
#define PWM_SERVO_3_GPIO GPIOB
|
#define PWM_SERVO_3_GPIO GPIOB
|
||||||
#define PWM_SERVO_3_PIN GPIO4
|
#define PWM_SERVO_3_PIN GPIO4
|
||||||
#define PWM_SERVO_3_AF GPIO_AF2
|
#define PWM_SERVO_3_AF GPIO_AF2
|
||||||
@@ -217,7 +213,6 @@
|
|||||||
#if USE_PWM4
|
#if USE_PWM4
|
||||||
#define PWM_SERVO_4 4
|
#define PWM_SERVO_4 4
|
||||||
#define PWM_SERVO_4_TIMER TIM2
|
#define PWM_SERVO_4_TIMER TIM2
|
||||||
#define PWM_SERVO_4_RCC RCC_GPIOB
|
|
||||||
#define PWM_SERVO_4_GPIO GPIOB
|
#define PWM_SERVO_4_GPIO GPIOB
|
||||||
#define PWM_SERVO_4_PIN GPIO3
|
#define PWM_SERVO_4_PIN GPIO3
|
||||||
#define PWM_SERVO_4_AF GPIO_AF1
|
#define PWM_SERVO_4_AF GPIO_AF1
|
||||||
@@ -230,7 +225,6 @@
|
|||||||
#if USE_PWM5
|
#if USE_PWM5
|
||||||
#define PWM_SERVO_5 5
|
#define PWM_SERVO_5 5
|
||||||
#define PWM_SERVO_5_TIMER TIM2
|
#define PWM_SERVO_5_TIMER TIM2
|
||||||
#define PWM_SERVO_5_RCC RCC_GPIOA
|
|
||||||
#define PWM_SERVO_5_GPIO GPIOA
|
#define PWM_SERVO_5_GPIO GPIOA
|
||||||
#define PWM_SERVO_5_PIN GPIO15
|
#define PWM_SERVO_5_PIN GPIO15
|
||||||
#define PWM_SERVO_5_AF GPIO_AF1
|
#define PWM_SERVO_5_AF GPIO_AF1
|
||||||
|
|||||||
@@ -222,7 +222,6 @@
|
|||||||
#if USE_PWM0
|
#if USE_PWM0
|
||||||
#define PWM_SERVO_0 0
|
#define PWM_SERVO_0 0
|
||||||
#define PWM_SERVO_0_TIMER TIM3
|
#define PWM_SERVO_0_TIMER TIM3
|
||||||
#define PWM_SERVO_0_RCC RCC_GPIOB
|
|
||||||
#define PWM_SERVO_0_GPIO GPIOB
|
#define PWM_SERVO_0_GPIO GPIOB
|
||||||
#define PWM_SERVO_0_PIN GPIO0
|
#define PWM_SERVO_0_PIN GPIO0
|
||||||
#define PWM_SERVO_0_AF GPIO_AF2
|
#define PWM_SERVO_0_AF GPIO_AF2
|
||||||
@@ -238,7 +237,6 @@
|
|||||||
#if USE_PWM1
|
#if USE_PWM1
|
||||||
#define PWM_SERVO_1 1
|
#define PWM_SERVO_1 1
|
||||||
#define PWM_SERVO_1_TIMER TIM2
|
#define PWM_SERVO_1_TIMER TIM2
|
||||||
#define PWM_SERVO_1_RCC RCC_GPIOA
|
|
||||||
#define PWM_SERVO_1_GPIO GPIOA
|
#define PWM_SERVO_1_GPIO GPIOA
|
||||||
#define PWM_SERVO_1_PIN GPIO2
|
#define PWM_SERVO_1_PIN GPIO2
|
||||||
#define PWM_SERVO_1_AF GPIO_AF1
|
#define PWM_SERVO_1_AF GPIO_AF1
|
||||||
@@ -254,7 +252,6 @@
|
|||||||
#if USE_PWM2
|
#if USE_PWM2
|
||||||
#define PWM_SERVO_2 2
|
#define PWM_SERVO_2 2
|
||||||
#define PWM_SERVO_2_TIMER TIM3
|
#define PWM_SERVO_2_TIMER TIM3
|
||||||
#define PWM_SERVO_2_RCC RCC_GPIOB
|
|
||||||
#define PWM_SERVO_2_GPIO GPIOB
|
#define PWM_SERVO_2_GPIO GPIOB
|
||||||
#define PWM_SERVO_2_PIN GPIO5
|
#define PWM_SERVO_2_PIN GPIO5
|
||||||
#define PWM_SERVO_2_AF GPIO_AF2
|
#define PWM_SERVO_2_AF GPIO_AF2
|
||||||
@@ -270,7 +267,6 @@
|
|||||||
#if USE_PWM3
|
#if USE_PWM3
|
||||||
#define PWM_SERVO_3 3
|
#define PWM_SERVO_3 3
|
||||||
#define PWM_SERVO_3_TIMER TIM3
|
#define PWM_SERVO_3_TIMER TIM3
|
||||||
#define PWM_SERVO_3_RCC RCC_GPIOB
|
|
||||||
#define PWM_SERVO_3_GPIO GPIOB
|
#define PWM_SERVO_3_GPIO GPIOB
|
||||||
#define PWM_SERVO_3_PIN GPIO4
|
#define PWM_SERVO_3_PIN GPIO4
|
||||||
#define PWM_SERVO_3_AF GPIO_AF2
|
#define PWM_SERVO_3_AF GPIO_AF2
|
||||||
@@ -286,7 +282,6 @@
|
|||||||
#if USE_PWM4
|
#if USE_PWM4
|
||||||
#define PWM_SERVO_4 4
|
#define PWM_SERVO_4 4
|
||||||
#define PWM_SERVO_4_TIMER TIM2
|
#define PWM_SERVO_4_TIMER TIM2
|
||||||
#define PWM_SERVO_4_RCC RCC_GPIOB
|
|
||||||
#define PWM_SERVO_4_GPIO GPIOB
|
#define PWM_SERVO_4_GPIO GPIOB
|
||||||
#define PWM_SERVO_4_PIN GPIO3
|
#define PWM_SERVO_4_PIN GPIO3
|
||||||
#define PWM_SERVO_4_AF GPIO_AF1
|
#define PWM_SERVO_4_AF GPIO_AF1
|
||||||
@@ -302,7 +297,6 @@
|
|||||||
#if USE_PWM5
|
#if USE_PWM5
|
||||||
#define PWM_SERVO_5 5
|
#define PWM_SERVO_5 5
|
||||||
#define PWM_SERVO_5_TIMER TIM2
|
#define PWM_SERVO_5_TIMER TIM2
|
||||||
#define PWM_SERVO_5_RCC RCC_GPIOA
|
|
||||||
#define PWM_SERVO_5_GPIO GPIOA
|
#define PWM_SERVO_5_GPIO GPIOA
|
||||||
#define PWM_SERVO_5_PIN GPIO15
|
#define PWM_SERVO_5_PIN GPIO15
|
||||||
#define PWM_SERVO_5_AF GPIO_AF1
|
#define PWM_SERVO_5_AF GPIO_AF1
|
||||||
@@ -316,7 +310,6 @@
|
|||||||
#if USE_PWM6
|
#if USE_PWM6
|
||||||
#define PWM_SERVO_6 6
|
#define PWM_SERVO_6 6
|
||||||
#define PWM_SERVO_6_TIMER TIM3
|
#define PWM_SERVO_6_TIMER TIM3
|
||||||
#define PWM_SERVO_6_RCC RCC_GPIOB
|
|
||||||
#define PWM_SERVO_6_GPIO GPIOB
|
#define PWM_SERVO_6_GPIO GPIOB
|
||||||
#define PWM_SERVO_6_PIN GPIO1
|
#define PWM_SERVO_6_PIN GPIO1
|
||||||
#define PWM_SERVO_6_AF GPIO_AF2
|
#define PWM_SERVO_6_AF GPIO_AF2
|
||||||
@@ -346,6 +339,28 @@
|
|||||||
#define PPM_GPIO_PIN GPIO8
|
#define PPM_GPIO_PIN GPIO8
|
||||||
#define PPM_GPIO_AF GPIO_AF1
|
#define PPM_GPIO_AF GPIO_AF1
|
||||||
|
|
||||||
|
/*
|
||||||
|
* PWM input
|
||||||
|
*/
|
||||||
|
#define PWM_INPUT1_TIMER TIM1
|
||||||
|
#define PWM_INPUT1_CHANNEL_PERIOD TIM_IC1
|
||||||
|
#define PWM_INPUT1_CHANNEL_DUTY TIM_IC2
|
||||||
|
#define PWM_INPUT1_TIMER_INPUT TIM_IC_IN_TI1
|
||||||
|
#define PWM_INPUT1_SLAVE_TRIG TIM_SMCR_TS_IT1FP1
|
||||||
|
#define PWM_INPUT1_IRQ NVIC_TIM1_CC_IRQ
|
||||||
|
#define PWM_INPUT1_IRQ2 NVIC_TIM1_UP_TIM10_IRQ
|
||||||
|
#define PWM_INPUT1_CC_IE (TIM_DIER_CC1IE | TIM_DIER_CC2IE)
|
||||||
|
#define USE_PWM_INPUT_TIM1 TRUE
|
||||||
|
#define TIM1_PWM_INPUT_IDX 0
|
||||||
|
#define TIM1_CC_IF_PERIOD TIM_SR_CC1IF
|
||||||
|
#define TIM1_CC_IF_DUTY TIM_SR_CC2IF
|
||||||
|
#define TIM1_CCR_PERIOD TIM1_CCR1
|
||||||
|
#define TIM1_CCR_DUTY TIM1_CCR2
|
||||||
|
// PPM in (aka PA8) is used: not compatible with PPM RC receiver
|
||||||
|
#define PWM_INPUT1_GPIO_PORT GPIOA
|
||||||
|
#define PWM_INPUT1_GPIO_PIN GPIO8
|
||||||
|
#define PWM_INPUT1_GPIO_AF GPIO_AF1
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Spektrum
|
* Spektrum
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -219,7 +219,6 @@
|
|||||||
#if USE_PWM0
|
#if USE_PWM0
|
||||||
#define PWM_SERVO_0 0
|
#define PWM_SERVO_0 0
|
||||||
#define PWM_SERVO_0_TIMER TIM3
|
#define PWM_SERVO_0_TIMER TIM3
|
||||||
#define PWM_SERVO_0_RCC RCC_GPIOB
|
|
||||||
#define PWM_SERVO_0_GPIO GPIOB
|
#define PWM_SERVO_0_GPIO GPIOB
|
||||||
#define PWM_SERVO_0_PIN GPIO1
|
#define PWM_SERVO_0_PIN GPIO1
|
||||||
#define PWM_SERVO_0_AF GPIO_AF2
|
#define PWM_SERVO_0_AF GPIO_AF2
|
||||||
@@ -232,7 +231,6 @@
|
|||||||
#if USE_PWM1
|
#if USE_PWM1
|
||||||
#define PWM_SERVO_1 1
|
#define PWM_SERVO_1 1
|
||||||
#define PWM_SERVO_1_TIMER TIM3
|
#define PWM_SERVO_1_TIMER TIM3
|
||||||
#define PWM_SERVO_1_RCC RCC_GPIOC
|
|
||||||
#define PWM_SERVO_1_GPIO GPIOC
|
#define PWM_SERVO_1_GPIO GPIOC
|
||||||
#define PWM_SERVO_1_PIN GPIO8
|
#define PWM_SERVO_1_PIN GPIO8
|
||||||
#define PWM_SERVO_1_AF GPIO_AF2
|
#define PWM_SERVO_1_AF GPIO_AF2
|
||||||
@@ -245,7 +243,6 @@
|
|||||||
#if USE_PWM2
|
#if USE_PWM2
|
||||||
#define PWM_SERVO_2 2
|
#define PWM_SERVO_2 2
|
||||||
#define PWM_SERVO_2_TIMER TIM3
|
#define PWM_SERVO_2_TIMER TIM3
|
||||||
#define PWM_SERVO_2_RCC RCC_GPIOC
|
|
||||||
#define PWM_SERVO_2_GPIO GPIOC
|
#define PWM_SERVO_2_GPIO GPIOC
|
||||||
#define PWM_SERVO_2_PIN GPIO7
|
#define PWM_SERVO_2_PIN GPIO7
|
||||||
#define PWM_SERVO_2_AF GPIO_AF2
|
#define PWM_SERVO_2_AF GPIO_AF2
|
||||||
@@ -258,7 +255,6 @@
|
|||||||
#if USE_PWM3
|
#if USE_PWM3
|
||||||
#define PWM_SERVO_3 3
|
#define PWM_SERVO_3 3
|
||||||
#define PWM_SERVO_3_TIMER TIM3
|
#define PWM_SERVO_3_TIMER TIM3
|
||||||
#define PWM_SERVO_3_RCC RCC_GPIOB
|
|
||||||
#define PWM_SERVO_3_GPIO GPIOB
|
#define PWM_SERVO_3_GPIO GPIOB
|
||||||
#define PWM_SERVO_3_PIN GPIO4
|
#define PWM_SERVO_3_PIN GPIO4
|
||||||
#define PWM_SERVO_3_AF GPIO_AF2
|
#define PWM_SERVO_3_AF GPIO_AF2
|
||||||
@@ -271,7 +267,6 @@
|
|||||||
#if USE_PWM4
|
#if USE_PWM4
|
||||||
#define PWM_SERVO_4 4
|
#define PWM_SERVO_4 4
|
||||||
#define PWM_SERVO_4_TIMER TIM4
|
#define PWM_SERVO_4_TIMER TIM4
|
||||||
#define PWM_SERVO_4_RCC RCC_GPIOB
|
|
||||||
#define PWM_SERVO_4_GPIO GPIOB
|
#define PWM_SERVO_4_GPIO GPIOB
|
||||||
#define PWM_SERVO_4_PIN GPIO7
|
#define PWM_SERVO_4_PIN GPIO7
|
||||||
#define PWM_SERVO_4_AF GPIO_AF2
|
#define PWM_SERVO_4_AF GPIO_AF2
|
||||||
@@ -284,7 +279,6 @@
|
|||||||
#if USE_PWM5
|
#if USE_PWM5
|
||||||
#define PWM_SERVO_5 5
|
#define PWM_SERVO_5 5
|
||||||
#define PWM_SERVO_5_TIMER TIM4
|
#define PWM_SERVO_5_TIMER TIM4
|
||||||
#define PWM_SERVO_5_RCC RCC_GPIOB
|
|
||||||
#define PWM_SERVO_5_GPIO GPIOB
|
#define PWM_SERVO_5_GPIO GPIOB
|
||||||
#define PWM_SERVO_5_PIN GPIO6
|
#define PWM_SERVO_5_PIN GPIO6
|
||||||
#define PWM_SERVO_5_AF GPIO_AF2
|
#define PWM_SERVO_5_AF GPIO_AF2
|
||||||
@@ -297,7 +291,6 @@
|
|||||||
#if USE_PWM6
|
#if USE_PWM6
|
||||||
#define PWM_SERVO_6 6
|
#define PWM_SERVO_6 6
|
||||||
#define PWM_SERVO_6_TIMER TIM5
|
#define PWM_SERVO_6_TIMER TIM5
|
||||||
#define PWM_SERVO_6_RCC RCC_GPIOA
|
|
||||||
#define PWM_SERVO_6_GPIO GPIOA
|
#define PWM_SERVO_6_GPIO GPIOA
|
||||||
#define PWM_SERVO_6_PIN GPIO3
|
#define PWM_SERVO_6_PIN GPIO3
|
||||||
#define PWM_SERVO_6_AF GPIO_AF2
|
#define PWM_SERVO_6_AF GPIO_AF2
|
||||||
@@ -310,7 +303,6 @@
|
|||||||
#if USE_PWM7
|
#if USE_PWM7
|
||||||
#define PWM_SERVO_7 7
|
#define PWM_SERVO_7 7
|
||||||
#define PWM_SERVO_7_TIMER TIM5
|
#define PWM_SERVO_7_TIMER TIM5
|
||||||
#define PWM_SERVO_7_RCC RCC_GPIOA
|
|
||||||
#define PWM_SERVO_7_GPIO GPIOA
|
#define PWM_SERVO_7_GPIO GPIOA
|
||||||
#define PWM_SERVO_7_PIN GPIO2
|
#define PWM_SERVO_7_PIN GPIO2
|
||||||
#define PWM_SERVO_7_AF GPIO_AF2
|
#define PWM_SERVO_7_AF GPIO_AF2
|
||||||
@@ -323,7 +315,6 @@
|
|||||||
#if USE_PWM8
|
#if USE_PWM8
|
||||||
#define PWM_SERVO_8 8
|
#define PWM_SERVO_8 8
|
||||||
#define PWM_SERVO_8_TIMER TIM5
|
#define PWM_SERVO_8_TIMER TIM5
|
||||||
#define PWM_SERVO_8_RCC RCC_GPIOA
|
|
||||||
#define PWM_SERVO_8_GPIO GPIOA
|
#define PWM_SERVO_8_GPIO GPIOA
|
||||||
#define PWM_SERVO_8_PIN GPIO1
|
#define PWM_SERVO_8_PIN GPIO1
|
||||||
#define PWM_SERVO_8_AF GPIO_AF2
|
#define PWM_SERVO_8_AF GPIO_AF2
|
||||||
@@ -336,7 +327,6 @@
|
|||||||
#if USE_PWM9
|
#if USE_PWM9
|
||||||
#define PWM_SERVO_9 9
|
#define PWM_SERVO_9 9
|
||||||
#define PWM_SERVO_9_TIMER TIM5
|
#define PWM_SERVO_9_TIMER TIM5
|
||||||
#define PWM_SERVO_9_RCC RCC_GPIOA
|
|
||||||
#define PWM_SERVO_9_GPIO GPIOA
|
#define PWM_SERVO_9_GPIO GPIOA
|
||||||
#define PWM_SERVO_9_PIN GPIO0
|
#define PWM_SERVO_9_PIN GPIO0
|
||||||
#define PWM_SERVO_9_AF GPIO_AF2
|
#define PWM_SERVO_9_AF GPIO_AF2
|
||||||
@@ -349,7 +339,6 @@
|
|||||||
#if USE_PWM10
|
#if USE_PWM10
|
||||||
#define PWM_SERVO_10 10
|
#define PWM_SERVO_10 10
|
||||||
#define PWM_SERVO_10_TIMER TIM2
|
#define PWM_SERVO_10_TIMER TIM2
|
||||||
#define PWM_SERVO_10_RCC RCC_GPIOB
|
|
||||||
#define PWM_SERVO_10_GPIO GPIOB
|
#define PWM_SERVO_10_GPIO GPIOB
|
||||||
#define PWM_SERVO_10_PIN GPIO3
|
#define PWM_SERVO_10_PIN GPIO3
|
||||||
#define PWM_SERVO_10_AF GPIO_AF1
|
#define PWM_SERVO_10_AF GPIO_AF1
|
||||||
|
|||||||
@@ -203,10 +203,9 @@
|
|||||||
#if USE_PWM1
|
#if USE_PWM1
|
||||||
#define PWM_SERVO_1 0
|
#define PWM_SERVO_1 0
|
||||||
#define PWM_SERVO_1_TIMER TIM3
|
#define PWM_SERVO_1_TIMER TIM3
|
||||||
#define PWM_SERVO_1_RCC RCC_GPIOC
|
|
||||||
#define PWM_SERVO_1_GPIO GPIOC
|
#define PWM_SERVO_1_GPIO GPIOC
|
||||||
#define PWM_SERVO_1_PIN GPIO6
|
#define PWM_SERVO_1_PIN GPIO6
|
||||||
#define PWM_SERVO_1_AF 0
|
#define PWM_SERVO_1_AF AFIO_MAPR_TIM3_REMAP_FULL_REMAP
|
||||||
#define PWM_SERVO_1_OC TIM_OC1
|
#define PWM_SERVO_1_OC TIM_OC1
|
||||||
#define PWM_SERVO_1_OC_BIT (1<<0)
|
#define PWM_SERVO_1_OC_BIT (1<<0)
|
||||||
#else
|
#else
|
||||||
@@ -216,10 +215,9 @@
|
|||||||
#if USE_PWM2
|
#if USE_PWM2
|
||||||
#define PWM_SERVO_2 1
|
#define PWM_SERVO_2 1
|
||||||
#define PWM_SERVO_2_TIMER TIM3
|
#define PWM_SERVO_2_TIMER TIM3
|
||||||
#define PWM_SERVO_2_RCC RCC_GPIOC
|
|
||||||
#define PWM_SERVO_2_GPIO GPIOC
|
#define PWM_SERVO_2_GPIO GPIOC
|
||||||
#define PWM_SERVO_2_PIN GPIO7
|
#define PWM_SERVO_2_PIN GPIO7
|
||||||
#define PWM_SERVO_2_AF 0
|
#define PWM_SERVO_2_AF AFIO_MAPR_TIM3_REMAP_FULL_REMAP
|
||||||
#define PWM_SERVO_2_OC TIM_OC2
|
#define PWM_SERVO_2_OC TIM_OC2
|
||||||
#define PWM_SERVO_2_OC_BIT (1<<1)
|
#define PWM_SERVO_2_OC_BIT (1<<1)
|
||||||
#else
|
#else
|
||||||
@@ -229,10 +227,9 @@
|
|||||||
#if USE_PWM3
|
#if USE_PWM3
|
||||||
#define PWM_SERVO_3 2
|
#define PWM_SERVO_3 2
|
||||||
#define PWM_SERVO_3_TIMER TIM3
|
#define PWM_SERVO_3_TIMER TIM3
|
||||||
#define PWM_SERVO_3_RCC RCC_GPIOC
|
|
||||||
#define PWM_SERVO_3_GPIO GPIOC
|
#define PWM_SERVO_3_GPIO GPIOC
|
||||||
#define PWM_SERVO_3_PIN GPIO8
|
#define PWM_SERVO_3_PIN GPIO8
|
||||||
#define PWM_SERVO_3_AF 0
|
#define PWM_SERVO_3_AF AFIO_MAPR_TIM3_REMAP_FULL_REMAP
|
||||||
#define PWM_SERVO_3_OC TIM_OC3
|
#define PWM_SERVO_3_OC TIM_OC3
|
||||||
#define PWM_SERVO_3_OC_BIT (1<<2)
|
#define PWM_SERVO_3_OC_BIT (1<<2)
|
||||||
#else
|
#else
|
||||||
@@ -242,10 +239,9 @@
|
|||||||
#if USE_PWM4
|
#if USE_PWM4
|
||||||
#define PWM_SERVO_4 3
|
#define PWM_SERVO_4 3
|
||||||
#define PWM_SERVO_4_TIMER TIM3
|
#define PWM_SERVO_4_TIMER TIM3
|
||||||
#define PWM_SERVO_4_RCC RCC_GPIOC
|
|
||||||
#define PWM_SERVO_4_GPIO GPIOC
|
#define PWM_SERVO_4_GPIO GPIOC
|
||||||
#define PWM_SERVO_4_PIN GPIO9
|
#define PWM_SERVO_4_PIN GPIO9
|
||||||
#define PWM_SERVO_4_AF 0
|
#define PWM_SERVO_4_AF AFIO_MAPR_TIM3_REMAP_FULL_REMAP
|
||||||
#define PWM_SERVO_4_OC TIM_OC4
|
#define PWM_SERVO_4_OC TIM_OC4
|
||||||
#define PWM_SERVO_4_OC_BIT (1<<3)
|
#define PWM_SERVO_4_OC_BIT (1<<3)
|
||||||
#else
|
#else
|
||||||
@@ -255,7 +251,6 @@
|
|||||||
#if USE_PWM5
|
#if USE_PWM5
|
||||||
#define PWM_SERVO_5 4
|
#define PWM_SERVO_5 4
|
||||||
#define PWM_SERVO_5_TIMER TIM4
|
#define PWM_SERVO_5_TIMER TIM4
|
||||||
#define PWM_SERVO_5_RCC RCC_GPIOB
|
|
||||||
#define PWM_SERVO_5_GPIO GPIOB
|
#define PWM_SERVO_5_GPIO GPIOB
|
||||||
#define PWM_SERVO_5_PIN GPIO8
|
#define PWM_SERVO_5_PIN GPIO8
|
||||||
#define PWM_SERVO_5_AF 0
|
#define PWM_SERVO_5_AF 0
|
||||||
@@ -268,12 +263,11 @@
|
|||||||
#if USE_PWM6
|
#if USE_PWM6
|
||||||
#define PWM_SERVO_6 5
|
#define PWM_SERVO_6 5
|
||||||
#define PWM_SERVO_6_TIMER TIM4
|
#define PWM_SERVO_6_TIMER TIM4
|
||||||
#define PWM_SERVO_6_RCC RCC_GPIOB
|
|
||||||
#define PWM_SERVO_6_GPIO GPIOB
|
#define PWM_SERVO_6_GPIO GPIOB
|
||||||
#define PWM_SERVO_6_PIN GPIO9
|
#define PWM_SERVO_6_PIN GPIO9
|
||||||
#define PWM_SERVO_6_AF 0
|
#define PWM_SERVO_6_AF 0
|
||||||
#define PWM_SERVO_6_OC TIM_OC4
|
#define PWM_SERVO_6_OC TIM_OC4
|
||||||
#define PWM_SERVO_6_OC_BIT (1<<4)
|
#define PWM_SERVO_6_OC_BIT (1<<3)
|
||||||
#else
|
#else
|
||||||
#define PWM_SERVO_6_OC_BIT 0
|
#define PWM_SERVO_6_OC_BIT 0
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -256,10 +256,9 @@
|
|||||||
#if USE_PWM1
|
#if USE_PWM1
|
||||||
#define PWM_SERVO_1 0
|
#define PWM_SERVO_1 0
|
||||||
#define PWM_SERVO_1_TIMER TIM3
|
#define PWM_SERVO_1_TIMER TIM3
|
||||||
#define PWM_SERVO_1_RCC RCC_GPIOC
|
|
||||||
#define PWM_SERVO_1_GPIO GPIOC
|
#define PWM_SERVO_1_GPIO GPIOC
|
||||||
#define PWM_SERVO_1_PIN GPIO6
|
#define PWM_SERVO_1_PIN GPIO6
|
||||||
#define PWM_SERVO_1_AF 0
|
#define PWM_SERVO_1_AF AFIO_MAPR_TIM3_REMAP_FULL_REMAP
|
||||||
#define PWM_SERVO_1_OC TIM_OC1
|
#define PWM_SERVO_1_OC TIM_OC1
|
||||||
#define PWM_SERVO_1_OC_BIT (1<<0)
|
#define PWM_SERVO_1_OC_BIT (1<<0)
|
||||||
#else
|
#else
|
||||||
@@ -269,10 +268,9 @@
|
|||||||
#if USE_PWM2
|
#if USE_PWM2
|
||||||
#define PWM_SERVO_2 1
|
#define PWM_SERVO_2 1
|
||||||
#define PWM_SERVO_2_TIMER TIM3
|
#define PWM_SERVO_2_TIMER TIM3
|
||||||
#define PWM_SERVO_2_RCC RCC_GPIOC
|
|
||||||
#define PWM_SERVO_2_GPIO GPIOC
|
#define PWM_SERVO_2_GPIO GPIOC
|
||||||
#define PWM_SERVO_2_PIN GPIO7
|
#define PWM_SERVO_2_PIN GPIO7
|
||||||
#define PWM_SERVO_2_AF 0
|
#define PWM_SERVO_2_AF AFIO_MAPR_TIM3_REMAP_FULL_REMAP
|
||||||
#define PWM_SERVO_2_OC TIM_OC2
|
#define PWM_SERVO_2_OC TIM_OC2
|
||||||
#define PWM_SERVO_2_OC_BIT (1<<1)
|
#define PWM_SERVO_2_OC_BIT (1<<1)
|
||||||
#else
|
#else
|
||||||
@@ -282,10 +280,9 @@
|
|||||||
#if USE_PWM3
|
#if USE_PWM3
|
||||||
#define PWM_SERVO_3 2
|
#define PWM_SERVO_3 2
|
||||||
#define PWM_SERVO_3_TIMER TIM3
|
#define PWM_SERVO_3_TIMER TIM3
|
||||||
#define PWM_SERVO_3_RCC RCC_GPIOC
|
|
||||||
#define PWM_SERVO_3_GPIO GPIOC
|
#define PWM_SERVO_3_GPIO GPIOC
|
||||||
#define PWM_SERVO_3_PIN GPIO8
|
#define PWM_SERVO_3_PIN GPIO8
|
||||||
#define PWM_SERVO_3_AF 0
|
#define PWM_SERVO_3_AF AFIO_MAPR_TIM3_REMAP_FULL_REMAP
|
||||||
#define PWM_SERVO_3_OC TIM_OC3
|
#define PWM_SERVO_3_OC TIM_OC3
|
||||||
#define PWM_SERVO_3_OC_BIT (1<<2)
|
#define PWM_SERVO_3_OC_BIT (1<<2)
|
||||||
#else
|
#else
|
||||||
@@ -295,10 +292,9 @@
|
|||||||
#if USE_PWM4
|
#if USE_PWM4
|
||||||
#define PWM_SERVO_4 3
|
#define PWM_SERVO_4 3
|
||||||
#define PWM_SERVO_4_TIMER TIM3
|
#define PWM_SERVO_4_TIMER TIM3
|
||||||
#define PWM_SERVO_4_RCC RCC_GPIOC
|
|
||||||
#define PWM_SERVO_4_GPIO GPIOC
|
#define PWM_SERVO_4_GPIO GPIOC
|
||||||
#define PWM_SERVO_4_PIN GPIO9
|
#define PWM_SERVO_4_PIN GPIO9
|
||||||
#define PWM_SERVO_4_AF 0
|
#define PWM_SERVO_4_AF AFIO_MAPR_TIM3_REMAP_FULL_REMAP
|
||||||
#define PWM_SERVO_4_OC TIM_OC4
|
#define PWM_SERVO_4_OC TIM_OC4
|
||||||
#define PWM_SERVO_4_OC_BIT (1<<3)
|
#define PWM_SERVO_4_OC_BIT (1<<3)
|
||||||
#else
|
#else
|
||||||
@@ -308,7 +304,6 @@
|
|||||||
#if USE_PWM5
|
#if USE_PWM5
|
||||||
#define PWM_SERVO_5 4
|
#define PWM_SERVO_5 4
|
||||||
#define PWM_SERVO_5_TIMER TIM5
|
#define PWM_SERVO_5_TIMER TIM5
|
||||||
#define PWM_SERVO_5_RCC RCC_GPIOA
|
|
||||||
#define PWM_SERVO_5_GPIO GPIOA
|
#define PWM_SERVO_5_GPIO GPIOA
|
||||||
#define PWM_SERVO_5_PIN GPIO0
|
#define PWM_SERVO_5_PIN GPIO0
|
||||||
#define PWM_SERVO_5_AF 0
|
#define PWM_SERVO_5_AF 0
|
||||||
@@ -333,7 +328,6 @@
|
|||||||
#if USE_PWM6
|
#if USE_PWM6
|
||||||
#define PWM_SERVO_6 5
|
#define PWM_SERVO_6 5
|
||||||
#define PWM_SERVO_6_TIMER TIM5
|
#define PWM_SERVO_6_TIMER TIM5
|
||||||
#define PWM_SERVO_6_RCC RCC_GPIOA
|
|
||||||
#define PWM_SERVO_6_GPIO GPIOA
|
#define PWM_SERVO_6_GPIO GPIOA
|
||||||
#define PWM_SERVO_6_PIN GPIO1
|
#define PWM_SERVO_6_PIN GPIO1
|
||||||
#define PWM_SERVO_6_AF 0
|
#define PWM_SERVO_6_AF 0
|
||||||
@@ -363,7 +357,6 @@
|
|||||||
#if USE_PWM7
|
#if USE_PWM7
|
||||||
#define PWM_SERVO_7 6
|
#define PWM_SERVO_7 6
|
||||||
#define PWM_SERVO_7_TIMER TIM4
|
#define PWM_SERVO_7_TIMER TIM4
|
||||||
#define PWM_SERVO_7_RCC RCC_GPIOB
|
|
||||||
#define PWM_SERVO_7_GPIO GPIOB
|
#define PWM_SERVO_7_GPIO GPIOB
|
||||||
#define PWM_SERVO_7_PIN GPIO6
|
#define PWM_SERVO_7_PIN GPIO6
|
||||||
#define PWM_SERVO_7_AF 0
|
#define PWM_SERVO_7_AF 0
|
||||||
@@ -376,7 +369,6 @@
|
|||||||
#if USE_PWM8
|
#if USE_PWM8
|
||||||
#define PWM_SERVO_8 7
|
#define PWM_SERVO_8 7
|
||||||
#define PWM_SERVO_8_TIMER TIM4
|
#define PWM_SERVO_8_TIMER TIM4
|
||||||
#define PWM_SERVO_8_RCC RCC_GPIOB
|
|
||||||
#define PWM_SERVO_8_GPIO GPIOB
|
#define PWM_SERVO_8_GPIO GPIOB
|
||||||
#define PWM_SERVO_8_PIN GPIO7
|
#define PWM_SERVO_8_PIN GPIO7
|
||||||
#define PWM_SERVO_8_AF 0
|
#define PWM_SERVO_8_AF 0
|
||||||
|
|||||||
@@ -382,7 +382,6 @@
|
|||||||
#if USE_PWM1
|
#if USE_PWM1
|
||||||
#define PWM_SERVO_1 0
|
#define PWM_SERVO_1 0
|
||||||
#define PWM_SERVO_1_TIMER TIM3
|
#define PWM_SERVO_1_TIMER TIM3
|
||||||
#define PWM_SERVO_1_RCC RCC_GPIOC
|
|
||||||
#define PWM_SERVO_1_GPIO GPIOC
|
#define PWM_SERVO_1_GPIO GPIOC
|
||||||
#define PWM_SERVO_1_PIN GPIO6
|
#define PWM_SERVO_1_PIN GPIO6
|
||||||
#define PWM_SERVO_1_AF GPIO_AF2
|
#define PWM_SERVO_1_AF GPIO_AF2
|
||||||
@@ -395,7 +394,6 @@
|
|||||||
#if USE_PWM2
|
#if USE_PWM2
|
||||||
#define PWM_SERVO_2 1
|
#define PWM_SERVO_2 1
|
||||||
#define PWM_SERVO_2_TIMER TIM3
|
#define PWM_SERVO_2_TIMER TIM3
|
||||||
#define PWM_SERVO_2_RCC RCC_GPIOC
|
|
||||||
#define PWM_SERVO_2_GPIO GPIOC
|
#define PWM_SERVO_2_GPIO GPIOC
|
||||||
#define PWM_SERVO_2_PIN GPIO7
|
#define PWM_SERVO_2_PIN GPIO7
|
||||||
#define PWM_SERVO_2_AF GPIO_AF2
|
#define PWM_SERVO_2_AF GPIO_AF2
|
||||||
@@ -408,7 +406,6 @@
|
|||||||
#if USE_PWM3
|
#if USE_PWM3
|
||||||
#define PWM_SERVO_3 2
|
#define PWM_SERVO_3 2
|
||||||
#define PWM_SERVO_3_TIMER TIM3
|
#define PWM_SERVO_3_TIMER TIM3
|
||||||
#define PWM_SERVO_3_RCC RCC_GPIOC
|
|
||||||
#define PWM_SERVO_3_GPIO GPIOC
|
#define PWM_SERVO_3_GPIO GPIOC
|
||||||
#define PWM_SERVO_3_PIN GPIO8
|
#define PWM_SERVO_3_PIN GPIO8
|
||||||
#define PWM_SERVO_3_AF GPIO_AF2
|
#define PWM_SERVO_3_AF GPIO_AF2
|
||||||
@@ -421,7 +418,6 @@
|
|||||||
#if USE_PWM4
|
#if USE_PWM4
|
||||||
#define PWM_SERVO_4 3
|
#define PWM_SERVO_4 3
|
||||||
#define PWM_SERVO_4_TIMER TIM3
|
#define PWM_SERVO_4_TIMER TIM3
|
||||||
#define PWM_SERVO_4_RCC RCC_GPIOC
|
|
||||||
#define PWM_SERVO_4_GPIO GPIOC
|
#define PWM_SERVO_4_GPIO GPIOC
|
||||||
#define PWM_SERVO_4_PIN GPIO9
|
#define PWM_SERVO_4_PIN GPIO9
|
||||||
#define PWM_SERVO_4_AF GPIO_AF2
|
#define PWM_SERVO_4_AF GPIO_AF2
|
||||||
@@ -434,7 +430,6 @@
|
|||||||
#if USE_PWM5
|
#if USE_PWM5
|
||||||
#define PWM_SERVO_5 4
|
#define PWM_SERVO_5 4
|
||||||
#define PWM_SERVO_5_TIMER TIM5
|
#define PWM_SERVO_5_TIMER TIM5
|
||||||
#define PWM_SERVO_5_RCC RCC_GPIOA
|
|
||||||
#define PWM_SERVO_5_GPIO GPIOA
|
#define PWM_SERVO_5_GPIO GPIOA
|
||||||
#define PWM_SERVO_5_PIN GPIO0
|
#define PWM_SERVO_5_PIN GPIO0
|
||||||
#define PWM_SERVO_5_AF GPIO_AF2
|
#define PWM_SERVO_5_AF GPIO_AF2
|
||||||
@@ -447,7 +442,6 @@
|
|||||||
#if USE_PWM6
|
#if USE_PWM6
|
||||||
#define PWM_SERVO_6 5
|
#define PWM_SERVO_6 5
|
||||||
#define PWM_SERVO_6_TIMER TIM5
|
#define PWM_SERVO_6_TIMER TIM5
|
||||||
#define PWM_SERVO_6_RCC RCC_GPIOA
|
|
||||||
#define PWM_SERVO_6_GPIO GPIOA
|
#define PWM_SERVO_6_GPIO GPIOA
|
||||||
#define PWM_SERVO_6_PIN GPIO1
|
#define PWM_SERVO_6_PIN GPIO1
|
||||||
#define PWM_SERVO_6_AF GPIO_AF2
|
#define PWM_SERVO_6_AF GPIO_AF2
|
||||||
@@ -460,7 +454,6 @@
|
|||||||
#if USE_PWM7
|
#if USE_PWM7
|
||||||
#define PWM_SERVO_7 6
|
#define PWM_SERVO_7 6
|
||||||
#define PWM_SERVO_7_TIMER TIM4
|
#define PWM_SERVO_7_TIMER TIM4
|
||||||
#define PWM_SERVO_7_RCC RCC_GPIOB
|
|
||||||
#define PWM_SERVO_7_GPIO GPIOB
|
#define PWM_SERVO_7_GPIO GPIOB
|
||||||
#define PWM_SERVO_7_PIN GPIO6
|
#define PWM_SERVO_7_PIN GPIO6
|
||||||
#define PWM_SERVO_7_AF GPIO_AF2
|
#define PWM_SERVO_7_AF GPIO_AF2
|
||||||
@@ -473,7 +466,6 @@
|
|||||||
#if USE_PWM8
|
#if USE_PWM8
|
||||||
#define PWM_SERVO_8 7
|
#define PWM_SERVO_8 7
|
||||||
#define PWM_SERVO_8_TIMER TIM4
|
#define PWM_SERVO_8_TIMER TIM4
|
||||||
#define PWM_SERVO_8_RCC RCC_GPIOB
|
|
||||||
#define PWM_SERVO_8_GPIO GPIOB
|
#define PWM_SERVO_8_GPIO GPIOB
|
||||||
#define PWM_SERVO_8_PIN GPIO7
|
#define PWM_SERVO_8_PIN GPIO7
|
||||||
#define PWM_SERVO_8_AF GPIO_AF2
|
#define PWM_SERVO_8_AF GPIO_AF2
|
||||||
|
|||||||
@@ -315,7 +315,6 @@
|
|||||||
#if USE_PWM1
|
#if USE_PWM1
|
||||||
#define PWM_SERVO_1 4
|
#define PWM_SERVO_1 4
|
||||||
#define PWM_SERVO_1_TIMER TIM4
|
#define PWM_SERVO_1_TIMER TIM4
|
||||||
#define PWM_SERVO_1_RCC RCC_GPIOB
|
|
||||||
#define PWM_SERVO_1_GPIO GPIOB
|
#define PWM_SERVO_1_GPIO GPIOB
|
||||||
#define PWM_SERVO_1_PIN GPIO6
|
#define PWM_SERVO_1_PIN GPIO6
|
||||||
#define PWM_SERVO_1_AF 0
|
#define PWM_SERVO_1_AF 0
|
||||||
@@ -328,7 +327,6 @@
|
|||||||
#if USE_PWM2
|
#if USE_PWM2
|
||||||
#define PWM_SERVO_2 5
|
#define PWM_SERVO_2 5
|
||||||
#define PWM_SERVO_2_TIMER TIM4
|
#define PWM_SERVO_2_TIMER TIM4
|
||||||
#define PWM_SERVO_2_RCC RCC_GPIOB
|
|
||||||
#define PWM_SERVO_2_GPIO GPIOB
|
#define PWM_SERVO_2_GPIO GPIOB
|
||||||
#define PWM_SERVO_2_PIN GPIO7
|
#define PWM_SERVO_2_PIN GPIO7
|
||||||
#define PWM_SERVO_2_AF 0
|
#define PWM_SERVO_2_AF 0
|
||||||
@@ -341,7 +339,6 @@
|
|||||||
#if USE_PWM3
|
#if USE_PWM3
|
||||||
#define PWM_SERVO_3 0
|
#define PWM_SERVO_3 0
|
||||||
#define PWM_SERVO_3_TIMER TIM4
|
#define PWM_SERVO_3_TIMER TIM4
|
||||||
#define PWM_SERVO_3_RCC RCC_GPIOB
|
|
||||||
#define PWM_SERVO_3_GPIO GPIOB
|
#define PWM_SERVO_3_GPIO GPIOB
|
||||||
#define PWM_SERVO_3_PIN GPIO8
|
#define PWM_SERVO_3_PIN GPIO8
|
||||||
#define PWM_SERVO_3_AF 0
|
#define PWM_SERVO_3_AF 0
|
||||||
@@ -354,7 +351,6 @@
|
|||||||
#if USE_PWM4
|
#if USE_PWM4
|
||||||
#define PWM_SERVO_4 1
|
#define PWM_SERVO_4 1
|
||||||
#define PWM_SERVO_4_TIMER TIM4
|
#define PWM_SERVO_4_TIMER TIM4
|
||||||
#define PWM_SERVO_4_RCC RCC_GPIOB
|
|
||||||
#define PWM_SERVO_4_GPIO GPIOB
|
#define PWM_SERVO_4_GPIO GPIOB
|
||||||
#define PWM_SERVO_4_PIN GPIO9
|
#define PWM_SERVO_4_PIN GPIO9
|
||||||
#define PWM_SERVO_4_AF 0
|
#define PWM_SERVO_4_AF 0
|
||||||
@@ -367,7 +363,6 @@
|
|||||||
#if USE_PWM5
|
#if USE_PWM5
|
||||||
#define PWM_SERVO_5 2
|
#define PWM_SERVO_5 2
|
||||||
#define PWM_SERVO_5_TIMER TIM5
|
#define PWM_SERVO_5_TIMER TIM5
|
||||||
#define PWM_SERVO_5_RCC RCC_GPIOA
|
|
||||||
#define PWM_SERVO_5_GPIO GPIOA
|
#define PWM_SERVO_5_GPIO GPIOA
|
||||||
#define PWM_SERVO_5_PIN GPIO0
|
#define PWM_SERVO_5_PIN GPIO0
|
||||||
#define PWM_SERVO_5_AF 0
|
#define PWM_SERVO_5_AF 0
|
||||||
@@ -392,7 +387,6 @@
|
|||||||
#if USE_PWM6
|
#if USE_PWM6
|
||||||
#define PWM_SERVO_6 3
|
#define PWM_SERVO_6 3
|
||||||
#define PWM_SERVO_6_TIMER TIM5
|
#define PWM_SERVO_6_TIMER TIM5
|
||||||
#define PWM_SERVO_6_RCC RCC_GPIOA
|
|
||||||
#define PWM_SERVO_6_GPIO GPIOA
|
#define PWM_SERVO_6_GPIO GPIOA
|
||||||
#define PWM_SERVO_6_PIN GPIO1
|
#define PWM_SERVO_6_PIN GPIO1
|
||||||
#define PWM_SERVO_6_AF 0
|
#define PWM_SERVO_6_AF 0
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 Freek van Tienen <freek.v.tienen@gmail.com>
|
||||||
|
*
|
||||||
|
* This file is part of paparazzi.
|
||||||
|
*
|
||||||
|
* paparazzi is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* paparazzi is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with paparazzi; see the file COPYING. If not, write to
|
||||||
|
* the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @file boards/navstik/baro_board.c
|
||||||
|
* Baro board interface for Bosch BMP185 on Navstik I2C3 without EOC check.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "std.h"
|
||||||
|
|
||||||
|
#include "subsystems/sensors/baro.h"
|
||||||
|
#include "peripherals/bmp085.h"
|
||||||
|
#include "peripherals/bmp085_regs.h"
|
||||||
|
#include <libopencm3/stm32/gpio.h>
|
||||||
|
#include "subsystems/abi.h"
|
||||||
|
|
||||||
|
#include "led.h"
|
||||||
|
|
||||||
|
|
||||||
|
struct Bmp085 baro_bmp085;
|
||||||
|
|
||||||
|
void baro_init(void) {
|
||||||
|
bmp085_init(&baro_bmp085, &i2c3, BMP085_SLAVE_ADDR);
|
||||||
|
|
||||||
|
#ifdef BARO_LED
|
||||||
|
LED_OFF(BARO_LED);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void baro_periodic(void) {
|
||||||
|
if (baro_bmp085.initialized) {
|
||||||
|
bmp085_periodic(&baro_bmp085);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bmp085_read_eeprom_calib(&baro_bmp085);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void baro_event(void) {
|
||||||
|
bmp085_event(&baro_bmp085);
|
||||||
|
|
||||||
|
if (baro_bmp085.data_available) {
|
||||||
|
float pressure = (float)baro_bmp085.pressure;
|
||||||
|
AbiSendMsgBARO_ABS(BARO_BOARD_SENDER_ID, &pressure);
|
||||||
|
baro_bmp085.data_available = FALSE;
|
||||||
|
#ifdef BARO_LED
|
||||||
|
RunOnceEvery(10,LED_TOGGLE(BARO_LED));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 Freek van Tienen <freek.v.tienen@gmail.com>
|
||||||
|
*
|
||||||
|
* This file is part of paparazzi.
|
||||||
|
*
|
||||||
|
* paparazzi is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* paparazzi is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with paparazzi; see the file COPYING. If not, write to
|
||||||
|
* the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* board specific functions for the navstik board
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BOARDS_NAVSTIK_BARO_H
|
||||||
|
#define BOARDS_NAVSTIK_BARO_H
|
||||||
|
|
||||||
|
// only for printing the baro type during compilation
|
||||||
|
#ifndef BARO_BOARD
|
||||||
|
#define BARO_BOARD BARO_BOARD_BMP085
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern void baro_event(void);
|
||||||
|
#define BaroEvent baro_event
|
||||||
|
|
||||||
|
#endif /* BOARDS_NAVSTIK_BARO_H */
|
||||||
@@ -0,0 +1,320 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 Freek van Tienen <freek.v.tienen@gmail.com>
|
||||||
|
*
|
||||||
|
* This file is part of paparazzi.
|
||||||
|
*
|
||||||
|
* paparazzi is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* paparazzi is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with paparazzi; see the file COPYING. If not, write to
|
||||||
|
* the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CONFIG_NAVSTIK_1_0_H
|
||||||
|
#define CONFIG_NAVSTIK_1_0_H
|
||||||
|
|
||||||
|
/* Navstik has a 12MHz external clock and 168MHz internal. */
|
||||||
|
#define EXT_CLK 25000000
|
||||||
|
#define AHB_CLK 168000000
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Onboard LEDs
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* red, on PA8 */
|
||||||
|
#ifndef USE_LED_1
|
||||||
|
#define USE_LED_1 1
|
||||||
|
#endif
|
||||||
|
#define LED_1_GPIO GPIOC
|
||||||
|
#define LED_1_GPIO_PIN GPIO4
|
||||||
|
#define LED_1_GPIO_ON gpio_set
|
||||||
|
#define LED_1_GPIO_OFF gpio_clear
|
||||||
|
#define LED_1_AFIO_REMAP ((void)0)
|
||||||
|
|
||||||
|
/* green, shared with JTAG_TRST */
|
||||||
|
#ifndef USE_LED_2
|
||||||
|
#define USE_LED_2 1
|
||||||
|
#endif
|
||||||
|
#define LED_2_GPIO GPIOC
|
||||||
|
#define LED_2_GPIO_PIN GPIO5
|
||||||
|
#define LED_2_GPIO_ON gpio_set
|
||||||
|
#define LED_2_GPIO_OFF gpio_clear
|
||||||
|
#define LED_2_AFIO_REMAP ((void)0)
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* not actual LEDS, used as GPIOs
|
||||||
|
*/
|
||||||
|
#define GPS_POWER_GPIO GPIOA,GPIO4
|
||||||
|
#define IMU_POWER_GPIO GPIOC,GPIO15
|
||||||
|
|
||||||
|
/* Default actuators driver */
|
||||||
|
#define DEFAULT_ACTUATORS "subsystems/actuators/actuators_pwm.h"
|
||||||
|
#define ActuatorDefaultSet(_x,_y) ActuatorPwmSet(_x,_y)
|
||||||
|
#define ActuatorsDefaultInit() ActuatorsPwmInit()
|
||||||
|
#define ActuatorsDefaultCommit() ActuatorsPwmCommit()
|
||||||
|
|
||||||
|
|
||||||
|
/* UART */
|
||||||
|
#define UART1_GPIO_AF GPIO_AF7
|
||||||
|
#define UART1_GPIO_PORT_RX GPIOB
|
||||||
|
#define UART1_GPIO_RX GPIO7
|
||||||
|
#define UART1_GPIO_PORT_TX GPIOB
|
||||||
|
#define UART1_GPIO_TX GPIO6
|
||||||
|
|
||||||
|
#define UART2_GPIO_AF GPIO_AF7
|
||||||
|
#define UART2_GPIO_PORT_RX GPIOA
|
||||||
|
#define UART2_GPIO_RX GPIO3
|
||||||
|
#define UART2_GPIO_PORT_TX GPIOA
|
||||||
|
#define UART2_GPIO_TX GPIO2
|
||||||
|
|
||||||
|
#define UART5_GPIO_AF GPIO_AF8
|
||||||
|
#define UART5_GPIO_PORT_RX GPIOD
|
||||||
|
#define UART5_GPIO_RX GPIO2
|
||||||
|
#define UART5_GPIO_PORT_TX GPIOC
|
||||||
|
#define UART5_GPIO_TX GPIO12
|
||||||
|
|
||||||
|
#define UART6_GPIO_AF GPIO_AF8
|
||||||
|
#define UART6_GPIO_PORT_RX GPIOC
|
||||||
|
#define UART6_GPIO_RX GPIO7
|
||||||
|
#define UART6_GPIO_PORT_TX GPIOC
|
||||||
|
#define UART6_GPIO_TX GPIO6
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Spektrum
|
||||||
|
*/
|
||||||
|
/* The line that is pulled low at power up to initiate the bind process */
|
||||||
|
#define SPEKTRUM_BIND_PIN GPIO6
|
||||||
|
#define SPEKTRUM_BIND_PIN_PORT GPIOC
|
||||||
|
#define SPEKTRUM_BIND_PIN_HIGH 1
|
||||||
|
|
||||||
|
#define SPEKTRUM_UART6_RCC RCC_USART6
|
||||||
|
#define SPEKTRUM_UART6_BANK GPIOC
|
||||||
|
#define SPEKTRUM_UART6_PIN GPIO7
|
||||||
|
#define SPEKTRUM_UART6_AF GPIO_AF8
|
||||||
|
#define SPEKTRUM_UART6_IRQ NVIC_USART6_IRQ
|
||||||
|
#define SPEKTRUM_UART6_ISR usart6_isr
|
||||||
|
#define SPEKTRUM_UART6_DEV USART6
|
||||||
|
|
||||||
|
/*
|
||||||
|
* PPM
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* input on PC6 (Spektrum Tx) */
|
||||||
|
#define USE_PPM_TIM8 8
|
||||||
|
#define PPM_CHANNEL TIM_IC3
|
||||||
|
#define PPM_TIMER_INPUT TIM_IC_IN_TI2
|
||||||
|
#define PPM_IRQ NVIC_TIM3_CC_IRQ
|
||||||
|
#define PPM_IRQ2 NVIC_TIM1_UP_TIM10_IRQ
|
||||||
|
// Capture/Compare InteruptEnable and InterruptFlag
|
||||||
|
#define PPM_CC_IE TIM_DIER_CC2IE
|
||||||
|
#define PPM_CC_IF TIM_SR_CC2IF
|
||||||
|
#define PPM_GPIO_PORT GPIOC
|
||||||
|
#define PPM_GPIO_PIN GPIO7
|
||||||
|
#define PPM_GPIO_AF GPIO_AF8
|
||||||
|
|
||||||
|
/* SPI */
|
||||||
|
#define SPI1_GPIO_AF GPIO_AF5
|
||||||
|
#define SPI1_GPIO_PORT_MISO GPIOA
|
||||||
|
#define SPI1_GPIO_MISO GPIO6
|
||||||
|
#define SPI1_GPIO_PORT_MOSI GPIOA
|
||||||
|
#define SPI1_GPIO_MOSI GPIO7
|
||||||
|
#define SPI1_GPIO_PORT_SCK GPIOA
|
||||||
|
#define SPI1_GPIO_SCK GPIO5
|
||||||
|
|
||||||
|
#define SPI2_GPIO_AF GPIO_AF5
|
||||||
|
#define SPI2_GPIO_PORT_MISO GPIOB
|
||||||
|
#define SPI2_GPIO_MISO GPIO14
|
||||||
|
#define SPI2_GPIO_PORT_MOSI GPIOB
|
||||||
|
#define SPI2_GPIO_MOSI GPIO15
|
||||||
|
#define SPI2_GPIO_PORT_SCK GPIOB
|
||||||
|
#define SPI2_GPIO_SCK GPIO13
|
||||||
|
|
||||||
|
#define SPI_SELECT_SLAVE0_PORT GPIOA
|
||||||
|
#define SPI_SELECT_SLAVE0_PIN GPIO15
|
||||||
|
|
||||||
|
#define SPI_SELECT_SLAVE1_PORT GPIOA
|
||||||
|
#define SPI_SELECT_SLAVE1_PIN GPIO4
|
||||||
|
|
||||||
|
#define SPI_SELECT_SLAVE2_PORT GPIOB
|
||||||
|
#define SPI_SELECT_SLAVE2_PIN GPIO12
|
||||||
|
|
||||||
|
#define SPI_SELECT_SLAVE3_PORT GPIOC
|
||||||
|
#define SPI_SELECT_SLAVE3_PIN GPIO13
|
||||||
|
|
||||||
|
#define SPI_SELECT_SLAVE4_PORT GPIOC
|
||||||
|
#define SPI_SELECT_SLAVE4_PIN GPIO12
|
||||||
|
|
||||||
|
#define SPI_SELECT_SLAVE5_PORT GPIOC
|
||||||
|
#define SPI_SELECT_SLAVE5_PIN GPIO4
|
||||||
|
|
||||||
|
|
||||||
|
/* I2C mapping */
|
||||||
|
#define I2C1_GPIO_PORT GPIOB
|
||||||
|
#define I2C1_GPIO_SCL GPIO8
|
||||||
|
#define I2C1_GPIO_SDA GPIO9
|
||||||
|
|
||||||
|
#define I2C3_GPIO_PORT_SCL GPIOA
|
||||||
|
#define I2C3_GPIO_SCL GPIO8
|
||||||
|
#define I2C3_GPIO_PORT_SDA GPIOC
|
||||||
|
#define I2C3_GPIO_SDA GPIO9
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ADC
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Onboard ADCs */
|
||||||
|
/*
|
||||||
|
BATT_volt PC1/ADC123 (ADC123_IN11)
|
||||||
|
BATT_current PA1/ADC123 (ADC123_IN1)
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Internal ADC for battery enabled by default
|
||||||
|
#ifndef USE_ADC_1
|
||||||
|
#define USE_ADC_1 1
|
||||||
|
#endif
|
||||||
|
#if USE_ADC_1
|
||||||
|
#define AD1_1_CHANNEL 11
|
||||||
|
#define ADC_1 AD1_1
|
||||||
|
#define ADC_1_GPIO_PORT GPIOC
|
||||||
|
#define ADC_1_GPIO_PIN GPIO1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef USE_ADC_2
|
||||||
|
#define USE_ADC_2 1
|
||||||
|
#endif
|
||||||
|
#if USE_ADC_2
|
||||||
|
#define AD1_2_CHANNEL 1
|
||||||
|
#define ADC_2 AD1_2
|
||||||
|
#define ADC_2_GPIO_PORT GPIOA
|
||||||
|
#define ADC_2_GPIO_PIN GPIO1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* allow to define ADC_CHANNEL_VSUPPLY and ADC_CHANNEL_CURRENT in the airframe file*/
|
||||||
|
#ifndef ADC_CHANNEL_VSUPPLY
|
||||||
|
#define ADC_CHANNEL_VSUPPLY ADC_1
|
||||||
|
#endif
|
||||||
|
#ifndef ADC_CHANNEL_CURRENT
|
||||||
|
#define ADC_CHANNEL_CURRENT ADC_2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define DefaultVoltageOfAdc(adc) (0.00382*adc)
|
||||||
|
#define DefaultMilliAmpereOfAdc(adc) (0.42497*adc)
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* PWM
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define PWM_USE_TIM1 1
|
||||||
|
#define PWM_USE_TIM2 2
|
||||||
|
#define PWM_USE_TIM3 3
|
||||||
|
#define PWM_USE_TIM8 8
|
||||||
|
|
||||||
|
#define USE_PWM1 1
|
||||||
|
#define USE_PWM2 1
|
||||||
|
#define USE_PWM3 1
|
||||||
|
#define USE_PWM4 1
|
||||||
|
#define USE_PWM5 1
|
||||||
|
#define USE_PWM6 1
|
||||||
|
|
||||||
|
|
||||||
|
// PWM_SERVO_x is the index of the servo in the actuators_pwm_values array
|
||||||
|
#if USE_PWM1
|
||||||
|
#define PWM_SERVO_1 0
|
||||||
|
#define PWM_SERVO_1_TIMER TIM3
|
||||||
|
#define PWM_SERVO_1_GPIO GPIOB
|
||||||
|
#define PWM_SERVO_1_PIN GPIO5
|
||||||
|
#define PWM_SERVO_1_AF GPIO_AF2
|
||||||
|
#define PWM_SERVO_1_OC TIM_OC2
|
||||||
|
#define PWM_SERVO_1_OC_BIT (1<<1)
|
||||||
|
#else
|
||||||
|
#define PWM_SERVO_1_OC_BIT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if USE_PWM2
|
||||||
|
#define PWM_SERVO_2 1
|
||||||
|
#define PWM_SERVO_2_TIMER TIM1
|
||||||
|
#define PWM_SERVO_2_GPIO GPIOA
|
||||||
|
#define PWM_SERVO_2_PIN GPIO10
|
||||||
|
#define PWM_SERVO_2_AF GPIO_AF1
|
||||||
|
#define PWM_SERVO_2_OC TIM_OC3
|
||||||
|
#define PWM_SERVO_2_OC_BIT (1<<2)
|
||||||
|
#else
|
||||||
|
#define PWM_SERVO_2_OC_BIT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if USE_PWM3
|
||||||
|
#define PWM_SERVO_3 2
|
||||||
|
#define PWM_SERVO_3_TIMER TIM8
|
||||||
|
#define PWM_SERVO_3_GPIO GPIOC
|
||||||
|
#define PWM_SERVO_3_PIN GPIO8
|
||||||
|
#define PWM_SERVO_3_AF GPIO_AF3
|
||||||
|
#define PWM_SERVO_3_OC TIM_OC3
|
||||||
|
#define PWM_SERVO_3_OC_BIT (1<<2)
|
||||||
|
#else
|
||||||
|
#define PWM_SERVO_3_OC_BIT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if USE_PWM4
|
||||||
|
#define PWM_SERVO_4 3
|
||||||
|
#define PWM_SERVO_4_TIMER TIM2
|
||||||
|
#define PWM_SERVO_4_GPIO GPIOB
|
||||||
|
#define PWM_SERVO_4_PIN GPIO11
|
||||||
|
#define PWM_SERVO_4_AF GPIO_AF1
|
||||||
|
#define PWM_SERVO_4_OC TIM_OC4
|
||||||
|
#define PWM_SERVO_4_OC_BIT (1<<3)
|
||||||
|
#else
|
||||||
|
#define PWM_SERVO_4_OC_BIT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if USE_PWM5
|
||||||
|
#define PWM_SERVO_5 4
|
||||||
|
#define PWM_SERVO_5_TIMER TIM3
|
||||||
|
#define PWM_SERVO_5_GPIO GPIOB
|
||||||
|
#define PWM_SERVO_5_PIN GPIO1
|
||||||
|
#define PWM_SERVO_5_AF GPIO_AF2
|
||||||
|
#define PWM_SERVO_5_OC TIM_OC4
|
||||||
|
#define PWM_SERVO_5_OC_BIT (1<<3)
|
||||||
|
#else
|
||||||
|
#define PWM_SERVO_5_OC_BIT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if USE_PWM6
|
||||||
|
#define PWM_SERVO_6 5
|
||||||
|
#define PWM_SERVO_6_TIMER TIM3
|
||||||
|
#define PWM_SERVO_6_GPIO GPIOB
|
||||||
|
#define PWM_SERVO_6_PIN GPIO0
|
||||||
|
#define PWM_SERVO_6_AF GPIO_AF2
|
||||||
|
#define PWM_SERVO_6_OC TIM_OC3
|
||||||
|
#define PWM_SERVO_6_OC_BIT (1<<2)
|
||||||
|
#else
|
||||||
|
#define PWM_SERVO_6_OC_BIT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* servo 2 on TIM1 */
|
||||||
|
#define PWM_TIM1_CHAN_MASK (PWM_SERVO_2_OC_BIT)
|
||||||
|
/* servo 4 on TIM2 */
|
||||||
|
#define PWM_TIM2_CHAN_MASK (PWM_SERVO_4_OC_BIT)
|
||||||
|
/* servos 1,5,6 on TIM3 */
|
||||||
|
#define PWM_TIM3_CHAN_MASK (PWM_SERVO_1_OC_BIT|PWM_SERVO_5_OC_BIT|PWM_SERVO_6_OC_BIT)
|
||||||
|
/* servo 3 on TIM8 */
|
||||||
|
#define PWM_TIM8_CHAN_MASK (PWM_SERVO_3_OC_BIT)
|
||||||
|
|
||||||
|
/* by default activate onboard baro */
|
||||||
|
#ifndef USE_BARO_BOARD
|
||||||
|
#define USE_BARO_BOARD 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* CONFIG_NAVSTIK_1_0_H */
|
||||||
@@ -226,7 +226,6 @@
|
|||||||
#if USE_PWM1
|
#if USE_PWM1
|
||||||
#define PWM_SERVO_1 0
|
#define PWM_SERVO_1 0
|
||||||
#define PWM_SERVO_1_TIMER TIM2
|
#define PWM_SERVO_1_TIMER TIM2
|
||||||
#define PWM_SERVO_1_RCC RCC_GPIOA
|
|
||||||
#define PWM_SERVO_1_GPIO GPIOA
|
#define PWM_SERVO_1_GPIO GPIOA
|
||||||
#define PWM_SERVO_1_PIN GPIO0
|
#define PWM_SERVO_1_PIN GPIO0
|
||||||
#define PWM_SERVO_1_AF GPIO_AF1
|
#define PWM_SERVO_1_AF GPIO_AF1
|
||||||
@@ -240,7 +239,6 @@
|
|||||||
#if USE_PWM2
|
#if USE_PWM2
|
||||||
#define PWM_SERVO_2 1
|
#define PWM_SERVO_2 1
|
||||||
#define PWM_SERVO_2_TIMER TIM2
|
#define PWM_SERVO_2_TIMER TIM2
|
||||||
#define PWM_SERVO_2_RCC RCC_GPIOA
|
|
||||||
#define PWM_SERVO_2_GPIO GPIOA
|
#define PWM_SERVO_2_GPIO GPIOA
|
||||||
#define PWM_SERVO_2_PIN GPIO1
|
#define PWM_SERVO_2_PIN GPIO1
|
||||||
#define PWM_SERVO_2_AF GPIO_AF1
|
#define PWM_SERVO_2_AF GPIO_AF1
|
||||||
@@ -254,7 +252,6 @@
|
|||||||
#if USE_PWM3
|
#if USE_PWM3
|
||||||
#define PWM_SERVO_3_IDX 2
|
#define PWM_SERVO_3_IDX 2
|
||||||
#define PWM_SERVO_3_TIMER TIM2
|
#define PWM_SERVO_3_TIMER TIM2
|
||||||
#define PWM_SERVO_3_RCC RCC_GPIOA
|
|
||||||
#define PWM_SERVO_3_GPIO GPIOA
|
#define PWM_SERVO_3_GPIO GPIOA
|
||||||
#define PWM_SERVO_3_PIN GPIO2
|
#define PWM_SERVO_3_PIN GPIO2
|
||||||
#define PWM_SERVO_3_AF GPIO_AF1
|
#define PWM_SERVO_3_AF GPIO_AF1
|
||||||
@@ -268,7 +265,6 @@
|
|||||||
#if USE_PWM4
|
#if USE_PWM4
|
||||||
#define PWM_SERVO_4 3
|
#define PWM_SERVO_4 3
|
||||||
#define PWM_SERVO_4_TIMER TIM2
|
#define PWM_SERVO_4_TIMER TIM2
|
||||||
#define PWM_SERVO_4_RCC RCC_GPIOA
|
|
||||||
#define PWM_SERVO_4_GPIO GPIOA
|
#define PWM_SERVO_4_GPIO GPIOA
|
||||||
#define PWM_SERVO_4_PIN GPIO3
|
#define PWM_SERVO_4_PIN GPIO3
|
||||||
#define PWM_SERVO_4_AF GPIO_AF1
|
#define PWM_SERVO_4_AF GPIO_AF1
|
||||||
|
|||||||
@@ -393,7 +393,6 @@
|
|||||||
#if USE_PWM0
|
#if USE_PWM0
|
||||||
#define PWM_SERVO_0 0
|
#define PWM_SERVO_0 0
|
||||||
#define PWM_SERVO_0_TIMER TIM1
|
#define PWM_SERVO_0_TIMER TIM1
|
||||||
#define PWM_SERVO_0_RCC RCC_GPIOE
|
|
||||||
#define PWM_SERVO_0_GPIO GPIOE
|
#define PWM_SERVO_0_GPIO GPIOE
|
||||||
#define PWM_SERVO_0_PIN GPIO9
|
#define PWM_SERVO_0_PIN GPIO9
|
||||||
#define PWM_SERVO_0_AF GPIO_AF1
|
#define PWM_SERVO_0_AF GPIO_AF1
|
||||||
@@ -406,7 +405,6 @@
|
|||||||
#if USE_PWM1
|
#if USE_PWM1
|
||||||
#define PWM_SERVO_1 1
|
#define PWM_SERVO_1 1
|
||||||
#define PWM_SERVO_1_TIMER TIM1
|
#define PWM_SERVO_1_TIMER TIM1
|
||||||
#define PWM_SERVO_1_RCC RCC_GPIOE
|
|
||||||
#define PWM_SERVO_1_GPIO GPIOE
|
#define PWM_SERVO_1_GPIO GPIOE
|
||||||
#define PWM_SERVO_1_PIN GPIO11
|
#define PWM_SERVO_1_PIN GPIO11
|
||||||
#define PWM_SERVO_1_AF GPIO_AF1
|
#define PWM_SERVO_1_AF GPIO_AF1
|
||||||
@@ -419,7 +417,6 @@
|
|||||||
#if USE_PWM2
|
#if USE_PWM2
|
||||||
#define PWM_SERVO_2 2
|
#define PWM_SERVO_2 2
|
||||||
#define PWM_SERVO_2_TIMER TIM1
|
#define PWM_SERVO_2_TIMER TIM1
|
||||||
#define PWM_SERVO_2_RCC RCC_GPIOE
|
|
||||||
#define PWM_SERVO_2_GPIO GPIOE
|
#define PWM_SERVO_2_GPIO GPIOE
|
||||||
#define PWM_SERVO_2_PIN GPIO13
|
#define PWM_SERVO_2_PIN GPIO13
|
||||||
#define PWM_SERVO_2_AF GPIO_AF1
|
#define PWM_SERVO_2_AF GPIO_AF1
|
||||||
@@ -432,7 +429,6 @@
|
|||||||
#if USE_PWM3
|
#if USE_PWM3
|
||||||
#define PWM_SERVO_3 3
|
#define PWM_SERVO_3 3
|
||||||
#define PWM_SERVO_3_TIMER TIM1
|
#define PWM_SERVO_3_TIMER TIM1
|
||||||
#define PWM_SERVO_3_RCC RCC_GPIOE
|
|
||||||
#define PWM_SERVO_3_GPIO GPIOE
|
#define PWM_SERVO_3_GPIO GPIOE
|
||||||
#define PWM_SERVO_3_PIN GPIO14
|
#define PWM_SERVO_3_PIN GPIO14
|
||||||
#define PWM_SERVO_3_AF GPIO_AF1
|
#define PWM_SERVO_3_AF GPIO_AF1
|
||||||
@@ -445,7 +441,6 @@
|
|||||||
#if USE_PWM4
|
#if USE_PWM4
|
||||||
#define PWM_SERVO_4 4
|
#define PWM_SERVO_4 4
|
||||||
#define PWM_SERVO_4_TIMER TIM9
|
#define PWM_SERVO_4_TIMER TIM9
|
||||||
#define PWM_SERVO_4_RCC RCC_GPIOE
|
|
||||||
#define PWM_SERVO_4_GPIO GPIOE
|
#define PWM_SERVO_4_GPIO GPIOE
|
||||||
#define PWM_SERVO_4_PIN GPIO5
|
#define PWM_SERVO_4_PIN GPIO5
|
||||||
#define PWM_SERVO_4_AF GPIO_AF3
|
#define PWM_SERVO_4_AF GPIO_AF3
|
||||||
@@ -458,7 +453,6 @@
|
|||||||
#if USE_PWM5
|
#if USE_PWM5
|
||||||
#define PWM_SERVO_5 5
|
#define PWM_SERVO_5 5
|
||||||
#define PWM_SERVO_5_TIMER TIM9
|
#define PWM_SERVO_5_TIMER TIM9
|
||||||
#define PWM_SERVO_5_RCC RCC_GPIOE
|
|
||||||
#define PWM_SERVO_5_GPIO GPIOE
|
#define PWM_SERVO_5_GPIO GPIOE
|
||||||
#define PWM_SERVO_5_PIN GPIO6
|
#define PWM_SERVO_5_PIN GPIO6
|
||||||
#define PWM_SERVO_5_AF GPIO_AF3
|
#define PWM_SERVO_5_AF GPIO_AF3
|
||||||
@@ -472,7 +466,6 @@
|
|||||||
#if USE_PWM6
|
#if USE_PWM6
|
||||||
#define PWM_SERVO_6 6
|
#define PWM_SERVO_6 6
|
||||||
#define PWM_SERVO_6_TIMER TIM5
|
#define PWM_SERVO_6_TIMER TIM5
|
||||||
#define PWM_SERVO_6_RCC RCC_GPIOA
|
|
||||||
#define PWM_SERVO_6_GPIO GPIOA
|
#define PWM_SERVO_6_GPIO GPIOA
|
||||||
#define PWM_SERVO_6_PIN GPIO3
|
#define PWM_SERVO_6_PIN GPIO3
|
||||||
#define PWM_SERVO_6_AF GPIO_AF2
|
#define PWM_SERVO_6_AF GPIO_AF2
|
||||||
@@ -485,7 +478,6 @@
|
|||||||
#if USE_PWM7
|
#if USE_PWM7
|
||||||
#define PWM_SERVO_7 7
|
#define PWM_SERVO_7 7
|
||||||
#define PWM_SERVO_7_TIMER TIM5
|
#define PWM_SERVO_7_TIMER TIM5
|
||||||
#define PWM_SERVO_7_RCC RCC_GPIOA
|
|
||||||
#define PWM_SERVO_7_GPIO GPIOA
|
#define PWM_SERVO_7_GPIO GPIOA
|
||||||
#define PWM_SERVO_7_PIN GPIO2
|
#define PWM_SERVO_7_PIN GPIO2
|
||||||
#define PWM_SERVO_7_AF GPIO_AF2
|
#define PWM_SERVO_7_AF GPIO_AF2
|
||||||
@@ -498,7 +490,6 @@
|
|||||||
#if USE_PWM8
|
#if USE_PWM8
|
||||||
#define PWM_SERVO_8 8
|
#define PWM_SERVO_8 8
|
||||||
#define PWM_SERVO_8_TIMER TIM5
|
#define PWM_SERVO_8_TIMER TIM5
|
||||||
#define PWM_SERVO_8_RCC RCC_GPIOA
|
|
||||||
#define PWM_SERVO_8_GPIO GPIOA
|
#define PWM_SERVO_8_GPIO GPIOA
|
||||||
#define PWM_SERVO_8_PIN GPIO1
|
#define PWM_SERVO_8_PIN GPIO1
|
||||||
#define PWM_SERVO_8_AF GPIO_AF2
|
#define PWM_SERVO_8_AF GPIO_AF2
|
||||||
@@ -511,7 +502,6 @@
|
|||||||
#if USE_PWM9
|
#if USE_PWM9
|
||||||
#define PWM_SERVO_9 9
|
#define PWM_SERVO_9 9
|
||||||
#define PWM_SERVO_9_TIMER TIM5
|
#define PWM_SERVO_9_TIMER TIM5
|
||||||
#define PWM_SERVO_9_RCC RCC_GPIOA
|
|
||||||
#define PWM_SERVO_9_GPIO GPIOA
|
#define PWM_SERVO_9_GPIO GPIOA
|
||||||
#define PWM_SERVO_9_PIN GPIO0
|
#define PWM_SERVO_9_PIN GPIO0
|
||||||
#define PWM_SERVO_9_AF GPIO_AF2
|
#define PWM_SERVO_9_AF GPIO_AF2
|
||||||
@@ -525,7 +515,6 @@
|
|||||||
#if USE_PWM10
|
#if USE_PWM10
|
||||||
#define PWM_SERVO_10 10
|
#define PWM_SERVO_10 10
|
||||||
#define PWM_SERVO_10_TIMER TIM12
|
#define PWM_SERVO_10_TIMER TIM12
|
||||||
#define PWM_SERVO_10_RCC RCC_GPIOB
|
|
||||||
#define PWM_SERVO_10_GPIO GPIOB
|
#define PWM_SERVO_10_GPIO GPIOB
|
||||||
#define PWM_SERVO_10_PIN GPIO14
|
#define PWM_SERVO_10_PIN GPIO14
|
||||||
#define PWM_SERVO_10_AF GPIO_AF9
|
#define PWM_SERVO_10_AF GPIO_AF9
|
||||||
@@ -538,7 +527,6 @@
|
|||||||
#if USE_PWM11
|
#if USE_PWM11
|
||||||
#define PWM_SERVO_11 11
|
#define PWM_SERVO_11 11
|
||||||
#define PWM_SERVO_11_TIMER TIM12
|
#define PWM_SERVO_11_TIMER TIM12
|
||||||
#define PWM_SERVO_11_RCC RCC_GPIOB
|
|
||||||
#define PWM_SERVO_11_GPIO GPIOB
|
#define PWM_SERVO_11_GPIO GPIOB
|
||||||
#define PWM_SERVO_11_PIN GPIO15
|
#define PWM_SERVO_11_PIN GPIO15
|
||||||
#define PWM_SERVO_11_AF GPIO_AF9
|
#define PWM_SERVO_11_AF GPIO_AF9
|
||||||
|
|||||||
@@ -57,16 +57,6 @@ extern float h_ctl_pitch_of_roll;
|
|||||||
h_ctl_pitch_igain = _gain; \
|
h_ctl_pitch_igain = _gain; \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* inner roll loop parameters */
|
|
||||||
extern float h_ctl_ref_roll_angle;
|
|
||||||
extern float h_ctl_ref_roll_rate;
|
|
||||||
extern float h_ctl_ref_roll_accel;
|
|
||||||
|
|
||||||
/* inner pitch loop parameters */
|
|
||||||
extern float h_ctl_ref_pitch_angle;
|
|
||||||
extern float h_ctl_ref_pitch_rate;
|
|
||||||
extern float h_ctl_ref_pitch_accel;
|
|
||||||
|
|
||||||
extern bool_t use_airspeed_ratio;
|
extern bool_t use_airspeed_ratio;
|
||||||
|
|
||||||
#endif /* FW_H_CTL_A_H */
|
#endif /* FW_H_CTL_A_H */
|
||||||
|
|||||||
@@ -460,7 +460,7 @@ void autopilot_check_in_flight(bool_t motors_on) {
|
|||||||
|
|
||||||
|
|
||||||
void autopilot_set_motors_on(bool_t motors_on) {
|
void autopilot_set_motors_on(bool_t motors_on) {
|
||||||
if (ahrs_is_aligned() && motors_on)
|
if (autopilot_mode != AP_MODE_KILL && ahrs_is_aligned() && motors_on)
|
||||||
autopilot_motors_on = TRUE;
|
autopilot_motors_on = TRUE;
|
||||||
else
|
else
|
||||||
autopilot_motors_on = FALSE;
|
autopilot_motors_on = FALSE;
|
||||||
|
|||||||
@@ -446,7 +446,7 @@ static void guidance_h_traj_run(bool_t in_flight) {
|
|||||||
((guidance_h_again * guidance_h_accel_ref.x) >> 8); /* acceleration feedforward gain */
|
((guidance_h_again * guidance_h_accel_ref.x) >> 8); /* acceleration feedforward gain */
|
||||||
guidance_h_cmd_earth.y =
|
guidance_h_cmd_earth.y =
|
||||||
pd_y +
|
pd_y +
|
||||||
((guidance_h_vgain * guidance_h_speed_ref.x) >> 17) + /* speed feedforward gain */
|
((guidance_h_vgain * guidance_h_speed_ref.y) >> 17) + /* speed feedforward gain */
|
||||||
((guidance_h_again * guidance_h_accel_ref.y) >> 8); /* acceleration feedforward gain */
|
((guidance_h_again * guidance_h_accel_ref.y) >> 8); /* acceleration feedforward gain */
|
||||||
|
|
||||||
/* trim max bank angle from PD */
|
/* trim max bank angle from PD */
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user