mbed-src updated for BMD-200 evaluation board. Just pin numbers are updated.
Dependents: mbed_blinky-bmd-200 bmd-200_accel_demo firstRig
Fork of mbed-src by
Replacement for the "mbed" or "mbed-src" library when using the BMD-200 Evaluation kit. This library only remaps the pin names (i.e. LED1 points to p0.01 instead of p0.18, etc) as used by the BMD-200 Evaluation board (select the nRF51822_mkit platform). All other code is untouched.
targets/hal/TARGET_NXP/TARGET_LPC11U6X/pinmap.c@592:5e2eb8beba71, 2015-07-10 (annotated)
- Committer:
- dcnichols
- Date:
- Fri Jul 10 17:36:27 2015 +0000
- Revision:
- 592:5e2eb8beba71
- Parent:
- 285:31249416b6f9
updating to latest mbed-src
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 174:8bb9f3a33240 | 1 | /* mbed Microcontroller Library |
mbed_official | 174:8bb9f3a33240 | 2 | * Copyright (c) 2006-2013 ARM Limited |
mbed_official | 174:8bb9f3a33240 | 3 | * |
mbed_official | 174:8bb9f3a33240 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
mbed_official | 174:8bb9f3a33240 | 5 | * you may not use this file except in compliance with the License. |
mbed_official | 174:8bb9f3a33240 | 6 | * You may obtain a copy of the License at |
mbed_official | 174:8bb9f3a33240 | 7 | * |
mbed_official | 174:8bb9f3a33240 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
mbed_official | 174:8bb9f3a33240 | 9 | * |
mbed_official | 174:8bb9f3a33240 | 10 | * Unless required by applicable law or agreed to in writing, software |
mbed_official | 174:8bb9f3a33240 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
mbed_official | 174:8bb9f3a33240 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
mbed_official | 174:8bb9f3a33240 | 13 | * See the License for the specific language governing permissions and |
mbed_official | 174:8bb9f3a33240 | 14 | * limitations under the License. |
mbed_official | 174:8bb9f3a33240 | 15 | */ |
mbed_official | 227:7bd0639b8911 | 16 | #include "mbed_assert.h" |
mbed_official | 174:8bb9f3a33240 | 17 | #include "pinmap.h" |
mbed_official | 285:31249416b6f9 | 18 | #include "mbed_error.h" |
mbed_official | 174:8bb9f3a33240 | 19 | |
mbed_official | 174:8bb9f3a33240 | 20 | void pin_function(PinName pin, int function) { |
mbed_official | 227:7bd0639b8911 | 21 | MBED_ASSERT(pin != (PinName)NC); |
mbed_official | 174:8bb9f3a33240 | 22 | __IO uint32_t *reg = (__IO uint32_t*)(LPC_IOCON_BASE + (pin & 0x1FF)); |
mbed_official | 174:8bb9f3a33240 | 23 | |
mbed_official | 174:8bb9f3a33240 | 24 | // pin function bits: [2:0] -> 111 = (0x7) |
mbed_official | 174:8bb9f3a33240 | 25 | *reg = (*reg & ~0x7) | (function & 0x7); |
mbed_official | 174:8bb9f3a33240 | 26 | } |
mbed_official | 174:8bb9f3a33240 | 27 | |
mbed_official | 174:8bb9f3a33240 | 28 | void pin_mode(PinName pin, PinMode mode) { |
mbed_official | 227:7bd0639b8911 | 29 | MBED_ASSERT(pin != (PinName)NC); |
mbed_official | 174:8bb9f3a33240 | 30 | if ((pin == P0_4) || (pin == P0_5)) { |
mbed_official | 174:8bb9f3a33240 | 31 | // The true open-drain pins PIO0_4 and PIO0_5 can be configured for different I2C-bus speeds. |
mbed_official | 174:8bb9f3a33240 | 32 | return; |
mbed_official | 174:8bb9f3a33240 | 33 | } |
mbed_official | 174:8bb9f3a33240 | 34 | |
mbed_official | 174:8bb9f3a33240 | 35 | __IO uint32_t *reg = (__IO uint32_t*)(LPC_IOCON_BASE + (pin & 0x1FF)); |
mbed_official | 174:8bb9f3a33240 | 36 | |
mbed_official | 174:8bb9f3a33240 | 37 | if (mode == OpenDrain) { |
mbed_official | 174:8bb9f3a33240 | 38 | *reg |= (1 << 10); |
mbed_official | 174:8bb9f3a33240 | 39 | } else { |
mbed_official | 174:8bb9f3a33240 | 40 | uint32_t tmp = *reg; |
mbed_official | 174:8bb9f3a33240 | 41 | tmp &= ~(0x3 << 3); |
mbed_official | 174:8bb9f3a33240 | 42 | tmp |= (mode & 0x3) << 3; |
mbed_official | 174:8bb9f3a33240 | 43 | *reg = tmp; |
mbed_official | 174:8bb9f3a33240 | 44 | } |
mbed_official | 174:8bb9f3a33240 | 45 | } |