Added energy estimation
This commit is contained in:
parent
b32a9b9be5
commit
f33844bd9c
2 changed files with 20 additions and 4 deletions
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: rs232.c,v 1.1 2006/06/18 07:49:33 adamdunkels Exp $
|
* @(#)$Id: rs232.c,v 1.2 2007/05/22 21:07:51 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \addtogroup esbrs232
|
/** \addtogroup esbrs232
|
||||||
|
@ -55,6 +55,7 @@ static int (* input_handler)(unsigned char) = NULL;
|
||||||
interrupt(UART1RX_VECTOR)
|
interrupt(UART1RX_VECTOR)
|
||||||
rs232_rx_usart1(void)
|
rs232_rx_usart1(void)
|
||||||
{
|
{
|
||||||
|
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||||
/* Check status register for receive errors. - before reading RXBUF since
|
/* Check status register for receive errors. - before reading RXBUF since
|
||||||
it clears the error and interrupt flags */
|
it clears the error and interrupt flags */
|
||||||
if(!(URCTL1 & RXERR) && input_handler != NULL) {
|
if(!(URCTL1 & RXERR) && input_handler != NULL) {
|
||||||
|
@ -66,6 +67,7 @@ interrupt(UART1RX_VECTOR)
|
||||||
/* Else read out the char to clear the I-flags, etc. */
|
/* Else read out the char to clear the I-flags, etc. */
|
||||||
RXBUF1;
|
RXBUF1;
|
||||||
}
|
}
|
||||||
|
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
|
@ -91,11 +93,15 @@ rs232_init(void)
|
||||||
void
|
void
|
||||||
rs232_send(char c)
|
rs232_send(char c)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
ENERGEST_ON(ENERGEST_TYPE_SERIAL);
|
||||||
/* Loop until the transmission buffer is available. */
|
/* Loop until the transmission buffer is available. */
|
||||||
while ((IFG2 & UTXIFG1) == 0);
|
while((IFG2 & UTXIFG1) == 0) {
|
||||||
|
}
|
||||||
|
|
||||||
/* Transmit the data. */
|
/* Transmit the data. */
|
||||||
TXBUF1 = c;
|
TXBUF1 = c;
|
||||||
|
ENERGEST_OFF(ENERGEST_TYPE_SERIAL);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: tr1001-gcr.c,v 1.7 2007/03/19 00:35:23 adamdunkels Exp $
|
* @(#)$Id: tr1001-gcr.c,v 1.8 2007/05/22 21:08:04 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* \addtogroup esb
|
* \addtogroup esb
|
||||||
|
@ -76,6 +76,14 @@ static unsigned short packets_err;
|
||||||
static unsigned short packets_ok;
|
static unsigned short packets_ok;
|
||||||
#endif /* TR1001_STATISTICS */
|
#endif /* TR1001_STATISTICS */
|
||||||
|
|
||||||
|
/*const struct radio_driver tr1001_driver =
|
||||||
|
{
|
||||||
|
tr1001_send,
|
||||||
|
tr1001_read,
|
||||||
|
tr1001_set_receiver,
|
||||||
|
tr1001_on,
|
||||||
|
tr1001_off,
|
||||||
|
};*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The buffer which holds incoming data.
|
* The buffer which holds incoming data.
|
||||||
|
@ -142,7 +150,7 @@ static struct process *poll_process;
|
||||||
#define LOG(...)
|
#define LOG(...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define GCRLOG(...) /* printf(__VA_ARGS__) */
|
#define GCRLOG(...) /* printf(__VA_ARGS__)*/
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#if TR1001_STATISTICS
|
#if TR1001_STATISTICS
|
||||||
|
@ -386,10 +394,12 @@ tr1001_init(struct process *p)
|
||||||
interrupt (UART0RX_VECTOR)
|
interrupt (UART0RX_VECTOR)
|
||||||
tr1001_rxhandler(void)
|
tr1001_rxhandler(void)
|
||||||
{
|
{
|
||||||
|
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||||
tr1001_default_rxhandler_pt(RXBUF0);
|
tr1001_default_rxhandler_pt(RXBUF0);
|
||||||
if(tr1001_rxstate == RXSTATE_FULL) {
|
if(tr1001_rxstate == RXSTATE_FULL) {
|
||||||
LPM_AWAKE();
|
LPM_AWAKE();
|
||||||
}
|
}
|
||||||
|
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue