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
This commit is contained in:
parent
b17934c491
commit
b6be226e69
22 changed files with 999 additions and 361 deletions
30
examples/osd/arduino-sketch/led_pwm.h
Normal file
30
examples/osd/arduino-sketch/led_pwm.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
* \defgroup Arduino LED PWM example
|
||||
*
|
||||
* Resource definition for Arduino LED PWM module
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* Resource definitions for the Arduino LED PWM module
|
||||
*
|
||||
* \author
|
||||
* Ralf Schlatterbeck <rsc@tux.runtux.com>
|
||||
*/
|
||||
|
||||
#ifndef led_pwm_h
|
||||
#define led_pwm_h
|
||||
#include "contiki.h"
|
||||
#include "contiki-net.h"
|
||||
#include "erbium.h"
|
||||
#include "er-coap-13.h"
|
||||
|
||||
extern uint8_t pwm;
|
||||
extern uint8_t period_100ms;
|
||||
extern resource_t resource_led_pwm;
|
||||
extern resource_t resource_led_period;
|
||||
|
||||
#endif // led_pwm_h
|
||||
/** @} */
|
Loading…
Add table
Add a link
Reference in a new issue