Commit Graph

20 Commits

Author SHA1 Message Date
Pat Hickey ce8dc5fd5c AP_AnalogSource: obsoleted by AP_HAL. Renamed to AP_ADC_AnalogSource. 2012-12-20 14:51:25 +11:00
Pat Hickey 3f1d9d7f69 AP_Param: #include <AP_Param.h> fixups for libraries & sketches
* I mostly went through with grep and added an #include <AP_Param.h> below
  every #include <AP_Common.h>. Not all of these example sketches might
  strictly need AP_Param.
2012-12-20 14:51:19 +11:00
Andrew Tridgell fc63087cb8 AnalogSource: switch to SREG = oldSREG pattern for interrupt mask/restore 2012-11-20 22:31:09 +11:00
Andrew Tridgell 403721f8ca AP_AnalogSource: allow for the 'NONE' pin in Arduino ADC
This allows us to have a configuration parameter for a pin which
defaults to -1, meaning not to read a pin at all. It will always
return 0
2012-11-06 21:45:40 +11:00
Andrew Tridgell a979fb6014 AP_AnalogSource: added set_pin() interface
this allows pin numbers to be changed at runtime
2012-10-16 17:20:15 +11:00
uncrustify 4a7e79b3ac uncrustify libraries/AP_AnalogSource/AnalogSource.h 2012-08-21 19:00:17 -07:00
uncrustify 46eeaffdf1 uncrustify libraries/AP_AnalogSource/AP_AnalogSource_Arduino.h 2012-08-21 19:00:17 -07:00
uncrustify d7fe646829 uncrustify libraries/AP_AnalogSource/AP_AnalogSource_ADC.h 2012-08-21 19:00:17 -07:00
uncrustify 3c1a4b249a uncrustify libraries/AP_AnalogSource/AP_AnalogSource_Arduino.cpp 2012-08-21 19:00:17 -07:00
uncrustify e9b5e28b40 uncrustify libraries/AP_AnalogSource/examples/AnalogSource_Arduino/AnalogSource_Arduino.pde 2012-08-21 19:00:17 -07:00
Andrew Tridgell a4b1b9f0a4 AP_AnalogSource: make read_average() return a float
this allows it to take advantage of better than 1 bit resolution by
averaging
2012-08-15 12:39:35 +10:00
Andrew Tridgell 175b6d2606 AP_AnalogSource: fixed reporting of VCC
the VCC pin number should not be converted
2012-07-21 19:49:24 +10:00
rmackay9 4dd4c95d5c AP_AnalogSource_Arduino: fix to allow analog port to be read to be specified as a "channel" (i.e. A0)
Also fixed example range finder sketch to work with interrupt enabled AP_AnalogSource_Arduino class
2012-07-11 21:19:17 +09:00
Andrew Tridgell d755fedc26 AnalogSource: prevent a division by zero on zero ADC data 2012-07-06 19:59:18 +10:00
Andrew Tridgell 769011e947 AnalogSource: added some example code 2012-07-01 15:01:05 +10:00
Andrew Tridgell c8befe4536 AnalogSource: make the Arduino AnalogSource interrupt driven
this fixes several problems with reading analog sources:

 - we were getting poor values because we didn't wait long enough for
   an analog source to settle

 - we wasted a lot of CPU cycles waiting for conversions

 - we were not taking averages over many samples, which we did with
   the old AP_ADC driver on the APM1
2012-07-01 15:01:05 +10: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
Andrew Tridgell 10e546eebd AnalogSource: return a float from read() method
this gives the full resolution when using the ADC backend. It also
adds scaling for the Arduino backend
2011-12-17 07:29:09 +11:00
Randy Mackay 1f53c25577 RangeFinder - small bug fix to initialise prescale variable.
Fixed up example sketch so it compiles and works again!
2011-12-10 16:25:41 +09:00
Pat Hickey 0c0a1b1dcc purple: Added AnalogSource library
this library abstracts out the way of getting an analog value. If the
ADC library is being used then it calls the ADC Ch() method, otherwise
it calls analogRead()
2011-11-25 20:00:16 -08:00