Commit graph

117 commits

Author SHA1 Message Date
Harald Pichler 21bbe79079 use Arduino like optotriac driver 2014-11-19 13:54:53 +01:00
Harald Pichler 026b961d5e simplify code, bugfixes PE3 2014-11-19 13:54:42 +01:00
Ralf Schlatterbeck 53cf5ab6cf Fix A0-A5 ADC constants, use in example sketch 2014-11-19 13:53:59 +01:00
Ralf Schlatterbeck fbe6ae6a60 Fix off-by-one error in digitalPinToTimer 2014-11-19 13:53:53 +01:00
Ralf Schlatterbeck ddbfd6712c Remove obsolet macro in example 2014-11-19 13:53:44 +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 d5284eebe1 Factor resources, fix time
Now there is a generic resource that can generate and parse
application/json as well as text/plain. It can be re-used, only the
from_string and to_string routines have to be written and the resource
properly set up. A new resource format is specified, see
GENERIC_RESOURCE in, e.g., examples/osd/pwm-example. This is now used in
all my examples, namely pwm-example, arduino-sketch, wallclock-time.

There was an off by one error for the month in time formatting (in
gmtime and localtime). And the leap-year computation was broken. Both
fixed now, so we get a correct date. For localtime we are still 2 hours
off because daylight saving isn't implemented yet.

Also renamed gmtime to utc.
2014-11-19 13:53:12 +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
Ralf Schlatterbeck cfec3c6e2d Initial implementation of avr hardware timer
Mainly for PWM use for now.
With example to set the LED to different brightness via COAP.
We switch the LED with 50 kHz (20µs) in this example.
2014-11-19 13:47:37 +01:00
Ralf Schlatterbeck b4fb8c3f52 Add wallclock time handling
New application and new example.
We use the built-in timer routines and add an offset to get the
wallclock time. The offset can be set by time-changing routines
(currently only settimeofday).
We also maintain an offset for timezone handling but this isn't
currently fully implemented.
2014-11-19 13:43:45 +01:00
Harald Pichler b886a1faaf initial upload 2014-11-19 13:43:19 +01:00
Harald Pichler 15bab74093 initial upload 2014-11-19 13:43:12 +01:00
Harald Pichler 465eb28382 cleanup code 2014-11-19 13:43:05 +01:00
Harald Pichler 38dbf611e6 add Arduino pin definition and commands 2014-11-19 13:42:57 +01:00
Ralf Schlatterbeck 56f6f87c94 Allow changing bootloader_get_mac address
Current default in the Makefile is the *new* bootloader address.
But for backward compatibility we've modified the run*.sh files
to use the old address. The run*.sh also now explain how to change
the default.
2014-11-19 13:42:35 +01:00
Harald Pichler 1efbe0736a change resources to simple and make climate2 default 2014-11-19 13:42:13 +01:00
Harald Pichler d90e0d622d get s/button ->show button status 0/1 2014-11-19 13:42:05 +01:00
Harald Pichler c106898d2b add 0.5s delay between off and on 2014-11-19 13:41:54 +01:00
Harald Pichler 94d764e4cb add timer and shutter functionality 2014-11-19 13:41:48 +01:00
Harald Pichler 4d383eb923 change to port F6,F7 2014-11-19 13:41:18 +01:00
Harald Pichler 678891a1a9 change battery and cpttem format to xx.xx 2014-11-19 13:41:08 +01:00
Harald Pichler a656cf1dcd add shutter control resources, reset,timer 2014-11-19 13:41:00 +01:00
Harald Pichler 03a4081913 add contiki led, remove led1,led2 2014-11-19 13:40:52 +01:00
Harald Pichler 8905f35d72 simplify project-conf.h 2014-11-19 13:40:45 +01:00
Harald Pichler 26b1e874d6 bugfix statusled include 2014-11-19 13:40:38 +01:00
Harald Pichler affe81cc6d bugfix includes and names 2014-11-19 13:40:29 +01:00
Harald Pichler 1ca7b52217 remove not needed binary files 2014-11-19 13:39:43 +01:00
Harald Pichler 46df18ceb1 add /s/cputemp resource 2014-11-19 13:39:26 +01:00
Harald Pichler a90a6e0f65 add /p/name and p/model resource, remove info 2014-11-19 13:39:19 +01:00
Marcus Priesch 630bd8e9e4 Factored to support configurable amount of pwm's, fixes 2014-11-19 13:38:58 +01:00
Marcus Priesch 85d29b6473 initial check in 2014-11-19 13:38:51 +01:00
Harald Pichler 088c7118e0 compile all osd-examples 2014-11-19 13:38:38 +01:00
Harald Pichler 4760891bb4 simplified led resource to one led actuator 2014-11-19 13:38:29 +01:00
Harald Pichler 425f348daa initial upload 2014-11-19 13:38:16 +01:00
Harald Pichler 11b13a7a7e remove link status and bugfix params.c 2014-11-19 13:37:41 +01:00
Harald Pichler f2bd00b660 add patch milligrad ds1820 from Jan-Benedict Glaw 2014-11-19 13:37:33 +01:00
Harald Pichler 9906e9736c temp and hum sensors values xxxx -> xx.xx 2014-11-19 13:37:21 +01:00
Harald Pichler e5baf940e7 add dhtxx temp coap 2014-11-19 13:37:13 +01:00
Harald Pichler 1b04a24022 config panid over defines 2014-11-19 13:37:06 +01:00
Harald Pichler 8b323633cd define new tria pins, configurable type ligt or shutter or plug 2014-11-19 13:36:58 +01:00
Harald Pichler 35668c8aed initial upload 2014-11-19 13:36:52 +01:00
Harald Pichler 7ea29294d7 cleanup code add coap13 support 2014-11-19 13:36:44 +01:00
Harald Pichler fd57fcef72 cleanup code, add coap13 support 2014-11-19 13:36:28 +01:00
Harald Pichler a9b36497f6 del unused files 2014-11-19 13:36:19 +01:00
Harald Pichler 3a3091c884 del unused file 2014-11-19 13:36:10 +01:00
Harald Pichler f7e4fb6499 code cleanup 2014-11-19 13:35:58 +01:00
Harald Pichler cc950ace98 cleanup code 2014-11-19 13:35:47 +01:00
Harald Pichler 96f1264120 remove old project use climate instead 2014-11-19 13:35:36 +01:00
Harald Pichler fa7920952f delete old example 2014-11-19 13:35:27 +01:00