Skip to content

Commit

Permalink
Merge pull request contiki-os#1516 from alignan/pull/weather-meter-co…
Browse files Browse the repository at this point in the history
…ntikimac

Weather meter: replaced rtimer by ctimer as it was breaking contikimac
  • Loading branch information
alignan committed Feb 13, 2016
2 parents c6ded00 + 25ff850 commit 4cd0e3a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions platform/zoul/dev/weather-meter.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
#include "dev/gpio.h"
#include "dev/ioc.h"
#include "sys/timer.h"
#include "sys/rtimer.h"
#include "sys/ctimer.h"
/*---------------------------------------------------------------------------*/
#define DEBUG 0
#if DEBUG
Expand All @@ -77,7 +77,7 @@ static uint8_t enabled;
process_event_t anemometer_int_event;
process_event_t rain_gauge_int_event;
/*---------------------------------------------------------------------------*/
static struct rtimer rt;
static struct ctimer ct;
static struct timer debouncetimer;
/*---------------------------------------------------------------------------*/
typedef struct {
Expand Down Expand Up @@ -186,7 +186,7 @@ weather_meter_get_wind_dir(void)
}
/*---------------------------------------------------------------------------*/
static void
rt_callback(struct rtimer *t, void *ptr)
ct_callback(void *ptr)
{
uint32_t wind_speed;
int16_t wind_dir;
Expand Down Expand Up @@ -261,7 +261,8 @@ rt_callback(struct rtimer *t, void *ptr)
/* Enable the interrupt again */
GPIO_ENABLE_INTERRUPT(ANEMOMETER_SENSOR_PORT_BASE,
ANEMOMETER_SENSOR_PIN_MASK);
rtimer_set(&rt, RTIMER_NOW() + RTIMER_SECOND, 1, rt_callback, NULL);

ctimer_set(&ct, CLOCK_SECOND, ct_callback, NULL);
}
/*---------------------------------------------------------------------------*/
PROCESS(weather_meter_int_process, "Weather meter interrupt process handler");
Expand Down Expand Up @@ -444,7 +445,7 @@ configure(int type, int value)
/* Initialize here prior the first second tick */
wind_vane.value_prev = weather_meter_get_wind_dir();

rtimer_set(&rt, RTIMER_NOW() + RTIMER_SECOND, 1, rt_callback, NULL);
ctimer_set(&ct, CLOCK_SECOND, ct_callback, NULL);

GPIO_ENABLE_INTERRUPT(ANEMOMETER_SENSOR_PORT_BASE, ANEMOMETER_SENSOR_PIN_MASK);
GPIO_ENABLE_INTERRUPT(RAIN_GAUGE_SENSOR_PORT_BASE, RAIN_GAUGE_SENSOR_PIN_MASK);
Expand Down Expand Up @@ -485,3 +486,4 @@ configure(int type, int value)
SENSORS_SENSOR(weather_meter, WEATHER_METER_SENSOR, value, configure, NULL);
/*---------------------------------------------------------------------------*/
/** @} */

0 comments on commit 4cd0e3a

Please sign in to comment.