Refactor A/D conversion in adc.c
Now the necessary settings are in adc.h. Refactored to allow repeated ADC reads without reinitialization. Arduino allows setting analogReference, this is now also implemented. ADC is now initialized to sane values in apps/arduino/arduino-process.c dev/arduino/arduino-compat.h now has all hardware independent settings for arduino (some moved from platform/osd-merkur/dev/hw-arduino.h). turnOffPWM re-implemented with hw_timer, removed from wiring_digital.c ADC-specific arduino stuff moved to arduino-compat.h Arduinos wiring_analog no longer necessary. arduino-sketch example now reads analog inputs 1 and 5 using analogRead.
This commit is contained in:
parent
6c06f43417
commit
77c02d58f8
12 changed files with 154 additions and 199 deletions
|
@ -51,6 +51,7 @@
|
|||
|
||||
#include "arduino-process.h"
|
||||
#include "hw_timer.h"
|
||||
#include "adc.h"
|
||||
#include "hw-arduino.h"
|
||||
|
||||
PROCESS(arduino_sketch, "Arduino Sketch Wrapper");
|
||||
|
@ -60,6 +61,7 @@ PROCESS_THREAD(arduino_sketch, ev, data)
|
|||
PROCESS_BEGIN();
|
||||
|
||||
arduino_pwm_timer_init ();
|
||||
adc_init ();
|
||||
setup ();
|
||||
while (1) {
|
||||
loop ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue