diff --git a/conf/settings/modules/meteo_france_DAQ.xml b/conf/settings/modules/meteo_france_DAQ.xml new file mode 100644 index 00000000000..479ab8b3bda --- /dev/null +++ b/conf/settings/modules/meteo_france_DAQ.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/sw/airborne/modules/meteo/meteo_france_DAQ.c b/sw/airborne/modules/meteo/meteo_france_DAQ.c index 528cdc1ec00..e9a12ca2090 100644 --- a/sw/airborne/modules/meteo/meteo_france_DAQ.c +++ b/sw/airborne/modules/meteo/meteo_france_DAQ.c @@ -35,6 +35,7 @@ #include "state.h" #include "autopilot.h" +#include "generated/airframe.h" #include "subsystems/datalink/datalink.h" #include "subsystems/datalink/downlink.h" #include "subsystems/chibios-libopencm3/sdLog.h" @@ -44,8 +45,17 @@ struct MF_DAQ mf_daq; +#ifndef MF_DAQ_POWER_INIT +#define MF_DAQ_POWER_INIT TRUE +#endif + void init_mf_daq(void) { mf_daq.nb = 0; + mf_daq.power = MF_DAQ_POWER_INIT; +#if (defined MF_DAQ_POWER_PORT) && (defined MF_DAQ_POWER_PIN) + gpio_setup_output(MF_DAQ_POWER_PORT, MF_DAQ_POWER_PIN); +#endif + meteo_france_DAQ_SetPower(mf_daq.power) } void mf_daq_send_state(void) { diff --git a/sw/airborne/modules/meteo/meteo_france_DAQ.h b/sw/airborne/modules/meteo/meteo_france_DAQ.h index 490afbb3880..6a852ec4fd4 100644 --- a/sw/airborne/modules/meteo/meteo_france_DAQ.h +++ b/sw/airborne/modules/meteo/meteo_france_DAQ.h @@ -35,12 +35,14 @@ #define METEO_FRANCE_DAQ_H #include "std.h" +#include "mcu_periph/gpio.h" #define MF_DAQ_SIZE 32 struct MF_DAQ { float values[MF_DAQ_SIZE]; uint8_t nb; + uint8_t power; }; extern struct MF_DAQ mf_daq; @@ -50,5 +52,15 @@ extern void mf_daq_send_state(void); extern void mf_daq_send_report(void); extern void parse_mf_daq_msg(void); +#if (defined MF_DAQ_POWER_PORT) && (defined MF_DAQ_POWER_PIN) +#define meteo_france_DAQ_SetPower(_x) { \ + mf_daq.power = _x; \ + if (mf_daq.power) { gpio_set(MF_DAQ_POWER_PORT, MF_DAQ_POWER_PIN); } \ + else { gpio_clear(MF_DAQ_POWER_PORT, MF_DAQ_POWER_PIN); } \ +} +#else // POWER PORT and PIN undefined +#define meteo_france_DAQ_SetPower(_x) {} +#endif + #endif