[ahrs] use weak functions for things that don't need to be implemented by each algorithm

This commit is contained in:
Felix Ruess
2014-02-27 15:53:37 +01:00
parent 27ac86fcb5
commit f52941ff17
8 changed files with 14 additions and 51 deletions
+10
View File
@@ -29,3 +29,13 @@
struct Ahrs ahrs;
#define WEAK __attribute__((weak))
// weak functions, used if not explicitly provided by implementation
void WEAK ahrs_propagate(void) {}
void WEAK ahrs_update_accel(void) {}
void WEAK ahrs_update_mag(void) {}
void WEAK ahrs_update_gps(void) {}
+4 -4
View File
@@ -61,25 +61,25 @@ extern void ahrs_align(void);
/** Propagation. Usually integrates the gyro rates to angles.
* Reads the global #imu data struct.
* Needs to be implemented by each AHRS algorithm.
* Does nothing if not implemented by specific AHRS algorithm.
*/
extern void ahrs_propagate(void);
/** Update AHRS state with accerleration measurements.
* Reads the global #imu data struct.
* Needs to be implemented by each AHRS algorithm.
* Does nothing if not implemented by specific AHRS algorithm.
*/
extern void ahrs_update_accel(void);
/** Update AHRS state with magnetometer measurements.
* Reads the global #imu data struct.
* Needs to be implemented by each AHRS algorithm.
* Does nothing if not implemented by specific AHRS algorithm.
*/
extern void ahrs_update_mag(void);
/** Update AHRS state with GPS measurements.
* Reads the global #gps data struct.
* Needs to be implemented by each AHRS algorithm.
* Does nothing if not implemented by specific AHRS algorithm.
*/
extern void ahrs_update_gps(void);
@@ -195,22 +195,8 @@ void ahrs_propagate(void) {
}
}
void ahrs_update_accel(void) {
}
void ahrs_update_mag(void) {
}
void ahrs_update_gps(void) {
}
void ahrs_aligner_init(void) {
}
void ahrs_aligner_run(void) {
}
@@ -125,9 +125,6 @@ void ahrs_propagate(void) {
set_body_state_from_quat();
}
void ahrs_update_gps(void) {
}
void ahrs_update_accel(void) {
struct FloatVect3 imu_g;
ACCELS_FLOAT_OF_BFP(imu_g, imu.accel);
-11
View File
@@ -347,14 +347,3 @@ void ahrs_aligner_run(void) {
void ahrs_aligner_init(void) {
}
void ahrs_propagate(void) {
}
void ahrs_update_accel(void) {
}
void ahrs_update_mag(void) {
}
void ahrs_update_gps(void) {
}
@@ -87,11 +87,6 @@ void ahrs_propagate(void) {
stateSetBodyRates_f(&body_rate);
}
void ahrs_update_accel(void) {
}
void ahrs_update_mag(void) {
}
void ahrs_update_gps(void) {
@@ -278,10 +278,6 @@ void ahrs_update_mag(void) {
}
void ahrs_update_gps(void) {
}
/* measures phi and theta assuming no dynamic acceleration ?!! */
__attribute__ ((always_inline)) static inline void get_phi_theta_measurement_fom_accel(int32_t* phi_meas, int32_t* theta_meas, struct Int32Vect3 accel) {
-10
View File
@@ -94,13 +94,3 @@ void ahrs_propagate(void) {
}
}
void ahrs_update_accel(void) {
}
void ahrs_update_mag(void) {
}
void ahrs_update_gps(void) {
}