moved energest from lib/ to sys/

This commit is contained in:
adamdunkels 2008-07-03 23:59:20 +00:00
parent 45c6d92377
commit 64b6663b11
3 changed files with 22 additions and 17 deletions

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* @(#)$Id: clock.c,v 1.12 2008/01/08 08:01:41 adamdunkels Exp $
* @(#)$Id: clock.c,v 1.13 2008/07/03 23:59:20 adamdunkels Exp $
*/
@ -37,7 +37,7 @@
#include "contiki-conf.h"
#include "lib/energest.h"
#include "sys/energest.h"
#include "sys/clock.h"
#include "sys/etimer.h"
@ -108,6 +108,7 @@ clock_init(void)
/* Select SMCLK (2.4576MHz), clear TAR */
/* TACTL = TASSEL1 | TACLR | ID_3; */
/* Select ACLK 32768Hz clock, divide by 8 */
TACTL = TASSEL0 | TACLR | ID_3;

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)$Id: uart1.c,v 1.5 2008/02/03 20:59:35 adamdunkels Exp $
* @(#)$Id: uart1.c,v 1.6 2008/07/03 23:59:20 adamdunkels Exp $
*/
/*
@ -37,7 +37,7 @@
#include <io.h>
#include <signal.h>
#include "lib/energest.h"
#include "sys/energest.h"
#include "dev/uart1.h"
#include "dev/leds.h"
#include "dev/watchdog.h"

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: energest-arch.c,v 1.4 2007/12/17 18:47:17 nvt-se Exp $
* $Id: energest-arch.c,v 1.5 2008/07/03 23:59:20 adamdunkels Exp $
*/
/**
@ -38,28 +38,32 @@
* Adam Dunkels <adam@sics.se>
*/
#include "lib/energest.h"
#include "sys/energest.h"
#include "sys/clock.h"
#include "sys/rtimer.h"
#define DEC2FIX(h,d) ((h * 64) + (unsigned long)(0.64 * d))
#define DEC2FIX(h,d) ((h * 64L) + (unsigned long)((d * 64L) / 1000L))
/*---------------------------------------------------------------------------*/
#if 0
unsigned long
energest_arch_current_estimate(void)
{
return 3 * /* The voltage is 3 V */ /* The DEC2FIX() stuff is
the current */
(energest_type_time(ENERGEST_TYPE_CPU) * DEC2FIX(18,0) +
energest_type_time(ENERGEST_TYPE_LPM) * DEC2FIX(0,545) +
energest_type_time(ENERGEST_TYPE_LED_GREEN) * DEC2FIX(46,0) + /* Not measured */
energest_type_time(ENERGEST_TYPE_LED_YELLOW) * DEC2FIX(46,0) + /* Not measured */
energest_type_time(ENERGEST_TYPE_LED_RED) * DEC2FIX(46,0) +
energest_type_time(ENERGEST_TYPE_SENSORS) * DEC2FIX(60,0) + /* Not measured */
energest_type_time(ENERGEST_TYPE_TRANSMIT) * DEC2FIX(177,0) +
energest_type_time(ENERGEST_TYPE_LISTEN) * DEC2FIX(200,0)) / 10;
return /* The voltage is 3 V */ /* The DEC2FIX() stuff is
the current */
(3 * (energest_type_time(ENERGEST_TYPE_CPU) * DEC2FIX(1L,800L) +
energest_type_time(ENERGEST_TYPE_LPM) * DEC2FIX(0L,545L) +
energest_type_time(ENERGEST_TYPE_LED_GREEN) * DEC2FIX(4L,600L) + /* Not measured */
energest_type_time(ENERGEST_TYPE_LED_YELLOW) * DEC2FIX(4L,600L) + /* Not measured */
energest_type_time(ENERGEST_TYPE_LED_RED) * DEC2FIX(4L,600L) +
energest_type_time(ENERGEST_TYPE_SENSORS) * DEC2FIX(6L,000L) + /* Not measured */
energest_type_time(ENERGEST_TYPE_TRANSMIT) * DEC2FIX(17L,700L) +
energest_type_time(ENERGEST_TYPE_LISTEN) * DEC2FIX(20L,000L))) /
(64 * ENERGEST_SECOND / 1000);
return 0;
}
#endif
/*---------------------------------------------------------------------------*/
unsigned short
energest_arch_now(void)