Commit Graph

16 Commits

Author SHA1 Message Date
Lucas De Marchi bc476e1987 AP_ADC: fix ADS1115 instantiation
This can't be called on constructor since hal may not be initialized at
that time.
2016-11-19 14:05:22 -02:00
Andrew Tridgell 7c36e14524 AP_ADC: fixed thread usage in AP_ADC_ADS1115 2016-11-09 17:08:03 +11:00
Murilo Belluzzo fe48901db0 AP_ADC_ADS1115: Remove resource leak.
Constructor allocate '_samples' but there was no destructor to
deallocate it. Also, initializes '_gain' to silence CID 9144 although
'_gain' wasn't being used uninitialized because of ::init().

CID 91424
2016-08-03 00:24:55 -03:00
Lucas De Marchi 8f11bf7373 AP_ADC: ADS1115: fix typo 2016-07-28 18:05:45 -03:00
Lucas De Marchi c6edae7e8e Revert "Global: workaround toolchain problem on windows"
This reverts commit 4e2b30b413.

The toolchain for windows is now updated, we can remove this workaround.
2016-07-25 17:56:12 -03:00
Lucas De Marchi 4e2b30b413 Global: workaround toolchain problem on windows
The minimum version for gcc was supposed to be 4.9 for any platform.
However our build instructions are outdated. Remove the problematic
parts that use the sparse-endian.h header while we don't fix the setup
for windows.
2016-07-19 09:30:39 +09:00
Lucas De Marchi e5d519edec AP_ADC: AP_ADC_ADS1115: release bus lock as soon as possible 2016-07-14 17:32:32 -03:00
Lucas De Marchi 85c0c98194 AP_ADC: ADS1115: fix driver after conversion to I2CDevice
In _start_conversion(), the check for return code of _dev->transfer() was
inverted. The structure also needs to be PACKED, otherwise there will be
a hole in the middle.  Fix these issues and use be16_t where it makes
sense.

In read() we need to check for the second byte of config register, so
either make it an array of uint8_t or convert from big endian to host
endianness.  It's simpler to leave it as it was, accessing just the
first byte. Also the conversion value is in be16 type an needs to be
converted to host endiannes, not the opposite.

Fix bus number: all boards that use it expect it to be on bus 1, not 0.
2016-07-14 17:32:32 -03:00
Luiz Ywata 038389f583 AP_ADC_ADS1115: use I2CDevice interface 2016-07-14 17:32:32 -03:00
Lucas De Marchi 4562c0cffc AP_ADC: ADS1115: coding style fixes
- Clean trailing whitespaces
  - Fix switch
  - Use pragma once
2016-02-01 14:18:51 -02:00
Caio Marcelo de Oliveira Filho b293fb150c AP_ADC: use millis/micros/panic functions 2015-11-20 12:28:36 +09:00
Lucas De Marchi 2c38e31c93 Remove use of PSTR
The PSTR is already define as a NOP for all supported platforms. It's
only needed for AVR so here we remove all the uses throughout the
codebase.

This was automated with a simple python script so it also converts
places which spans to multiple lines, removing the matching parentheses.

AVR-specific places were not changed.
2015-10-30 14:35:04 +09:00
Gustavo Jose de Sousa a552390125 AP_ADC: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-11 16:28:41 +10:00
Lucas De Marchi f7dc19554f AP_ADC: use functor macros
Functor is not yet being used but let's make is macro fallback to the
previous Delegate implementation for easy of transition between the two.
2015-05-26 13:46:51 +10:00
Tom Pittenger f4bfc12316 AP_ADC: fix compile warnings re float constants 2015-04-24 12:24:49 +09:00
Staroselskii Georgii b5aef01f72 AP_ADC: added ADS1115 support 2015-02-12 12:57:45 +11:00