Skip to content

Commit 2481fbe

Browse files
committed
Merge pull request #62 from arebert/lpc4088
LPC4088: PIN mode fix, export to external tools and MAC address retrieval
2 parents b9d52bd + 00cfdba commit 2481fbe

File tree

10 files changed

+2713
-8
lines changed

10 files changed

+2713
-8
lines changed

Diff for: libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/PinNames.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ typedef enum {
8888
} PinName;
8989

9090
typedef enum {
91-
PullUp = 0,
92-
PullDown = 3,
93-
PullNone = 2,
91+
PullUp = 2,
92+
PullDown = 1,
93+
PullNone = 0,
9494
OpenDrain = 4
9595
} PinMode;
9696

Diff for: libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/can_api.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ void can_irq_set(can_t *obj, CanIrqType type, uint32_t enable) {
164164
obj->dev->MOD &= ~(1);
165165

166166
// Enable NVIC if at least 1 interrupt is active
167-
if(LPC_CAN1->IER | LPC_CAN2->IER != 0) {
167+
if((LPC_CAN1->IER | LPC_CAN2->IER) != 0) {
168168
NVIC_SetVector(CAN_IRQn, (uint32_t) &can_irq_n);
169169
NVIC_EnableIRQ(CAN_IRQn);
170170
}

Diff for: libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/ethernet_api.c

+44
Original file line numberDiff line numberDiff line change
@@ -962,3 +962,47 @@ void ethernet_set_link(int speed, int duplex) {
962962
break;
963963
}
964964
}
965+
966+
/*
967+
* The Embedded Artists LPC4088 QuickStart Board has an eeprom with a unique
968+
* 48 bit ID. This ID is used as MAC address.
969+
*/
970+
971+
#include "i2c_api.h"
972+
973+
static int _macRetrieved = 0;
974+
static char _macAddr[6] = {0x00,0x02,0xF7,0xF0,0x00,0x00};
975+
#define EEPROM_24AA02E48_ADDR (0xA0)
976+
977+
void mbed_mac_address(char *mac) {
978+
979+
if (_macRetrieved == 0) {
980+
char tmp[6];
981+
i2c_t i2cObj;
982+
983+
i2c_init(&i2cObj, P0_27, P0_28);
984+
985+
do {
986+
// the unique ID is at offset 0xFA
987+
tmp[0] = 0xFA;
988+
if (i2c_write(&i2cObj, EEPROM_24AA02E48_ADDR, tmp, 1, 1) != 1) {
989+
break; // failed to write
990+
}
991+
992+
993+
if (i2c_read(&i2cObj, EEPROM_24AA02E48_ADDR, tmp, 6, 1) != 6) {
994+
break; // failed to read
995+
}
996+
997+
memcpy(_macAddr, tmp, 6);
998+
999+
} while(0);
1000+
1001+
// We always consider the MAC address to be retrieved even though
1002+
// reading from the eeprom failed. If it wasn't possible to read
1003+
// from eeprom the default address will be used.
1004+
_macRetrieved = 1;
1005+
}
1006+
1007+
memcpy(mac, _macAddr, 6);
1008+
}

Diff for: workspace_tools/export/codered.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
class CodeRed(Exporter):
2222
NAME = 'CodeRed'
23-
TARGETS = ['LPC1768']
23+
TARGETS = ['LPC1768', 'LPC4088']
2424
TOOLCHAIN = 'GCC_CR'
2525

2626
def generate(self):

Diff for: workspace_tools/export/codered_lpc4088_cproject.tmpl

+1,922
Large diffs are not rendered by default.

Diff for: workspace_tools/export/codered_lpc4088_project.tmpl

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>{{name}}</name>
4+
<comment>This file was automagically generated by mbed.org. For more information, see http://mbed.org/handbook/Exporting-To-Code-Red</comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
10+
<triggers>clean,full,incremental,</triggers>
11+
<arguments>
12+
<dictionary>
13+
<key>?name?</key>
14+
<value></value>
15+
</dictionary>
16+
<dictionary>
17+
<key>org.eclipse.cdt.make.core.append_environment</key>
18+
<value>true</value>
19+
</dictionary>
20+
<dictionary>
21+
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
22+
<value>all</value>
23+
</dictionary>
24+
<dictionary>
25+
<key>org.eclipse.cdt.make.core.buildArguments</key>
26+
<value></value>
27+
</dictionary>
28+
<dictionary>
29+
<key>org.eclipse.cdt.make.core.buildCommand</key>
30+
<value>make</value>
31+
</dictionary>
32+
<dictionary>
33+
<key>org.eclipse.cdt.make.core.buildLocation</key>
34+
<value>${workspace_loc:/{{name}}/Debug}</value>
35+
</dictionary>
36+
<dictionary>
37+
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
38+
<value>clean</value>
39+
</dictionary>
40+
<dictionary>
41+
<key>org.eclipse.cdt.make.core.contents</key>
42+
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
43+
</dictionary>
44+
<dictionary>
45+
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
46+
<value>false</value>
47+
</dictionary>
48+
<dictionary>
49+
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
50+
<value>true</value>
51+
</dictionary>
52+
<dictionary>
53+
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
54+
<value>true</value>
55+
</dictionary>
56+
<dictionary>
57+
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
58+
<value>all</value>
59+
</dictionary>
60+
<dictionary>
61+
<key>org.eclipse.cdt.make.core.stopOnError</key>
62+
<value>true</value>
63+
</dictionary>
64+
<dictionary>
65+
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
66+
<value>true</value>
67+
</dictionary>
68+
</arguments>
69+
</buildCommand>
70+
<buildCommand>
71+
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
72+
<triggers>full,incremental,</triggers>
73+
<arguments>
74+
</arguments>
75+
</buildCommand>
76+
</buildSpec>
77+
<natures>
78+
<nature>org.eclipse.cdt.core.cnature</nature>
79+
<nature>org.eclipse.cdt.core.ccnature</nature>
80+
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
81+
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
82+
</natures>
83+
</projectDescription>
84+

Diff for: workspace_tools/export/uvision4.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
class Uvision4(Exporter):
2222
NAME = 'uVision4'
2323
TOOLCHAIN = 'ARM'
24-
TARGETS = ['LPC1768', 'LPC11U24', 'KL25Z', 'LPC1347', 'LPC1114']
24+
TARGETS = ['LPC1768', 'LPC11U24', 'KL25Z', 'LPC1347', 'LPC1114', 'LPC4088']
2525
FILE_TYPES = {
2626
'c_sources':'1',
2727
'cpp_sources':'8',

0 commit comments

Comments
 (0)