mbed(SerialHalfDuplex入り)

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Mon Apr 28 17:39:05 2014 +0100
Revision:
83:8a40adfe8776
Parent:
82:6473597d706e
Child:
90:cb3d968589d8
Release 83 of the mbed library

Main changes:

- updated tests
- K64F TCP/IP support
- lots of fixes in various targets

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 82:6473597d706e 1 /* mbed Microcontroller Library
bogdanm 82:6473597d706e 2 *******************************************************************************
bogdanm 82:6473597d706e 3 * Copyright (c) 2014, STMicroelectronics
bogdanm 82:6473597d706e 4 * All rights reserved.
bogdanm 82:6473597d706e 5 *
bogdanm 82:6473597d706e 6 * Redistribution and use in source and binary forms, with or without
bogdanm 82:6473597d706e 7 * modification, are permitted provided that the following conditions are met:
bogdanm 82:6473597d706e 8 *
bogdanm 82:6473597d706e 9 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 82:6473597d706e 10 * this list of conditions and the following disclaimer.
bogdanm 82:6473597d706e 11 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 82:6473597d706e 12 * this list of conditions and the following disclaimer in the documentation
bogdanm 82:6473597d706e 13 * and/or other materials provided with the distribution.
bogdanm 82:6473597d706e 14 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 82:6473597d706e 15 * may be used to endorse or promote products derived from this software
bogdanm 82:6473597d706e 16 * without specific prior written permission.
bogdanm 82:6473597d706e 17 *
bogdanm 82:6473597d706e 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 82:6473597d706e 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 82:6473597d706e 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 82:6473597d706e 21 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 82:6473597d706e 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 82:6473597d706e 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 82:6473597d706e 24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 82:6473597d706e 25 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 82:6473597d706e 26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 82:6473597d706e 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 82:6473597d706e 28 *******************************************************************************
bogdanm 82:6473597d706e 29 */
bogdanm 82:6473597d706e 30 #ifndef MBED_PINNAMES_H
bogdanm 82:6473597d706e 31 #define MBED_PINNAMES_H
bogdanm 82:6473597d706e 32
bogdanm 82:6473597d706e 33 #include "cmsis.h"
bogdanm 82:6473597d706e 34
bogdanm 82:6473597d706e 35 #ifdef __cplusplus
bogdanm 82:6473597d706e 36 extern "C" {
bogdanm 82:6473597d706e 37 #endif
bogdanm 82:6473597d706e 38
bogdanm 82:6473597d706e 39 // MODE (see GPIOMode_TypeDef structure)
bogdanm 82:6473597d706e 40 // OTYPE (see GPIOOType_TypeDef structure)
bogdanm 82:6473597d706e 41 // PUPD (see GPIOPuPd_TypeDef structure)
bogdanm 82:6473597d706e 42 // AFNUM (see AF_mapping constant table, 0xFF is not used)
bogdanm 82:6473597d706e 43 #define STM_PIN_DATA(MODE, OTYPE, PUPD, AFNUM) (((AFNUM)<<8)|((PUPD)<<4)|((OTYPE)<<2)|((MODE)<<0))
bogdanm 82:6473597d706e 44 #define STM_PIN_MODE(X) (((X)>>0) & 0x3)
bogdanm 82:6473597d706e 45 #define STM_PIN_OTYPE(X) (((X)>>2) & 0x1)
bogdanm 82:6473597d706e 46 #define STM_PIN_PUPD(X) (((X)>>4) & 0x3)
bogdanm 82:6473597d706e 47 #define STM_PIN_AFNUM(X) (((X)>>8) & 0xF)
bogdanm 82:6473597d706e 48
bogdanm 82:6473597d706e 49 // High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H)
bogdanm 82:6473597d706e 50 // Low nibble = pin number
bogdanm 82:6473597d706e 51 #define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF)
bogdanm 82:6473597d706e 52 #define STM_PIN(X) ((uint32_t)(X) & 0xF)
bogdanm 82:6473597d706e 53
bogdanm 82:6473597d706e 54 typedef enum {
bogdanm 82:6473597d706e 55 PIN_INPUT,
bogdanm 82:6473597d706e 56 PIN_OUTPUT
bogdanm 82:6473597d706e 57 } PinDirection;
bogdanm 82:6473597d706e 58
bogdanm 82:6473597d706e 59 typedef enum {
bogdanm 82:6473597d706e 60 PA_0 = 0x00,
bogdanm 82:6473597d706e 61 PA_1 = 0x01,
bogdanm 82:6473597d706e 62 PA_2 = 0x02,
bogdanm 82:6473597d706e 63 PA_3 = 0x03,
bogdanm 82:6473597d706e 64 PA_4 = 0x04,
bogdanm 82:6473597d706e 65 PA_5 = 0x05,
bogdanm 82:6473597d706e 66 PA_6 = 0x06,
bogdanm 82:6473597d706e 67 PA_7 = 0x07,
bogdanm 82:6473597d706e 68 PA_8 = 0x08,
bogdanm 82:6473597d706e 69 PA_9 = 0x09,
bogdanm 82:6473597d706e 70 PA_10 = 0x0A,
bogdanm 82:6473597d706e 71 PA_11 = 0x0B,
bogdanm 82:6473597d706e 72 PA_12 = 0x0C,
bogdanm 82:6473597d706e 73 PA_13 = 0x0D,
bogdanm 82:6473597d706e 74 PA_14 = 0x0E,
bogdanm 82:6473597d706e 75 PA_15 = 0x0F,
bogdanm 82:6473597d706e 76
bogdanm 82:6473597d706e 77 PB_0 = 0x10,
bogdanm 82:6473597d706e 78 PB_1 = 0x11,
bogdanm 82:6473597d706e 79 PB_2 = 0x12,
bogdanm 82:6473597d706e 80 PB_3 = 0x13,
bogdanm 82:6473597d706e 81 PB_4 = 0x14,
bogdanm 82:6473597d706e 82 PB_5 = 0x15,
bogdanm 82:6473597d706e 83 PB_6 = 0x16,
bogdanm 82:6473597d706e 84 PB_7 = 0x17,
bogdanm 82:6473597d706e 85 PB_8 = 0x18,
bogdanm 82:6473597d706e 86 PB_9 = 0x19,
bogdanm 82:6473597d706e 87 PB_10 = 0x1A,
bogdanm 82:6473597d706e 88 PB_11 = 0x1B,
bogdanm 82:6473597d706e 89 PB_12 = 0x1C,
bogdanm 82:6473597d706e 90 PB_13 = 0x1D,
bogdanm 82:6473597d706e 91 PB_14 = 0x1E,
bogdanm 82:6473597d706e 92 PB_15 = 0x1F,
bogdanm 82:6473597d706e 93
bogdanm 82:6473597d706e 94 PC_0 = 0x20,
bogdanm 82:6473597d706e 95 PC_1 = 0x21,
bogdanm 82:6473597d706e 96 PC_2 = 0x22,
bogdanm 82:6473597d706e 97 PC_3 = 0x23,
bogdanm 82:6473597d706e 98 PC_4 = 0x24,
bogdanm 82:6473597d706e 99 PC_5 = 0x25,
bogdanm 82:6473597d706e 100 PC_6 = 0x26,
bogdanm 82:6473597d706e 101 PC_7 = 0x27,
bogdanm 82:6473597d706e 102 PC_8 = 0x28,
bogdanm 82:6473597d706e 103 PC_9 = 0x29,
bogdanm 82:6473597d706e 104 PC_10 = 0x2A,
bogdanm 82:6473597d706e 105 PC_11 = 0x2B,
bogdanm 82:6473597d706e 106 PC_12 = 0x2C,
bogdanm 82:6473597d706e 107 PC_13 = 0x2D,
bogdanm 82:6473597d706e 108 PC_14 = 0x2E,
bogdanm 82:6473597d706e 109 PC_15 = 0x2F,
bogdanm 82:6473597d706e 110
bogdanm 82:6473597d706e 111 PD_2 = 0x32,
bogdanm 82:6473597d706e 112
bogdanm 82:6473597d706e 113 PF_0 = 0x50,
bogdanm 82:6473597d706e 114 PF_1 = 0x51,
bogdanm 82:6473597d706e 115 PF_4 = 0x54,
bogdanm 82:6473597d706e 116 PF_5 = 0x55,
bogdanm 82:6473597d706e 117 PF_6 = 0x56,
bogdanm 82:6473597d706e 118 PF_7 = 0x57,
bogdanm 82:6473597d706e 119
bogdanm 82:6473597d706e 120
bogdanm 82:6473597d706e 121 // Arduino connector namings
bogdanm 82:6473597d706e 122 A0 = PA_0,
bogdanm 82:6473597d706e 123 A1 = PA_1,
bogdanm 82:6473597d706e 124 A2 = PA_4,
bogdanm 82:6473597d706e 125 A3 = PB_0,
bogdanm 82:6473597d706e 126 A4 = PC_1,
bogdanm 82:6473597d706e 127 A5 = PC_0,
bogdanm 82:6473597d706e 128 D0 = PA_3,
bogdanm 82:6473597d706e 129 D1 = PA_2,
bogdanm 82:6473597d706e 130 D2 = PA_10,
bogdanm 82:6473597d706e 131 D3 = PB_3,
bogdanm 82:6473597d706e 132 D4 = PB_5,
bogdanm 82:6473597d706e 133 D5 = PB_4,
bogdanm 82:6473597d706e 134 D6 = PB_10,
bogdanm 82:6473597d706e 135 D7 = PA_8,
bogdanm 82:6473597d706e 136 D8 = PA_9,
bogdanm 82:6473597d706e 137 D9 = PC_7,
bogdanm 82:6473597d706e 138 D10 = PB_6,
bogdanm 82:6473597d706e 139 D11 = PA_7,
bogdanm 82:6473597d706e 140 D12 = PA_6,
bogdanm 82:6473597d706e 141 D13 = PA_5,
bogdanm 82:6473597d706e 142 D14 = PB_9,
bogdanm 82:6473597d706e 143 D15 = PB_8,
bogdanm 82:6473597d706e 144
bogdanm 82:6473597d706e 145 // Generic signals namings
bogdanm 82:6473597d706e 146 LED1 = PA_5,
bogdanm 82:6473597d706e 147 LED2 = PA_5,
bogdanm 82:6473597d706e 148 LED3 = PA_5,
bogdanm 82:6473597d706e 149 LED4 = PA_5,
bogdanm 82:6473597d706e 150 USER_BUTTON = PC_13,
bogdanm 82:6473597d706e 151 SERIAL_TX = PA_2,
bogdanm 82:6473597d706e 152 SERIAL_RX = PA_3,
bogdanm 82:6473597d706e 153 USBTX = PA_2,
bogdanm 82:6473597d706e 154 USBRX = PA_3,
bogdanm 82:6473597d706e 155 I2C_SCL = PB_8,
bogdanm 82:6473597d706e 156 I2C_SDA = PB_9,
bogdanm 82:6473597d706e 157 SPI_MOSI = PA_7,
bogdanm 82:6473597d706e 158 SPI_MISO = PA_6,
bogdanm 82:6473597d706e 159 SPI_SCK = PA_5,
bogdanm 82:6473597d706e 160 SPI_CS = PB_6,
bogdanm 83:8a40adfe8776 161 PWM_OUT = PC_7,
bogdanm 82:6473597d706e 162
bogdanm 82:6473597d706e 163 // Not connected
bogdanm 82:6473597d706e 164 NC = (int)0xFFFFFFFF
bogdanm 82:6473597d706e 165 } PinName;
bogdanm 82:6473597d706e 166
bogdanm 82:6473597d706e 167 typedef enum {
bogdanm 82:6473597d706e 168 PullNone = 0,
bogdanm 82:6473597d706e 169 PullUp = 1,
bogdanm 82:6473597d706e 170 PullDown = 2,
bogdanm 82:6473597d706e 171 OpenDrain = 3,
bogdanm 82:6473597d706e 172 PullDefault = PullNone
bogdanm 82:6473597d706e 173 } PinMode;
bogdanm 82:6473597d706e 174
bogdanm 82:6473597d706e 175 #ifdef __cplusplus
bogdanm 82:6473597d706e 176 }
bogdanm 82:6473597d706e 177 #endif
bogdanm 82:6473597d706e 178
bogdanm 82:6473597d706e 179 #endif