diff --git a/sw/airborne/inter_mcu.h b/sw/airborne/inter_mcu.h index 4c44a4c8b69..83110195c7b 100644 --- a/sw/airborne/inter_mcu.h +++ b/sw/airborne/inter_mcu.h @@ -86,8 +86,8 @@ extern volatile bool inter_mcu_received_ap; * Getter and setter functions for ap_state and fbw_state elements * protected by mutexes */ -extern PPRZ_RTOS_MTX(ap_state_mtx); -extern PPRZ_RTOS_MTX(fbw_state_mtx); +PPRZ_RTOS_MTX_DECL(ap_state_mtx); +PPRZ_RTOS_MTX_DECL(fbw_state_mtx); /** get AP command * @param cmd_idx command index @@ -247,12 +247,12 @@ static inline void imcu_set_status(uint8_t status) * @param current pointer to return current * @param energy pointer to return cumulated energy */ -static inline void imcu_get_electrical(uint16_t *vsupply, int32_t *current, float *energy) +static inline void imcu_get_electrical(uint16_t *_vsupply, int32_t *_current, float *_energy) { PPRZ_RTOS_MTX_LOCK(fbw_state_mtx); - *vsupply = fbw_state->vsupply; - *current = fbw_state->current; - *energy = fbw_state->energy; + *_vsupply = fbw_state->vsupply; + *_current = fbw_state->current; + *_energy = fbw_state->energy; PPRZ_RTOS_MTX_UNLOCK(fbw_state_mtx); } @@ -261,12 +261,12 @@ static inline void imcu_get_electrical(uint16_t *vsupply, int32_t *current, floa * @param current new current (mA) * @param energy new cumulated energy (mAh) */ -static inline void imcu_set_electrical(uint16_t vsupply, int32_t current, float energy) +static inline void imcu_set_electrical(uint16_t _vsupply, int32_t _current, float _energy) { PPRZ_RTOS_MTX_LOCK(fbw_state_mtx); - fbw_state->vsupply = vsupply; - fbw_state->current = current; - fbw_state->energy = energy; + fbw_state->vsupply = _vsupply; + fbw_state->current = _current; + fbw_state->energy = _energy; PPRZ_RTOS_MTX_UNLOCK(fbw_state_mtx); } diff --git a/sw/airborne/pprz_rtos.h b/sw/airborne/pprz_rtos.h index 340f67d3730..74efdf03018 100644 --- a/sw/airborne/pprz_rtos.h +++ b/sw/airborne/pprz_rtos.h @@ -33,13 +33,15 @@ #include #define PPRZ_RTOS_MTX(_mtx) mutex_t _mtx +#define PPRZ_RTOS_MTX_DECL(_mtx) extern mutex_t _mtx #define PPRZ_RTOS_MTX_INIT(_mtx) chMtxObjectInit(&(_mtx)) #define PPRZ_RTOS_MTX_LOCK(_mtx) chMtxLock(&(_mtx)) #define PPRZ_RTOS_MTX_UNLOCK(_mtx) chMtxUnlock(&(_mtx)) #else // no RTOS -#define PPRZ_RTOS_MTX(_mtx) {} +#define PPRZ_RTOS_MTX(_mtx) +#define PPRZ_RTOS_MTX_DECL(_mtx) #define PPRZ_RTOS_MTX_INIT(_mtx) {} #define PPRZ_RTOS_MTX_LOCK(_mtx) {} #define PPRZ_RTOS_MTX_UNLOCK(_mtx) {}