mbed library

Dependents:   Printf

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Mon May 19 18:14:09 2014 +0100
Revision:
84:0b3ab51c8877
Parent:
82:6473597d706e
Child:
96:487b796308b0
Release 84 of the mbed library

Main changes:

- added LPC11U68 to the official build
- Bug fixes and new features for ST Nucleo boards
- I2C fixes for Freescale targets
- Added nRF51822 exporters

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 // AFNUM (see AF_mapping constant table)
bogdanm 82:6473597d706e 41 #define STM_PIN_DATA(MODE, AFNUM) (((MODE) << 8) | (AFNUM))
bogdanm 82:6473597d706e 42 #define STM_PIN_MODE(X) ((X) >> 8)
bogdanm 82:6473597d706e 43 #define STM_PIN_AFNUM(X) ((X) & 0xFF)
bogdanm 82:6473597d706e 44
bogdanm 82:6473597d706e 45 // High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H)
bogdanm 82:6473597d706e 46 // Low nibble = pin number
bogdanm 82:6473597d706e 47 #define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF)
bogdanm 82:6473597d706e 48 #define STM_PIN(X) ((uint32_t)(X) & 0xF)
bogdanm 82:6473597d706e 49
bogdanm 82:6473597d706e 50 typedef enum {
bogdanm 82:6473597d706e 51 PIN_INPUT,
bogdanm 82:6473597d706e 52 PIN_OUTPUT
bogdanm 82:6473597d706e 53 } PinDirection;
bogdanm 82:6473597d706e 54
bogdanm 82:6473597d706e 55 typedef enum {
bogdanm 82:6473597d706e 56 PA_0 = 0x00,
bogdanm 82:6473597d706e 57 PA_1 = 0x01,
bogdanm 82:6473597d706e 58 PA_2 = 0x02,
bogdanm 82:6473597d706e 59 PA_3 = 0x03,
bogdanm 82:6473597d706e 60 PA_4 = 0x04,
bogdanm 82:6473597d706e 61 PA_5 = 0x05,
bogdanm 82:6473597d706e 62 PA_6 = 0x06,
bogdanm 82:6473597d706e 63 PA_7 = 0x07,
bogdanm 82:6473597d706e 64 PA_8 = 0x08,
bogdanm 82:6473597d706e 65 PA_9 = 0x09,
bogdanm 82:6473597d706e 66 PA_10 = 0x0A,
bogdanm 82:6473597d706e 67 PA_11 = 0x0B,
bogdanm 82:6473597d706e 68 PA_12 = 0x0C,
bogdanm 82:6473597d706e 69 PA_13 = 0x0D,
bogdanm 82:6473597d706e 70 PA_14 = 0x0E,
bogdanm 82:6473597d706e 71 PA_15 = 0x0F,
bogdanm 82:6473597d706e 72
bogdanm 82:6473597d706e 73 PB_0 = 0x10,
bogdanm 82:6473597d706e 74 PB_1 = 0x11,
bogdanm 82:6473597d706e 75 PB_2 = 0x12,
bogdanm 82:6473597d706e 76 PB_3 = 0x13,
bogdanm 82:6473597d706e 77 PB_4 = 0x14,
bogdanm 82:6473597d706e 78 PB_5 = 0x15,
bogdanm 82:6473597d706e 79 PB_6 = 0x16,
bogdanm 82:6473597d706e 80 PB_7 = 0x17,
bogdanm 82:6473597d706e 81 PB_8 = 0x18,
bogdanm 82:6473597d706e 82 PB_9 = 0x19,
bogdanm 82:6473597d706e 83 PB_10 = 0x1A,
bogdanm 82:6473597d706e 84 PB_11 = 0x1B,
bogdanm 82:6473597d706e 85 PB_12 = 0x1C,
bogdanm 82:6473597d706e 86 PB_13 = 0x1D,
bogdanm 82:6473597d706e 87 PB_14 = 0x1E,
bogdanm 82:6473597d706e 88 PB_15 = 0x1F,
bogdanm 82:6473597d706e 89
bogdanm 82:6473597d706e 90 PC_0 = 0x20,
bogdanm 82:6473597d706e 91 PC_1 = 0x21,
bogdanm 82:6473597d706e 92 PC_2 = 0x22,
bogdanm 82:6473597d706e 93 PC_3 = 0x23,
bogdanm 82:6473597d706e 94 PC_4 = 0x24,
bogdanm 82:6473597d706e 95 PC_5 = 0x25,
bogdanm 82:6473597d706e 96 PC_6 = 0x26,
bogdanm 82:6473597d706e 97 PC_7 = 0x27,
bogdanm 82:6473597d706e 98 PC_8 = 0x28,
bogdanm 82:6473597d706e 99 PC_9 = 0x29,
bogdanm 82:6473597d706e 100 PC_10 = 0x2A,
bogdanm 82:6473597d706e 101 PC_11 = 0x2B,
bogdanm 82:6473597d706e 102 PC_12 = 0x2C,
bogdanm 82:6473597d706e 103 PC_13 = 0x2D,
bogdanm 82:6473597d706e 104 PC_14 = 0x2E,
bogdanm 82:6473597d706e 105 PC_15 = 0x2F,
bogdanm 82:6473597d706e 106
bogdanm 82:6473597d706e 107 PD_2 = 0x32,
bogdanm 82:6473597d706e 108
bogdanm 82:6473597d706e 109 // Arduino connector namings
bogdanm 82:6473597d706e 110 A0 = PA_0,
bogdanm 82:6473597d706e 111 A1 = PA_1,
bogdanm 82:6473597d706e 112 A2 = PA_4,
bogdanm 82:6473597d706e 113 A3 = PB_0,
bogdanm 82:6473597d706e 114 A4 = PC_1,
bogdanm 82:6473597d706e 115 A5 = PC_0,
bogdanm 82:6473597d706e 116 D0 = PA_3,
bogdanm 82:6473597d706e 117 D1 = PA_2,
bogdanm 82:6473597d706e 118 D2 = PA_10,
bogdanm 82:6473597d706e 119 D3 = PB_3,
bogdanm 82:6473597d706e 120 D4 = PB_5,
bogdanm 82:6473597d706e 121 D5 = PB_4,
bogdanm 82:6473597d706e 122 D6 = PB_10,
bogdanm 82:6473597d706e 123 D7 = PA_8,
bogdanm 82:6473597d706e 124 D8 = PA_9,
bogdanm 82:6473597d706e 125 D9 = PC_7,
bogdanm 82:6473597d706e 126 D10 = PB_6,
bogdanm 82:6473597d706e 127 D11 = PA_7,
bogdanm 82:6473597d706e 128 D12 = PA_6,
bogdanm 82:6473597d706e 129 D13 = PA_5,
bogdanm 82:6473597d706e 130 D14 = PB_9,
bogdanm 82:6473597d706e 131 D15 = PB_8,
bogdanm 82:6473597d706e 132
bogdanm 82:6473597d706e 133 // Generic signals namings
bogdanm 82:6473597d706e 134 LED1 = PA_5,
bogdanm 82:6473597d706e 135 LED2 = PA_5,
bogdanm 82:6473597d706e 136 LED3 = PA_5,
bogdanm 82:6473597d706e 137 LED4 = PA_5,
bogdanm 82:6473597d706e 138 USER_BUTTON = PC_13,
bogdanm 82:6473597d706e 139 SERIAL_TX = PA_2,
bogdanm 82:6473597d706e 140 SERIAL_RX = PA_3,
bogdanm 82:6473597d706e 141 USBTX = PA_2,
bogdanm 82:6473597d706e 142 USBRX = PA_3,
bogdanm 82:6473597d706e 143 I2C_SCL = PB_8,
bogdanm 82:6473597d706e 144 I2C_SDA = PB_9,
bogdanm 82:6473597d706e 145 SPI_MOSI = PA_7,
bogdanm 82:6473597d706e 146 SPI_MISO = PA_6,
bogdanm 82:6473597d706e 147 SPI_SCK = PA_5,
bogdanm 82:6473597d706e 148 SPI_CS = PB_6,
bogdanm 82:6473597d706e 149 PWM_OUT = PB_3,
bogdanm 82:6473597d706e 150
bogdanm 82:6473597d706e 151 // Not connected
bogdanm 82:6473597d706e 152 NC = (int)0xFFFFFFFF
bogdanm 82:6473597d706e 153 } PinName;
bogdanm 82:6473597d706e 154
bogdanm 82:6473597d706e 155 typedef enum {
bogdanm 82:6473597d706e 156 PullNone = 0,
bogdanm 82:6473597d706e 157 PullUp = 1,
bogdanm 82:6473597d706e 158 PullDown = 2,
bogdanm 82:6473597d706e 159 OpenDrain = 3,
bogdanm 82:6473597d706e 160 PullDefault = PullNone
bogdanm 82:6473597d706e 161 } PinMode;
bogdanm 82:6473597d706e 162
bogdanm 82:6473597d706e 163 #ifdef __cplusplus
bogdanm 82:6473597d706e 164 }
bogdanm 82:6473597d706e 165 #endif
bogdanm 82:6473597d706e 166
bogdanm 82:6473597d706e 167 #endif