mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
targets/TARGET_NUVOTON/TARGET_M451/PinNames.h@187:0387e8f68319, 2018-09-06 (annotated)
- Committer:
- AnnaBridge
- Date:
- Thu Sep 06 13:40:20 2018 +0100
- Revision:
- 187:0387e8f68319
- Parent:
- targets/TARGET_NUVOTON/TARGET_M451/TARGET_NUMAKER_PFM_M453/PinNames.h@182:a56a73fd2a6f
- Child:
- 188:bcfe06ba3d64
mbed-dev library. Release version 163
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 149:156823d33999 | 1 | /* mbed Microcontroller Library |
<> | 149:156823d33999 | 2 | * Copyright (c) 2015-2016 Nuvoton |
<> | 149:156823d33999 | 3 | * |
<> | 149:156823d33999 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
<> | 149:156823d33999 | 5 | * you may not use this file except in compliance with the License. |
<> | 149:156823d33999 | 6 | * You may obtain a copy of the License at |
<> | 149:156823d33999 | 7 | * |
<> | 149:156823d33999 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
<> | 149:156823d33999 | 9 | * |
<> | 149:156823d33999 | 10 | * Unless required by applicable law or agreed to in writing, software |
<> | 149:156823d33999 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
<> | 149:156823d33999 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
<> | 149:156823d33999 | 13 | * See the License for the specific language governing permissions and |
<> | 149:156823d33999 | 14 | * limitations under the License. |
<> | 149:156823d33999 | 15 | */ |
<> | 149:156823d33999 | 16 | #ifndef MBED_PINNAMES_H |
<> | 149:156823d33999 | 17 | #define MBED_PINNAMES_H |
<> | 149:156823d33999 | 18 | |
<> | 149:156823d33999 | 19 | #include "cmsis.h" |
<> | 149:156823d33999 | 20 | |
<> | 149:156823d33999 | 21 | #ifdef __cplusplus |
<> | 149:156823d33999 | 22 | extern "C" { |
<> | 149:156823d33999 | 23 | #endif |
<> | 149:156823d33999 | 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)) |
<> | 149:156823d33999 | 51 | |
<> | 149:156823d33999 | 52 | typedef enum { |
<> | 149:156823d33999 | 53 | PIN_INPUT, |
<> | 149:156823d33999 | 54 | PIN_OUTPUT |
<> | 149:156823d33999 | 55 | } PinDirection; |
<> | 149:156823d33999 | 56 | |
<> | 149:156823d33999 | 57 | typedef enum { |
<> | 149:156823d33999 | 58 | PullNone = 0, |
<> | 149:156823d33999 | 59 | PullDown, |
<> | 149:156823d33999 | 60 | PullUp, |
<> | 149:156823d33999 | 61 | |
<> | 149:156823d33999 | 62 | PushPull, |
<> | 149:156823d33999 | 63 | OpenDrain, |
<> | 149:156823d33999 | 64 | Quasi, |
<> | 149:156823d33999 | 65 | |
<> | 149:156823d33999 | 66 | PullDefault = PullUp, |
<> | 149:156823d33999 | 67 | } PinMode; |
<> | 149:156823d33999 | 68 | |
<> | 149:156823d33999 | 69 | typedef enum { |
<> | 149:156823d33999 | 70 | // Not connected |
<> | 149:156823d33999 | 71 | NC = (int)0xFFFFFFFF, |
<> | 149:156823d33999 | 72 | |
<> | 149:156823d33999 | 73 | // Generic naming |
<> | 149:156823d33999 | 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, |
<> | 149:156823d33999 | 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, |
<> | 149:156823d33999 | 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, |
<> | 149:156823d33999 | 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, |
<> | 149:156823d33999 | 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, |
<> | 149:156823d33999 | 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, |
<> | 149:156823d33999 | 80 | |
<> | 149:156823d33999 | 81 | // Arduino UNO naming |
<> | 149:156823d33999 | 82 | A0 = PB_0, |
<> | 149:156823d33999 | 83 | A1 = PB_1, |
<> | 149:156823d33999 | 84 | A2 = PB_2, |
<> | 149:156823d33999 | 85 | A3 = PB_3, |
<> | 149:156823d33999 | 86 | A4 = PB_4, |
<> | 149:156823d33999 | 87 | A5 = PB_8, |
<> | 149:156823d33999 | 88 | A6 = PB_9, |
<> | 149:156823d33999 | 89 | A7 = PB_10, |
<> | 149:156823d33999 | 90 | |
<> | 149:156823d33999 | 91 | D0 = PD_6, |
<> | 149:156823d33999 | 92 | D1 = PD_1, |
<> | 149:156823d33999 | 93 | D2 = PC_6, |
<> | 149:156823d33999 | 94 | D3 = PC_7, |
<> | 149:156823d33999 | 95 | D4 = PC_11, |
<> | 149:156823d33999 | 96 | D5 = PC_12, |
<> | 149:156823d33999 | 97 | D6 = PC_13, |
<> | 149:156823d33999 | 98 | D7 = PC_14, |
<> | 149:156823d33999 | 99 | D8 = PC_0, |
<> | 149:156823d33999 | 100 | D9 = PC_1, |
<> | 149:156823d33999 | 101 | D10 = PC_2, |
<> | 149:156823d33999 | 102 | D11 = PC_3, |
<> | 149:156823d33999 | 103 | D12 = PC_4, |
<> | 149:156823d33999 | 104 | D13 = PC_5, |
<> | 149:156823d33999 | 105 | D14 = PE_5, |
<> | 149:156823d33999 | 106 | D15 = PE_4, |
AnnaBridge | 182:a56a73fd2a6f | 107 | |
AnnaBridge | 182:a56a73fd2a6f | 108 | I2C_SCL = D15, |
AnnaBridge | 182:a56a73fd2a6f | 109 | I2C_SDA = D14, |
<> | 149:156823d33999 | 110 | |
AnnaBridge | 182:a56a73fd2a6f | 111 | // NOTE: board-specific naming |
<> | 149:156823d33999 | 112 | // UART naming |
<> | 149:156823d33999 | 113 | USBTX = PA_8, |
<> | 149:156823d33999 | 114 | USBRX = PA_9, |
<> | 149:156823d33999 | 115 | STDIO_UART_TX = USBTX, |
<> | 149:156823d33999 | 116 | STDIO_UART_RX = USBRX, |
AnnaBridge | 182:a56a73fd2a6f | 117 | SERIAL_TX = USBTX, |
AnnaBridge | 182:a56a73fd2a6f | 118 | SERIAL_RX = USBRX, |
<> | 149:156823d33999 | 119 | // LED naming |
<> | 149:156823d33999 | 120 | LED1 = PD_2, |
<> | 149:156823d33999 | 121 | LED2 = PD_3, |
<> | 149:156823d33999 | 122 | LED3 = PD_7, |
AnnaBridge | 172:7d866c31b3c5 | 123 | LED4 = LED1, // No real LED. Just for passing ATS. |
<> | 149:156823d33999 | 124 | LED_RED = LED2, |
<> | 149:156823d33999 | 125 | LED_GREEN = LED3, |
<> | 149:156823d33999 | 126 | LED_BLUE = LED1, |
<> | 149:156823d33999 | 127 | // Button naming |
<> | 153:fa9ff456f731 | 128 | SW2 = PA_15, |
<> | 153:fa9ff456f731 | 129 | SW3 = PA_14, |
<> | 149:156823d33999 | 130 | |
<> | 149:156823d33999 | 131 | } PinName; |
<> | 149:156823d33999 | 132 | |
<> | 149:156823d33999 | 133 | #ifdef __cplusplus |
<> | 149:156823d33999 | 134 | } |
<> | 149:156823d33999 | 135 | #endif |
<> | 149:156823d33999 | 136 | |
<> | 149:156823d33999 | 137 | #endif // MBED_PINNAMES_H |