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@189:f392fc9709a3, 2019-02-20 (annotated)
- Committer:
- AnnaBridge
- Date:
- Wed Feb 20 22:31:08 2019 +0000
- Revision:
- 189:f392fc9709a3
- Parent:
- 188:bcfe06ba3d64
mbed library release version 165
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 { |
AnnaBridge | 188:bcfe06ba3d64 | 58 | /* Input pull mode */ |
<> | 149:156823d33999 | 59 | PullNone = 0, |
<> | 149:156823d33999 | 60 | PullDown, |
<> | 149:156823d33999 | 61 | PullUp, |
<> | 149:156823d33999 | 62 | |
AnnaBridge | 188:bcfe06ba3d64 | 63 | /* I/O mode */ |
AnnaBridge | 188:bcfe06ba3d64 | 64 | InputOnly, |
AnnaBridge | 188:bcfe06ba3d64 | 65 | PushPullOutput, |
<> | 149:156823d33999 | 66 | OpenDrain, |
AnnaBridge | 188:bcfe06ba3d64 | 67 | QuasiBidirectional, |
<> | 149:156823d33999 | 68 | |
AnnaBridge | 188:bcfe06ba3d64 | 69 | /* Default input pull mode */ |
AnnaBridge | 188:bcfe06ba3d64 | 70 | PullDefault = PullUp |
<> | 149:156823d33999 | 71 | } PinMode; |
<> | 149:156823d33999 | 72 | |
<> | 149:156823d33999 | 73 | typedef enum { |
<> | 149:156823d33999 | 74 | // Not connected |
<> | 149:156823d33999 | 75 | NC = (int)0xFFFFFFFF, |
<> | 149:156823d33999 | 76 | |
<> | 149:156823d33999 | 77 | // Generic naming |
<> | 149:156823d33999 | 78 | 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 | 79 | 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 | 80 | 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 | 81 | 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 | 82 | 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 | 83 | 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 | 84 | |
<> | 149:156823d33999 | 85 | // Arduino UNO naming |
<> | 149:156823d33999 | 86 | A0 = PB_0, |
<> | 149:156823d33999 | 87 | A1 = PB_1, |
<> | 149:156823d33999 | 88 | A2 = PB_2, |
<> | 149:156823d33999 | 89 | A3 = PB_3, |
<> | 149:156823d33999 | 90 | A4 = PB_4, |
<> | 149:156823d33999 | 91 | A5 = PB_8, |
<> | 149:156823d33999 | 92 | A6 = PB_9, |
<> | 149:156823d33999 | 93 | A7 = PB_10, |
<> | 149:156823d33999 | 94 | |
<> | 149:156823d33999 | 95 | D0 = PD_6, |
<> | 149:156823d33999 | 96 | D1 = PD_1, |
<> | 149:156823d33999 | 97 | D2 = PC_6, |
<> | 149:156823d33999 | 98 | D3 = PC_7, |
<> | 149:156823d33999 | 99 | D4 = PC_11, |
<> | 149:156823d33999 | 100 | D5 = PC_12, |
<> | 149:156823d33999 | 101 | D6 = PC_13, |
<> | 149:156823d33999 | 102 | D7 = PC_14, |
<> | 149:156823d33999 | 103 | D8 = PC_0, |
<> | 149:156823d33999 | 104 | D9 = PC_1, |
<> | 149:156823d33999 | 105 | D10 = PC_2, |
<> | 149:156823d33999 | 106 | D11 = PC_3, |
<> | 149:156823d33999 | 107 | D12 = PC_4, |
<> | 149:156823d33999 | 108 | D13 = PC_5, |
<> | 149:156823d33999 | 109 | D14 = PE_5, |
<> | 149:156823d33999 | 110 | D15 = PE_4, |
AnnaBridge | 182:a56a73fd2a6f | 111 | |
AnnaBridge | 182:a56a73fd2a6f | 112 | I2C_SCL = D15, |
AnnaBridge | 182:a56a73fd2a6f | 113 | I2C_SDA = D14, |
<> | 149:156823d33999 | 114 | |
AnnaBridge | 182:a56a73fd2a6f | 115 | // NOTE: board-specific naming |
<> | 149:156823d33999 | 116 | // UART naming |
<> | 149:156823d33999 | 117 | USBTX = PA_8, |
<> | 149:156823d33999 | 118 | USBRX = PA_9, |
<> | 149:156823d33999 | 119 | STDIO_UART_TX = USBTX, |
<> | 149:156823d33999 | 120 | STDIO_UART_RX = USBRX, |
AnnaBridge | 182:a56a73fd2a6f | 121 | SERIAL_TX = USBTX, |
AnnaBridge | 182:a56a73fd2a6f | 122 | SERIAL_RX = USBRX, |
<> | 149:156823d33999 | 123 | // LED naming |
<> | 149:156823d33999 | 124 | LED1 = PD_2, |
<> | 149:156823d33999 | 125 | LED2 = PD_3, |
<> | 149:156823d33999 | 126 | LED3 = PD_7, |
AnnaBridge | 172:7d866c31b3c5 | 127 | LED4 = LED1, // No real LED. Just for passing ATS. |
<> | 149:156823d33999 | 128 | LED_RED = LED2, |
<> | 149:156823d33999 | 129 | LED_GREEN = LED3, |
<> | 149:156823d33999 | 130 | LED_BLUE = LED1, |
<> | 149:156823d33999 | 131 | // Button naming |
<> | 153:fa9ff456f731 | 132 | SW2 = PA_15, |
<> | 153:fa9ff456f731 | 133 | SW3 = PA_14, |
<> | 149:156823d33999 | 134 | |
<> | 149:156823d33999 | 135 | } PinName; |
<> | 149:156823d33999 | 136 | |
<> | 149:156823d33999 | 137 | #ifdef __cplusplus |
<> | 149:156823d33999 | 138 | } |
<> | 149:156823d33999 | 139 | #endif |
<> | 149:156823d33999 | 140 | |
<> | 149:156823d33999 | 141 | #endif // MBED_PINNAMES_H |