mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Mon Sep 28 10:45:10 2015 +0100
Revision:
630:825f75ca301e
Synchronized with git revision 54fbe4144faf309c37205a5d39fa665daa919f10

Full URL: https://github.com/mbedmicro/mbed/commit/54fbe4144faf309c37205a5d39fa665daa919f10/

NUCLEO_F031K6 : Add new target

Who changed what in which revision?

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