finished modifying for two stage module, wrapper with init func for pwm_input hw access and xtend_rssi module that uses measured pwm input values

This commit is contained in:
Stephen Dwyer
2011-11-14 00:30:07 -07:00
parent c0f3851faa
commit 9f85fa3be5
7 changed files with 94 additions and 12 deletions
+1 -1
View File
@@ -195,7 +195,7 @@
<modules>
<load name="infrared_adc.xml"/>
<load name="pwm_input_mod.xml"/>
<load name="pwm_meas.xml"/>
<load name="xtend_rssi.xml">
<configure name="XTEND_RSSI_PWM_INPUT_CHANNEL" value="1"/>
</load>
+19
View File
@@ -0,0 +1,19 @@
<!DOCTYPE module SYSTEM "module.dtd">
<!-- Currently only available on LPC21xx arch
pwm input measurement mcu periph access and init wrapper for other modules
For LPC21xx on the TWOG:
1 - INPUT CAPTURE CAP0.3 on P0.29 (TWOG ADC5, 5V->3.3V voltage divider)
2 - INPUT CAPTURE CAP0.0 on P0.30 (TWOG ADC4, no voltage divider)
-->
<module name="pwm_meas" dir="core">
<header>
<file name="pwm_meas.h"/>
</header>
<init fun="pwm_meas_init()"/>
<makefile target="ap">
<file name="pwm_meas.c"/>
<file name="pwm_input.c" dir="mcu_periph"/>
<file_arch name="pwm_input_arch.c" dir="mcu_periph"/>
<define name="USE_PWM_INPUT"/> <!-- needed to enable the pwm_input interrupts in sys_time_hw.c -->
</makefile>
</module>
+1 -5
View File
@@ -7,18 +7,14 @@
2 - INPUT CAPTURE CAP0.0 on P0.30 (TWOG ADC4, no voltage divider)
-->
<module name="xtend_rssi" dir="datalink">
<depend require="pwm_input_mod.xml"/>
<depend require="pwm_meas.xml"/>
<header>
<file name="xtend_rssi.h"/>
</header>
<!-- <init fun="xtend_rssi_init()"/> -->
<periodic fun="xtend_rssi_periodic()" freq="0.5"/>
<makefile target="ap">
<file name="xtend_rssi.c"/>
<!-- <file name="pwm_input.c" dir="mcu_periph"/> -->
<!-- <file_arch name="pwm_input_arch.c" dir="mcu_periph"/> -->
<define name="XTEND_RSSI_PWM_INPUT_CHANNEL" value="$(XTEND_RSSI_PWM_INPUT_CHANNEL)"/> <!-- configure the pwm input to be used in airframe file -->
<!-- <define name="USE_PWM_INPUT"/> --> <!-- needed to enable the pwm_input interrupts in sys_time_hw.c -->
<define name="USE_PWM_INPUT$(XTEND_RSSI_PWM_INPUT_CHANNEL)" value="PWM_PULSE_TYPE_ACTIVE_HIGH"/> <!-- rssi signal is active high -->
</makefile>
</module>
+38
View File
@@ -0,0 +1,38 @@
/*
* $Id$
*
* Copyright (C) 2011 The Paparazzi Team
*
* 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 pwm_meas.c
*
* Wrapper to access pwm_input mcu peripheral from other modules
*/
#include "modules/core/pwm_meas.h"
#include "mcu_periph/pwm_input.h"
#include "sys_time.h"
void pwm_meas_init( void )
{
pwm_input_init();
}
+35
View File
@@ -0,0 +1,35 @@
/*
* $Id$
*
* Copyright (C) 2011 The Paparazzi Team
*
* 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 pwm_meas.h
*
* Wrapper to access pwm_input mcu peripheral from other modules
*/
#ifndef PWM_MEAS_H
#define PWM_MEAS_H
void pwm_meas_init( void );
#endif
@@ -46,11 +46,6 @@
#define XTEND_RSSI_PWM_ARRAY_INDEX (XTEND_RSSI_PWM_INPUT_CHANNEL - 1)
void xtend_rssi_init( void )
{
//pwm_input_init();
}
void xtend_rssi_periodic( void ) {
/* get the last duty if valid then reset valid flag (this says if we got another pulse since the last one)
@@ -32,7 +32,6 @@
#ifndef XTEND_RSSI_H
#define XTEND_RSSI_H
void xtend_rssi_init( void );
void xtend_rssi_periodic( void );
#endif