mbed library sources. Supersedes mbed-src. GR-PEACH runs on RAM.

Fork of mbed-dev by mbed official

Committer:
bogdanm
Date:
Thu Oct 01 15:25:22 2015 +0300
Revision:
0:9b334a45a8ff
Initial commit on mbed-dev

Replaces mbed-src (now inactive)

Who changed what in which revision?

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