Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-dev by
targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG_STK3200/PinNames.h@0:9b334a45a8ff, 2015-10-01 (annotated)
- Committer:
- bogdanm
- Date:
- Thu Oct 01 15:25:22 2015 +0300
- Revision:
- 0:9b334a45a8ff
Initial commit on mbed-dev
Replaces mbed-src (now inactive)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 0:9b334a45a8ff | 1 | /***************************************************************************//** |
bogdanm | 0:9b334a45a8ff | 2 | * @file PinNames.h |
bogdanm | 0:9b334a45a8ff | 3 | ******************************************************************************* |
bogdanm | 0:9b334a45a8ff | 4 | * @section License |
bogdanm | 0:9b334a45a8ff | 5 | * <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b> |
bogdanm | 0:9b334a45a8ff | 6 | ******************************************************************************* |
bogdanm | 0:9b334a45a8ff | 7 | * |
bogdanm | 0:9b334a45a8ff | 8 | * Permission is granted to anyone to use this software for any purpose, |
bogdanm | 0:9b334a45a8ff | 9 | * including commercial applications, and to alter it and redistribute it |
bogdanm | 0:9b334a45a8ff | 10 | * freely, subject to the following restrictions: |
bogdanm | 0:9b334a45a8ff | 11 | * |
bogdanm | 0:9b334a45a8ff | 12 | * 1. The origin of this software must not be misrepresented; you must not |
bogdanm | 0:9b334a45a8ff | 13 | * claim that you wrote the original software. |
bogdanm | 0:9b334a45a8ff | 14 | * 2. Altered source versions must be plainly marked as such, and must not be |
bogdanm | 0:9b334a45a8ff | 15 | * misrepresented as being the original software. |
bogdanm | 0:9b334a45a8ff | 16 | * 3. This notice may not be removed or altered from any source distribution. |
bogdanm | 0:9b334a45a8ff | 17 | * |
bogdanm | 0:9b334a45a8ff | 18 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no |
bogdanm | 0:9b334a45a8ff | 19 | * obligation to support this Software. Silicon Labs is providing the |
bogdanm | 0:9b334a45a8ff | 20 | * Software "AS IS", with no express or implied warranties of any kind, |
bogdanm | 0:9b334a45a8ff | 21 | * including, but not limited to, any implied warranties of merchantability |
bogdanm | 0:9b334a45a8ff | 22 | * or fitness for any particular purpose or warranties against infringement |
bogdanm | 0:9b334a45a8ff | 23 | * of any proprietary rights of a third party. |
bogdanm | 0:9b334a45a8ff | 24 | * |
bogdanm | 0:9b334a45a8ff | 25 | * Silicon Labs will not be liable for any consequential, incidental, or |
bogdanm | 0:9b334a45a8ff | 26 | * special damages, or any other relief, or for any claim by any third party, |
bogdanm | 0:9b334a45a8ff | 27 | * arising from your use of this Software. |
bogdanm | 0:9b334a45a8ff | 28 | * |
bogdanm | 0:9b334a45a8ff | 29 | ******************************************************************************/ |
bogdanm | 0:9b334a45a8ff | 30 | #ifndef MBED_PINNAMES_H |
bogdanm | 0:9b334a45a8ff | 31 | #define MBED_PINNAMES_H |
bogdanm | 0:9b334a45a8ff | 32 | |
bogdanm | 0:9b334a45a8ff | 33 | #include "cmsis.h" |
bogdanm | 0:9b334a45a8ff | 34 | #include "em_gpio.h" |
bogdanm | 0:9b334a45a8ff | 35 | |
bogdanm | 0:9b334a45a8ff | 36 | #ifdef __cplusplus |
bogdanm | 0:9b334a45a8ff | 37 | extern "C" { |
bogdanm | 0:9b334a45a8ff | 38 | #endif |
bogdanm | 0:9b334a45a8ff | 39 | |
bogdanm | 0:9b334a45a8ff | 40 | typedef enum { |
bogdanm | 0:9b334a45a8ff | 41 | PIN_INPUT = 0, |
bogdanm | 0:9b334a45a8ff | 42 | PIN_OUTPUT = 1 |
bogdanm | 0:9b334a45a8ff | 43 | } PinDirection; |
bogdanm | 0:9b334a45a8ff | 44 | |
bogdanm | 0:9b334a45a8ff | 45 | typedef enum { |
bogdanm | 0:9b334a45a8ff | 46 | /* EFM32 Pin Names |
bogdanm | 0:9b334a45a8ff | 47 | * First 4 bits represent pin number, the remaining |
bogdanm | 0:9b334a45a8ff | 48 | * bits represent port number (A = 0, B = 1, ...) |
bogdanm | 0:9b334a45a8ff | 49 | */ |
bogdanm | 0:9b334a45a8ff | 50 | PA0 = 0 << 4, PA1, PA2, PA3, PA4, PA5, PA6, PA7, PA8, PA9, PA10, PA11, PA12, PA13, PA14, PA15, |
bogdanm | 0:9b334a45a8ff | 51 | PB0 = 1 << 4, PB1, PB2, PB3, PB4, PB5, PB6, PB7, PB8, PB9, PB10, PB11, PB12, PB13, PB14, PB15, |
bogdanm | 0:9b334a45a8ff | 52 | PC0 = 2 << 4, PC1, PC2, PC3, PC4, PC5, PC6, PC7, PC8, PC9, PC10, PC11, PC12, PC13, PC14, PC15, |
bogdanm | 0:9b334a45a8ff | 53 | PD0 = 3 << 4, PD1, PD2, PD3, PD4, PD5, PD6, PD7, PD8, PD9, PD10, PD11, PD12, PD13, PD14, PD15, |
bogdanm | 0:9b334a45a8ff | 54 | PE0 = 4 << 4, PE1, PE2, PE3, PE4, PE5, PE6, PE7, PE8, PE9, PE10, PE11, PE12, PE13, PE14, PE15, |
bogdanm | 0:9b334a45a8ff | 55 | PF0 = 5 << 4, PF1, PF2, PF3, PF4, PF5, PF6, PF7, PF8, PF9, PF10, PF11, PF12, PF13, PF14, PF15, |
bogdanm | 0:9b334a45a8ff | 56 | |
bogdanm | 0:9b334a45a8ff | 57 | /* Starter Kit says LED0 and LED1, but mbed expects 1 and 2. This way using 1 and 2 or 0 and 1 will work. */ |
bogdanm | 0:9b334a45a8ff | 58 | LED0 = PC10, |
bogdanm | 0:9b334a45a8ff | 59 | LED1 = PC11, |
bogdanm | 0:9b334a45a8ff | 60 | LED2 = LED0, |
bogdanm | 0:9b334a45a8ff | 61 | LED3 = LED0, |
bogdanm | 0:9b334a45a8ff | 62 | LED4 = LED1, |
bogdanm | 0:9b334a45a8ff | 63 | |
bogdanm | 0:9b334a45a8ff | 64 | /* Push Buttons */ |
bogdanm | 0:9b334a45a8ff | 65 | SW0 = PC8, |
bogdanm | 0:9b334a45a8ff | 66 | SW1 = PC9, |
bogdanm | 0:9b334a45a8ff | 67 | BTN0 = SW0, |
bogdanm | 0:9b334a45a8ff | 68 | BTN1 = SW1, |
bogdanm | 0:9b334a45a8ff | 69 | |
bogdanm | 0:9b334a45a8ff | 70 | /* Serial */ |
bogdanm | 0:9b334a45a8ff | 71 | SERIAL_TX = PD7, |
bogdanm | 0:9b334a45a8ff | 72 | SERIAL_RX = PD6, |
bogdanm | 0:9b334a45a8ff | 73 | USBTX = PD4, |
bogdanm | 0:9b334a45a8ff | 74 | USBRX = PD5, |
bogdanm | 0:9b334a45a8ff | 75 | EFM_BC_EN = PA9, |
bogdanm | 0:9b334a45a8ff | 76 | |
bogdanm | 0:9b334a45a8ff | 77 | /* Not connected */ |
bogdanm | 0:9b334a45a8ff | 78 | NC = (int) 0xFFFFFFFF |
bogdanm | 0:9b334a45a8ff | 79 | } PinName; |
bogdanm | 0:9b334a45a8ff | 80 | |
bogdanm | 0:9b334a45a8ff | 81 | |
bogdanm | 0:9b334a45a8ff | 82 | /* 0x10 represents setting the DOUT register (see efm32 modes in ref. manual) */ |
bogdanm | 0:9b334a45a8ff | 83 | typedef enum { |
bogdanm | 0:9b334a45a8ff | 84 | /* EFM32 pin modes */ |
bogdanm | 0:9b334a45a8ff | 85 | Disabled = gpioModeDisabled, |
bogdanm | 0:9b334a45a8ff | 86 | DisabledPullUp = gpioModeDisabled | 0x10, |
bogdanm | 0:9b334a45a8ff | 87 | Input = gpioModeInput, |
bogdanm | 0:9b334a45a8ff | 88 | InputFilter = gpioModeInput | 0x10, |
bogdanm | 0:9b334a45a8ff | 89 | InputPullDown = gpioModeInputPull, |
bogdanm | 0:9b334a45a8ff | 90 | InputPullUp = gpioModeInputPull | 0x10, |
bogdanm | 0:9b334a45a8ff | 91 | InputPullFilterDown = gpioModeInputPullFilter, |
bogdanm | 0:9b334a45a8ff | 92 | InputPullFilterUp = gpioModeInputPullFilter | 0x10, |
bogdanm | 0:9b334a45a8ff | 93 | PushPull = gpioModePushPull, |
bogdanm | 0:9b334a45a8ff | 94 | PushPullDrive = gpioModePushPullDrive, |
bogdanm | 0:9b334a45a8ff | 95 | WiredOr = gpioModeWiredOr, |
bogdanm | 0:9b334a45a8ff | 96 | WiredOrPullDown = gpioModeWiredOrPullDown, |
bogdanm | 0:9b334a45a8ff | 97 | WiredAnd = gpioModeWiredAnd, |
bogdanm | 0:9b334a45a8ff | 98 | WiredAndFilter = gpioModeWiredAndFilter, |
bogdanm | 0:9b334a45a8ff | 99 | WiredAndPullUp = gpioModeWiredAndPullUp, |
bogdanm | 0:9b334a45a8ff | 100 | WiredAndPullUpFilter = gpioModeWiredAndPullUpFilter, |
bogdanm | 0:9b334a45a8ff | 101 | WiredAndDrive = gpioModeWiredAndDrive, |
bogdanm | 0:9b334a45a8ff | 102 | WiredAndDriveFilter = gpioModeWiredAndDriveFilter, |
bogdanm | 0:9b334a45a8ff | 103 | WiredAndDrivePullUp = gpioModeWiredAndDrivePullUp, |
bogdanm | 0:9b334a45a8ff | 104 | WiredAndDrivePullUpFilter = gpioModeWiredAndDrivePullUpFilter, |
bogdanm | 0:9b334a45a8ff | 105 | |
bogdanm | 0:9b334a45a8ff | 106 | /* mbed modes: |
bogdanm | 0:9b334a45a8ff | 107 | * PullUp, PullDown, PullNone, OpenDrain |
bogdanm | 0:9b334a45a8ff | 108 | * |
bogdanm | 0:9b334a45a8ff | 109 | * mbed default digital input mode: |
bogdanm | 0:9b334a45a8ff | 110 | * PullDefault |
bogdanm | 0:9b334a45a8ff | 111 | * |
bogdanm | 0:9b334a45a8ff | 112 | * mbed default digital output mode: |
bogdanm | 0:9b334a45a8ff | 113 | * PullNone |
bogdanm | 0:9b334a45a8ff | 114 | */ |
bogdanm | 0:9b334a45a8ff | 115 | PullUp = InputPullUp, |
bogdanm | 0:9b334a45a8ff | 116 | PullDown = InputPullDown, |
bogdanm | 0:9b334a45a8ff | 117 | OpenDrain = WiredAnd, |
bogdanm | 0:9b334a45a8ff | 118 | PullNone = PushPull, |
bogdanm | 0:9b334a45a8ff | 119 | PullDefault = PushPull |
bogdanm | 0:9b334a45a8ff | 120 | } PinMode; |
bogdanm | 0:9b334a45a8ff | 121 | |
bogdanm | 0:9b334a45a8ff | 122 | #ifdef __cplusplus |
bogdanm | 0:9b334a45a8ff | 123 | } |
bogdanm | 0:9b334a45a8ff | 124 | #endif |
bogdanm | 0:9b334a45a8ff | 125 | |
bogdanm | 0:9b334a45a8ff | 126 | #endif |