*** empty log message ***

This commit is contained in:
Antoine Drouin
2006-01-04 04:16:00 +00:00
parent 000f1ad4f1
commit 1315cf5bea
2 changed files with 69 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
#include "radio_control.h"
int32_t rc_values[RADIO_CTL_NB];
uint8_t rc_status;
int32_t avg_rc_values[RADIO_CTL_NB];
uint8_t rc_values_contains_avg_channels = FALSE;
uint8_t time_sime_last_ppm;
+60
View File
@@ -0,0 +1,60 @@
#ifndef RADIO_CONTROL_H
#define RADIO_CONTROL_H
#include "led.h"
#include "sys_time.h"
#include "ppm.h"
#include "radio.h"
#define MAX_PPRZ 9600
#define MIN_PPRZ -MAX_PPRZ
#define RC_AVG_PERIOD 8
#define RC_LOST_TIME 10
#define RC_REALLY_LOST_TIME 20
#define RC_OK 0
#define RC_LOST 1
#define RC_REALLY_LOST 2
extern int32_t rc_values[RADIO_CTL_NB];
extern uint8_t rc_status;
extern int32_t avg_rc_values[RADIO_CTL_NB];
extern uint8_t rc_values_contains_avg_channels;
extern uint8_t time_sime_last_ppm;
static inline void radio_control_init ( void ) {
rc_status = RC_REALLY_LOST;
time_sime_last_ppm = RC_REALLY_LOST_TIME;
}
static inline void radio_control_periodic_task ( void ) {
if (time_sime_last_ppm >= RC_REALLY_LOST_TIME) {
rc_status = RC_REALLY_LOST;
LED_OFF(1);
}
else {
time_sime_last_ppm++;
if (time_sime_last_ppm >= RC_LOST_TIME) {
rc_status = RC_LOST;
LED_TOGGLE(1);
}
}
}
static inline void radio_control_ppm_event ( void ) {
if (ppm_valid) {
time_sime_last_ppm = 0;
rc_status = RC_OK;
NormalizePpm();
LED_ON(1);
// static uint32_t foo;
//foo++;
// if (!(foo%10)) {
// PRINT_RADIO_CONTROL();
// }
ppm_valid = FALSE;
}
}
#endif /* RADIO_CONTROL_H */