Soundharrajan

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Wed Jun 11 15:14:05 2014 +0100
Revision:
85:024bf7f99721
Child:
90:cb3d968589d8
Release 85 of the mbed library

Main changes:

- K64F Ethernet fixes
- Updated tests
- Fixes for various mbed targets
- Code cleanup: fixed warnings, more consistent code style
- GCC support for K64F

There is a known issue with the I2C interface on some ST targets. If you
find the I2C interface problematic on your ST board, please log a bug
against this on mbed.org.

Who changed what in which revision?

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