diff --git a/boards/native/drivers/native-ltc4150.c b/boards/native/drivers/native-ltc4150.c index 9df6c90581..bdeea8a443 100644 --- a/boards/native/drivers/native-ltc4150.c +++ b/boards/native/drivers/native-ltc4150.c @@ -31,6 +31,7 @@ #define native_ltc4150_startup_delay 10 static int _int_enabled; +static int hwtimer_id; /** * native ltc4150 hwtimer - interrupt handler proxy @@ -40,9 +41,10 @@ static void _int_handler() DEBUG("ltc4150 _int_handler()\n"); ltc4150_interrupt(); if (_int_enabled == 1) { - if (hwtimer_set(100000, _int_handler, NULL) == -1) { + hwtimer_id = hwtimer_set(100000, _int_handler, NULL); + if (hwtimer_id == -1) { errx(1, "_int_handler: hwtimer_set"); - }; + } } } @@ -53,6 +55,7 @@ void ltc4150_disable_int(void) { DEBUG("ltc4150_disable_int()\n"); _int_enabled = 0; + hwtimer_remove(hwtimer_id); } /** @@ -62,9 +65,10 @@ void ltc4150_enable_int(void) { DEBUG("ltc4150_enable_int()\n"); _int_enabled = 1; - if (hwtimer_set(100000, _int_handler, NULL) == -1) { + hwtimer_id = hwtimer_set(100000, _int_handler, NULL); + if (hwtimer_id == -1) { errx(1, "ltc4150_enable_int: hwtimer_set"); - }; + } } /**