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

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
171:3a7713b1edbc
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 143:86740a56073b 1 /* mbed Microcontroller Library
AnnaBridge 143:86740a56073b 2 * Copyright (c) 2006-2017 ARM Limited
AnnaBridge 143:86740a56073b 3 *
AnnaBridge 143:86740a56073b 4 * Licensed under the Apache License, Version 2.0 (the "License");
AnnaBridge 143:86740a56073b 5 * you may not use this file except in compliance with the License.
AnnaBridge 143:86740a56073b 6 * You may obtain a copy of the License at
AnnaBridge 143:86740a56073b 7 *
AnnaBridge 143:86740a56073b 8 * http://www.apache.org/licenses/LICENSE-2.0
AnnaBridge 143:86740a56073b 9 *
AnnaBridge 143:86740a56073b 10 * Unless required by applicable law or agreed to in writing, software
AnnaBridge 143:86740a56073b 11 * distributed under the License is distributed on an "AS IS" BASIS,
AnnaBridge 143:86740a56073b 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
AnnaBridge 143:86740a56073b 13 * See the License for the specific language governing permissions and
AnnaBridge 143:86740a56073b 14 * limitations under the License.
AnnaBridge 143:86740a56073b 15 */
AnnaBridge 143:86740a56073b 16 #ifndef MBED_PERIPHERALNAMES_H
AnnaBridge 143:86740a56073b 17 #define MBED_PERIPHERALNAMES_H
AnnaBridge 143:86740a56073b 18
AnnaBridge 143:86740a56073b 19 #include "cmsis.h"
AnnaBridge 143:86740a56073b 20
AnnaBridge 143:86740a56073b 21 #ifdef __cplusplus
AnnaBridge 143:86740a56073b 22 extern "C" {
AnnaBridge 143:86740a56073b 23 #endif
AnnaBridge 143:86740a56073b 24
AnnaBridge 143:86740a56073b 25 typedef enum {
AnnaBridge 143:86740a56073b 26 OSC32KCLK = 1,
AnnaBridge 143:86740a56073b 27 } RTCName;
AnnaBridge 143:86740a56073b 28
AnnaBridge 143:86740a56073b 29 typedef enum {
AnnaBridge 143:86740a56073b 30 UART_0 = 0,
AnnaBridge 143:86740a56073b 31 UART_1 = 1,
AnnaBridge 143:86740a56073b 32 UART_2 = 2,
AnnaBridge 143:86740a56073b 33 UART_3 = 3,
AnnaBridge 143:86740a56073b 34 UART_4 = 4,
AnnaBridge 143:86740a56073b 35 } UARTName;
AnnaBridge 143:86740a56073b 36
AnnaBridge 143:86740a56073b 37 #define STDIO_UART_TX USBTX
AnnaBridge 143:86740a56073b 38 #define STDIO_UART_RX USBRX
AnnaBridge 143:86740a56073b 39 #define STDIO_UART UART_0
AnnaBridge 143:86740a56073b 40
AnnaBridge 143:86740a56073b 41 typedef enum {
AnnaBridge 143:86740a56073b 42 I2C_0 = 0,
AnnaBridge 143:86740a56073b 43 I2C_1 = 1,
AnnaBridge 143:86740a56073b 44 I2C_2 = 2,
AnnaBridge 143:86740a56073b 45 } I2CName;
AnnaBridge 143:86740a56073b 46
AnnaBridge 143:86740a56073b 47 #define TPM_SHIFT 8
AnnaBridge 143:86740a56073b 48 typedef enum {
AnnaBridge 143:86740a56073b 49 PWM_1 = (0 << TPM_SHIFT) | (0), // FTM0 CH0
AnnaBridge 143:86740a56073b 50 PWM_2 = (0 << TPM_SHIFT) | (1), // FTM0 CH1
AnnaBridge 143:86740a56073b 51 PWM_3 = (0 << TPM_SHIFT) | (2), // FTM0 CH2
AnnaBridge 143:86740a56073b 52 PWM_4 = (0 << TPM_SHIFT) | (3), // FTM0 CH3
AnnaBridge 143:86740a56073b 53 PWM_5 = (0 << TPM_SHIFT) | (4), // FTM0 CH4
AnnaBridge 143:86740a56073b 54 PWM_6 = (0 << TPM_SHIFT) | (5), // FTM0 CH5
AnnaBridge 143:86740a56073b 55 PWM_7 = (0 << TPM_SHIFT) | (6), // FTM0 CH6
AnnaBridge 143:86740a56073b 56 PWM_8 = (0 << TPM_SHIFT) | (7), // FTM0 CH7
AnnaBridge 143:86740a56073b 57 PWM_9 = (1 << TPM_SHIFT) | (0), // FTM1 CH0
AnnaBridge 143:86740a56073b 58 PWM_10 = (1 << TPM_SHIFT) | (1), // FTM1 CH1
AnnaBridge 143:86740a56073b 59 PWM_11 = (1 << TPM_SHIFT) | (2), // FTM1 CH2
AnnaBridge 143:86740a56073b 60 PWM_12 = (1 << TPM_SHIFT) | (3), // FTM1 CH3
AnnaBridge 143:86740a56073b 61 PWM_13 = (1 << TPM_SHIFT) | (4), // FTM1 CH4
AnnaBridge 143:86740a56073b 62 PWM_14 = (1 << TPM_SHIFT) | (5), // FTM1 CH5
AnnaBridge 143:86740a56073b 63 PWM_15 = (1 << TPM_SHIFT) | (6), // FTM1 CH6
AnnaBridge 143:86740a56073b 64 PWM_16 = (1 << TPM_SHIFT) | (7), // FTM1 CH7
AnnaBridge 143:86740a56073b 65 PWM_17 = (2 << TPM_SHIFT) | (0), // FTM2 CH0
AnnaBridge 143:86740a56073b 66 PWM_18 = (2 << TPM_SHIFT) | (1), // FTM2 CH1
AnnaBridge 143:86740a56073b 67 PWM_19 = (2 << TPM_SHIFT) | (2), // FTM2 CH2
AnnaBridge 143:86740a56073b 68 PWM_20 = (2 << TPM_SHIFT) | (3), // FTM2 CH3
AnnaBridge 143:86740a56073b 69 PWM_21 = (2 << TPM_SHIFT) | (4), // FTM2 CH4
AnnaBridge 143:86740a56073b 70 PWM_22 = (2 << TPM_SHIFT) | (5), // FTM2 CH5
AnnaBridge 143:86740a56073b 71 PWM_23 = (2 << TPM_SHIFT) | (6), // FTM2 CH6
AnnaBridge 143:86740a56073b 72 PWM_24 = (2 << TPM_SHIFT) | (7), // FTM2 CH7
AnnaBridge 143:86740a56073b 73 PWM_25 = (3 << TPM_SHIFT) | (0), // FTM3 CH0
AnnaBridge 143:86740a56073b 74 PWM_26 = (3 << TPM_SHIFT) | (1), // FTM3 CH1
AnnaBridge 143:86740a56073b 75 PWM_27 = (3 << TPM_SHIFT) | (2), // FTM3 CH2
AnnaBridge 143:86740a56073b 76 PWM_28 = (3 << TPM_SHIFT) | (3), // FTM3 CH3
AnnaBridge 143:86740a56073b 77 PWM_29 = (3 << TPM_SHIFT) | (4), // FTM3 CH4
AnnaBridge 143:86740a56073b 78 PWM_30 = (3 << TPM_SHIFT) | (5), // FTM3 CH5
AnnaBridge 143:86740a56073b 79 PWM_31 = (3 << TPM_SHIFT) | (6), // FTM3 CH6
AnnaBridge 143:86740a56073b 80 PWM_32 = (3 << TPM_SHIFT) | (7), // FTM3 CH7
AnnaBridge 143:86740a56073b 81 } PWMName;
AnnaBridge 143:86740a56073b 82
AnnaBridge 143:86740a56073b 83 #define ADC_INSTANCE_SHIFT 8
AnnaBridge 143:86740a56073b 84 #define ADC_B_CHANNEL_SHIFT 5
AnnaBridge 143:86740a56073b 85 typedef enum {
AnnaBridge 143:86740a56073b 86 ADC0_SE4b = (0 << ADC_INSTANCE_SHIFT) | (1 << ADC_B_CHANNEL_SHIFT) | 4,
AnnaBridge 143:86740a56073b 87 ADC0_SE5b = (0 << ADC_INSTANCE_SHIFT) | (1 << ADC_B_CHANNEL_SHIFT) | 5,
AnnaBridge 143:86740a56073b 88 ADC0_SE6b = (0 << ADC_INSTANCE_SHIFT) | (1 << ADC_B_CHANNEL_SHIFT) | 6,
AnnaBridge 143:86740a56073b 89 ADC0_SE7b = (0 << ADC_INSTANCE_SHIFT) | (1 << ADC_B_CHANNEL_SHIFT) | 7,
AnnaBridge 143:86740a56073b 90 ADC0_SE8 = (0 << ADC_INSTANCE_SHIFT) | 8,
AnnaBridge 143:86740a56073b 91 ADC0_SE9 = (0 << ADC_INSTANCE_SHIFT) | 9,
AnnaBridge 143:86740a56073b 92 ADC0_SE12 = (0 << ADC_INSTANCE_SHIFT) | 12,
AnnaBridge 143:86740a56073b 93 ADC0_SE13 = (0 << ADC_INSTANCE_SHIFT) | 13,
AnnaBridge 143:86740a56073b 94 ADC0_SE14 = (0 << ADC_INSTANCE_SHIFT) | 14,
AnnaBridge 143:86740a56073b 95 ADC0_SE15 = (0 << ADC_INSTANCE_SHIFT) | 15,
AnnaBridge 143:86740a56073b 96 ADC0_SE16 = (0 << ADC_INSTANCE_SHIFT) | 16,
AnnaBridge 143:86740a56073b 97 ADC0_SE17 = (0 << ADC_INSTANCE_SHIFT) | 17,
AnnaBridge 143:86740a56073b 98 ADC0_SE18 = (0 << ADC_INSTANCE_SHIFT) | 18,
AnnaBridge 143:86740a56073b 99 ADC0_SE21 = (0 << ADC_INSTANCE_SHIFT) | 21,
AnnaBridge 143:86740a56073b 100 ADC0_SE22 = (0 << ADC_INSTANCE_SHIFT) | 22,
AnnaBridge 143:86740a56073b 101 ADC0_SE23 = (0 << ADC_INSTANCE_SHIFT) | 23,
AnnaBridge 143:86740a56073b 102 ADC1_SE4a = (1 << ADC_INSTANCE_SHIFT) | 4,
AnnaBridge 143:86740a56073b 103 ADC1_SE5a = (1 << ADC_INSTANCE_SHIFT) | 5,
AnnaBridge 143:86740a56073b 104 ADC1_SE6a = (1 << ADC_INSTANCE_SHIFT) | 6,
AnnaBridge 143:86740a56073b 105 ADC1_SE7a = (1 << ADC_INSTANCE_SHIFT) | 7,
AnnaBridge 143:86740a56073b 106 ADC1_SE4b = (1 << ADC_INSTANCE_SHIFT) | (1 << ADC_B_CHANNEL_SHIFT) | 4,
AnnaBridge 143:86740a56073b 107 ADC1_SE5b = (1 << ADC_INSTANCE_SHIFT) | (1 << ADC_B_CHANNEL_SHIFT) | 5,
AnnaBridge 143:86740a56073b 108 ADC1_SE6b = (1 << ADC_INSTANCE_SHIFT) | (1 << ADC_B_CHANNEL_SHIFT) | 6,
AnnaBridge 143:86740a56073b 109 ADC1_SE7b = (1 << ADC_INSTANCE_SHIFT) | (1 << ADC_B_CHANNEL_SHIFT) | 7,
AnnaBridge 143:86740a56073b 110 ADC1_SE8 = (1 << ADC_INSTANCE_SHIFT) | 8,
AnnaBridge 143:86740a56073b 111 ADC1_SE9 = (1 << ADC_INSTANCE_SHIFT) | 9,
AnnaBridge 143:86740a56073b 112 ADC1_SE12 = (1 << ADC_INSTANCE_SHIFT) | 12,
AnnaBridge 143:86740a56073b 113 ADC1_SE13 = (1 << ADC_INSTANCE_SHIFT) | 13,
AnnaBridge 143:86740a56073b 114 ADC1_SE14 = (1 << ADC_INSTANCE_SHIFT) | 14,
AnnaBridge 143:86740a56073b 115 ADC1_SE15 = (1 << ADC_INSTANCE_SHIFT) | 15,
AnnaBridge 143:86740a56073b 116 ADC1_SE16 = (1 << ADC_INSTANCE_SHIFT) | 16,
AnnaBridge 143:86740a56073b 117 ADC1_SE17 = (1 << ADC_INSTANCE_SHIFT) | 17,
AnnaBridge 143:86740a56073b 118 ADC1_SE18 = (1 << ADC_INSTANCE_SHIFT) | 18,
AnnaBridge 143:86740a56073b 119 ADC1_SE23 = (1 << ADC_INSTANCE_SHIFT) | 23,
AnnaBridge 143:86740a56073b 120 } ADCName;
AnnaBridge 143:86740a56073b 121
AnnaBridge 143:86740a56073b 122 typedef enum {
AnnaBridge 143:86740a56073b 123 DAC_0 = 0
AnnaBridge 143:86740a56073b 124 } DACName;
AnnaBridge 143:86740a56073b 125
AnnaBridge 143:86740a56073b 126
AnnaBridge 143:86740a56073b 127 typedef enum {
AnnaBridge 143:86740a56073b 128 SPI_0 = 0,
AnnaBridge 143:86740a56073b 129 SPI_1 = 1,
AnnaBridge 143:86740a56073b 130 SPI_2 = 2,
AnnaBridge 143:86740a56073b 131 } SPIName;
AnnaBridge 143:86740a56073b 132
AnnaBridge 143:86740a56073b 133 #ifdef __cplusplus
AnnaBridge 143:86740a56073b 134 }
AnnaBridge 143:86740a56073b 135 #endif
AnnaBridge 143:86740a56073b 136
AnnaBridge 143:86740a56073b 137 #endif