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