5 #include "oXs_config_basic.h"
6 #include "oXs_config_advanced.h"
7 #include "oXs_config_macros.h"
12 // values to say how to use a ads measurement
19 #define ADS_AIRSPEED 6
21 #define ADS_NOT_USED 8
23 // values to configure the ads multiplexer
34 // values to configure the programable ads gain amplifier
42 // value to configure the rate of ads conversion (value is the delay in msec that must be wait before getting the conversion ; this take care of the tolerance of 10% foreseen in the datasheet
53 extern const uint8_t ads_Measure
[4] ;
54 extern const uint8_t ads_Gain
[4] ;
55 extern const uint8_t ads_Rate
[4] ;
56 extern const float ads_Offset
[4] ;
57 extern const float ads_Scale
[4] ;
58 extern const uint8_t ads_MaxCount
[4] ;
61 extern uint32_t ads_MilliAskConv
;
62 extern uint8_t ads_Addr
;
63 extern uint8_t ads_CurrentIdx
;
64 extern uint8_t I2CErrorCodeAds1115
;
65 extern int32_t ads_SumOfConv
[4] ; // summarise all conversion in order to calculate average
66 extern uint8_t ads_Counter
[4] ;
67 extern struct ONE_MEASUREMENT ads_Conv
[4] ; //averaged conversion including offset and scale
68 extern uint8_t ads_Last_Conv_Idx
;
75 OXS_ADS1115(uint8_t addr
, HardwareSerial
&print
);
77 OXS_ADS1115(uint8_t addr
) ;
81 boolean
readSensor( void ); //return true if an averaged has just been calculated
82 void ads_requestNextConv(void) ;
83 void ads_calculateCurrent(void) ;
84 void ads_calculate_airspeed( int16_t ads_difPressureADC
) ;
85 #if defined(AN_ADS1115_IS_CONNECTED) && (AN_ADS1115_IS_CONNECTED == YES ) && defined(ADS_MEASURE) && defined(ADS_CURRENT_BASED_ON)
86 struct CURRENTDATA adsCurrentData
;
87 float floatConsumedMilliAmps
; // in mA
90 #if defined(AN_ADS1115_IS_CONNECTED) && (AN_ADS1115_IS_CONNECTED == YES ) && defined(ADS_MEASURE) && defined(ADS_AIRSPEED_BASED_ON)
91 struct AIRSPEEDDATA adsAirSpeedData
;
96 HardwareSerial
* printer
;
98 }; // end class OXS_ADS1115
102 #endif // OXS_ADS1115