Bugfix: PIN Modes was not set correctly

Added: Export to uVision and Code Red toolchains
pull/62/head
unknown 2013-09-09 14:10:11 +02:00
parent 45565cb055
commit 0e36bdd457
6 changed files with 52 additions and 8 deletions

View File

@ -88,9 +88,9 @@ typedef enum {
} PinName;
typedef enum {
PullUp = 0,
PullDown = 3,
PullNone = 2,
PullUp = 2,
PullDown = 1,
PullNone = 0,
OpenDrain = 4
} PinMode;

View File

@ -164,7 +164,7 @@ void can_irq_set(can_t *obj, CanIrqType type, uint32_t enable) {
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);
}

View File

@ -962,3 +962,47 @@ void ethernet_set_link(int speed, int duplex) {
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);
}

View File

@ -20,7 +20,7 @@ from os.path import splitext, basename
class CodeRed(Exporter):
NAME = 'CodeRed'
TARGETS = ['LPC1768']
TARGETS = ['LPC1768', 'LPC4088']
TOOLCHAIN = 'GCC_CR'
def generate(self):

View File

@ -21,7 +21,7 @@ from os.path import basename
class Uvision4(Exporter):
NAME = 'uVision4'
TOOLCHAIN = 'ARM'
TARGETS = ['LPC1768', 'LPC11U24', 'KL25Z', 'LPC1347', 'LPC1114']
TARGETS = ['LPC1768', 'LPC11U24', 'KL25Z', 'LPC1347', 'LPC1114', 'LPC4088']
FILE_TYPES = {
'c_sources':'1',
'cpp_sources':'8',

View File

@ -76,9 +76,9 @@ if __name__ == '__main__':
setup_test_user_prj()
for toolchain, target in [
('uvision', 'LPC1768'), ('uvision', 'LPC11U24'), ('uvision', 'KL25Z'), ('uvision', 'LPC1347'), ('uvision', 'LPC1114'),
('uvision', 'LPC1768'), ('uvision', 'LPC11U24'), ('uvision', 'KL25Z'), ('uvision', 'LPC1347'), ('uvision', 'LPC1114'), ('uvision', 'LPC4088'),
('codered', 'LPC1768'),
('codered', 'LPC1768'), ('codered', 'LPC4088'),
# Linux path: /home/emimon01/bin/gcc-cs/bin/
# Windows path: "C:/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin/"