[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[paparazzi-commits] [5698] introduced a new macro to make it possible to
From: |
antoine drouin |
Subject: |
[paparazzi-commits] [5698] introduced a new macro to make it possible to have different PPM tic and SYS tic |
Date: |
Thu, 26 Aug 2010 10:44:22 +0000 |
Revision: 5698
http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=5698
Author: poine
Date: 2010-08-26 10:44:21 +0000 (Thu, 26 Aug 2010)
Log Message:
-----------
introduced a new macro to make it possible to have different PPM tic and SYS tic
Modified Paths:
--------------
paparazzi3/trunk/sw/airborne/radio_control.h
paparazzi3/trunk/sw/tools/gen_radio.ml
Modified: paparazzi3/trunk/sw/airborne/radio_control.h
===================================================================
--- paparazzi3/trunk/sw/airborne/radio_control.h 2010-08-26 07:53:51 UTC
(rev 5697)
+++ paparazzi3/trunk/sw/airborne/radio_control.h 2010-08-26 10:44:21 UTC
(rev 5698)
@@ -59,7 +59,16 @@
extern uint8_t time_since_last_ppm;
extern uint8_t ppm_cpt, last_ppm_cpt;
+/*
+ * On tiny (and booz) the ppm counter is running at the same speed as
+ * the systic counter. There is no reason for this to be true.
+ * Let's add a pair of macros to make it possible for them to be different.
+ *
+ */
+#define RC_PPM_TICS_OF_USEC SYS_TICS_OF_USEC
+#define RC_PPM_SIGNED_TICS_OF_USEC SIGNED_SYS_TICS_OF_USEC
+
/************* INIT ******************************************************/
static inline void radio_control_init ( void ) {
rc_status = RC_REALLY_LOST;
Modified: paparazzi3/trunk/sw/tools/gen_radio.ml
===================================================================
--- paparazzi3/trunk/sw/tools/gen_radio.ml 2010-08-26 07:53:51 UTC (rev
5697)
+++ paparazzi3/trunk/sw/tools/gen_radio.ml 2010-08-26 10:44:21 UTC (rev
5698)
@@ -70,9 +70,9 @@
let norm1_ppm = fun c ->
if c.neutral = c.min then
- sprintf "tmp_radio * (MAX_PPRZ / (float)(SIGNED_SYS_TICS_OF_USEC(%d-%d)))"
c.max c.min, "0"
+ sprintf "tmp_radio * (MAX_PPRZ /
(float)(RC_PPM_SIGNED_TICS_OF_USEC(%d-%d)))" c.max c.min, "0"
else
- sprintf "tmp_radio * (tmp_radio >=0 ?
(MAX_PPRZ/(float)(SIGNED_SYS_TICS_OF_USEC(%d-%d))) :
(MIN_PPRZ/(float)(SIGNED_SYS_TICS_OF_USEC(%d-%d))))" c.max c.neutral c.min
c.neutral, "MIN_PPRZ"
+ sprintf "tmp_radio * (tmp_radio >=0 ?
(MAX_PPRZ/(float)(RC_PPM_SIGNED_TICS_OF_USEC(%d-%d))) :
(MIN_PPRZ/(float)(RC_PPM_SIGNED_TICS_OF_USEC(%d-%d))))" c.max c.neutral c.min
c.neutral, "MIN_PPRZ"
let gen_normalize_ppm = fun channels ->
printf "#define NormalizePpm() {\\\n";
@@ -84,7 +84,7 @@
if c.averaged then begin
printf " avg_rc_values[RADIO_%s] += ppm_pulses[RADIO_%s];\\\n" c.name
c.name
end else begin
- printf " tmp_radio = ppm_pulses[RADIO_%s] - SYS_TICS_OF_USEC(%d);\\\n"
c.name c.neutral;
+ printf " tmp_radio = ppm_pulses[RADIO_%s] -
RC_PPM_TICS_OF_USEC(%d);\\\n" c.name c.neutral;
printf " rc_values[RADIO_%s] = %s;\\\n" c.name value;
printf " Bound(rc_values[RADIO_%s], %s, MAX_PPRZ); \\\n\\\n" c.name
min_pprz;
end
@@ -97,7 +97,7 @@
(fun c ->
if c.averaged then begin
let value, min_pprz = norm1_ppm c in
- printf " tmp_radio = avg_rc_values[RADIO_%s] / RC_AVG_PERIOD -
SYS_TICS_OF_USEC(%d);\\\n" c.name c.neutral;
+ printf " tmp_radio = avg_rc_values[RADIO_%s] / RC_AVG_PERIOD -
RC_PPM_TICS_OF_USEC(%d);\\\n" c.name c.neutral;
printf " rc_values[RADIO_%s] = %s;\\\n" c.name value;
printf " avg_rc_values[RADIO_%s] = 0;\\\n" c.name;
printf " Bound(rc_values[RADIO_%s], %s, MAX_PPRZ); \\\n\\\n" c.name
min_pprz;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [paparazzi-commits] [5698] introduced a new macro to make it possible to have different PPM tic and SYS tic,
antoine drouin <=