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