Commit Graph

137 Commits

Author SHA1 Message Date
Michael du Breuil 08ef60d436 AP_ADC: Remove unused AP_ADC class 2018-07-17 09:29:50 +10:00
Peter Barker b6191578dc AP_ADC: correct compilter warnings
../../libraries/AP_ADC/AP_ADC_ADS1115.h:34:25: warning: private field
'_last_update_timestamp' is not used [-Wunused-private-field]
    uint32_t            _last_update_timestamp;
                        ^
1 warning generated.
2018-03-02 09:26:37 +09:00
Lucas De Marchi 5472bc4de1 Global: change Device::PeriodicCb signature
Remove bool return as it's never being used and not supported on PX4.
2017-01-14 10:03:54 +11:00
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
Mathieu OTHACEHE 152edf7189 Global: remove mode line from headers
Using a global .dir-locals.el file is a better alternative than
reincluding the same emacs header in every file of the project.
2016-10-24 09:42:01 -02: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 5ab1c6ff51 AP_ADC: remove ADS7844
It's not used by any board.
2016-07-29 15:01:15 -03:00
Lucas De Marchi ef81e71afa AP_ADC: remove example tailored to a single ADC
This is the only user of ADS7844 - we don't have it actually used in our
boards. Remove the example since we can later add a more generic one or
at least one that reuses a driver from our boards.
2016-07-29 15:01:15 -03:00
Lucas De Marchi 8f11bf7373 AP_ADC: ADS1115: fix typo 2016-07-28 18:05:45 -03:00
Randy Mackay d19c074ba1 AP_ADC_ADS1115.h: changed member declaration order to resolve compiler warning
No functional change
2016-07-27 13:39:32 +09: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 b5d3094738 AP_ADC: fix warning on printf
../../libraries/AP_ADC/examples/AP_ADC_test/AP_ADC_test.cpp: In function ‘void show_timing()’:
../../libraries/AP_ADC/examples/AP_ADC_test/AP_ADC_test.cpp:61:88: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint32_t {aka unsigned int}’ [-Wformat=]
     hal.console->printf("timing: mint=%lu maxt=%lu avg=%lu\n", mint, maxt, totalt/count);
                                                                                        ^
../../libraries/AP_ADC/examples/AP_ADC_test/AP_ADC_test.cpp:61:88: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint32_t {aka unsigned int}’ [-Wformat=]
../../libraries/AP_ADC/examples/AP_ADC_test/AP_ADC_test.cpp:61:88: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘uint32_t {aka unsigned int}’ [-Wformat=]
2016-05-04 08:58:37 -03:00
Ricardo de Almeida Gonzaga 5bd034a5a8 Global: start using cmath instead of math.h 2016-04-05 21:06:19 -07:00
Lucas De Marchi 6623246cf5 AP_ADC: replace header guard with pragma once 2016-02-18 14:52:34 -02: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
Gustavo Jose de Sousa c2e3f05dbf waf: ardupilotwaf: prefix build context methods with ap_
It helps to distinguish between things from waf and things from ardupilotwaf.
2016-01-22 20:10:29 -02:00
Gustavo Jose de Sousa 3d22490397 waf: examples: use methods from bld instead of ardupilotwaf 2016-01-22 20:10:29 -02:00
Gustavo Jose de Sousa d281067bcc waf: make example binaries be placed in 'examples' dir
This commit makes examples' wscripts use ardupilotwaf.example() instead of
ardupilot.program().
2016-01-15 16:46:41 -02:00
Lucas De Marchi a096703b06 Global: don't link with AP_Progmem
AP_Progmem is not used anymore.
2015-12-27 15:58:12 -02:00
Caio Marcelo de Oliveira Filho 6e7b73610d waf: add waf support 2015-12-03 07:54:30 +11:00
Andrew Tridgell 1ee7963edb AP_ADC: fixed example build 2015-11-20 17:33:17 +11:00
Caio Marcelo de Oliveira Filho b293fb150c AP_ADC: use millis/micros/panic functions 2015-11-20 12:28:36 +09:00
Andrew Tridgell 8f4ce7f20b build: removed all nocore.inoflag files
these were APM2 specific
2015-11-16 08:05:17 +11:00
Lucas De Marchi 4ae35c9a74 AP_ADC: remove checks for HAL_BOARD_APM2 and HAL_BOARD_APM1 2015-11-04 12:14:11 +11:00
Lucas De Marchi 5244559010 Minimize AP_Progmem.h includes
Most of AP_Progmem is already gone so we can stop including it in most
of the places. The only places that need it are the ones using
pgm_read_*() APIs.

In some cases the header needed to be added in the .cpp since it was
removed from the .h to reduce scope. In those cases the headers were
also reordered.
2015-10-30 14:35:32 +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
Caio Marcelo de Oliveira Filho 1fc801c2c9 AP_ADC: remove unnecessary board includes from example 2015-10-21 09:16:12 +11:00
Caio Marcelo de Oliveira Filho ec52df991c build: compile only the HAL files needed by the board
Instead of requiring every program to specify the HAL related modules,
let the build system do it (in practice everything we compiled depended
on HAL anyway). This allow including only the necessary files in the
compilation.
2015-10-21 09:16:07 +11:00
Caio Marcelo de Oliveira Filho 2e464a53c2 AP_HAL: make code not depend on concrete HAL implementations
The switching between different AP_HAL was happening by giving different
definitions of AP_HAL_BOARD_DRIVER, and the programs would use it to
instantiate.

A program or library code would have to explicitly include (and depend)
on the concrete implementation of the HAL, even when using it only via
interface.

The proposed change move this dependency to be link time. There is a
AP_HAL::get_HAL() function that is used by the client code. Each
implementation of HAL provides its own definition of this function,
returning the appropriate concrete instance.

Since this replaces the job of AP_HAL_BOARD_DRIVER, the definition was
removed.

The static variables for PX4 and VRBRAIN were named differently to avoid
shadowing the extern symbol 'hal'.
2015-10-21 09:16:07 +11: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
Andrew Tridgell 0cfdb9af8a AP_ADC: convert example from .pde to .cpp 2015-06-01 16:58:10 +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
Lucas De Marchi 57386434d1 AP_ADC: remove AP_ADC_HIL
It's not being used and it's actually broken: it references
AP_ADC_HIL::read() that doesn't exist.
2015-05-26 13:46:48 +10:00
Tom Pittenger 52474faa2e AP_ADC: fix compile warning re member init order 2015-04-24 14:15:24 +09: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
Andrew Tridgell 1c94b39d6e AP_ADC: fixed example build 2014-08-13 22:11:21 +10:00
Kevin Hester c34c4d79f6 AP_ADC: fixup line endings 2014-04-15 15:56:13 +09:00
Andrew Tridgell d83dbb38b4 AP_ADC: updates for AP_HAL::MemberProc 2013-09-30 21:06:42 +10:00
Andrew Tridgell 30b6b23b10 AP_ADC: enable APM1 ADC on Linux 2013-09-29 00:57:13 +10:00
Andrew Tridgell 6134d9d0d7 AP_ADC: use new scheduler API 2013-09-28 21:24:03 +10:00
Andrew Tridgell 97b7130bb9 libraries: update license header to GPLv3
we switched to GPLv3 a long time ago, but neglected to update the
per-file license headers
2013-08-30 13:01:39 +10:00
Andrew Tridgell dc97a8eff7 AP_ADC: fixed license text
we are on GPLv3 now
2013-08-30 13:01:32 +10:00
Andrew Tridgell 90cf1b0386 AP_ADC: removed unused setHIL method 2013-05-02 15:27:16 +10:00
Andrew Tridgell 5667f5d817 AP_ADC: fixed APM1 HIL_SENSORS Ch6() return 2013-04-02 13:20:08 +11:00