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-dev by
targets/TARGET_NUVOTON/TARGET_NUC472/TARGET_NUMAKER_PFM_NUC472/PinNames.h@172:7d866c31b3c5, 2017-08-31 (annotated)
- Committer:
- AnnaBridge
- Date:
- Thu Aug 31 17:27:04 2017 +0100
- Revision:
- 172:7d866c31b3c5
- Parent:
- 161:2cc1468da177
- Child:
- 182:a56a73fd2a6f
This updates the lib to the mbed lib v 150
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 144:ef7eb2e8f9f7 | 1 | /* mbed Microcontroller Library |
<> | 144:ef7eb2e8f9f7 | 2 | * Copyright (c) 2015-2016 Nuvoton |
<> | 144:ef7eb2e8f9f7 | 3 | * |
<> | 144:ef7eb2e8f9f7 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
<> | 144:ef7eb2e8f9f7 | 5 | * you may not use this file except in compliance with the License. |
<> | 144:ef7eb2e8f9f7 | 6 | * You may obtain a copy of the License at |
<> | 144:ef7eb2e8f9f7 | 7 | * |
<> | 144:ef7eb2e8f9f7 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
<> | 144:ef7eb2e8f9f7 | 9 | * |
<> | 144:ef7eb2e8f9f7 | 10 | * Unless required by applicable law or agreed to in writing, software |
<> | 144:ef7eb2e8f9f7 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
<> | 144:ef7eb2e8f9f7 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
<> | 144:ef7eb2e8f9f7 | 13 | * See the License for the specific language governing permissions and |
<> | 144:ef7eb2e8f9f7 | 14 | * limitations under the License. |
<> | 144:ef7eb2e8f9f7 | 15 | */ |
<> | 144:ef7eb2e8f9f7 | 16 | #ifndef MBED_PINNAMES_H |
<> | 144:ef7eb2e8f9f7 | 17 | #define MBED_PINNAMES_H |
<> | 144:ef7eb2e8f9f7 | 18 | |
<> | 144:ef7eb2e8f9f7 | 19 | #include "cmsis.h" |
<> | 144:ef7eb2e8f9f7 | 20 | |
<> | 144:ef7eb2e8f9f7 | 21 | #ifdef __cplusplus |
<> | 144:ef7eb2e8f9f7 | 22 | extern "C" { |
<> | 144:ef7eb2e8f9f7 | 23 | #endif |
<> | 144:ef7eb2e8f9f7 | 24 | |
<> | 161:2cc1468da177 | 25 | #define NU_PININDEX_Pos 0 |
<> | 161:2cc1468da177 | 26 | #define NU_PININDEX_Msk (0xFFul << NU_PININDEX_Pos) |
<> | 161:2cc1468da177 | 27 | #define NU_PINPORT_Pos 8 |
<> | 161:2cc1468da177 | 28 | #define NU_PINPORT_Msk (0xFul << NU_PINPORT_Pos) |
<> | 161:2cc1468da177 | 29 | #define NU_PIN_MODINDEX_Pos 12 |
<> | 161:2cc1468da177 | 30 | #define NU_PIN_MODINDEX_Msk (0xFul << NU_PIN_MODINDEX_Pos) |
<> | 161:2cc1468da177 | 31 | #define NU_PIN_BIND_Pos 16 |
<> | 161:2cc1468da177 | 32 | #define NU_PIN_BIND_Msk (0x1ul << NU_PIN_BIND_Pos) |
<> | 161:2cc1468da177 | 33 | |
<> | 161:2cc1468da177 | 34 | #define NU_PININDEX(PINNAME) (((unsigned int)(PINNAME) & NU_PININDEX_Msk) >> NU_PININDEX_Pos) |
<> | 161:2cc1468da177 | 35 | #define NU_PINPORT(PINNAME) (((unsigned int)(PINNAME) & NU_PINPORT_Msk) >> NU_PINPORT_Pos) |
<> | 161:2cc1468da177 | 36 | #define NU_PIN_BIND(PINNAME) (((unsigned int)(PINNAME) & NU_PIN_BIND_Msk) >> NU_PIN_BIND_Pos) |
<> | 161:2cc1468da177 | 37 | #define NU_PIN_MODINDEX(PINNAME) (((unsigned int)(PINNAME) & NU_PIN_MODINDEX_Msk) >> NU_PIN_MODINDEX_Pos) |
<> | 161:2cc1468da177 | 38 | #define NU_PINNAME(PORT, PIN) ((((unsigned int) (PORT)) << (NU_PINPORT_Pos)) | (((unsigned int) (PIN)) << NU_PININDEX_Pos)) |
<> | 161:2cc1468da177 | 39 | #define NU_PINNAME_BIND(PINNAME, modname) NU_PINNAME_BIND_(NU_PINPORT(PINNAME), NU_PININDEX(PINNAME), modname) |
<> | 161:2cc1468da177 | 40 | #define NU_PINNAME_BIND_(PORT, PIN, modname) ((((unsigned int)(PORT)) << NU_PINPORT_Pos) | (((unsigned int)(PIN)) << NU_PININDEX_Pos) | (NU_MODINDEX(modname) << NU_PIN_MODINDEX_Pos) | NU_PIN_BIND_Msk) |
<> | 161:2cc1468da177 | 41 | |
<> | 161:2cc1468da177 | 42 | #define NU_PORT_BASE(port) ((GPIO_T *)(((uint32_t) GPIOA_BASE) + 0x40 * port)) |
<> | 161:2cc1468da177 | 43 | #define NU_MFP_POS(pin) ((pin % 8) * 4) |
<> | 161:2cc1468da177 | 44 | #define NU_MFP_MSK(pin) (0xful << NU_MFP_POS(pin)) |
<> | 161:2cc1468da177 | 45 | |
<> | 161:2cc1468da177 | 46 | // LEGACY |
<> | 161:2cc1468da177 | 47 | #define NU_PINNAME_TO_PIN(PINNAME) NU_PININDEX(PINNAME) |
<> | 161:2cc1468da177 | 48 | #define NU_PINNAME_TO_PORT(PINNAME) NU_PINPORT(PINNAME) |
<> | 161:2cc1468da177 | 49 | #define NU_PINNAME_TO_MODSUBINDEX(PINNAME) NU_PIN_MODINDEX(PINNAME) |
<> | 161:2cc1468da177 | 50 | #define NU_PORT_N_PIN_TO_PINNAME(PORT, PIN) NU_PINNAME((PORT), (PIN)) |
<> | 144:ef7eb2e8f9f7 | 51 | |
<> | 144:ef7eb2e8f9f7 | 52 | typedef enum { |
<> | 144:ef7eb2e8f9f7 | 53 | PIN_INPUT, |
<> | 144:ef7eb2e8f9f7 | 54 | PIN_OUTPUT |
<> | 144:ef7eb2e8f9f7 | 55 | } PinDirection; |
<> | 144:ef7eb2e8f9f7 | 56 | |
<> | 144:ef7eb2e8f9f7 | 57 | typedef enum { |
<> | 144:ef7eb2e8f9f7 | 58 | PullNone = 0, |
<> | 144:ef7eb2e8f9f7 | 59 | PullDown, |
<> | 144:ef7eb2e8f9f7 | 60 | PullUp, |
<> | 144:ef7eb2e8f9f7 | 61 | |
<> | 144:ef7eb2e8f9f7 | 62 | PushPull, |
<> | 144:ef7eb2e8f9f7 | 63 | OpenDrain, |
<> | 144:ef7eb2e8f9f7 | 64 | Quasi, |
<> | 144:ef7eb2e8f9f7 | 65 | |
<> | 144:ef7eb2e8f9f7 | 66 | PullDefault = PullUp, |
<> | 144:ef7eb2e8f9f7 | 67 | } PinMode; |
<> | 144:ef7eb2e8f9f7 | 68 | |
<> | 144:ef7eb2e8f9f7 | 69 | typedef enum { |
<> | 144:ef7eb2e8f9f7 | 70 | // Not connected |
<> | 144:ef7eb2e8f9f7 | 71 | NC = (int)0xFFFFFFFF, |
<> | 144:ef7eb2e8f9f7 | 72 | |
<> | 144:ef7eb2e8f9f7 | 73 | // Generic naming |
<> | 144:ef7eb2e8f9f7 | 74 | PA_0 = NU_PORT_N_PIN_TO_PINNAME(0, 0), PA_1, PA_2, PA_3, PA_4, PA_5, PA_6, PA_7, PA_8, PA_9, PA_10, PA_11, PA_12, PA_13, PA_14, PA_15, |
<> | 144:ef7eb2e8f9f7 | 75 | PB_0 = NU_PORT_N_PIN_TO_PINNAME(1, 0), PB_1, PB_2, PB_3, PB_4, PB_5, PB_6, PB_7, PB_8, PB_9, PB_10, PB_11, PB_12, PB_13, PB_14, PB_15, |
<> | 144:ef7eb2e8f9f7 | 76 | PC_0 = NU_PORT_N_PIN_TO_PINNAME(2, 0), PC_1, PC_2, PC_3, PC_4, PC_5, PC_6, PC_7, PC_8, PC_9, PC_10, PC_11, PC_12, PC_13, PC_14, PC_15, |
<> | 144:ef7eb2e8f9f7 | 77 | PD_0 = NU_PORT_N_PIN_TO_PINNAME(3, 0), PD_1, PD_2, PD_3, PD_4, PD_5, PD_6, PD_7, PD_8, PD_9, PD_10, PD_11, PD_12, PD_13, PD_14, PD_15, |
<> | 144:ef7eb2e8f9f7 | 78 | PE_0 = NU_PORT_N_PIN_TO_PINNAME(4, 0), PE_1, PE_2, PE_3, PE_4, PE_5, PE_6, PE_7, PE_8, PE_9, PE_10, PE_11, PE_12, PE_13, PE_14, PE_15, |
<> | 144:ef7eb2e8f9f7 | 79 | PF_0 = NU_PORT_N_PIN_TO_PINNAME(5, 0), PF_1, PF_2, PF_3, PF_4, PF_5, PF_6, PF_7, PF_8, PF_9, PF_10, PF_11, PF_12, PF_13, PF_14, PF_15, |
<> | 144:ef7eb2e8f9f7 | 80 | PG_0 = NU_PORT_N_PIN_TO_PINNAME(6, 0), PG_1, PG_2, PG_3, PG_4, PG_5, PG_6, PG_7, PG_8, PG_9, PG_10, PG_11, PG_12, PG_13, PG_14, PG_15, |
<> | 144:ef7eb2e8f9f7 | 81 | PH_0 = NU_PORT_N_PIN_TO_PINNAME(7, 0), PH_1, PH_2, PH_3, PH_4, PH_5, PH_6, PH_7, PH_8, PH_9, PH_10, PH_11, PH_12, PH_13, PH_14, PH_15, |
<> | 144:ef7eb2e8f9f7 | 82 | PI_0 = NU_PORT_N_PIN_TO_PINNAME(8, 0), PI_1, PI_2, PI_3, PI_4, PI_5, PI_6, PI_7, PI_8, PI_9, PI_10, PI_11, PI_12, PI_13, PI_14, PI_15, |
<> | 144:ef7eb2e8f9f7 | 83 | |
<> | 144:ef7eb2e8f9f7 | 84 | // Arduino UNO naming |
<> | 144:ef7eb2e8f9f7 | 85 | A0 = PE_1, |
<> | 144:ef7eb2e8f9f7 | 86 | A1 = PE_2, |
<> | 144:ef7eb2e8f9f7 | 87 | A2 = PE_3, |
<> | 144:ef7eb2e8f9f7 | 88 | A3 = PE_4, |
<> | 144:ef7eb2e8f9f7 | 89 | A4 = PE_5, |
<> | 144:ef7eb2e8f9f7 | 90 | A5 = PE_12, |
<> | 144:ef7eb2e8f9f7 | 91 | A6 = PE_13, |
<> | 144:ef7eb2e8f9f7 | 92 | A7 = PE_14, |
<> | 144:ef7eb2e8f9f7 | 93 | |
<> | 144:ef7eb2e8f9f7 | 94 | D0 = PG_1, |
<> | 144:ef7eb2e8f9f7 | 95 | D1 = PG_2, |
<> | 144:ef7eb2e8f9f7 | 96 | D2 = PF_9, |
<> | 144:ef7eb2e8f9f7 | 97 | D3 = PF_10, |
<> | 144:ef7eb2e8f9f7 | 98 | D4 = PC_10, |
<> | 144:ef7eb2e8f9f7 | 99 | D5 = PC_11, |
<> | 144:ef7eb2e8f9f7 | 100 | D6 = PA_10, |
<> | 144:ef7eb2e8f9f7 | 101 | D7 = PA_9, |
<> | 144:ef7eb2e8f9f7 | 102 | D8 = PD_7, |
<> | 144:ef7eb2e8f9f7 | 103 | D9 = PD_6, |
<> | 144:ef7eb2e8f9f7 | 104 | D10 = PD_3, |
<> | 144:ef7eb2e8f9f7 | 105 | D11 = PD_2, |
<> | 144:ef7eb2e8f9f7 | 106 | D12 = PD_1, |
<> | 144:ef7eb2e8f9f7 | 107 | D13 = PD_0, |
<> | 144:ef7eb2e8f9f7 | 108 | D14 = PD_12, |
<> | 144:ef7eb2e8f9f7 | 109 | D15 = PD_10, |
<> | 144:ef7eb2e8f9f7 | 110 | |
<> | 144:ef7eb2e8f9f7 | 111 | // FIXME: other board-specific naming |
<> | 144:ef7eb2e8f9f7 | 112 | // UART naming |
<> | 144:ef7eb2e8f9f7 | 113 | USBTX = PD_5, |
<> | 144:ef7eb2e8f9f7 | 114 | USBRX = PD_4, |
<> | 144:ef7eb2e8f9f7 | 115 | STDIO_UART_TX = USBTX, |
<> | 144:ef7eb2e8f9f7 | 116 | STDIO_UART_RX = USBRX, |
<> | 144:ef7eb2e8f9f7 | 117 | // LED naming |
<> | 144:ef7eb2e8f9f7 | 118 | LED1 = PD_9, |
<> | 144:ef7eb2e8f9f7 | 119 | LED2 = PA_4, |
<> | 144:ef7eb2e8f9f7 | 120 | LED3 = PD_8, |
AnnaBridge | 172:7d866c31b3c5 | 121 | LED4 = LED1, // No real LED. Just for passing ATS. |
<> | 144:ef7eb2e8f9f7 | 122 | LED_RED = LED1, |
<> | 144:ef7eb2e8f9f7 | 123 | LED_GREEN = LED2, |
<> | 144:ef7eb2e8f9f7 | 124 | LED_BLUE = LED3, |
<> | 144:ef7eb2e8f9f7 | 125 | // Button naming |
<> | 144:ef7eb2e8f9f7 | 126 | SW1 = PC_12, |
<> | 144:ef7eb2e8f9f7 | 127 | SW2 = PC_13, |
<> | 144:ef7eb2e8f9f7 | 128 | |
<> | 144:ef7eb2e8f9f7 | 129 | } PinName; |
<> | 144:ef7eb2e8f9f7 | 130 | |
<> | 144:ef7eb2e8f9f7 | 131 | #ifdef __cplusplus |
<> | 144:ef7eb2e8f9f7 | 132 | } |
<> | 144:ef7eb2e8f9f7 | 133 | #endif |
<> | 144:ef7eb2e8f9f7 | 134 | |
<> | 144:ef7eb2e8f9f7 | 135 | #endif // MBED_PINNAMES_H |