Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-src by
Revision 22:dbd009839d5e, committed 2013-09-13
- Comitter:
- mbed_official
- Date:
- Fri Sep 13 14:22:58 2013 +0100
- Parent:
- 21:67d3158c7b56
- Child:
- 23:8d50de55f208
- Commit message:
- Synchronized with git revision 2481fbe2a21f381cba6e6c3abdaceaed7e288e06
Changed in this revision
--- a/targets/hal/TARGET_NXP/TARGET_LPC408X/PinNames.h Wed Sep 11 16:54:00 2013 +0100
+++ b/targets/hal/TARGET_NXP/TARGET_LPC408X/PinNames.h Fri Sep 13 14:22:58 2013 +0100
@@ -88,9 +88,9 @@
} PinName;
typedef enum {
- PullUp = 0,
- PullDown = 3,
- PullNone = 2,
+ PullUp = 2,
+ PullDown = 1,
+ PullNone = 0,
OpenDrain = 4
} PinMode;
--- a/targets/hal/TARGET_NXP/TARGET_LPC408X/can_api.c Wed Sep 11 16:54:00 2013 +0100
+++ b/targets/hal/TARGET_NXP/TARGET_LPC408X/can_api.c Fri Sep 13 14:22:58 2013 +0100
@@ -164,7 +164,7 @@
obj->dev->MOD &= ~(1);
// Enable NVIC if at least 1 interrupt is active
- if(LPC_CAN1->IER | LPC_CAN2->IER != 0) {
+ if((LPC_CAN1->IER | LPC_CAN2->IER) != 0) {
NVIC_SetVector(CAN_IRQn, (uint32_t) &can_irq_n);
NVIC_EnableIRQ(CAN_IRQn);
}
--- a/targets/hal/TARGET_NXP/TARGET_LPC408X/ethernet_api.c Wed Sep 11 16:54:00 2013 +0100
+++ b/targets/hal/TARGET_NXP/TARGET_LPC408X/ethernet_api.c Fri Sep 13 14:22:58 2013 +0100
@@ -962,3 +962,47 @@
break;
}
}
+
+/*
+ * The Embedded Artists LPC4088 QuickStart Board has an eeprom with a unique
+ * 48 bit ID. This ID is used as MAC address.
+ */
+
+#include "i2c_api.h"
+
+static int _macRetrieved = 0;
+static char _macAddr[6] = {0x00,0x02,0xF7,0xF0,0x00,0x00};
+#define EEPROM_24AA02E48_ADDR (0xA0)
+
+void mbed_mac_address(char *mac) {
+
+ if (_macRetrieved == 0) {
+ char tmp[6];
+ i2c_t i2cObj;
+
+ i2c_init(&i2cObj, P0_27, P0_28);
+
+ do {
+ // the unique ID is at offset 0xFA
+ tmp[0] = 0xFA;
+ if (i2c_write(&i2cObj, EEPROM_24AA02E48_ADDR, tmp, 1, 1) != 1) {
+ break; // failed to write
+ }
+
+
+ if (i2c_read(&i2cObj, EEPROM_24AA02E48_ADDR, tmp, 6, 1) != 6) {
+ break; // failed to read
+ }
+
+ memcpy(_macAddr, tmp, 6);
+
+ } while(0);
+
+ // We always consider the MAC address to be retrieved even though
+ // reading from the eeprom failed. If it wasn't possible to read
+ // from eeprom the default address will be used.
+ _macRetrieved = 1;
+ }
+
+ memcpy(mac, _macAddr, 6);
+}
