mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
drivers: remove outdated ltc4150 driver
This commit is contained in:
parent
881ef849ac
commit
6e6a14f449
@ -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
|
||||
|
@ -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 */
|
||||
/** @} */
|
@ -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 */
|
@ -1 +0,0 @@
|
||||
include $(RIOTBASE)/Makefile.base
|
@ -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++;
|
||||
}
|
||||
|
||||
/** @} */
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user