updated API and added active flags because some sensors react on radio activity

This commit is contained in:
nifi 2006-10-10 12:37:04 +00:00
parent 8a3481d632
commit 11c1762a62

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* @(#)$Id: tr1001.c,v 1.4 2006/10/09 11:56:13 adamdunkels Exp $
* @(#)$Id: tr1001.c,v 1.5 2006/10/10 12:37:04 nifi Exp $
*/
/**
* \addtogroup esb
@ -93,6 +93,8 @@ static unsigned short tr1001_rxlen = 0;
*/
volatile unsigned char tr1001_rxstate = RXSTATE_READY;
static u8_t radio_active;
static u16_t rxcrc, rxcrctmp;
/*
@ -108,8 +110,6 @@ struct tr1001_hdr {
*/
#define TR1001_HDRLEN sizeof(struct tr1001_hdr)
#define BUF ((uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN])
#define OFF 0
#define ON 1
static u8_t onoroff = ON;
@ -588,6 +588,8 @@ tr1001_send(u8_t *packet, u16_t len)
/* Prepare the transmission. */
prepare_transmission(NUM_SYNCHBYTES);
radio_active = 1;
crc16 = 0xffff;
/* Send packet header. */
@ -622,7 +624,7 @@ tr1001_send(u8_t *packet, u16_t len)
}
/*---------------------------------------------------------------------------*/
unsigned short
tr1001_poll(void)
tr1001_poll(u8_t *buf, u16_t bufsize)
{
unsigned short tmplen;
@ -729,5 +731,17 @@ tr1001_sstrength_value(unsigned int type)
}
#endif /* TR1001_STATISTICS */
/*---------------------------------------------------------------------------*/
unsigned char
tr1001_active(void)
{
return radio_active;
}
/*--------------------------------------------------------------------------*/
void
tr1001_clear_active(void)
{
radio_active = 0;
}
/*---------------------------------------------------------------------------*/
/** @} */
/** @} */