bugfix compile error

This commit is contained in:
Harald Pichler 2017-11-09 10:59:07 +01:00
parent b929b419af
commit 6695835808
5 changed files with 10 additions and 15 deletions

View file

@ -70,6 +70,7 @@ extern "C"{
#define bitClear(value, bit) ((value) &= ~(1UL << (bit))) #define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit)) #define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
#define clockCyclesPerMicrosecond() ( F_CPU / 1000000L )
#define microsecondsToClockCycles(a) ( (a) * (F_CPU / 1000000L) ) #define microsecondsToClockCycles(a) ( (a) * (F_CPU / 1000000L) )
typedef unsigned int word; typedef unsigned int word;

View file

@ -17,15 +17,12 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#if defined(ARDUINO_ARCH_AVR)
#include <avr/interrupt.h> #include <avr/interrupt.h>
extern "C" { #include "Arduino.h"
#include "Arduino.h"
}
#include "Servo.h" #include "Servo.h"
#if defined(ARDUINO_ARCH_AVR)
#define usToTicks(_us) (( clockCyclesPerMicrosecond()* _us) / 8) // converts microseconds to tick (assumes prescale of 8) // 12 Aug 2009 #define usToTicks(_us) (( clockCyclesPerMicrosecond()* _us) / 8) // converts microseconds to tick (assumes prescale of 8) // 12 Aug 2009
#define ticksToUs(_ticks) (( (unsigned)_ticks * 8)/ clockCyclesPerMicrosecond() ) // converts from ticks back to microseconds #define ticksToUs(_ticks) (( (unsigned)_ticks * 8)/ clockCyclesPerMicrosecond() ) // converts from ticks back to microseconds

View file

@ -50,6 +50,7 @@
#include <inttypes.h> #include <inttypes.h>
#define ARDUINO_ARCH_AVR #define ARDUINO_ARCH_AVR
/* /*
* Defines for 16 bit timers used with Servo library * Defines for 16 bit timers used with Servo library
* *

View file

@ -37,7 +37,7 @@
#define PLATFORM_HAS_BATTERY 1 #define PLATFORM_HAS_BATTERY 1
#define LOOP_INTERVAL (30 * CLOCK_SECOND) #define LOOP_INTERVAL (CLOCK_SECOND/10)
/* Save energy */ /* Save energy */
//#define RDC_CONF_PT_YIELD_OFF //#define RDC_CONF_PT_YIELD_OFF

View file

@ -9,27 +9,23 @@
* Note that for a normal arduino sketch you won't have to include any * Note that for a normal arduino sketch you won't have to include any
* of the contiki-specific files here, the sketch should just work. * of the contiki-specific files here, the sketch should just work.
*/ */
#include "Servo.h"
extern "C" { extern "C" {
#include "arduino-process.h" #include "arduino-process.h"
#include "rest-engine.h" #include "rest-engine.h"
#include "net/netstack.h" #include "net/netstack.h"
#include "Servo.h"
extern resource_t res_led, res_battery, res_cputemp; extern resource_t res_led, res_battery, res_cputemp;
}
uint8_t led_pin=4; uint8_t led_pin=4;
uint8_t led_status; uint8_t led_status;
int potpin = A5; // analog pin used to connect the potentiometer int potpin = A5; // analog pin used to connect the potentiometer
int val; // variable to read the value from the analog pin int val; // variable to read the value from the analog pin
Servo servo(); // create servo object to control a servo Servo servo; // create servo object to control a servo
}
void setup (void) void setup (void)
{ {
@ -48,7 +44,7 @@ void setup (void)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
// NETSTACK_MAC.off(1); // NETSTACK_MAC.off(1);
mcu_sleep_set(128); // mcu_sleep_set(128);
} }
void loop (void) void loop (void)