MAV'RIC
/home/travis/build/lis-epfl/MAVRIC_Library/hal/analog_monitor_default_config.h
00001 /*******************************************************************************
00002  * Copyright (c) 2009-2016, MAV'RIC Development Team
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions are met:
00007  *
00008  * 1. Redistributions of source code must retain the above copyright notice,
00009  * this list of conditions and the following disclaimer.
00010  *
00011  * 2. Redistributions in binary form must reproduce the above copyright notice,
00012  * this list of conditions and the following disclaimer in the documentation
00013  * and/or other materials provided with the distribution.
00014  *
00015  * 3. Neither the name of the copyright holder nor the names of its contributors
00016  * may be used to endorse or promote products derived from this software without
00017  * specific prior written permission.
00018  *
00019  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00020  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00021  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00022  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
00023  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00024  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00025  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00026  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00027  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00028  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00029  * POSSIBILITY OF SUCH DAMAGE.
00030  ******************************************************************************/
00031 
00032 /*******************************************************************************
00033  * \file analog_monitor_default_config.h
00034  *
00035  * \author MAV'RIC Team
00036  * \author Gregoire Heitz
00037  *
00038  * \brief The configuration for the analog monitor module
00039  *
00040  * in MAVRIC autopilot we have a voltage divider on ADC_6, ADC_7, ADC_10 and ADC_11
00041  * Voltage divider values change from rev_4 to rev_4_1 and followings
00042  *
00043  * For rev_4 the inverse of the voltage divider is
00044  * 6.6f on ADC_6 and ADC_7 and 11.0f on ADC_10 and ADC_11
00045  *
00046  * For rev4_1 and followings
00047  * 9.1818f on ADC_6 and ADC_7 and 23.0f on ADC_10 and ADC_11
00048  *
00049  * You can either
00050  * edit this file to change the voltage divider values
00051  * or
00052  * in your project, declare float* config = conf_conv_factor;
00053  * and then edit config array to change one or few values accordingly
00054  * before calling analog_monitor_init(&central_data->analog_monitor, config);
00055  *
00056  ******************************************************************************/
00057 
00058 
00059 #ifndef ANALOG_MONITOR_DEFAULT_CONFIG_H_
00060 #define ANALOG_MONITOR_DEFAULT_CONFIG_H_
00061 
00062 #ifdef __cplusplus
00063 extern "C" {
00064 #endif
00065 
00066 #include "hal/analog_monitor.h"
00067 
00068 #define INV_VOLTAGE_DIVIDER_1 9.1818f   // previously 6.6f for V4.0
00069 #define INV_VOLTAGE_DIVIDER_2 23.0f     // previously 11.0f for V4.0
00070 
00071 static inline analog_monitor_conf_t analog_monitor_default_config()
00072 {
00073     analog_monitor_conf_t analog_monitor_conf = {};
00074     analog_monitor_conf.enable =
00075     {
00076         false,      //ANALOG_RAIL_2,
00077         false,      //ANALOG_RAIL_3,
00078         false,      //ANALOG_RAIL_4,
00079         false,      //ANALOG_RAIL_5,
00080         false,      //ANALOG_RAIL_6,
00081         false,      //ANALOG_RAIL_7,
00082         true,       //ANALOG_RAIL_10
00083         true,       //ANALOG_RAIL_11
00084         true,       //ANALOG_RAIL_12
00085         false,      //ANALOG_RAIL_13
00086     };
00087     analog_monitor_conf.conv_factor =
00088     {
00089         1.0f,                                   //.conv_factor_2 =
00090         1.0f,                                   //.conv_factor_3 =
00091         1.0f,                                   //.conv_factor_4 =
00092         1.0f,                                   //.conv_factor_5 =
00093         (0.00023485f * INV_VOLTAGE_DIVIDER_1),  //.conv_factor_6 =
00094         (0.00023485f * INV_VOLTAGE_DIVIDER_1),  //.conv_factor_7 =
00095         (-0.0002409f * INV_VOLTAGE_DIVIDER_2),  //.conv_factor_10 =
00096         (-0.0002409f * INV_VOLTAGE_DIVIDER_2),  //.conv_factor_11 =
00097         -0.00025f,                              //.conv_factor_12 =
00098         -1.0f                                   //.conv_factor_13 =
00099     };
00100     return analog_monitor_conf;
00101 };
00102 
00103 #ifdef __cplusplus
00104 }
00105 #endif
00106 
00107 #endif /* ANALOG_MONITOR_DEFAULT_CONFIG_H_ */
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines