Made initialization function return a pointer to the MAC driver structure, to make initialization nicer

This commit is contained in:
adamdunkels 2007-10-23 21:27:57 +00:00
parent f638c628d7
commit 67aa9e8589
2 changed files with 27 additions and 23 deletions

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: nullmac.c,v 1.3 2007/05/25 08:07:15 adamdunkels Exp $
* $Id: nullmac.c,v 1.4 2007/10/23 21:27:57 adamdunkels Exp $
*/
/**
@ -84,14 +84,6 @@ off(void)
return radio->off();
}
/*---------------------------------------------------------------------------*/
void
nullmac_init(const struct radio_driver *d)
{
radio = d;
radio->set_receive_function(input);
radio->on();
}
/*---------------------------------------------------------------------------*/
const struct mac_driver nullmac_driver = {
send,
read,
@ -99,3 +91,13 @@ const struct mac_driver nullmac_driver = {
on,
off,
};
/*---------------------------------------------------------------------------*/
const struct mac_driver *
nullmac_init(const struct radio_driver *d)
{
radio = d;
radio->set_receive_function(input);
radio->on();
return &nullmac_driver;
}
/*---------------------------------------------------------------------------*/