diff --git a/drivers/cc2420/cc2420.c b/drivers/cc2420/cc2420.c index cef9714d7b..eb90332c67 100644 --- a/drivers/cc2420/cc2420.c +++ b/drivers/cc2420/cc2420.c @@ -128,7 +128,7 @@ radio_address_t cc2420_set_address(radio_address_t addr) buf[0] = (uint8_t)(addr & 0xFF); buf[1] = (uint8_t)(addr >> 8); cc2420_write_ram(CC2420_RAM_SHORTADR, buf, 2); - cc2420_set_address_long(0x00FF & addr); + cc2420_set_address_long(0xFFFF & addr); return addr; } @@ -149,7 +149,7 @@ uint64_t cc2420_set_address_long(uint64_t addr) radio_address_t cc2420_get_address(void) { - uint16_t addr; + radio_address_t addr; cc2420_read_ram(CC2420_RAM_SHORTADR, (uint8_t *)&addr, sizeof(addr)); return addr; } @@ -173,6 +173,6 @@ uint16_t cc2420_set_pan(uint16_t pan) uint16_t cc2420_get_pan(void) { uint16_t pan; - cc2420_read_ram(CC2420_RAM_SHORTADR, (uint8_t *)&pan, sizeof(pan)); + cc2420_read_ram(CC2420_RAM_PANID, (uint8_t *)&pan, sizeof(pan)); return pan; } diff --git a/drivers/cc2420/cc2420_spi.c b/drivers/cc2420/cc2420_spi.c index 3f06b74467..72f2d63f57 100644 --- a/drivers/cc2420/cc2420_spi.c +++ b/drivers/cc2420/cc2420_spi.c @@ -29,8 +29,8 @@ uint16_t cc2420_read_reg(uint8_t addr) { cc2420_spi_select(); cc2420_txrx(addr | CC2420_READ_ACCESS); result = cc2420_txrx(NOBYTE); - result = result << 8; - result = cc2420_txrx(NOBYTE); + result <<= 8; + result |= cc2420_txrx(NOBYTE); cc2420_spi_unselect(); restoreIRQ(cpsr); return result;