Commit Graph

53 Commits

Author SHA1 Message Date
Caio Marcelo de Oliveira Filho b293fb150c AP_ADC: use millis/micros/panic functions 2015-11-20 12:28:36 +09: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
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
Andrew Tridgell d83dbb38b4 AP_ADC: updates for AP_HAL::MemberProc 2013-09-30 21:06:42 +10:00
Andrew Tridgell 6134d9d0d7 AP_ADC: use new scheduler API 2013-09-28 21:24:03 +10:00
Andrew Tridgell dc97a8eff7 AP_ADC: fixed license text
we are on GPLv3 now
2013-08-30 13:01:32 +10:00
James Bielman d84ba8ef59 Use HAL suspend/resume timer procs rather than atomic.
- Preparation for removing begin/end atomic.
2013-01-03 17:33:13 -08:00
Pat Hickey a556a95565 AP_ADC: uses new semaphore interface 2013-01-03 13:48:07 -08:00
Pat Hickey 992de8c2b9 AP_ADC_ADS7844: changed to use spidevicedriver transaction 2012-12-20 14:52:32 +11:00
Pat Hickey d5a46ca1e3 AP_ADC: uses scheduler panic 2012-12-20 14:52:32 +11:00
Pat Hickey 09c14f3807 AP_ADC: more robust semaphores 2012-12-20 14:51:35 +11:00
Pat Hickey 668caa4a2e Fix calls to AP_HAL::Scheduler::register_timer_process 2012-12-20 14:51:27 +11:00
Pat Hickey 30deb76ea3 AP_ADC: ported to AP_HAL
AP_ADC_test run on bench with APM1, looks ok.
2012-12-20 14:51:25 +11:00
Andrew Tridgell c1a02e49a0 ADC: switch to SREG = oldSREG pattern for interrupt mask/restore 2012-11-20 22:30:03 +11:00
rmackay9 6ea5c21f7c AP_ADC: added num_samples_available to allow main loop to be synced with arrival of new sensor data for Oilpan. 2012-09-10 11:37:43 +09:00
rmackay9 0a6219695b AP_InertialSensor: changed read of sensor from MPU6000 to happen immediately
This reduces the delay between when data arrives and when it is used
by up to 1ms.

Added num_samples_available method to all InertialSensors to allow
main loop timing to be synced with sensors.
2012-09-10 11:37:33 +09:00
uncrustify 79b370cf1d uncrustify libraries/AP_ADC/AP_ADC_ADS7844.cpp 2012-08-21 18:59:13 -07:00
Andrew Tridgell d692a932ca ADC: added suspend/resume on init 2012-05-01 12:06:54 +10:00
Andrew Tridgell 9b95d2060a ADC: minor fix to the ADC Ch6() code
we don't need to add count any more, as floating point maths doesn't
need to round up
2012-03-27 15:37:24 +11:00
Andrew Tridgell f9394f8068 ADC: removed the ADC level accel smoothing
the quaternion code does a better job of handling this noise than this
filter does
2012-03-10 10:34:32 +11:00
Andrew Tridgell a0a360f955 ADC: use floats for ADC averaging
this costs almost nothing and improved accel/gyro calibration
2012-03-10 10:34:32 +11:00
Andrew Tridgell c80ec9a55c AP_ADC: added new_data_available() interface
returns true if more samples are available
2012-03-10 10:34:28 +11:00
rmackay9 c444cdb3f4 AP_ADC - removed small compiler warning 2012-02-29 22:43:46 +09:00
Andrew Tridgell 79d622939a ADC: on channel overflow we should not zero last_ch6_micros
this happens every 64 seconds because of unused channels on the
ADC. Zeroing this creates a bad delta_t value for the DCM code.
2012-02-16 17:48:36 +11:00
Randy Mackay ed19c25a97 Arduino 1.0 - changed all #includes of "WProgram.h", "wiring.h" and "WConstants.h to "Arduino.h".
Modified FastSerial's write function to return size_t (number of bytes written).
2012-01-28 12:25:47 +09:00
Jason Short 94e7ba8df2 Removed Gyro filter, In the end it doesn't help and I think it could actually hurt gyro integration. 2012-01-20 22:52:29 -08:00
Andrew Tridgell 8780a60234 ADC: update for new ap_proceduce prototype 2011-12-21 23:31:38 +11:00
Andrew Tridgell 6341db7031 Revert "ADC: only read channels that are actually being used"
This reverts commit 95e6bb26f4772ca8c7faa62215de6f078d3df3c7.

ADC will be disabled on APM2
2011-12-17 07:29:09 +11:00
Andrew Tridgell d442bad413 Revert "ADC: added an enable_channel() API"
This reverts commit dafeac01d8f14162600cf821404ba4072dcae14d.

ADC will be disabled on APM2
2011-12-17 07:29:09 +11:00
Andrew Tridgell 9591317dbc ADC: added an enable_channel() API
enable_channel() must be used before the Ch6() method is called to
enable gathering of data on the required channels
2011-12-16 20:09:40 +11:00
Andrew Tridgell 09947dace1 ADC: only read channels that are actually being used
on the APM2 we usually use none of the ADC channels, although we may
use the airspeed sensor. This change means we detect which channels
are being read, and only do the SPI transfers for those ones. That
saves us about 100usec per timer interrupt (ie. about 10% of our CPU)
2011-12-16 20:09:35 +11:00
Andrew Tridgell f125f6619a fixed formatting of ADC driver
it was a nasty mix of DOS and UNIX
2011-12-16 20:09:29 +11:00
Andrew Tridgell 5d503fd65e ADC: change adc.Ch() to return a float
this gives us a bit more precision in airspeed measurement, and costs
us virtually nothing as we are converting to float immediately after
getting the value
2011-12-12 15:14:55 +11:00
Andrew Tridgell e491168273 ADC: remove a very small (0.2 degrees/s) bias in the ADC code
small bias from integer rounding
2011-11-28 16:22:33 +11:00
Pat Hickey 017f121566 AP_ADC: rework ADC library to use PeriodicProcess and ISR_Register
this makes it possible to build the ADC library when another driver
may also want that interrupt
2011-11-25 20:00:16 -08:00
Jason Short 0bfa67f413 Heavy Accel Filter + mild Gyro Filter. To use, filter_result must be set to true on ADC. Off by default. 2011-10-01 15:44:53 -07:00
Jason Short f89da12387 Minimized the accel_filtered vector to be faster and more accurate.
Made the Filter include the Accels and moved from 8 to 4 terms in the filter
2011-09-30 18:40:29 -07:00
Jason Short de61e87128 Added ADC gyro Filtering for quads - this fixes a noise issue introduced into the controller
added Position mode
removed
Added back in the accelerometer experiment
Added filter_result boolean to enable filter on the fly
2011-09-29 23:27:23 -07:00
Andrew Tridgell f375258699 fixed inconsistent linefeeds in ADC code
the linefeeds had bacome inconsistent in this library, making some
editors fail to load the code
2011-09-19 11:04:02 +10:00
Andrew Tridgell a835912d93 ADC: randomise the sampling rate
this is based on suggestions from Kari and Mike, and should reduce the
aliasing effects we get from the simple averaging
2011-09-17 14:58:02 +10:00
Andrew Tridgell 1d68953416 ADC: the bottom 3 bits of ADC output are always zero
its a 12 bit ADC .... silly of me to think the bottom 3 bits are
valid!
2011-09-17 14:58:02 +10:00
Andrew Tridgell 9af7021a98 change ADC sample rate to 1kHz
this costs us about 9% of our CPU, but should make aliasing much less
of a problem.
2011-09-17 14:58:02 +10:00
Andrew Tridgell 70bf945d40 ADC: re-work for ADC code for full resolution and accurate timing
this changes the ADC code to return the full resolution of the
sensors. It also adds a new Ch6() interface that returns 6 channels at
once, so the IMU can read 3 accelerometers and 3 gyros at once, and
get the exact time that the values were accumulated over
2011-09-17 14:58:02 +10:00
jasonshort eb39d2d53a Added ability to grab an unfiltered value from the ADC
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2963 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-07-30 20:33:45 +00:00
jasonshort c5f06b99fe silly formatting
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2566 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-06-16 16:43:43 +00:00
jasonshort c1ddd58d4c Implemented moving average filter to deal with noise issues on quads, default is a 6 member filter.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2551 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-06-12 23:50:15 +00:00
james.goppert 7809b0ca2a Massive warning fixes.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2089 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-05-04 19:12:27 +00:00
mich146@hotmail.com bae1c531d0 ADC Library - reimplement overflow
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1832 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-03-31 14:19:59 +00:00