The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
171:3a7713b1edbc
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 109:9296ab0bfc11 1 /* mbed Microcontroller Library
Kojto 109:9296ab0bfc11 2 *******************************************************************************
Kojto 109:9296ab0bfc11 3 * Copyright (c) 2015 WIZnet Co.,Ltd. All rights reserved.
Kojto 109:9296ab0bfc11 4 * All rights reserved.
Kojto 109:9296ab0bfc11 5 *
Kojto 109:9296ab0bfc11 6 * Redistribution and use in source and binary forms, with or without
Kojto 109:9296ab0bfc11 7 * modification, are permitted provided that the following conditions are met:
Kojto 109:9296ab0bfc11 8 *
Kojto 109:9296ab0bfc11 9 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 109:9296ab0bfc11 10 * this list of conditions and the following disclaimer.
Kojto 109:9296ab0bfc11 11 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 109:9296ab0bfc11 12 * this list of conditions and the following disclaimer in the documentation
Kojto 109:9296ab0bfc11 13 * and/or other materials provided with the distribution.
Kojto 109:9296ab0bfc11 14 * 3. Neither the name of ARM Limited nor the names of its contributors
Kojto 109:9296ab0bfc11 15 * may be used to endorse or promote products derived from this software
Kojto 109:9296ab0bfc11 16 * without specific prior written permission.
Kojto 109:9296ab0bfc11 17 *
Kojto 109:9296ab0bfc11 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 109:9296ab0bfc11 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 109:9296ab0bfc11 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 109:9296ab0bfc11 21 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 109:9296ab0bfc11 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 109:9296ab0bfc11 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 109:9296ab0bfc11 24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 109:9296ab0bfc11 25 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 109:9296ab0bfc11 26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 109:9296ab0bfc11 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 109:9296ab0bfc11 28 *******************************************************************************
Kojto 109:9296ab0bfc11 29 */
Kojto 109:9296ab0bfc11 30
Kojto 109:9296ab0bfc11 31 #ifndef MBED_PINNAMES_H
Kojto 109:9296ab0bfc11 32 #define MBED_PINNAMES_H
Kojto 109:9296ab0bfc11 33
Kojto 109:9296ab0bfc11 34 #include "cmsis.h"
Kojto 109:9296ab0bfc11 35
Kojto 109:9296ab0bfc11 36 #ifdef __cplusplus
Kojto 109:9296ab0bfc11 37 extern "C" {
Kojto 109:9296ab0bfc11 38 #endif
Kojto 109:9296ab0bfc11 39
Kojto 109:9296ab0bfc11 40
Kojto 109:9296ab0bfc11 41 // See W7500x_hal_gpio.h for values of MODE, PUPD and AFNUM
Kojto 109:9296ab0bfc11 42 #define WIZ_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE) << 8) | ((PUPD) << 4) | ((AFNUM) << 0)))
Kojto 109:9296ab0bfc11 43 #define WIZ_PIN_PUPD(X) (((X) >> 4) & 0x0F)
Kojto 109:9296ab0bfc11 44 #define WIZ_PIN_AFNUM(X) (((X) >> 0) & 0x0F)
Kojto 109:9296ab0bfc11 45 #define WIZ_PIN_MODE(X) (((X) >> 8) & 0x0F)
Kojto 109:9296ab0bfc11 46 #define WIZ_MODE_INPUT (0)
Kojto 109:9296ab0bfc11 47 #define WIZ_MODE_OUTPUT (1)
Kojto 109:9296ab0bfc11 48 #define WIZ_MODE_AF (2)
Kojto 109:9296ab0bfc11 49
Kojto 109:9296ab0bfc11 50 #define WIZ_GPIO_NOPULL (0) /*!< No Pull-up or Pull-down activation */
Kojto 109:9296ab0bfc11 51 #define WIZ_GPIO_PULLDOWN (1) /*!< Pull-down activation */
Kojto 109:9296ab0bfc11 52 #define WIZ_GPIO_PULLUP (2) /*!< Pull-up activation */
Kojto 109:9296ab0bfc11 53 #define WIZ_GPIO_OPEN_DRAIN (3) /*!< Open Drain activation */
Kojto 109:9296ab0bfc11 54
Kojto 109:9296ab0bfc11 55
Kojto 109:9296ab0bfc11 56 #define WIZ_PORT(X) (((uint32_t)(X) >> 4) & 0xF) // port number (0=A, 1=B, 2=C, 3=D)
Kojto 109:9296ab0bfc11 57 #define WIZ_PIN_NUM(X) ((uint32_t)(X) & 0xF) // pin number
Kojto 109:9296ab0bfc11 58 #define WIZ_PIN_INDEX(X) (1 << ((uint32_t)(X) & 0xF)) // pin index : flag bit
Kojto 109:9296ab0bfc11 59
Kojto 109:9296ab0bfc11 60
Kojto 109:9296ab0bfc11 61 typedef enum {
Kojto 109:9296ab0bfc11 62 PIN_INPUT,
Kojto 109:9296ab0bfc11 63 PIN_OUTPUT
Kojto 109:9296ab0bfc11 64 } PinDirection;
Kojto 109:9296ab0bfc11 65
Kojto 109:9296ab0bfc11 66
Kojto 109:9296ab0bfc11 67 typedef enum {
Kojto 109:9296ab0bfc11 68 // W7500x PORT[5:4] + PIN[3:0])
Kojto 109:9296ab0bfc11 69 PA_0 = 0x000,
Kojto 109:9296ab0bfc11 70 PA_1 = 0x001,
Kojto 109:9296ab0bfc11 71 PA_2 = 0x002,
Kojto 109:9296ab0bfc11 72 PA_3 = 0x003,
Kojto 109:9296ab0bfc11 73 PA_4 = 0x004,
Kojto 109:9296ab0bfc11 74 PA_5 = 0x005,
Kojto 109:9296ab0bfc11 75 PA_6 = 0x006,
Kojto 109:9296ab0bfc11 76 PA_7 = 0x007,
Kojto 109:9296ab0bfc11 77 PA_8 = 0x008,
Kojto 109:9296ab0bfc11 78 PA_9 = 0x009,
Kojto 109:9296ab0bfc11 79 PA_10 = 0x00A,
Kojto 109:9296ab0bfc11 80 PA_11 = 0x00B,
Kojto 109:9296ab0bfc11 81 PA_12 = 0x00C,
Kojto 109:9296ab0bfc11 82 PA_13 = 0x00D,
Kojto 109:9296ab0bfc11 83 PA_14 = 0x00E,
Kojto 109:9296ab0bfc11 84 PA_15 = 0x00F,
Kojto 109:9296ab0bfc11 85
Kojto 109:9296ab0bfc11 86 PB_0 = 0x010,
Kojto 109:9296ab0bfc11 87 PB_1 = 0x011,
Kojto 109:9296ab0bfc11 88 PB_2 = 0x012,
Kojto 109:9296ab0bfc11 89 PB_3 = 0x013,
Kojto 109:9296ab0bfc11 90 PB_4 = 0x014,
Kojto 109:9296ab0bfc11 91 PB_5 = 0x015,
Kojto 109:9296ab0bfc11 92 PB_6 = 0x016,
Kojto 109:9296ab0bfc11 93 PB_7 = 0x017,
Kojto 109:9296ab0bfc11 94 PB_8 = 0x018,
Kojto 109:9296ab0bfc11 95 PB_9 = 0x019,
Kojto 109:9296ab0bfc11 96 PB_10 = 0x01A,
Kojto 109:9296ab0bfc11 97 PB_11 = 0x01B,
Kojto 109:9296ab0bfc11 98 PB_12 = 0x01C,
Kojto 109:9296ab0bfc11 99 PB_13 = 0x01D,
Kojto 109:9296ab0bfc11 100 PB_14 = 0x01E,
Kojto 109:9296ab0bfc11 101 PB_15 = 0x01F,
Kojto 109:9296ab0bfc11 102
Kojto 109:9296ab0bfc11 103 PC_0 = 0x020,
Kojto 109:9296ab0bfc11 104 PC_1 = 0x021,
Kojto 109:9296ab0bfc11 105 PC_2 = 0x022,
Kojto 109:9296ab0bfc11 106 PC_3 = 0x023,
Kojto 109:9296ab0bfc11 107 PC_4 = 0x024,
Kojto 109:9296ab0bfc11 108 PC_5 = 0x025,
Kojto 109:9296ab0bfc11 109 PC_6 = 0x026,
Kojto 109:9296ab0bfc11 110 PC_7 = 0x027,
Kojto 109:9296ab0bfc11 111 PC_8 = 0x028,
Kojto 109:9296ab0bfc11 112 PC_9 = 0x029,
Kojto 109:9296ab0bfc11 113
Kojto 109:9296ab0bfc11 114 PC_10 = 0x02A,
Kojto 109:9296ab0bfc11 115 PC_11 = 0x02B,
Kojto 109:9296ab0bfc11 116 PC_12 = 0x02C,
Kojto 109:9296ab0bfc11 117 PC_13 = 0x02D,
Kojto 109:9296ab0bfc11 118 PC_14 = 0x02E,
Kojto 109:9296ab0bfc11 119 PC_15 = 0x02F,
Kojto 109:9296ab0bfc11 120
Kojto 109:9296ab0bfc11 121 PD_0 = 0x030,
Kojto 109:9296ab0bfc11 122 PD_1 = 0x031,
Kojto 109:9296ab0bfc11 123 PD_2 = 0x032,
Kojto 109:9296ab0bfc11 124 PD_3 = 0x033,
Kojto 109:9296ab0bfc11 125 PD_4 = 0x034,
Kojto 109:9296ab0bfc11 126
Kojto 109:9296ab0bfc11 127 PA_00 = PA_0,
Kojto 109:9296ab0bfc11 128 PA_01 = PA_1,
Kojto 109:9296ab0bfc11 129 PA_02 = PA_2,
Kojto 109:9296ab0bfc11 130 PA_03 = PA_3,
Kojto 109:9296ab0bfc11 131 PA_04 = PA_4,
Kojto 109:9296ab0bfc11 132 PA_05 = PA_5,
Kojto 109:9296ab0bfc11 133 PA_06 = PA_6,
Kojto 109:9296ab0bfc11 134 PA_07 = PA_7,
Kojto 109:9296ab0bfc11 135 PA_08 = PA_8,
Kojto 109:9296ab0bfc11 136 PA_09 = PA_9,
Kojto 109:9296ab0bfc11 137
Kojto 109:9296ab0bfc11 138 PB_00 = PB_0,
Kojto 109:9296ab0bfc11 139 PB_01 = PB_1,
Kojto 109:9296ab0bfc11 140 PB_02 = PB_2,
Kojto 109:9296ab0bfc11 141 PB_03 = PB_3,
Kojto 109:9296ab0bfc11 142 PB_04 = PB_4,
Kojto 109:9296ab0bfc11 143 PB_05 = PB_5,
Kojto 109:9296ab0bfc11 144 PB_06 = PB_6,
Kojto 109:9296ab0bfc11 145 PB_07 = PB_7,
Kojto 109:9296ab0bfc11 146 PB_08 = PB_8,
Kojto 109:9296ab0bfc11 147 PB_09 = PB_9,
Kojto 109:9296ab0bfc11 148
Kojto 109:9296ab0bfc11 149 PC_00 = PC_0,
Kojto 109:9296ab0bfc11 150 PC_01 = PC_1,
Kojto 109:9296ab0bfc11 151 PC_02 = PC_2,
Kojto 109:9296ab0bfc11 152 PC_03 = PC_3,
Kojto 109:9296ab0bfc11 153 PC_04 = PC_4,
Kojto 109:9296ab0bfc11 154 PC_05 = PC_5,
Kojto 109:9296ab0bfc11 155 PC_06 = PC_6,
Kojto 109:9296ab0bfc11 156 PC_07 = PC_7,
Kojto 109:9296ab0bfc11 157 PC_08 = PC_8,
Kojto 109:9296ab0bfc11 158 PC_09 = PC_9,
Kojto 109:9296ab0bfc11 159
Kojto 109:9296ab0bfc11 160 PD_00 = PD_0,
Kojto 109:9296ab0bfc11 161 PD_01 = PD_1,
Kojto 109:9296ab0bfc11 162 PD_02 = PD_2,
Kojto 109:9296ab0bfc11 163 PD_03 = PD_3,
Kojto 109:9296ab0bfc11 164 PD_04 = PD_4,
Kojto 109:9296ab0bfc11 165
Kojto 109:9296ab0bfc11 166
Kojto 109:9296ab0bfc11 167 // Generic signals namings
Kojto 109:9296ab0bfc11 168 LED1 = PA_01,
Kojto 109:9296ab0bfc11 169 LED2 = PA_02,
Kojto 109:9296ab0bfc11 170 LED3 = LED1,
Kojto 109:9296ab0bfc11 171 LED4 = LED2,
Kojto 109:9296ab0bfc11 172
Kojto 109:9296ab0bfc11 173 USBTX = PC_10,
Kojto 109:9296ab0bfc11 174 USBRX = PC_11,
Kojto 109:9296ab0bfc11 175
Kojto 109:9296ab0bfc11 176 // For ECO
Kojto 109:9296ab0bfc11 177 P5 = PA_5,
Kojto 109:9296ab0bfc11 178 P6 = PA_6,
Kojto 109:9296ab0bfc11 179 P7 = PA_7,
Kojto 109:9296ab0bfc11 180 P8 = PA_8,
Kojto 109:9296ab0bfc11 181 P9 = PA_9,
Kojto 109:9296ab0bfc11 182 P10 = PA_10,
Kojto 109:9296ab0bfc11 183 P11 = PA_11,
Kojto 109:9296ab0bfc11 184 P12 = PA_12,
Kojto 109:9296ab0bfc11 185 P13 = PA_13,
Kojto 109:9296ab0bfc11 186 P14 = PA_14,
Kojto 109:9296ab0bfc11 187 P15 = PB_0,
Kojto 109:9296ab0bfc11 188 P16 = PB_1,
Kojto 109:9296ab0bfc11 189 P17 = PB_2,
Kojto 109:9296ab0bfc11 190 P18 = PB_3,
Kojto 109:9296ab0bfc11 191 P19 = PC_5,
Kojto 109:9296ab0bfc11 192 P20 = PC_4,
Kojto 109:9296ab0bfc11 193 P21 = PC_0,
Kojto 109:9296ab0bfc11 194 P22 = PC_1,
Kojto 109:9296ab0bfc11 195 P23 = PC_2,
Kojto 109:9296ab0bfc11 196 P24 = PC_3,
Kojto 109:9296ab0bfc11 197 P25 = PC_8,
Kojto 109:9296ab0bfc11 198 P26 = PC_9,
Kojto 109:9296ab0bfc11 199 P27 = PC_12,
Kojto 109:9296ab0bfc11 200 P28 = PC_13,
Kojto 109:9296ab0bfc11 201 P29 = PC_14,
Kojto 109:9296ab0bfc11 202 P30 = PC_15,
Kojto 109:9296ab0bfc11 203 P31 = PC_6,
Kojto 109:9296ab0bfc11 204 P32 = PC_7,
Kojto 109:9296ab0bfc11 205
Kojto 109:9296ab0bfc11 206 //Use SPI1
Kojto 109:9296ab0bfc11 207 SD_SEL = PB_0, // SPI1_CS
Kojto 109:9296ab0bfc11 208 SD_CLK = PB_1, // SPI1_CLK
Kojto 109:9296ab0bfc11 209 SD_MISO = PB_2, // MOSI1
Kojto 109:9296ab0bfc11 210 SD_MOSI = PB_3, // MISO1
Kojto 109:9296ab0bfc11 211
Kojto 109:9296ab0bfc11 212 // Not connected
Kojto 109:9296ab0bfc11 213 NC = (int)0xFFFFFFFF
Kojto 109:9296ab0bfc11 214 } PinName;
Kojto 109:9296ab0bfc11 215
Kojto 109:9296ab0bfc11 216 typedef enum {
Kojto 109:9296ab0bfc11 217 PullNone = 0,
Kojto 109:9296ab0bfc11 218 PullDown = 1,
Kojto 109:9296ab0bfc11 219 PullUp = 2,
Kojto 109:9296ab0bfc11 220 PullDefault = PullNone
Kojto 109:9296ab0bfc11 221 } PinMode;
Kojto 109:9296ab0bfc11 222
Kojto 109:9296ab0bfc11 223
Kojto 109:9296ab0bfc11 224 #ifdef __cplusplus
Kojto 109:9296ab0bfc11 225 }
Kojto 109:9296ab0bfc11 226 #endif
Kojto 109:9296ab0bfc11 227
Kojto 109:9296ab0bfc11 228 #endif