/** * Initialise the module, called on startup * \returns 0 on success or -1 if initialisation failed */ int32_t AltitudeInitialize() { BaroSensorInitialize(); RevoSettingsInitialize(); RevoSettingsConnectCallback(&SettingsUpdatedCb); SettingsUpdatedCb(NULL); #if defined(PIOS_INCLUDE_HCSR04) SonarAltitudeInitialize(); #endif return 0; }
/** * Initialise the module. Called before the start function * \returns 0 on success or -1 if initialisation failed */ int32_t SensorsInitialize(void) { source_data = (sensor_data *)pios_malloc(MAX_SENSOR_DATA_SIZE); GyroSensorInitialize(); AccelSensorInitialize(); MagSensorInitialize(); BaroSensorInitialize(); RevoCalibrationInitialize(); RevoSettingsInitialize(); AttitudeSettingsInitialize(); AccelGyroSettingsInitialize(); rotate = 0; RevoSettingsConnectCallback(&settingsUpdatedCb); RevoCalibrationConnectCallback(&settingsUpdatedCb); AttitudeSettingsConnectCallback(&settingsUpdatedCb); AccelGyroSettingsConnectCallback(&settingsUpdatedCb); return 0; }