Safety check: only try to read a packet if it was preceeded by an interrupt (which sets the pending flag)
This commit is contained in:
parent
3a5be4a7e4
commit
a3a8c0e179
1 changed files with 5 additions and 1 deletions
|
@ -28,7 +28,7 @@
|
|||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* @(#)$Id: cc2420.c,v 1.45 2010/03/16 18:10:09 adamdunkels Exp $
|
||||
* @(#)$Id: cc2420.c,v 1.46 2010/03/19 13:18:53 adamdunkels Exp $
|
||||
*/
|
||||
/*
|
||||
* This code is almost device independent and should be easy to port.
|
||||
|
@ -631,6 +631,10 @@ cc2420_read(void *buf, unsigned short bufsize)
|
|||
uint16_t checksum;
|
||||
#endif /* CC2420_CONF_CHECKSUM */
|
||||
|
||||
if(!pending) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
pending = 0;
|
||||
|
||||
GET_LOCK();
|
||||
|
|
Loading…
Reference in a new issue