ARM: use arduino.h for UART pinout.
This removes another 36 bytes binary size and six(!) MBED files. The mess of MBED files is now pretty much resolved, only a few essential ones left.
This commit is contained in:
parent
66dcde54dc
commit
52e2585f13
|
|
@ -98,7 +98,6 @@ TARGET = $(PROGRAM).hex
|
||||||
# Until the generic ARM port is completed, we'd have to wrap all sources
|
# Until the generic ARM port is completed, we'd have to wrap all sources
|
||||||
# in #ifdef __AVR__. To avoid this, build only a selection for now:
|
# in #ifdef __AVR__. To avoid this, build only a selection for now:
|
||||||
SOURCES = mendel.c cpu.c serial.c sermsg.c sersendf.c
|
SOURCES = mendel.c cpu.c serial.c sermsg.c sersendf.c
|
||||||
SOURCES += mbed-pinmap.c
|
|
||||||
ifeq ($(MCU), lpc1114)
|
ifeq ($(MCU), lpc1114)
|
||||||
SOURCES += mbed-system_LPC11xx.c
|
SOURCES += mbed-system_LPC11xx.c
|
||||||
endif
|
endif
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,13 @@
|
||||||
|
|
||||||
#include "mbed-LPC11xx.h"
|
#include "mbed-LPC11xx.h"
|
||||||
|
|
||||||
|
/** Pins for UART, the serial port.
|
||||||
|
*/
|
||||||
|
#define RXD PIO1_6
|
||||||
|
#define RXD_CMSIS PIO1_6_CMSIS
|
||||||
|
#define TXD PIO1_7
|
||||||
|
#define TXD_CMSIS PIO1_7_CMSIS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Offsets to the various GPIO registers. See chapter 12.3 in LPC111x User
|
Offsets to the various GPIO registers. See chapter 12.3 in LPC111x User
|
||||||
Manual.
|
Manual.
|
||||||
|
|
|
||||||
246
mbed-PinNames.h
246
mbed-PinNames.h
|
|
@ -1,246 +0,0 @@
|
||||||
/* mbed Microcontroller Library
|
|
||||||
* Copyright (c) 2006-2013 ARM Limited
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
Notes for Teacup:
|
|
||||||
|
|
||||||
Copied from $(MBED)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/TARGET_LPC11XX/PinNames.h.
|
|
||||||
|
|
||||||
Used only to get things running quickly. Without serial it's almost
|
|
||||||
impossible to see wether code changes work. Should go away soon, because
|
|
||||||
all this MBED stuff is too bloated for Teacup's purposes.
|
|
||||||
|
|
||||||
- Prefixed names of #include files with mbed- to match the names of the
|
|
||||||
copies in the Teacup repo.
|
|
||||||
*/
|
|
||||||
#ifndef MBED_PINNAMES_H
|
|
||||||
#define MBED_PINNAMES_H
|
|
||||||
|
|
||||||
#include "mbed-cmsis.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
PIN_INPUT,
|
|
||||||
PIN_OUTPUT
|
|
||||||
} PinDirection;
|
|
||||||
|
|
||||||
#define PORT_SHIFT 12
|
|
||||||
#define PIN_SHIFT 8
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
// LPC1114 Pin Names (PORT[15:12] + PIN[11:8] + IOCON offset[7:0])
|
|
||||||
|
|
||||||
P0_0 = (0 << PORT_SHIFT) | (0 << PIN_SHIFT) | 0x0c,
|
|
||||||
P0_1 = (0 << PORT_SHIFT) | (1 << PIN_SHIFT) | 0x10,
|
|
||||||
P0_2 = (0 << PORT_SHIFT) | (2 << PIN_SHIFT) | 0x1c,
|
|
||||||
P0_3 = (0 << PORT_SHIFT) | (3 << PIN_SHIFT) | 0x2c,
|
|
||||||
P0_4 = (0 << PORT_SHIFT) | (4 << PIN_SHIFT) | 0x30,
|
|
||||||
P0_5 = (0 << PORT_SHIFT) | (5 << PIN_SHIFT) | 0x34,
|
|
||||||
P0_6 = (0 << PORT_SHIFT) | (6 << PIN_SHIFT) | 0x4c,
|
|
||||||
P0_7 = (0 << PORT_SHIFT) | (7 << PIN_SHIFT) | 0x50,
|
|
||||||
P0_8 = (0 << PORT_SHIFT) | (8 << PIN_SHIFT) | 0x60,
|
|
||||||
P0_9 = (0 << PORT_SHIFT) | (9 << PIN_SHIFT) | 0x64,
|
|
||||||
P0_11 = (0 << PORT_SHIFT) | (11 << PIN_SHIFT) | 0x74,
|
|
||||||
|
|
||||||
P1_0 = (1 << PORT_SHIFT) | (0 << PIN_SHIFT) | 0x78,
|
|
||||||
P1_1 = (1 << PORT_SHIFT) | (1 << PIN_SHIFT) | 0x7c,
|
|
||||||
P1_2 = (1 << PORT_SHIFT) | (2 << PIN_SHIFT) | 0x80,
|
|
||||||
P1_4 = (1 << PORT_SHIFT) | (4 << PIN_SHIFT) | 0x94,
|
|
||||||
P1_5 = (1 << PORT_SHIFT) | (5 << PIN_SHIFT) | 0xa0,
|
|
||||||
P1_6 = (1 << PORT_SHIFT) | (6 << PIN_SHIFT) | 0xa4,
|
|
||||||
P1_7 = (1 << PORT_SHIFT) | (7 << PIN_SHIFT) | 0xa8,
|
|
||||||
P1_8 = (1 << PORT_SHIFT) | (8 << PIN_SHIFT) | 0x14,
|
|
||||||
P1_9 = (1 << PORT_SHIFT) | (9 << PIN_SHIFT) | 0x38,
|
|
||||||
P1_10 = (1 << PORT_SHIFT) | (10 << PIN_SHIFT) | 0x6c,
|
|
||||||
P1_11 = (1 << PORT_SHIFT) | (11 << PIN_SHIFT) | 0x98,
|
|
||||||
|
|
||||||
P2_0 = (2 << PORT_SHIFT) | (0 << PIN_SHIFT) | 0x08,
|
|
||||||
P2_1 = (2 << PORT_SHIFT) | (1 << PIN_SHIFT) | 0x28,
|
|
||||||
P2_2 = (2 << PORT_SHIFT) | (2 << PIN_SHIFT) | 0x5c,
|
|
||||||
P2_3 = (2 << PORT_SHIFT) | (3 << PIN_SHIFT) | 0x8c,
|
|
||||||
P2_4 = (2 << PORT_SHIFT) | (4 << PIN_SHIFT) | 0x40,
|
|
||||||
P2_5 = (2 << PORT_SHIFT) | (5 << PIN_SHIFT) | 0x44,
|
|
||||||
P2_6 = (2 << PORT_SHIFT) | (6 << PIN_SHIFT) | 0x00,
|
|
||||||
P2_7 = (2 << PORT_SHIFT) | (7 << PIN_SHIFT) | 0x20,
|
|
||||||
P2_8 = (2 << PORT_SHIFT) | (8 << PIN_SHIFT) | 0x24,
|
|
||||||
P2_9 = (2 << PORT_SHIFT) | (9 << PIN_SHIFT) | 0x54,
|
|
||||||
P2_10 = (2 << PORT_SHIFT) | (10 << PIN_SHIFT) | 0x58,
|
|
||||||
P2_11 = (2 << PORT_SHIFT) | (11 << PIN_SHIFT) | 0x70,
|
|
||||||
|
|
||||||
P3_0 = (3 << PORT_SHIFT) | (0 << PIN_SHIFT) | 0x84,
|
|
||||||
P3_1 = (3 << PORT_SHIFT) | (1 << PIN_SHIFT) | 0x88,
|
|
||||||
P3_2 = (3 << PORT_SHIFT) | (2 << PIN_SHIFT) | 0x9c,
|
|
||||||
P3_3 = (3 << PORT_SHIFT) | (3 << PIN_SHIFT) | 0xac,
|
|
||||||
P3_4 = (3 << PORT_SHIFT) | (4 << PIN_SHIFT) | 0x3c,
|
|
||||||
P3_5 = (3 << PORT_SHIFT) | (5 << PIN_SHIFT) | 0x48,
|
|
||||||
|
|
||||||
// mbed DIP Pin Names (CQ board)
|
|
||||||
// p4 = P0_0,
|
|
||||||
p5 = P0_9,
|
|
||||||
p6 = P0_8,
|
|
||||||
p7 = P0_6,
|
|
||||||
p8 = P1_5,
|
|
||||||
p9 = P1_7,
|
|
||||||
p10 = P1_6,
|
|
||||||
p11 = P0_7,
|
|
||||||
p12 = P1_0,
|
|
||||||
p13 = P1_1,
|
|
||||||
p14 = P1_2,
|
|
||||||
p15 = P0_11,
|
|
||||||
p16 = P1_0,
|
|
||||||
p17 = P1_1,
|
|
||||||
p18 = P1_2,
|
|
||||||
p20 = P1_4,
|
|
||||||
p22 = P0_2,
|
|
||||||
p23 = P0_11,
|
|
||||||
p24 = P0_2,
|
|
||||||
p25 = P1_8,
|
|
||||||
p26 = P1_9,
|
|
||||||
p27 = P0_4,
|
|
||||||
p28 = P0_5,
|
|
||||||
p29 = P0_3,
|
|
||||||
p30 = P0_1,
|
|
||||||
|
|
||||||
// Other mbed Pin Names
|
|
||||||
LED1 = P1_5,
|
|
||||||
LED2 = P0_7,
|
|
||||||
LED3 = P1_5,
|
|
||||||
LED4 = P0_7,
|
|
||||||
|
|
||||||
USBTX = P1_7,
|
|
||||||
USBRX = P1_6,
|
|
||||||
|
|
||||||
// mbed DIP Pin Names (LPCXpresso LPC1114)
|
|
||||||
// xp4 = P0_0,
|
|
||||||
xp5 = P0_9,
|
|
||||||
xp6 = P0_8,
|
|
||||||
xp7 = P2_11,
|
|
||||||
xp8 = P0_2,
|
|
||||||
xp9 = P1_7,
|
|
||||||
xp10 = P1_6,
|
|
||||||
xp11 = P0_7,
|
|
||||||
xp12 = P2_0,
|
|
||||||
xp13 = P2_1,
|
|
||||||
xp14 = P2_2,
|
|
||||||
xp15 = P0_11,
|
|
||||||
xp16 = P1_0,
|
|
||||||
xp17 = P1_1,
|
|
||||||
xp18 = P1_2,
|
|
||||||
xp20 = P1_4,
|
|
||||||
xp21 = P1_5,
|
|
||||||
xp22 = P1_8,
|
|
||||||
xp23 = P0_6,
|
|
||||||
xp25 = P3_0,
|
|
||||||
xp26 = P3_1,
|
|
||||||
xp27 = P3_2,
|
|
||||||
|
|
||||||
xp29 = P3_3,
|
|
||||||
xp30 = P2_10,
|
|
||||||
xp31 = P2_9,
|
|
||||||
xp32 = P2_8,
|
|
||||||
xp33 = P2_7,
|
|
||||||
xp34 = P2_6,
|
|
||||||
xp35 = P2_5,
|
|
||||||
xp36 = P2_4,
|
|
||||||
xp37 = P2_3,
|
|
||||||
xp38 = P1_11,
|
|
||||||
xp39 = P1_10,
|
|
||||||
xp40 = P1_9,
|
|
||||||
xp41 = P0_4,
|
|
||||||
xp42 = P0_5,
|
|
||||||
xp43 = P0_3,
|
|
||||||
xp44 = P0_1,
|
|
||||||
|
|
||||||
// Other mbed Pin Names
|
|
||||||
xLED1 = P0_7,
|
|
||||||
|
|
||||||
// DIP Package Names
|
|
||||||
|
|
||||||
dp1 = P0_8,
|
|
||||||
dp2 = P0_9,
|
|
||||||
dp4 = P0_11,
|
|
||||||
dp5 = P0_5,
|
|
||||||
dp6 = P0_6,
|
|
||||||
dp9 = P1_0,
|
|
||||||
dp10 = P1_1,
|
|
||||||
dp11 = P1_2,
|
|
||||||
dp13 = P1_4,
|
|
||||||
dp14 = P1_5,
|
|
||||||
dp15 = P1_6,
|
|
||||||
dp16 = P1_7,
|
|
||||||
dp17 = P1_8,
|
|
||||||
dp18 = P1_9,
|
|
||||||
// dp23 = P0_0,
|
|
||||||
dp24 = P0_1,
|
|
||||||
dp25 = P0_2,
|
|
||||||
dp26 = P0_3,
|
|
||||||
dp27 = P0_4,
|
|
||||||
dp28 = P0_7,
|
|
||||||
|
|
||||||
dip1 = P0_8,
|
|
||||||
dip2 = P0_9,
|
|
||||||
dip4 = P0_11,
|
|
||||||
dip5 = P0_5,
|
|
||||||
dip6 = P0_6,
|
|
||||||
dip9 = P1_0,
|
|
||||||
dip10 = P1_1,
|
|
||||||
dip11 = P1_2,
|
|
||||||
dip13 = P1_4,
|
|
||||||
dip14 = P1_5,
|
|
||||||
dip15 = P1_6,
|
|
||||||
dip16 = P1_7,
|
|
||||||
dip17 = P1_8,
|
|
||||||
dip18 = P1_9,
|
|
||||||
// dip23 = P0_0,
|
|
||||||
dip24 = P0_1,
|
|
||||||
dip25 = P0_2,
|
|
||||||
dip26 = P0_3,
|
|
||||||
dip27 = P0_4,
|
|
||||||
dip28 = P0_7,
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Not connected
|
|
||||||
NC = (int)0xFFFFFFFF,
|
|
||||||
} PinName;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
CHANNEL0 = WAKEUP0_IRQn,
|
|
||||||
CHANNEL1 = WAKEUP1_IRQn,
|
|
||||||
CHANNEL2 = WAKEUP2_IRQn,
|
|
||||||
CHANNEL3 = WAKEUP3_IRQn,
|
|
||||||
CHANNEL4 = WAKEUP4_IRQn,
|
|
||||||
CHANNEL5 = WAKEUP5_IRQn,
|
|
||||||
CHANNEL6 = WAKEUP6_IRQn,
|
|
||||||
CHANNEL7 = WAKEUP7_IRQn
|
|
||||||
} Channel;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
PullUp = 2,
|
|
||||||
PullDown = 1,
|
|
||||||
PullNone = 0,
|
|
||||||
Repeater = 3,
|
|
||||||
OpenDrain = 4,
|
|
||||||
PullDefault = PullDown
|
|
||||||
} PinMode;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
1777
mbed-bitfields.h
1777
mbed-bitfields.h
File diff suppressed because it is too large
Load Diff
26
mbed-cmsis.h
26
mbed-cmsis.h
|
|
@ -1,26 +0,0 @@
|
||||||
/* mbed Microcontroller Library - CMSIS
|
|
||||||
* Copyright (C) 2009-2011 ARM Limited. All rights reserved.
|
|
||||||
*
|
|
||||||
* A generic CMSIS include header, pulling in LPC11U24 specifics
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
Notes for Teacup:
|
|
||||||
|
|
||||||
Copied from $(MBED)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/cmsis.h.
|
|
||||||
|
|
||||||
Used only to get things running quickly. Without serial it's almost
|
|
||||||
impossible to see wether code changes work. Should go away soon, because
|
|
||||||
all this MBED stuff is too bloated for Teacup's purposes.
|
|
||||||
|
|
||||||
- Prefixed names of #include files with mbed- to match the names of the
|
|
||||||
copies in the Teacup repo.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef MBED_CMSIS_H
|
|
||||||
#define MBED_CMSIS_H
|
|
||||||
|
|
||||||
#include "mbed-LPC11xx.h"
|
|
||||||
#include "mbed-cmsis_nvic.h"
|
|
||||||
#include "mbed-bitfields.h"
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
||||||
/* mbed Microcontroller Library
|
|
||||||
* CMSIS-style functionality to support dynamic vectors
|
|
||||||
*******************************************************************************
|
|
||||||
* Copyright (c) 2011 ARM Limited. All rights reserved.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of ARM Limited nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
Notes for Teacup:
|
|
||||||
|
|
||||||
Copied from $(MBED)/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/cmsis_nvic.h.
|
|
||||||
|
|
||||||
Used only to get things running quickly. Without serial it's almost
|
|
||||||
impossible to see wether code changes work. Should go away soon, because
|
|
||||||
all this MBED stuff is too bloated for Teacup's purposes.
|
|
||||||
|
|
||||||
- Prefixed names of #include files with mbed- to match the names of the
|
|
||||||
copies in the Teacup repo.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef MBED_CMSIS_NVIC_H
|
|
||||||
#define MBED_CMSIS_NVIC_H
|
|
||||||
|
|
||||||
#include "mbed-cmsis.h"
|
|
||||||
|
|
||||||
#define NVIC_NUM_VECTORS (16 + 32) // CORE + MCU Peripherals
|
|
||||||
#define NVIC_USER_IRQ_OFFSET 16
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
|
|
||||||
uint32_t NVIC_GetVector(IRQn_Type IRQn);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
/* mbed Microcontroller Library
|
|
||||||
* Copyright (c) 2006-2013 ARM Limited
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
Notes for Teacup:
|
|
||||||
|
|
||||||
Copied from $(MBED)/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/pinmap.c.
|
|
||||||
|
|
||||||
Used only to get things running quickly. Without serial it's almost
|
|
||||||
impossible to see wether code changes work. Should go away soon, because
|
|
||||||
all this MBED stuff is too bloated for Teacup's purposes.
|
|
||||||
|
|
||||||
- Prefixed names of #include files with mbed- to match the names of the
|
|
||||||
copies in the Teacup repo.
|
|
||||||
- Wrapped the whole file in #ifdef __ARMEL__ to not cause conflicts with
|
|
||||||
AVR builds.
|
|
||||||
*/
|
|
||||||
#ifdef __ARMEL__
|
|
||||||
#include "mbed-pinmap.h"
|
|
||||||
|
|
||||||
void pin_function(PinName pin, int function) {
|
|
||||||
uint32_t offset = (uint32_t)pin & 0xff;
|
|
||||||
__IO uint32_t *reg = (__IO uint32_t*)(LPC_IOCON_BASE + offset);
|
|
||||||
|
|
||||||
// pin function bits: [2:0] -> 111 = (0x7)
|
|
||||||
*reg = (*reg & ~0x7) | (function & 0x7);
|
|
||||||
}
|
|
||||||
|
|
||||||
void pin_mode(PinName pin, PinMode mode) {
|
|
||||||
uint32_t offset = (uint32_t)pin & 0xff;
|
|
||||||
uint32_t drain = ((uint32_t)mode & (uint32_t)OpenDrain) >> 2;
|
|
||||||
|
|
||||||
__IO uint32_t *reg = (__IO uint32_t*)(LPC_IOCON_BASE + offset);
|
|
||||||
uint32_t tmp = *reg;
|
|
||||||
|
|
||||||
// pin mode bits: [4:3] -> 11000 = (0x3 << 3)
|
|
||||||
tmp &= ~(0x3 << 3);
|
|
||||||
tmp |= (mode & 0x3) << 3;
|
|
||||||
|
|
||||||
// drain
|
|
||||||
tmp &= ~(0x1 << 10);
|
|
||||||
tmp |= drain << 10;
|
|
||||||
|
|
||||||
*reg = tmp;
|
|
||||||
}
|
|
||||||
#endif /* __ARMEL__ */
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
/* mbed Microcontroller Library
|
|
||||||
* Copyright (c) 2006-2013 ARM Limited
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
Notes for Teacup:
|
|
||||||
|
|
||||||
Copied from $(MBED)/libraries/mbed/hal/pinmap.h.
|
|
||||||
|
|
||||||
Used only to get things running quickly. Without serial it's almost
|
|
||||||
impossible to see wether code changes work. Should go away soon, because
|
|
||||||
all this MBED stuff is too bloated for Teacup's purposes.
|
|
||||||
|
|
||||||
- Prefixed names of #include files with mbed- to match the names of the
|
|
||||||
copies in the Teacup repo.
|
|
||||||
*/
|
|
||||||
#ifndef MBED_PINMAP_H
|
|
||||||
#define MBED_PINMAP_H
|
|
||||||
|
|
||||||
#include "mbed-PinNames.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
PinName pin;
|
|
||||||
int peripheral;
|
|
||||||
int function;
|
|
||||||
} PinMap;
|
|
||||||
|
|
||||||
void pin_function(PinName pin, int function);
|
|
||||||
void pin_mode (PinName pin, PinMode mode);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
11
serial-arm.c
11
serial-arm.c
|
|
@ -14,7 +14,6 @@
|
||||||
#if defined TEACUP_C_INCLUDE && defined __ARMEL__
|
#if defined TEACUP_C_INCLUDE && defined __ARMEL__
|
||||||
|
|
||||||
#include "arduino.h"
|
#include "arduino.h"
|
||||||
#include "mbed-pinmap.h"
|
|
||||||
|
|
||||||
#ifdef XONXOFF
|
#ifdef XONXOFF
|
||||||
#error XON/XOFF protocol not yet implemented for ARM. \
|
#error XON/XOFF protocol not yet implemented for ARM. \
|
||||||
|
|
@ -134,11 +133,11 @@ void serial_init() {
|
||||||
| 0 << 3 // Parity disabled.
|
| 0 << 3 // Parity disabled.
|
||||||
| 0 << 4; // 0 = odd parity, 1 = even parity.
|
| 0 << 4; // 0 = odd parity, 1 = even parity.
|
||||||
|
|
||||||
// Pinout the UART.
|
// Pinout the UART. No need to set GPIO stuff, like data direction.
|
||||||
pin_function(USBTX, 0x01);
|
LPC_IOCON->RXD_CMSIS = 0x01 << 0 // Function RXD.
|
||||||
pin_mode(USBTX, PullUp);
|
| 0x02 << 3; // Pullup enabled.
|
||||||
pin_function(USBRX, 0x01);
|
LPC_IOCON->TXD_CMSIS = 0x01 << 0 // Function TXD.
|
||||||
pin_mode(USBRX, PullUp);
|
| 0x00 << 3; // Pullup inactive.
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check wether characters can be read.
|
/** Check wether characters can be read.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue