mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
<>
Date:
Tue Dec 20 17:27:56 2016 +0000
Revision:
153:fa9ff456f731
Parent:
149:156823d33999
Child:
161:2cc1468da177
This updates the lib to the mbed lib v132

Who changed what in which revision?

UserRevisionLine numberNew 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
<> 149:156823d33999 25 #define NU_PORT_SHIFT 12
<> 149:156823d33999 26 #define NU_PINNAME_TO_PORT(name) ((unsigned int)(name) >> NU_PORT_SHIFT)
<> 149:156823d33999 27 #define NU_PINNAME_TO_PIN(name) ((unsigned int)(name) & ~(0xFFFFFFFF << NU_PORT_SHIFT))
<> 149:156823d33999 28 #define NU_PORT_N_PIN_TO_PINNAME(port, pin) ((((unsigned int) (port)) << (NU_PORT_SHIFT)) | ((unsigned int) (pin)))
<> 149:156823d33999 29 #define NU_PORT_BASE(port) ((GPIO_T *)(((uint32_t) GPIOA_BASE) + 0x40 * port))
<> 149:156823d33999 30 #define NU_MFP_POS(pin) ((pin % 8) * 4)
<> 149:156823d33999 31 #define NU_MFP_MSK(pin) (0xful << NU_MFP_POS(pin))
<> 149:156823d33999 32
<> 149:156823d33999 33 typedef enum {
<> 149:156823d33999 34 PIN_INPUT,
<> 149:156823d33999 35 PIN_OUTPUT
<> 149:156823d33999 36 } PinDirection;
<> 149:156823d33999 37
<> 149:156823d33999 38 typedef enum {
<> 149:156823d33999 39 PullNone = 0,
<> 149:156823d33999 40 PullDown,
<> 149:156823d33999 41 PullUp,
<> 149:156823d33999 42
<> 149:156823d33999 43 PushPull,
<> 149:156823d33999 44 OpenDrain,
<> 149:156823d33999 45 Quasi,
<> 149:156823d33999 46
<> 149:156823d33999 47 PullDefault = PullUp,
<> 149:156823d33999 48 } PinMode;
<> 149:156823d33999 49
<> 149:156823d33999 50 typedef enum {
<> 149:156823d33999 51 // Not connected
<> 149:156823d33999 52 NC = (int)0xFFFFFFFF,
<> 149:156823d33999 53
<> 149:156823d33999 54 // Generic naming
<> 149:156823d33999 55 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 56 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 57 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 58 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 59 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 60 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 61
<> 149:156823d33999 62 // Arduino UNO naming
<> 149:156823d33999 63 A0 = PB_0,
<> 149:156823d33999 64 A1 = PB_1,
<> 149:156823d33999 65 A2 = PB_2,
<> 149:156823d33999 66 A3 = PB_3,
<> 149:156823d33999 67 A4 = PB_4,
<> 149:156823d33999 68 A5 = PB_8,
<> 149:156823d33999 69 A6 = PB_9,
<> 149:156823d33999 70 A7 = PB_10,
<> 149:156823d33999 71
<> 149:156823d33999 72 D0 = PD_6,
<> 149:156823d33999 73 D1 = PD_1,
<> 149:156823d33999 74 D2 = PC_6,
<> 149:156823d33999 75 D3 = PC_7,
<> 149:156823d33999 76 D4 = PC_11,
<> 149:156823d33999 77 D5 = PC_12,
<> 149:156823d33999 78 D6 = PC_13,
<> 149:156823d33999 79 D7 = PC_14,
<> 149:156823d33999 80 D8 = PC_0,
<> 149:156823d33999 81 D9 = PC_1,
<> 149:156823d33999 82 D10 = PC_2,
<> 149:156823d33999 83 D11 = PC_3,
<> 149:156823d33999 84 D12 = PC_4,
<> 149:156823d33999 85 D13 = PC_5,
<> 149:156823d33999 86 D14 = PE_5,
<> 149:156823d33999 87 D15 = PE_4,
<> 149:156823d33999 88
<> 149:156823d33999 89 // FIXME: other board-specific naming
<> 149:156823d33999 90 // UART naming
<> 149:156823d33999 91 USBTX = PA_8,
<> 149:156823d33999 92 USBRX = PA_9,
<> 149:156823d33999 93 STDIO_UART_TX = USBTX,
<> 149:156823d33999 94 STDIO_UART_RX = USBRX,
<> 149:156823d33999 95 // LED naming
<> 149:156823d33999 96 LED1 = PD_2,
<> 149:156823d33999 97 LED2 = PD_3,
<> 149:156823d33999 98 LED3 = PD_7,
<> 149:156823d33999 99 LED4 = D0, // No real LED. Just for passing ATS.
<> 149:156823d33999 100 LED_RED = LED2,
<> 149:156823d33999 101 LED_GREEN = LED3,
<> 149:156823d33999 102 LED_BLUE = LED1,
<> 149:156823d33999 103 // Button naming
<> 153:fa9ff456f731 104 SW2 = PA_15,
<> 153:fa9ff456f731 105 SW3 = PA_14,
<> 149:156823d33999 106
<> 149:156823d33999 107 } PinName;
<> 149:156823d33999 108
<> 149:156823d33999 109 #ifdef __cplusplus
<> 149:156823d33999 110 }
<> 149:156823d33999 111 #endif
<> 149:156823d33999 112
<> 149:156823d33999 113 #endif // MBED_PINNAMES_H