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:
Thu Nov 08 11:45:42 2018 +0000
Revision:
171:3a7713b1edbc
mbed library. Release version 164

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 171:3a7713b1edbc 1 /* mbed Microcontroller Library
AnnaBridge 171:3a7713b1edbc 2 * Copyright (c) 2006-2013 ARM Limited
AnnaBridge 171:3a7713b1edbc 3 *
AnnaBridge 171:3a7713b1edbc 4 * Licensed under the Apache License, Version 2.0 (the "License");
AnnaBridge 171:3a7713b1edbc 5 * you may not use this file except in compliance with the License.
AnnaBridge 171:3a7713b1edbc 6 * You may obtain a copy of the License at
AnnaBridge 171:3a7713b1edbc 7 *
AnnaBridge 171:3a7713b1edbc 8 * http://www.apache.org/licenses/LICENSE-2.0
AnnaBridge 171:3a7713b1edbc 9 *
AnnaBridge 171:3a7713b1edbc 10 * Unless required by applicable law or agreed to in writing, software
AnnaBridge 171:3a7713b1edbc 11 * distributed under the License is distributed on an "AS IS" BASIS,
AnnaBridge 171:3a7713b1edbc 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
AnnaBridge 171:3a7713b1edbc 13 * See the License for the specific language governing permissions and
AnnaBridge 171:3a7713b1edbc 14 * limitations under the License.
AnnaBridge 171:3a7713b1edbc 15 */
AnnaBridge 171:3a7713b1edbc 16 #ifndef MBED_PERIPHERALNAMES_H
AnnaBridge 171:3a7713b1edbc 17 #define MBED_PERIPHERALNAMES_H
AnnaBridge 171:3a7713b1edbc 18
AnnaBridge 171:3a7713b1edbc 19 #include "cmsis.h"
AnnaBridge 171:3a7713b1edbc 20
AnnaBridge 171:3a7713b1edbc 21 #ifdef __cplusplus
AnnaBridge 171:3a7713b1edbc 22 extern "C" {
AnnaBridge 171:3a7713b1edbc 23 #endif
AnnaBridge 171:3a7713b1edbc 24
AnnaBridge 171:3a7713b1edbc 25 typedef enum {
AnnaBridge 171:3a7713b1edbc 26 OSC32KCLK = 0,
AnnaBridge 171:3a7713b1edbc 27 } RTCName;
AnnaBridge 171:3a7713b1edbc 28
AnnaBridge 171:3a7713b1edbc 29 typedef enum {
AnnaBridge 171:3a7713b1edbc 30 UART_1 = 1,
AnnaBridge 171:3a7713b1edbc 31 UART_2 = 2,
AnnaBridge 171:3a7713b1edbc 32 UART_3 = 3,
AnnaBridge 171:3a7713b1edbc 33 UART_4 = 4,
AnnaBridge 171:3a7713b1edbc 34 } UARTName;
AnnaBridge 171:3a7713b1edbc 35
AnnaBridge 171:3a7713b1edbc 36 #define STDIO_UART_TX USBTX
AnnaBridge 171:3a7713b1edbc 37 #define STDIO_UART_RX USBRX
AnnaBridge 171:3a7713b1edbc 38 #define STDIO_UART UART_1
AnnaBridge 171:3a7713b1edbc 39
AnnaBridge 171:3a7713b1edbc 40 #define SION_BIT_SHIFT (3)
AnnaBridge 171:3a7713b1edbc 41 #define DAISY_REG_SHIFT (4)
AnnaBridge 171:3a7713b1edbc 42 #define DAISY_REG_VALUE_SHIFT (16)
AnnaBridge 171:3a7713b1edbc 43
AnnaBridge 171:3a7713b1edbc 44 typedef enum {
AnnaBridge 171:3a7713b1edbc 45 I2C_1 = 1,
AnnaBridge 171:3a7713b1edbc 46 I2C_2 = 2,
AnnaBridge 171:3a7713b1edbc 47 I2C_3 = 3,
AnnaBridge 171:3a7713b1edbc 48 I2C_4 = 4,
AnnaBridge 171:3a7713b1edbc 49 } I2CName;
AnnaBridge 171:3a7713b1edbc 50
AnnaBridge 171:3a7713b1edbc 51 #define PWM_MODULE_SHIFT 2
AnnaBridge 171:3a7713b1edbc 52 #define PWM_SHIFT 8
AnnaBridge 171:3a7713b1edbc 53
AnnaBridge 171:3a7713b1edbc 54 typedef enum {
AnnaBridge 171:3a7713b1edbc 55 PWM_1 = (1 << PWM_SHIFT) | (0 << PWM_MODULE_SHIFT) | (0), // PWM1 Submodule 0 PWMA
AnnaBridge 171:3a7713b1edbc 56 PWM_2 = (1 << PWM_SHIFT) | (0 << PWM_MODULE_SHIFT) | (1), // PWM1 Submodule 0 PWMB
AnnaBridge 171:3a7713b1edbc 57 PWM_3 = (1 << PWM_SHIFT) | (1 << PWM_MODULE_SHIFT) | (0), // PWM1 Submodule 1 PWMA
AnnaBridge 171:3a7713b1edbc 58 PWM_4 = (1 << PWM_SHIFT) | (1 << PWM_MODULE_SHIFT) | (1), // PWM1 Submodule 1 PWMB
AnnaBridge 171:3a7713b1edbc 59 PWM_5 = (1 << PWM_SHIFT) | (2 << PWM_MODULE_SHIFT) | (0), // PWM1 Submodule 2 PWMA
AnnaBridge 171:3a7713b1edbc 60 PWM_6 = (1 << PWM_SHIFT) | (2 << PWM_MODULE_SHIFT) | (1), // PWM1 Submodule 2 PWMB
AnnaBridge 171:3a7713b1edbc 61 PWM_7 = (1 << PWM_SHIFT) | (3 << PWM_MODULE_SHIFT) | (0), // PWM1 Submodule 3 PWMA
AnnaBridge 171:3a7713b1edbc 62 PWM_8 = (1 << PWM_SHIFT) | (3 << PWM_MODULE_SHIFT) | (1), // PWM1 Submodule 3 PWMB
AnnaBridge 171:3a7713b1edbc 63 PWM_9 = (2 << PWM_SHIFT) | (0 << PWM_MODULE_SHIFT) | (0), // PWM2 Submodule 0 PWMA
AnnaBridge 171:3a7713b1edbc 64 PWM_10 = (2 << PWM_SHIFT) | (0 << PWM_MODULE_SHIFT) | (1), // PWM2 Submodule 0 PWMB
AnnaBridge 171:3a7713b1edbc 65 PWM_11 = (2 << PWM_SHIFT) | (1 << PWM_MODULE_SHIFT) | (0), // PWM2 Submodule 1 PWMA
AnnaBridge 171:3a7713b1edbc 66 PWM_12 = (2 << PWM_SHIFT) | (1 << PWM_MODULE_SHIFT) | (1), // PWM2 Submodule 1 PWMB
AnnaBridge 171:3a7713b1edbc 67 PWM_13 = (2 << PWM_SHIFT) | (2 << PWM_MODULE_SHIFT) | (0), // PWM2 Submodule 2 PWMA
AnnaBridge 171:3a7713b1edbc 68 PWM_14 = (2 << PWM_SHIFT) | (2 << PWM_MODULE_SHIFT) | (1), // PWM2 Submodule 2 PWMB
AnnaBridge 171:3a7713b1edbc 69 PWM_15 = (2 << PWM_SHIFT) | (3 << PWM_MODULE_SHIFT) | (0), // PWM2 Submodule 3 PWMA
AnnaBridge 171:3a7713b1edbc 70 PWM_16 = (2 << PWM_SHIFT) | (3 << PWM_MODULE_SHIFT) | (1), // PWM2 Submodule 3 PWMB
AnnaBridge 171:3a7713b1edbc 71 PWM_17 = (3 << PWM_SHIFT) | (0 << PWM_MODULE_SHIFT) | (0), // PWM3 Submodule 0 PWMA
AnnaBridge 171:3a7713b1edbc 72 PWM_18 = (3 << PWM_SHIFT) | (0 << PWM_MODULE_SHIFT) | (1), // PWM3 Submodule 0 PWMB
AnnaBridge 171:3a7713b1edbc 73 PWM_19 = (3 << PWM_SHIFT) | (1 << PWM_MODULE_SHIFT) | (0), // PWM3 Submodule 1 PWMA
AnnaBridge 171:3a7713b1edbc 74 PWM_20 = (3 << PWM_SHIFT) | (1 << PWM_MODULE_SHIFT) | (1), // PWM3 Submodule 1 PWMB
AnnaBridge 171:3a7713b1edbc 75 PWM_21 = (3 << PWM_SHIFT) | (2 << PWM_MODULE_SHIFT) | (0), // PWM3 Submodule 2 PWMA
AnnaBridge 171:3a7713b1edbc 76 PWM_22 = (3 << PWM_SHIFT) | (2 << PWM_MODULE_SHIFT) | (1), // PWM3 Submodule 2 PWMB
AnnaBridge 171:3a7713b1edbc 77 PWM_23 = (3 << PWM_SHIFT) | (3 << PWM_MODULE_SHIFT) | (0), // PWM3 Submodule 3 PWMA
AnnaBridge 171:3a7713b1edbc 78 PWM_24 = (3 << PWM_SHIFT) | (3 << PWM_MODULE_SHIFT) | (1), // PWM3 Submodule 3 PWMB
AnnaBridge 171:3a7713b1edbc 79 PWM_25 = (4 << PWM_SHIFT) | (0 << PWM_MODULE_SHIFT) | (0), // PWM4 Submodule 0 PWMA
AnnaBridge 171:3a7713b1edbc 80 PWM_26 = (4 << PWM_SHIFT) | (0 << PWM_MODULE_SHIFT) | (1), // PWM4 Submodule 0 PWMB
AnnaBridge 171:3a7713b1edbc 81 PWM_27 = (4 << PWM_SHIFT) | (1 << PWM_MODULE_SHIFT) | (0), // PWM4 Submodule 1 PWMA
AnnaBridge 171:3a7713b1edbc 82 PWM_28 = (4 << PWM_SHIFT) | (1 << PWM_MODULE_SHIFT) | (1), // PWM4 Submodule 1 PWMB
AnnaBridge 171:3a7713b1edbc 83 PWM_29 = (4 << PWM_SHIFT) | (2 << PWM_MODULE_SHIFT) | (0), // PWM4 Submodule 2 PWMA
AnnaBridge 171:3a7713b1edbc 84 PWM_30 = (4 << PWM_SHIFT) | (2 << PWM_MODULE_SHIFT) | (1), // PWM4 Submodule 2 PWMB
AnnaBridge 171:3a7713b1edbc 85 PWM_31 = (4 << PWM_SHIFT) | (3 << PWM_MODULE_SHIFT) | (0), // PWM4 Submodule 3 PWMA
AnnaBridge 171:3a7713b1edbc 86 PWM_32 = (4 << PWM_SHIFT) | (3 << PWM_MODULE_SHIFT) | (1) // PWM4 Submodule 3 PWMB
AnnaBridge 171:3a7713b1edbc 87 } PWMName;
AnnaBridge 171:3a7713b1edbc 88
AnnaBridge 171:3a7713b1edbc 89 #define ADC_INSTANCE_SHIFT 8
AnnaBridge 171:3a7713b1edbc 90 typedef enum {
AnnaBridge 171:3a7713b1edbc 91 ADC1_0 = (1 << ADC_INSTANCE_SHIFT | 0),
AnnaBridge 171:3a7713b1edbc 92 ADC1_1 = (1 << ADC_INSTANCE_SHIFT | 1),
AnnaBridge 171:3a7713b1edbc 93 ADC1_2 = (1 << ADC_INSTANCE_SHIFT | 2),
AnnaBridge 171:3a7713b1edbc 94 ADC1_3 = (1 << ADC_INSTANCE_SHIFT | 3),
AnnaBridge 171:3a7713b1edbc 95 ADC1_4 = (1 << ADC_INSTANCE_SHIFT | 4),
AnnaBridge 171:3a7713b1edbc 96 ADC1_5 = (1 << ADC_INSTANCE_SHIFT | 5),
AnnaBridge 171:3a7713b1edbc 97 ADC1_6 = (1 << ADC_INSTANCE_SHIFT | 6),
AnnaBridge 171:3a7713b1edbc 98 ADC1_7 = (1 << ADC_INSTANCE_SHIFT | 7),
AnnaBridge 171:3a7713b1edbc 99 ADC1_8 = (1 << ADC_INSTANCE_SHIFT | 8),
AnnaBridge 171:3a7713b1edbc 100 ADC1_9 = (1 << ADC_INSTANCE_SHIFT | 9),
AnnaBridge 171:3a7713b1edbc 101 ADC1_10 = (1 << ADC_INSTANCE_SHIFT | 10),
AnnaBridge 171:3a7713b1edbc 102 ADC1_11 = (1 << ADC_INSTANCE_SHIFT | 11),
AnnaBridge 171:3a7713b1edbc 103 ADC1_12 = (1 << ADC_INSTANCE_SHIFT | 12),
AnnaBridge 171:3a7713b1edbc 104 ADC1_13 = (1 << ADC_INSTANCE_SHIFT | 13),
AnnaBridge 171:3a7713b1edbc 105 ADC1_14 = (1 << ADC_INSTANCE_SHIFT | 14),
AnnaBridge 171:3a7713b1edbc 106 ADC1_15 = (1 << ADC_INSTANCE_SHIFT | 15),
AnnaBridge 171:3a7713b1edbc 107 ADC2_0 = (2 << ADC_INSTANCE_SHIFT | 0),
AnnaBridge 171:3a7713b1edbc 108 ADC2_1 = (2 << ADC_INSTANCE_SHIFT | 1),
AnnaBridge 171:3a7713b1edbc 109 ADC2_2 = (2 << ADC_INSTANCE_SHIFT | 2),
AnnaBridge 171:3a7713b1edbc 110 ADC2_3 = (2 << ADC_INSTANCE_SHIFT | 3),
AnnaBridge 171:3a7713b1edbc 111 ADC2_4 = (2 << ADC_INSTANCE_SHIFT | 4),
AnnaBridge 171:3a7713b1edbc 112 ADC2_5 = (2 << ADC_INSTANCE_SHIFT | 5),
AnnaBridge 171:3a7713b1edbc 113 ADC2_6 = (2 << ADC_INSTANCE_SHIFT | 6),
AnnaBridge 171:3a7713b1edbc 114 ADC2_7 = (2 << ADC_INSTANCE_SHIFT | 7),
AnnaBridge 171:3a7713b1edbc 115 ADC2_8 = (2 << ADC_INSTANCE_SHIFT | 8),
AnnaBridge 171:3a7713b1edbc 116 ADC2_9 = (2 << ADC_INSTANCE_SHIFT | 9),
AnnaBridge 171:3a7713b1edbc 117 ADC2_10 = (2 << ADC_INSTANCE_SHIFT | 10),
AnnaBridge 171:3a7713b1edbc 118 ADC2_11 = (2 << ADC_INSTANCE_SHIFT | 11),
AnnaBridge 171:3a7713b1edbc 119 ADC2_12 = (2 << ADC_INSTANCE_SHIFT | 12),
AnnaBridge 171:3a7713b1edbc 120 ADC2_13 = (2 << ADC_INSTANCE_SHIFT | 13),
AnnaBridge 171:3a7713b1edbc 121 ADC2_14 = (2 << ADC_INSTANCE_SHIFT | 14),
AnnaBridge 171:3a7713b1edbc 122 ADC2_15 = (2 << ADC_INSTANCE_SHIFT | 15),
AnnaBridge 171:3a7713b1edbc 123 } ADCName;
AnnaBridge 171:3a7713b1edbc 124
AnnaBridge 171:3a7713b1edbc 125 typedef enum {
AnnaBridge 171:3a7713b1edbc 126 DAC_0 = 0
AnnaBridge 171:3a7713b1edbc 127 } DACName;
AnnaBridge 171:3a7713b1edbc 128
AnnaBridge 171:3a7713b1edbc 129
AnnaBridge 171:3a7713b1edbc 130 typedef enum {
AnnaBridge 171:3a7713b1edbc 131 SPI_1 = 1,
AnnaBridge 171:3a7713b1edbc 132 SPI_2 = 2,
AnnaBridge 171:3a7713b1edbc 133 SPI_3 = 3,
AnnaBridge 171:3a7713b1edbc 134 } SPIName;
AnnaBridge 171:3a7713b1edbc 135
AnnaBridge 171:3a7713b1edbc 136 #ifdef __cplusplus
AnnaBridge 171:3a7713b1edbc 137 }
AnnaBridge 171:3a7713b1edbc 138 #endif
AnnaBridge 171:3a7713b1edbc 139
AnnaBridge 171:3a7713b1edbc 140 #endif