diff --git a/drivers/Makefile.dep b/drivers/Makefile.dep index 603519c61e1283e6b09e832a1e7768e6a8145d9e..d269da604f92391efca3e832d7f176d25d7936e6 100644 --- a/drivers/Makefile.dep +++ b/drivers/Makefile.dep @@ -139,10 +139,6 @@ ifneq (,$(filter lpd8808,$(USEMODULE))) FEATURES_REQUIRED += periph_gpio endif -ifneq (,$(filter ltc4150,$(USEMODULE))) - USEMODULE += xtimer -endif - ifneq (,$(filter mpu9150,$(USEMODULE))) USEMODULE += xtimer endif diff --git a/drivers/include/ltc4150.h b/drivers/include/ltc4150.h deleted file mode 100644 index 85b1ad70968660c931e2fbabddcabc8f5c5ecf35..0000000000000000000000000000000000000000 --- a/drivers/include/ltc4150.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2014 Freie Universität Berlin - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @defgroup drivers_ltc4150 LTC4150 Coulomb Counter - * @ingroup drivers_sensors - * @brief Device driver for LTC4150 coulomb counters - * - * @deprecated This driver should be ported to the peripheral driver interface - * (@ref drivers_periph) - * - * @{ - * - * @file - * @brief Driver interface for the LTC4150 driver - * - * @author Heiko Will <heiko.will@fu-berlin.de> - */ - - -#ifndef LTC4150_H -#define LTC4150_H - -#include "ltc4150_arch.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Initialize the counter - */ -void ltc4150_init(void); - -/** - * @brief Start a measurement - */ -void ltc4150_start(void); - -/** - * @brief End the ongoing measurement - */ -void ltc4150_stop(void); - -/** - * @brief Get the current electrical current - * - * @return electrical current in mA - */ -double ltc4150_get_current_mA(void); - -/** - * @brief Get the total power used since @p ltc4150_start was called - * - * @return power used in mAh - */ -double ltc4150_get_total_mAh(void); - -/** - * @brief Get the total energy used since @p ltc4150_start was called - * - * @return energy used in Joule - */ -double ltc4150_get_total_Joule(void); - -/** - * @brief Get the average electrical current sine @p ltc4150_start was called - * - * @return average current in mA - */ -double ltc4150_get_avg_mA(void); - -/** - * @brief Get the time the current measurement is going on - * - * @return time - */ -int ltc4150_get_interval(void); - -/** - * @brief Get the number of samples taken - * - * @return number of samples in the current interval - */ -long ltc4150_get_intcount(void); - -#ifdef __cplusplus -} -#endif - -#endif /* LTC4150_H */ -/** @} */ diff --git a/drivers/include/ltc4150_arch.h b/drivers/include/ltc4150_arch.h deleted file mode 100644 index f3590d8989cde1c6c7feaca2934c421843d0021b..0000000000000000000000000000000000000000 --- a/drivers/include/ltc4150_arch.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2008-2009, Freie Universitaet Berlin (FUB). All rights reserved. - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @defgroup drivers_ltc4150 LTC4150 - * @ingroup drivers_sensors - * @brief Driver for the Linear Technology LTC4150 Coulomb Counter - * @{ - * - * @file - * @brief LTC4150 Coulomb Counter - * - * @author Heiko Will <heiko.will@fu-berlin.de> - */ - -#ifndef LTC4150_ARCH_H -#define LTC4150_ARCH_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Constants used by the driver - * @{ - */ -#define _GFH (double)32.631375 -#define _R_SENSE (double)0.330 -#define SUPPLY_VOLTAGE (5) -/** @} */ - -/** - * @brief Board specific ltc4150 interrupt disable - **/ -void ltc4150_disable_int(void); - -/** - * @brief Board specific ltc4150 interrupt enable - **/ -void ltc4150_enable_int(void); - -/** - * @brief Board specific synchronization of ltc4150 - **/ -void ltc4150_sync_blocking(void); - -/** - * @brief Board specific ltc4150 initialization - **/ -void ltc4150_arch_init(void); - -/** - * @brief Ltc4150 interrupt handler - * - * This handler shall be called on ltc4150 interrupt, it is implemented in the - * driver. - */ -void ltc4150_interrupt(void); - -#ifdef __cplusplus -} -#endif - -/** * @} */ -#endif /* LTC4150_ARCH_H */ diff --git a/drivers/ltc4150/Makefile b/drivers/ltc4150/Makefile deleted file mode 100644 index 48422e909a47d7cd428d10fa73825060ccc8d8c2..0000000000000000000000000000000000000000 --- a/drivers/ltc4150/Makefile +++ /dev/null @@ -1 +0,0 @@ -include $(RIOTBASE)/Makefile.base diff --git a/drivers/ltc4150/ltc4150.c b/drivers/ltc4150/ltc4150.c deleted file mode 100644 index 4b17b83487d050b7e601da1226175cf66ef14def..0000000000000000000000000000000000000000 --- a/drivers/ltc4150/ltc4150.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright 2008-2009, Freie Universitaet Berlin (FUB). All rights reserved. - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @ingroup ltc4150 - * @{ - */ - -/** - * @file - * @brief LTC4150 Coulomb Counter - * - * @author Heiko Will - * @author Kaspar Schleiser <kaspar@schleiser.de> - */ - -#include <xtimer.h> -#include "ltc4150_arch.h" - -static volatile unsigned long int_count; -static unsigned int last_int_time; -static unsigned int last_int_duration; -static unsigned int start_time; - -static double __attribute__((__no_instrument_function__)) int_to_coulomb(int ints) -{ - return ((double)ints) / (_GFH * _R_SENSE); -} - -static double __attribute__((__no_instrument_function__)) coulomb_to_mA(double coulomb) -{ - return (coulomb * 1000) / 3600; -} - -static double mAh_to_Joule(double mAh) -{ - return (SUPPLY_VOLTAGE * mAh * 3600); -} - -uint32_t ltc4150_get_last_int_duration_us(void) -{ - return HWTIMER_TICKS_TO_US(last_int_duration); -} - -double ltc4150_get_current_mA(void) -{ - return 1000000000 / (ltc4150_get_last_int_duration_us() * (_GFH * _R_SENSE)); -} - -double __attribute__((__no_instrument_function__)) ltc4150_get_total_mAh(void) -{ - return coulomb_to_mA(int_to_coulomb(int_count)); -} - -double ltc4150_get_total_Joule(void) -{ - return mAh_to_Joule(ltc4150_get_total_mAh()); -} - -double ltc4150_get_avg_mA(void) -{ - return (int_to_coulomb(int_count) * 1000000000) / HWTIMER_TICKS_TO_US(last_int_time - start_time); -} - -int ltc4150_get_interval(void) -{ - return HWTIMER_TICKS_TO_US(last_int_time - start_time); -} - -unsigned long __attribute__((__no_instrument_function__)) ltc4150_get_intcount(void) -{ - return int_count; -} - -void ltc4150_init(void) -{ - ltc4150_arch_init(); -} - -void ltc4150_start(void) -{ - ltc4150_disable_int(); - int_count = 0; - uint32_t now = xtimer_now_usec(); - ltc4150_sync_blocking(); - start_time = now; - last_int_time = now; - ltc4150_enable_int(); -} - -void ltc4150_stop(void) -{ - ltc4150_disable_int(); -} - -void __attribute__((__no_instrument_function__)) ltc4150_interrupt(void) -{ - uint32_t now = xtimer_now_usec(); - - if (now >= last_int_time) { - last_int_duration = now - last_int_time; - } - else { - last_int_duration = (0 - 1) - last_int_time + now + 1; - } - - last_int_time = now; - int_count++; -} - -/** @} */ diff --git a/examples/default/main.c b/examples/default/main.c index a9e56d215bcf16fa5c5806b780f35f97f5bc342d..3da05daf56c819a372c93704b02853efa4803b89 100644 --- a/examples/default/main.c +++ b/examples/default/main.c @@ -33,10 +33,6 @@ #include "periph/rtc.h" #endif -#ifdef MODULE_LTC4150 -#include "ltc4150.h" -#endif - #ifdef MODULE_NETIF #include "net/gnrc/pktdump.h" #include "net/gnrc.h" @@ -44,10 +40,6 @@ int main(void) { -#ifdef MODULE_LTC4150 - ltc4150_start(); -#endif - #ifdef FEATURE_PERIPH_RTC rtc_init(); #endif diff --git a/sys/auto_init/auto_init.c b/sys/auto_init/auto_init.c index 77b3a567ca7d1c0d2e7d4831f60f15773aae2b31..85f7355267222899c2d55ed42aff4bbc7ccd44df 100644 --- a/sys/auto_init/auto_init.c +++ b/sys/auto_init/auto_init.c @@ -32,10 +32,6 @@ #include "gpioint.h" #endif -#ifdef MODULE_LTC4150 -#include "ltc4150.h" -#endif - #ifdef MODULE_MCI #include "diskio.h" #endif @@ -124,10 +120,6 @@ void auto_init(void) DEBUG("Auto init gpioint module.\n"); gpioint_init(); #endif -#ifdef MODULE_LTC4150 - DEBUG("Auto init ltc4150 module.\n"); - ltc4150_init(); -#endif #ifdef MODULE_MCI DEBUG("Auto init mci module.\n"); mci_initialize(); diff --git a/sys/shell/commands/Makefile b/sys/shell/commands/Makefile index 0e0dc877b6d670f203fdcd443b87e83d09980dc8..f22f61b0a2eabc3a9006fe3414eb934ef0c72b3a 100644 --- a/sys/shell/commands/Makefile +++ b/sys/shell/commands/Makefile @@ -5,9 +5,6 @@ SRC = shell_commands.c sc_sys.c ifneq (,$(filter mci,$(USEMODULE))) SRC += sc_disk.c endif -ifneq (,$(filter ltc4150,$(USEMODULE))) - SRC += sc_ltc4150.c -endif ifneq (,$(filter ps,$(USEMODULE))) SRC += sc_ps.c endif diff --git a/sys/shell/commands/sc_ltc4150.c b/sys/shell/commands/sc_ltc4150.c deleted file mode 100644 index 975a5f7647d805317e4b231922c031de21a5ffa0..0000000000000000000000000000000000000000 --- a/sys/shell/commands/sc_ltc4150.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2013 INRIA. - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @ingroup sys_shell_commands - * @{ - * - * @file - * @brief Provides shell commands to access ltc4150 - * - * @author Oliver Hahm <oliver.hahm@inria.fr> - * - * @} - */ - -#include <stdio.h> -#include "ltc4150.h" - -int _get_current_handler(int argc, char **argv) -{ - (void) argc; - (void) argv; - - printf("Power usage: %.4f mA (%.4f mA avg/ %.4f mAh total / %i usec)\n", - ltc4150_get_current_mA(), ltc4150_get_avg_mA(), ltc4150_get_total_mAh(), ltc4150_get_interval()); - - return 0; -} - -int _reset_current_handler(int argc, char **argv) -{ - (void) argc; - (void) argv; - - ltc4150_start(); - - return 0; -}