mbed library sources

Dependents:   FRDM-KL46Z_LCD_Test FRDM-KL46Z_LCD_Test FRDM-KL46Z_Plantilla FRDM-KL46Z_Plantilla ... more

Committer:
ebrus
Date:
Thu Jul 28 15:56:34 2016 +0000
Revision:
0:6bc4ac881c8e
1;

Who changed what in which revision?

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