diff --git a/targets/TARGET_STM/PinNamesTypes.h b/targets/TARGET_STM/PinNamesTypes.h new file mode 100644 index 0000000000..b7033a4245 --- /dev/null +++ b/targets/TARGET_STM/PinNamesTypes.h @@ -0,0 +1,93 @@ +/* mbed Microcontroller Library + ******************************************************************************* + * Copyright (c) 2016, STMicroelectronics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************* + */ +#ifndef MBED_PINNAMESTYPES_H +#define MBED_PINNAMESTYPES_H + +#include "cmsis.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ + ((PUPD & 0x07) << 4) |\ + ((AFNUM & 0x0F) << 7))) + +#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ + ((PUPD & 0x07) << 4) |\ + ((AFNUM & 0x0F) << 7) |\ + ((CHANNEL & 0x1F) << 11) |\ + ((INVERTED & 0x01) << 16))) + +#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) +#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) +#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) +#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) +#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) + +#define STM_MODE_INPUT (0) +#define STM_MODE_OUTPUT_PP (1) +#define STM_MODE_OUTPUT_OD (2) +#define STM_MODE_AF_PP (3) +#define STM_MODE_AF_OD (4) +#define STM_MODE_ANALOG (5) +#define STM_MODE_IT_RISING (6) +#define STM_MODE_IT_FALLING (7) +#define STM_MODE_IT_RISING_FALLING (8) +#define STM_MODE_EVT_RISING (9) +#define STM_MODE_EVT_FALLING (10) +#define STM_MODE_EVT_RISING_FALLING (11) +#define STM_MODE_IT_EVT_RESET (12) +// The last mode is only valid for specific families, so we put it in the end +#define STM_MODE_ANALOG_ADC_CONTROL (13) + +// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) +// Low nibble = pin number +#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) +#define STM_PIN(X) ((uint32_t)(X) & 0xF) + +typedef enum { + PIN_INPUT, + PIN_OUTPUT +} PinDirection; + +typedef enum { + PullNone = 0, + PullUp = 1, + PullDown = 2, + OpenDrain = 3, + PullDefault = PullNone +} PinMode; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/targets/TARGET_STM/TARGET_STM32F0/TARGET_DISCO_F051R8/PinNames.h b/targets/TARGET_STM/TARGET_STM32F0/TARGET_DISCO_F051R8/PinNames.h index eb2b381fde..1a9ae9dea4 100644 --- a/targets/TARGET_STM/TARGET_STM32F0/TARGET_DISCO_F051R8/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F0/TARGET_DISCO_F051R8/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -241,14 +202,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F030R8/PinNames.h b/targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F030R8/PinNames.h index 466e2de329..da752d856f 100644 --- a/targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F030R8/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F030R8/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -188,14 +149,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F031K6/PinNames.h b/targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F031K6/PinNames.h index 62ef13ac95..a5f7d1c6d3 100644 --- a/targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F031K6/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F031K6/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -157,14 +118,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F042K6/PinNames.h b/targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F042K6/PinNames.h index 1974719cc0..5799be2563 100644 --- a/targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F042K6/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F042K6/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -156,14 +117,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F070RB/PinNames.h b/targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F070RB/PinNames.h index f982294aa0..5ae174aca2 100644 --- a/targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F070RB/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F070RB/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -184,14 +145,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F072RB/PinNames.h b/targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F072RB/PinNames.h index f982294aa0..5ae174aca2 100644 --- a/targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F072RB/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F072RB/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -184,14 +145,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F091RC/PinNames.h b/targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F091RC/PinNames.h index f50d0c1eca..c33e9d2a14 100644 --- a/targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F091RC/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F091RC/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -185,14 +146,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F1/TARGET_BLUEPILL_F103C8/PinNames.h b/targets/TARGET_STM/TARGET_STM32F1/TARGET_BLUEPILL_F103C8/PinNames.h index a4253c997f..93ef0bdb37 100644 --- a/targets/TARGET_STM/TARGET_STM32F1/TARGET_BLUEPILL_F103C8/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F1/TARGET_BLUEPILL_F103C8/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -192,14 +153,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F1/TARGET_DISCO_F100RB/PinNames.h b/targets/TARGET_STM/TARGET_STM32F1/TARGET_DISCO_F100RB/PinNames.h index 5cdac4ee4a..c8624a880c 100644 --- a/targets/TARGET_STM/TARGET_STM32F1/TARGET_DISCO_F100RB/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F1/TARGET_DISCO_F100RB/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -203,14 +164,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F1/TARGET_NUCLEO_F103RB/PinNames.h b/targets/TARGET_STM/TARGET_STM32F1/TARGET_NUCLEO_F103RB/PinNames.h index cbfd8f673d..2576abd66d 100644 --- a/targets/TARGET_STM/TARGET_STM32F1/TARGET_NUCLEO_F103RB/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F1/TARGET_NUCLEO_F103RB/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -180,14 +141,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F2/TARGET_NUCLEO_F207ZG/PinNames.h b/targets/TARGET_STM/TARGET_STM32F2/TARGET_NUCLEO_F207ZG/PinNames.h index 42df98d88f..31ed9919f9 100644 --- a/targets/TARGET_STM/TARGET_STM32F2/TARGET_NUCLEO_F207ZG/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F2/TARGET_NUCLEO_F207ZG/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -254,14 +215,6 @@ typedef enum { #define STDIO_UART_RX SERIAL_RX #define STDIO_UART UART_3 -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F3/TARGET_DISCO_F303VC/PinNames.h b/targets/TARGET_STM/TARGET_STM32F3/TARGET_DISCO_F303VC/PinNames.h index 4edd427773..006d53492c 100644 --- a/targets/TARGET_STM/TARGET_STM32F3/TARGET_DISCO_F303VC/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F3/TARGET_DISCO_F303VC/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -244,14 +205,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F3/TARGET_DISCO_F334C8/PinNames.h b/targets/TARGET_STM/TARGET_STM32F3/TARGET_DISCO_F334C8/PinNames.h index b81b799215..673292d7c6 100644 --- a/targets/TARGET_STM/TARGET_STM32F3/TARGET_DISCO_F334C8/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F3/TARGET_DISCO_F334C8/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -174,14 +135,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F302R8/PinNames.h b/targets/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F302R8/PinNames.h index 832239d175..e82e9d4c16 100644 --- a/targets/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F302R8/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F302R8/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -184,14 +145,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303K8/PinNames.h b/targets/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303K8/PinNames.h index 9cd4e69814..2251f447f6 100644 --- a/targets/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303K8/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303K8/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -159,14 +120,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303RE/PinNames.h b/targets/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303RE/PinNames.h index f850b940fb..8eb572291a 100644 --- a/targets/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303RE/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303RE/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -192,14 +153,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303ZE/PinNames.h b/targets/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303ZE/PinNames.h index 994b4c6ebd..c4aab2e9cc 100644 --- a/targets/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303ZE/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303ZE/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -259,14 +220,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F334R8/PinNames.h b/targets/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F334R8/PinNames.h index 9f59bcf860..f67d08ec9f 100644 --- a/targets/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F334R8/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F334R8/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -187,14 +148,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_ARCH_MAX/PinNames.h b/targets/TARGET_STM/TARGET_STM32F4/TARGET_ARCH_MAX/PinNames.h index bd77a3968c..0b4d432f6c 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_ARCH_MAX/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_ARCH_MAX/PinNames.h @@ -31,43 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -// See stm32f4xx_hal_gpio.h and stm32f4xx_hal_gpio_ex.h for values of MODE, PUPD and AFNUM -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((INVERTED & 0x01) << 16) | ((CHANNEL & 0x1F) << 11) | ((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -275,14 +244,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_B96B_F446VE/PinNames.h b/targets/TARGET_STM/TARGET_STM32F4/TARGET_B96B_F446VE/PinNames.h index 5162e53409..0dc11e6a25 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_B96B_F446VE/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_B96B_F446VE/PinNames.h @@ -31,43 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -// See stm32f4xx_hal_gpio.h and stm32f4xx_hal_gpio_ex.h for values of MODE, PUPD and AFNUM -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((INVERTED & 0x01) << 16) | ((CHANNEL & 0x1F) << 11) | ((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -208,14 +177,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F401VC/PinNames.h b/targets/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F401VC/PinNames.h index bb2956a0a3..ed0b6786d6 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F401VC/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F401VC/PinNames.h @@ -31,43 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -// See stm32f4xx_hal_gpio.h and stm32f4xx_hal_gpio_ex.h for values of MODE, PUPD and AFNUM -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((INVERTED & 0x01) << 16) | ((CHANNEL & 0x1F) << 11) | ((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -167,14 +136,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F407VG/PinNames.h b/targets/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F407VG/PinNames.h index 1fa7322b78..eadabe008d 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F407VG/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F407VG/PinNames.h @@ -31,43 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -// See stm32f4xx_hal_gpio.h and stm32f4xx_hal_gpio_ex.h for values of MODE, PUPD and AFNUM -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((INVERTED & 0x01) << 16) | ((CHANNEL & 0x1F) << 11) | ((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -252,14 +221,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F429ZI/PinNames.h b/targets/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F429ZI/PinNames.h index e790e62c29..a63a20d105 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F429ZI/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F429ZI/PinNames.h @@ -31,43 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -// See stm32f4xx_hal_gpio.h and stm32f4xx_hal_gpio_ex.h for values of MODE, PUPD and AFNUM -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((INVERTED & 0x01) << 16) | ((CHANNEL & 0x1F) << 11) | ((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -216,14 +185,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/PinNames.h b/targets/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/PinNames.h index c238cc38f6..ed8ad27b01 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/PinNames.h @@ -31,43 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -// See stm32f4xx_hal_gpio.h and stm32f4xx_hal_gpio_ex.h for values of MODE, PUPD and AFNUM -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((INVERTED & 0x01) << 16) | ((CHANNEL & 0x1F) << 11) | ((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -293,14 +262,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_ELMO_F411RE/PinNames.h b/targets/TARGET_STM/TARGET_STM32F4/TARGET_ELMO_F411RE/PinNames.h index fa4ab57468..be2de24b4e 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_ELMO_F411RE/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_ELMO_F411RE/PinNames.h @@ -31,43 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -// See stm32f4xx_hal_gpio.h and stm32f4xx_hal_gpio_ex.h for values of MODE, PUPD and AFNUM -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((INVERTED & 0x01) << 16) | ((CHANNEL & 0x1F) << 11) | ((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -186,14 +155,6 @@ typedef enum { RF_RXTX_SW = PC_13 } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_F429_F439/PinNames.h b/targets/TARGET_STM/TARGET_STM32F4/TARGET_F429_F439/PinNames.h index ad4ac56e5d..302c59e62a 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_F429_F439/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_F429_F439/PinNames.h @@ -31,43 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -// See stm32f4xx_hal_gpio.h and stm32f4xx_hal_gpio_ex.h for values of MODE, PUPD and AFNUM -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((INVERTED & 0x01) << 16) | ((CHANNEL & 0x1F) << 11) | ((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H, 8=I, 9=J, A=K) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -243,14 +212,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/PinNames.h b/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/PinNames.h index d5e693570d..21c82161b1 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/PinNames.h @@ -31,43 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -// See stm32f4xx_hal_gpio.h and stm32f4xx_hal_gpio_ex.h for values of MODE, PUPD and AFNUM -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((INVERTED & 0x01) << 16) | ((CHANNEL & 0x1F) << 11) | ((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -212,14 +181,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F405RG/PinNames.h b/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F405RG/PinNames.h index 831103cc0e..b55c7d4bff 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F405RG/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F405RG/PinNames.h @@ -31,43 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -// See stm32f4xx_hal_gpio.h and stm32f4xx_hal_gpio_ex.h for values of MODE, PUPD and AFNUM -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((INVERTED & 0x01) << 16) | ((CHANNEL & 0x1F) << 11) | ((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -150,14 +119,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F411RE/PinNames.h b/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F411RE/PinNames.h index 1474103f89..61a6f94c16 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F411RE/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F411RE/PinNames.h @@ -31,43 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -// See stm32f4xx_hal_gpio.h and stm32f4xx_hal_gpio_ex.h for values of MODE, PUPD and AFNUM -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((INVERTED & 0x01) << 16) | ((CHANNEL & 0x1F) << 11) | ((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -259,14 +228,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F401RE/PinNames.h b/targets/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F401RE/PinNames.h index f663e7e0b7..e590f38f4b 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F401RE/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F401RE/PinNames.h @@ -31,43 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -// See stm32f4xx_hal_gpio.h and stm32f4xx_hal_gpio_ex.h for values of MODE, PUPD and AFNUM -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((INVERTED & 0x01) << 16) | ((CHANNEL & 0x1F) << 11) | ((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -176,14 +145,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F410RB/PinNames.h b/targets/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F410RB/PinNames.h index 19b179f8a5..39ff33b727 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F410RB/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F410RB/PinNames.h @@ -31,43 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -// See stm32f4xx_hal_gpio.h and stm32f4xx_hal_gpio_ex.h for values of MODE, PUPD and AFNUM -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((INVERTED & 0x01) << 16) | ((CHANNEL & 0x1F) << 11) | ((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -176,14 +145,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F411RE/PinNames.h b/targets/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F411RE/PinNames.h index f663e7e0b7..e590f38f4b 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F411RE/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F411RE/PinNames.h @@ -31,43 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -// See stm32f4xx_hal_gpio.h and stm32f4xx_hal_gpio_ex.h for values of MODE, PUPD and AFNUM -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((INVERTED & 0x01) << 16) | ((CHANNEL & 0x1F) << 11) | ((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -176,14 +145,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F412ZG/PinNames.h b/targets/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F412ZG/PinNames.h index 32e9af12bf..be56a9d8ac 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F412ZG/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F412ZG/PinNames.h @@ -17,51 +17,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -237,14 +198,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F446RE/PinNames.h b/targets/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F446RE/PinNames.h index f663e7e0b7..e590f38f4b 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F446RE/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F446RE/PinNames.h @@ -31,43 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -// See stm32f4xx_hal_gpio.h and stm32f4xx_hal_gpio_ex.h for values of MODE, PUPD and AFNUM -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((INVERTED & 0x01) << 16) | ((CHANNEL & 0x1F) << 11) | ((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -176,14 +145,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F446ZE/PinNames.h b/targets/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F446ZE/PinNames.h index 5933ae2fce..894669cae8 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F446ZE/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F446ZE/PinNames.h @@ -31,43 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -// See stm32f4xx_hal_gpio.h and stm32f4xx_hal_gpio_ex.h for values of MODE, PUPD and AFNUM -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((INVERTED & 0x01) << 16) | ((CHANNEL & 0x1F) << 11) | ((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -244,14 +213,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_EVK_ODIN_W2/PinNames.h b/targets/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_EVK_ODIN_W2/PinNames.h index c16f3db3d0..bef4204400 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_EVK_ODIN_W2/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_EVK_ODIN_W2/PinNames.h @@ -31,43 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -// See stm32f4xx_hal_gpio.h and stm32f4xx_hal_gpio_ex.h for values of MODE, PUPD and AFNUM -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((AFNUM) << 7) | ((PUPD) << 4) | ((MODE) << 0))) -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((INVERTED & 0x01) << 15) | ((CHANNEL & 0x0F) << 11) | ((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0))) -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x0F) -#define STM_PIN_INVERTED(X) (((X) >> 15) & 0x01) -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, PA_2 = 0x02, PA_3 = 0x03, PA_4 = 0x04, PA_5 = 0x05, PA_6 = 0x06, PA_7 = 0x07, @@ -198,14 +167,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F7/TARGET_DISCO_F746NG/PinNames.h b/targets/TARGET_STM/TARGET_STM32F7/TARGET_DISCO_F746NG/PinNames.h index acdd740c6e..7bcd0a2958 100644 --- a/targets/TARGET_STM/TARGET_STM32F7/TARGET_DISCO_F746NG/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F7/TARGET_DISCO_F746NG/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H, 8=I, 9=J, A=K) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -307,14 +268,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F7/TARGET_DISCO_F769NI/PinNames.h b/targets/TARGET_STM/TARGET_STM32F7/TARGET_DISCO_F769NI/PinNames.h index 995d26f90e..aa3d0bb0c3 100644 --- a/targets/TARGET_STM/TARGET_STM32F7/TARGET_DISCO_F769NI/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F7/TARGET_DISCO_F769NI/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H, 8=I, 9=J, A=K) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -307,14 +268,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F7/TARGET_F746_F756/PinNames.h b/targets/TARGET_STM/TARGET_STM32F7/TARGET_F746_F756/PinNames.h index e2e4006d9a..d9078bfb88 100644 --- a/targets/TARGET_STM/TARGET_STM32F7/TARGET_F746_F756/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F7/TARGET_F746_F756/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H, 8=I, 9=J, A=K) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -250,14 +211,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/PinNames.h b/targets/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/PinNames.h index e2e4006d9a..d9078bfb88 100644 --- a/targets/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H, 8=I, 9=J, A=K) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -250,14 +211,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32L0/TARGET_DISCO_L053C8/PinNames.h b/targets/TARGET_STM/TARGET_STM32L0/TARGET_DISCO_L053C8/PinNames.h index f340caa378..0713c2c719 100644 --- a/targets/TARGET_STM/TARGET_STM32L0/TARGET_DISCO_L053C8/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32L0/TARGET_DISCO_L053C8/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -171,14 +132,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L011K4/PinNames.h b/targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L011K4/PinNames.h index a92735ecc5..adcd8901a8 100644 --- a/targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L011K4/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L011K4/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -155,14 +116,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L031K6/PinNames.h b/targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L031K6/PinNames.h index a92735ecc5..adcd8901a8 100644 --- a/targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L031K6/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L031K6/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -155,14 +116,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L053R8/PinNames.h b/targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L053R8/PinNames.h index 7c79eea8b7..0fe9a43cee 100644 --- a/targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L053R8/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L053R8/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -184,14 +145,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/PinNames.h b/targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/PinNames.h index 7c79eea8b7..0fe9a43cee 100644 --- a/targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -184,14 +145,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32L1/TARGET_MOTE_L152RC/PinNames.h b/targets/TARGET_STM/TARGET_STM32L1/TARGET_MOTE_L152RC/PinNames.h index f2126a438d..7949eb0588 100755 --- a/targets/TARGET_STM/TARGET_STM32L1/TARGET_MOTE_L152RC/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32L1/TARGET_MOTE_L152RC/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -183,14 +144,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32L1/TARGET_NUCLEO_L152RE/PinNames.h b/targets/TARGET_STM/TARGET_STM32L1/TARGET_NUCLEO_L152RE/PinNames.h index c24e066f0d..a5726d715a 100644 --- a/targets/TARGET_STM/TARGET_STM32L1/TARGET_NUCLEO_L152RE/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32L1/TARGET_NUCLEO_L152RE/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -183,14 +144,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32L1/TARGET_NZ32_SC151/PinNames.h b/targets/TARGET_STM/TARGET_STM32L1/TARGET_NZ32_SC151/PinNames.h index 04ca5acf8d..3ef8175767 100644 --- a/targets/TARGET_STM/TARGET_STM32L1/TARGET_NZ32_SC151/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32L1/TARGET_NZ32_SC151/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -176,14 +137,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32L1/TARGET_XDOT_L151CC/PinNames.h b/targets/TARGET_STM/TARGET_STM32L1/TARGET_XDOT_L151CC/PinNames.h index 4e37c3d43a..7060d7da3c 100644 --- a/targets/TARGET_STM/TARGET_STM32L1/TARGET_XDOT_L151CC/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32L1/TARGET_XDOT_L151CC/PinNames.h @@ -31,51 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_IT_RISING (6) -#define STM_MODE_IT_FALLING (7) -#define STM_MODE_IT_RISING_FALLING (8) -#define STM_MODE_EVT_RISING (9) -#define STM_MODE_EVT_FALLING (10) -#define STM_MODE_EVT_RISING_FALLING (11) -#define STM_MODE_IT_EVT_RESET (12) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -213,14 +174,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32L4/TARGET_DISCO_L476VG/PinNames.h b/targets/TARGET_STM/TARGET_STM32L4/TARGET_DISCO_L476VG/PinNames.h index abf76c6fdc..a5c46bc015 100644 --- a/targets/TARGET_STM/TARGET_STM32L4/TARGET_DISCO_L476VG/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32L4/TARGET_DISCO_L476VG/PinNames.h @@ -31,52 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_ANALOG_ADC_CONTROL (6) -#define STM_MODE_IT_RISING (7) -#define STM_MODE_IT_FALLING (8) -#define STM_MODE_IT_RISING_FALLING (9) -#define STM_MODE_EVT_RISING (10) -#define STM_MODE_EVT_FALLING (11) -#define STM_MODE_EVT_RISING_FALLING (12) -#define STM_MODE_IT_EVT_RESET (13) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, // On P1/P2 connectors PA_1 = 0x01, // On P1/P2 connectors @@ -199,14 +159,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32L4/TARGET_L476_L486/PinNames.h b/targets/TARGET_STM/TARGET_STM32L4/TARGET_L476_L486/PinNames.h index 863fb4898f..2cea26f51a 100644 --- a/targets/TARGET_STM/TARGET_STM32L4/TARGET_L476_L486/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32L4/TARGET_L476_L486/PinNames.h @@ -31,52 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_ANALOG_ADC_CONTROL (6) -#define STM_MODE_IT_RISING (7) -#define STM_MODE_IT_FALLING (8) -#define STM_MODE_IT_RISING_FALLING (9) -#define STM_MODE_EVT_RISING (10) -#define STM_MODE_EVT_FALLING (11) -#define STM_MODE_EVT_RISING_FALLING (12) -#define STM_MODE_IT_EVT_RESET (13) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -185,14 +145,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32L4/TARGET_NUCLEO_L432KC/PinNames.h b/targets/TARGET_STM/TARGET_STM32L4/TARGET_NUCLEO_L432KC/PinNames.h index 4dad1a5033..7af62ee9ee 100644 --- a/targets/TARGET_STM/TARGET_STM32L4/TARGET_NUCLEO_L432KC/PinNames.h +++ b/targets/TARGET_STM/TARGET_STM32L4/TARGET_NUCLEO_L432KC/PinNames.h @@ -31,52 +31,12 @@ #define MBED_PINNAMES_H #include "cmsis.h" +#include "PinNamesTypes.h" #ifdef __cplusplus extern "C" { #endif -#define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7))) - -#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\ - ((PUPD & 0x07) << 4) |\ - ((AFNUM & 0x0F) << 7) |\ - ((CHANNEL & 0x1F) << 11) |\ - ((INVERTED & 0x01) << 16))) - -#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) -#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) -#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) -#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F) -#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01) - -#define STM_MODE_INPUT (0) -#define STM_MODE_OUTPUT_PP (1) -#define STM_MODE_OUTPUT_OD (2) -#define STM_MODE_AF_PP (3) -#define STM_MODE_AF_OD (4) -#define STM_MODE_ANALOG (5) -#define STM_MODE_ANALOG_ADC_CONTROL (6) -#define STM_MODE_IT_RISING (7) -#define STM_MODE_IT_FALLING (8) -#define STM_MODE_IT_RISING_FALLING (9) -#define STM_MODE_EVT_RISING (10) -#define STM_MODE_EVT_FALLING (11) -#define STM_MODE_EVT_RISING_FALLING (12) -#define STM_MODE_IT_EVT_RESET (13) - -// High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) -// Low nibble = pin number -#define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) -#define STM_PIN(X) ((uint32_t)(X) & 0xF) - -typedef enum { - PIN_INPUT, - PIN_OUTPUT -} PinDirection; - typedef enum { PA_0 = 0x00, PA_1 = 0x01, @@ -157,14 +117,6 @@ typedef enum { NC = (int)0xFFFFFFFF } PinName; -typedef enum { - PullNone = 0, - PullUp = 1, - PullDown = 2, - OpenDrain = 3, - PullDefault = PullNone -} PinMode; - #ifdef __cplusplus } #endif diff --git a/targets/TARGET_STM/TARGET_STM32L4/pinmap.c b/targets/TARGET_STM/TARGET_STM32L4/pinmap.c index 3dc800ea14..f2a9f540d7 100644 --- a/targets/TARGET_STM/TARGET_STM32L4/pinmap.c +++ b/targets/TARGET_STM/TARGET_STM32L4/pinmap.c @@ -41,14 +41,14 @@ static const uint32_t gpio_mode[14] = { 0x00000002, // 3 = GPIO_MODE_AF_PP 0x00000012, // 4 = GPIO_MODE_AF_OD 0x00000003, // 5 = GPIO_MODE_ANALOG - 0x0000000B, // 6 = GPIO_MODE_ANALOG_ADC_CONTROL - 0x10110000, // 7 = GPIO_MODE_IT_RISING - 0x10210000, // 8 = GPIO_MODE_IT_FALLING - 0x10310000, // 9 = GPIO_MODE_IT_RISING_FALLING - 0x10120000, // 10 = GPIO_MODE_EVT_RISING - 0x10220000, // 11 = GPIO_MODE_EVT_FALLING - 0x10320000, // 12 = GPIO_MODE_EVT_RISING_FALLING - 0x10000000 // 13 = Reset IT and EVT (not in STM32Cube HAL) + 0x10110000, // 6 = GPIO_MODE_IT_RISING + 0x10210000, // 7 = GPIO_MODE_IT_FALLING + 0x10310000, // 8 = GPIO_MODE_IT_RISING_FALLING + 0x10120000, // 9 = GPIO_MODE_EVT_RISING + 0x10220000, // 10 = GPIO_MODE_EVT_FALLING + 0x10320000, // 11 = GPIO_MODE_EVT_RISING_FALLING + 0x10000000, // 12 = Reset IT and EVT (not in STM32Cube HAL) + 0x0000000B //13 = GPIO_MODE_ANALOG_ADC_CONTROL }; // Enable GPIO clock and return GPIO base address