Commit graph

10 commits

Author SHA1 Message Date
Ralf Schlatterbeck
50a34d1235 Fix whitespace 2016-08-12 22:03:44 +02:00
Harald Pichler
c42a75d9d6 optimize power consumtion 2016-08-11 23:49:45 +02:00
Harald Pichler
6a2d13216a add mcu_sleep_off and on 2016-08-11 19:46:33 +02:00
Harald Pichler
8402b1c151 initial upload, add button 2016-08-03 21:58:02 +02:00
harald42
9a3c6adf8d add mcu_sleep routines 2016-04-12 10:34:40 +02:00
Harald Pichler
df95393980 remove init pwm per default, switch moisture sensor on and off to save energy 2014-12-12 08:47:01 +01:00
Ralf Schlatterbeck
ef06560465 Use PROCESS_PAUSE macro 2014-11-19 13:54:07 +01:00
Ralf Schlatterbeck
abdf6f8c6b 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.
2014-11-19 13:53:32 +01:00
Ralf Schlatterbeck
c46d6afa39 Make Arduino timer stuff work on Contiki
New discovery: Contiki also uses timer 0. With almost the same interface
as Arduino. So we now completely get rid of wiring.c (only the main
file, the other wiring_xxx stay) and implement Arduino timer, delay, etc
in terms of the corresponding Contiki routines. Verified that now delay
works as expected. The LED in examples/osd/arduino-sketch blinks!

Before this, the arduino_init routine in wiring.c destroyed the timer-0
initialization of contiki, making both, contiki timer implementation
*and* contiki timer implementation fail if the arduino_init routine was
called. Now both work.

Squashed with following bug-fix commit.
2014-11-19 13:50:58 +01:00
Ralf Schlatterbeck
b6be226e69 Add Arduino compatibility layer
We can now directly compile arduino sketches (.pde) files.
Arduino compatible analogWrite works now.
But there is still a long way to go, serial I/O and timer stuff (delay,
millis etc) currently don't work (not tested but I don't expect this to
work).
It can be used in an arduino sketch or in a normal contiki program.
We get a PWM frequency of 490.2 Hz (a period of 2.040 ms), that's
Arduino compatible. If you need different frequencies see native timer
usage in examples/osd/pwm-example
In a contiki program you have to call arduino_pwm_timer_init to
initialize the timer before pwm works. The arduino sketch wrapper
already does this.
For running a sketch, see examples/osd/arduino-sketch
2014-11-19 13:48:05 +01:00