Skip to content

Commit

Permalink
Guard Atmel RF driver build by DEVICE_I2C
Browse files Browse the repository at this point in the history
This module uses AT24MAC chip which is in I2C bus, so it requires
device to support I2C
  • Loading branch information
Seppo Takalo committed Oct 8, 2018
1 parent 1af1a4a commit f16a99c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
Expand Up @@ -20,7 +20,7 @@
#include "at24mac.h"
#include "PinNames.h"

#if defined(MBED_CONF_NANOSTACK_CONFIGURATION) && DEVICE_SPI
#if defined(MBED_CONF_NANOSTACK_CONFIGURATION) && DEVICE_SPI && DEVICE_I2C

#include "NanostackRfPhy.h"

Expand Down
Expand Up @@ -15,7 +15,7 @@
*/
#include <string.h>

#if defined(MBED_CONF_NANOSTACK_CONFIGURATION) && DEVICE_SPI
#if defined(MBED_CONF_NANOSTACK_CONFIGURATION) && DEVICE_SPI && DEVICE_I2C

#include "platform/arm_hal_interrupt.h"
#include "nanostack/platform/arm_hal_phy.h"
Expand Down
4 changes: 4 additions & 0 deletions components/802.15.4_RF/atmel-rf-driver/source/at24mac.cpp
Expand Up @@ -15,6 +15,8 @@
*/
#include "at24mac.h"

#if DEVICE_I2C

/* Device addressing */
#define AT24MAC_EEPROM_ADDRESS (0x0A<<4)
#define AT24MAC_RW_PROTECT_ADDRESS (0x06<<4)
Expand Down Expand Up @@ -80,3 +82,5 @@ int AT24Mac::read_eui48(void *buf)
return -1; //No ACK
return _i2c.read(AT24MAC_SERIAL_ADDRESS, (char*)buf, EUI48_LEN);
}

#endif /* DEVICE_I2C */
4 changes: 4 additions & 0 deletions components/802.15.4_RF/atmel-rf-driver/source/at24mac.h
Expand Up @@ -17,6 +17,9 @@
#define AT24MAC_H

#include "PinNames.h"

#if DEVICE_I2C

#include "I2C.h"
#include "drivers/DigitalInOut.h"
#include "platform/mbed_wait_api.h"
Expand Down Expand Up @@ -71,4 +74,5 @@ class AT24Mac {
mbed::I2C _i2c;
};

#endif /* DEVICE_I2C */
#endif /* AT24MAC_H */

0 comments on commit f16a99c

Please sign in to comment.