Enable a flag when packet SFD seen

This commit is contained in:
adamdunkels 2010-01-19 13:11:01 +00:00
parent 6f72ff7af1
commit acea0afb35
2 changed files with 9 additions and 2 deletions

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)$Id: cc2420-arch-sfd.c,v 1.1 2009/12/05 19:42:56 adamdunkels Exp $
* @(#)$Id: cc2420-arch-sfd.c,v 1.2 2010/01/19 13:11:01 adamdunkels Exp $
*/
#include <io.h>
@ -35,6 +35,7 @@
#include "dev/spi.h"
#include "dev/cc2420.h"
uint8_t cc2420_arch_sfd_counter;
uint16_t cc2420_arch_sfd_start_time;
uint16_t cc2420_arch_sfd_end_time;
@ -48,8 +49,10 @@ cc24240_timerb1_interrupt(void)
/* always read TBIV to clear IFG */
tbiv = TBIV;
if(SFD_IS_1) {
cc2420_arch_sfd_counter++;
cc2420_arch_sfd_start_time = TBCCR1;
} else {
cc2420_arch_sfd_counter = 0;
cc2420_arch_sfd_end_time = TBCCR1;
}
ENERGEST_OFF(ENERGEST_TYPE_IRQ);

View file

@ -26,11 +26,15 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)$Id: cc2420-arch-sfd.h,v 1.1 2009/12/05 19:42:56 adamdunkels Exp $
* @(#)$Id: cc2420-arch-sfd.h,v 1.2 2010/01/19 13:11:01 adamdunkels Exp $
*/
#ifndef CC2420_ARCH_SFD_H
#define CC2420_ARCH_SFD_H
extern uint8_t cc2420_arch_sfd_counter;
extern uint16_t cc2420_arch_sfd_start_time;
extern uint16_t cc2420_arch_sfd_end_time;
void cc2420_arch_sfd_init(void);
#endif /* CC2420_ARCH_SFD_H */