Commit Graph

18 Commits

Author SHA1 Message Date
Andrew Tridgell d75d97dcfb AnalogSource: switch to SREG = oldSREG pattern for interrupt mask/restore 2012-11-20 22:31:09 +11:00
Andrew Tridgell 85054c1541 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 f541b2a081 AP_AnalogSource: added set_pin() interface
this allows pin numbers to be changed at runtime
2012-10-16 17:20:15 +11:00
uncrustify ed2fb8574d uncrustify libraries/AP_AnalogSource/AnalogSource.h 2012-08-21 19:00:17 -07:00
uncrustify 9306fc5870 uncrustify libraries/AP_AnalogSource/AP_AnalogSource_Arduino.h 2012-08-21 19:00:17 -07:00
uncrustify 49f440ae3e uncrustify libraries/AP_AnalogSource/AP_AnalogSource_ADC.h 2012-08-21 19:00:17 -07:00
uncrustify bf75296577 uncrustify libraries/AP_AnalogSource/AP_AnalogSource_Arduino.cpp 2012-08-21 19:00:17 -07:00
uncrustify 5e7867f972 uncrustify libraries/AP_AnalogSource/examples/AnalogSource_Arduino/AnalogSource_Arduino.pde 2012-08-21 19:00:17 -07:00
Andrew Tridgell a361a3aebd 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 99410cbbfe AP_AnalogSource: fixed reporting of VCC
the VCC pin number should not be converted
2012-07-21 19:49:24 +10:00
rmackay9 1105a35c77 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 ec70e87495 AnalogSource: prevent a division by zero on zero ADC data 2012-07-06 19:59:18 +10:00
Andrew Tridgell 2bd5cd3b9a AnalogSource: added some example code 2012-07-01 15:01:05 +10:00
Andrew Tridgell 2046e396a2 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 98f3386ea0 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 7c939e83e0 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 ffb4492c16 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 0caf351c32 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