Added parameter to the mac off() method that specifies whether or not the radio should be turned off when the MAC layer is turned off

This commit is contained in:
adamdunkels 2008-02-24 21:05:28 +00:00
parent 436d1f25eb
commit 32a3fa5d4a
2 changed files with 9 additions and 5 deletions

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: mac.h,v 1.1 2007/05/25 06:40:19 adamdunkels Exp $ * $Id: mac.h,v 1.2 2008/02/24 21:05:28 adamdunkels Exp $
*/ */
/** /**
@ -58,7 +58,7 @@ struct mac_driver {
int (* on)(void); int (* on)(void);
/** Turn the MAC layer off. */ /** Turn the MAC layer off. */
int (* off)(void); int (* off)(int keep_radio_on);
}; };

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: nullmac.c,v 1.6 2007/12/23 14:56:54 oliverschmidt Exp $ * $Id: nullmac.c,v 1.7 2008/02/24 21:05:28 adamdunkels Exp $
*/ */
/** /**
@ -81,9 +81,13 @@ on(void)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static int static int
off(void) off(int keep_radio_on)
{ {
return radio->off(); if(keep_radio_on) {
return radio->on();
} else {
return radio->off();
}
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
const struct mac_driver nullmac_driver = { const struct mac_driver nullmac_driver = {