Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-src by
targets/hal/TARGET_RENESAS/TARGET_RZ_A1H/pinmap.c@443:ed48b4122bfb, 2015-01-12 (annotated)
- Committer:
- mbed_official
- Date:
- Mon Jan 12 08:15:07 2015 +0000
- Revision:
- 443:ed48b4122bfb
- Parent:
- 409:a95c696104d3
- Child:
- 617:3b0e8f440867
Synchronized with git revision 7a3d2b4423a702a090d20403e5209c70f572c84e
Full URL: https://github.com/mbedmicro/mbed/commit/7a3d2b4423a702a090d20403e5209c70f572c84e/
NUCLEO_F070RB - Update tests
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 390:35c2c1cf29cd | 1 | /* mbed Microcontroller Library |
mbed_official | 390:35c2c1cf29cd | 2 | * Copyright (c) 2006-2013 ARM Limited |
mbed_official | 390:35c2c1cf29cd | 3 | * |
mbed_official | 390:35c2c1cf29cd | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
mbed_official | 390:35c2c1cf29cd | 5 | * you may not use this file except in compliance with the License. |
mbed_official | 390:35c2c1cf29cd | 6 | * You may obtain a copy of the License at |
mbed_official | 390:35c2c1cf29cd | 7 | * |
mbed_official | 390:35c2c1cf29cd | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
mbed_official | 390:35c2c1cf29cd | 9 | * |
mbed_official | 390:35c2c1cf29cd | 10 | * Unless required by applicable law or agreed to in writing, software |
mbed_official | 390:35c2c1cf29cd | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
mbed_official | 390:35c2c1cf29cd | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
mbed_official | 390:35c2c1cf29cd | 13 | * See the License for the specific language governing permissions and |
mbed_official | 390:35c2c1cf29cd | 14 | * limitations under the License. |
mbed_official | 390:35c2c1cf29cd | 15 | */ |
mbed_official | 390:35c2c1cf29cd | 16 | #include "pinmap.h" |
mbed_official | 390:35c2c1cf29cd | 17 | #include "mbed_error.h" |
mbed_official | 390:35c2c1cf29cd | 18 | #include "gpio_addrdefine.h" |
mbed_official | 390:35c2c1cf29cd | 19 | |
mbed_official | 409:a95c696104d3 | 20 | PinName gpio_multi_guard = (PinName)NC; /* If set pin name here, setting of the "pin" is just one time */ |
mbed_official | 409:a95c696104d3 | 21 | |
mbed_official | 390:35c2c1cf29cd | 22 | void pin_function(PinName pin, int function) { |
mbed_official | 390:35c2c1cf29cd | 23 | if (pin == (PinName)NC) return; |
mbed_official | 390:35c2c1cf29cd | 24 | |
mbed_official | 390:35c2c1cf29cd | 25 | int n = pin >> 4; |
mbed_official | 390:35c2c1cf29cd | 26 | int bitmask = 1<<(pin & 0xf); |
mbed_official | 390:35c2c1cf29cd | 27 | |
mbed_official | 409:a95c696104d3 | 28 | if (gpio_multi_guard != pin) { |
mbed_official | 409:a95c696104d3 | 29 | if (function == 0) { |
mbed_official | 409:a95c696104d3 | 30 | // means GPIO mode |
mbed_official | 409:a95c696104d3 | 31 | *PMC(n) &= ~bitmask; |
mbed_official | 409:a95c696104d3 | 32 | } else { |
mbed_official | 409:a95c696104d3 | 33 | // alt-function mode |
mbed_official | 409:a95c696104d3 | 34 | --function; |
mbed_official | 390:35c2c1cf29cd | 35 | |
mbed_official | 409:a95c696104d3 | 36 | if (function & (1 << 2)) { *PFCAE(n) |= bitmask;}else { *PFCAE(n) &= ~bitmask;} |
mbed_official | 409:a95c696104d3 | 37 | if (function & (1 << 1)) { *PFCE(n) |= bitmask;}else { *PFCE(n) &= ~bitmask;} |
mbed_official | 409:a95c696104d3 | 38 | if (function & (1 << 0)) { *PFC(n) |= bitmask;}else { *PFC(n) &= ~bitmask;} |
mbed_official | 409:a95c696104d3 | 39 | *PIPC(n) |= bitmask; |
mbed_official | 390:35c2c1cf29cd | 40 | |
mbed_official | 409:a95c696104d3 | 41 | if (P1_0 <= pin && pin <= P1_7 && function == 0) { |
mbed_official | 409:a95c696104d3 | 42 | *PBDC(n) |= bitmask; |
mbed_official | 409:a95c696104d3 | 43 | } |
mbed_official | 443:ed48b4122bfb | 44 | *PMC(n) |= bitmask; |
mbed_official | 390:35c2c1cf29cd | 45 | } |
mbed_official | 409:a95c696104d3 | 46 | } else { |
mbed_official | 409:a95c696104d3 | 47 | gpio_multi_guard = (PinName)NC; |
mbed_official | 390:35c2c1cf29cd | 48 | } |
mbed_official | 390:35c2c1cf29cd | 49 | } |
mbed_official | 390:35c2c1cf29cd | 50 | |
mbed_official | 390:35c2c1cf29cd | 51 | void pin_mode(PinName pin, PinMode mode) { |
mbed_official | 390:35c2c1cf29cd | 52 | // if (pin == (PinName)NC) { return; } |
mbed_official | 390:35c2c1cf29cd | 53 | } |