Skip to content

Commit 0e36bdd

Browse files
unknownunknown
authored andcommitted
Bugfix: PIN Modes was not set correctly
Added: Export to uVision and Code Red toolchains
1 parent 45565cb commit 0e36bdd

File tree

6 files changed

+52
-8
lines changed

6 files changed

+52
-8
lines changed

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/PinNames.h

Lines changed: 3 additions & 3 deletions
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

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/can_api.c

Lines changed: 1 addition & 1 deletion
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
}

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/ethernet_api.c

Lines changed: 44 additions & 0 deletions
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+
}

workspace_tools/export/codered.py

Lines changed: 1 addition & 1 deletion
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):

workspace_tools/export/uvision4.py

Lines changed: 1 addition & 1 deletion
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',

workspace_tools/export_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ def test_export(toolchain, target, expected_error=None):
7676
setup_test_user_prj()
7777

7878
for toolchain, target in [
79-
('uvision', 'LPC1768'), ('uvision', 'LPC11U24'), ('uvision', 'KL25Z'), ('uvision', 'LPC1347'), ('uvision', 'LPC1114'),
79+
('uvision', 'LPC1768'), ('uvision', 'LPC11U24'), ('uvision', 'KL25Z'), ('uvision', 'LPC1347'), ('uvision', 'LPC1114'), ('uvision', 'LPC4088'),
8080

81-
('codered', 'LPC1768'),
81+
('codered', 'LPC1768'), ('codered', 'LPC4088'),
8282

8383
# Linux path: /home/emimon01/bin/gcc-cs/bin/
8484
# Windows path: "C:/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin/"

0 commit comments

Comments
 (0)