Remade the rimeaddr_t u16 to be an array rather than a scalar
This commit is contained in:
parent
b377a83730
commit
b7afd2baf0
2 changed files with 13 additions and 6 deletions
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: rimeaddr.c,v 1.1 2007/03/15 19:43:07 adamdunkels Exp $
|
* $Id: rimeaddr.c,v 1.2 2007/03/21 23:22:11 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,18 +41,24 @@
|
||||||
#include "rimeaddr.h"
|
#include "rimeaddr.h"
|
||||||
|
|
||||||
rimeaddr_t rimeaddr_node_addr;
|
rimeaddr_t rimeaddr_node_addr;
|
||||||
const rimeaddr_t rimeaddr_null = {.u16 = 0};
|
const rimeaddr_t rimeaddr_null = {.u16 = {0}};
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
rimeaddr_copy(rimeaddr_t *dest, const rimeaddr_t *src)
|
rimeaddr_copy(rimeaddr_t *dest, const rimeaddr_t *src)
|
||||||
{
|
{
|
||||||
dest->u16 = src->u16;
|
dest->u16[0] = src->u16[0];
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int
|
int
|
||||||
rimeaddr_cmp(const rimeaddr_t *addr1, const rimeaddr_t *addr2)
|
rimeaddr_cmp(const rimeaddr_t *addr1, const rimeaddr_t *addr2)
|
||||||
{
|
{
|
||||||
return addr1->u16 == addr2->u16;
|
return addr1->u16[0] == addr2->u16[0];
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
rimeaddr_set_node_addr(rimeaddr_t *t)
|
||||||
|
{
|
||||||
|
rimeaddr_copy(&rimeaddr_node_addr, t);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: rimeaddr.h,v 1.1 2007/03/15 19:43:07 adamdunkels Exp $
|
* $Id: rimeaddr.h,v 1.2 2007/03/21 23:22:11 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -43,11 +43,12 @@
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
unsigned char u8[2];
|
unsigned char u8[2];
|
||||||
unsigned short u16;
|
unsigned short u16[1];
|
||||||
} rimeaddr_t;
|
} rimeaddr_t;
|
||||||
|
|
||||||
void rimeaddr_copy(rimeaddr_t *dest, const rimeaddr_t *from);
|
void rimeaddr_copy(rimeaddr_t *dest, const rimeaddr_t *from);
|
||||||
int rimeaddr_cmp(const rimeaddr_t *addr1, const rimeaddr_t *addr2);
|
int rimeaddr_cmp(const rimeaddr_t *addr1, const rimeaddr_t *addr2);
|
||||||
|
void rimeaddr_set_node_addr(rimeaddr_t *t);
|
||||||
|
|
||||||
extern rimeaddr_t rimeaddr_node_addr;
|
extern rimeaddr_t rimeaddr_node_addr;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue