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
Kojto 111:4336505e4b1c 1 /* mbed Microcontroller Library
Kojto 111:4336505e4b1c 2 * Copyright (c) 2006-2015 ARM Limited
Kojto 111:4336505e4b1c 3 *
Kojto 111:4336505e4b1c 4 * Licensed under the Apache License, Version 2.0 (the "License");
Kojto 111:4336505e4b1c 5 * you may not use this file except in compliance with the License.
Kojto 111:4336505e4b1c 6 * You may obtain a copy of the License at
Kojto 111:4336505e4b1c 7 *
Kojto 111:4336505e4b1c 8 * http://www.apache.org/licenses/LICENSE-2.0
Kojto 111:4336505e4b1c 9 *
Kojto 111:4336505e4b1c 10 * Unless required by applicable law or agreed to in writing, software
Kojto 111:4336505e4b1c 11 * distributed under the License is distributed on an "AS IS" BASIS,
Kojto 111:4336505e4b1c 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Kojto 111:4336505e4b1c 13 * See the License for the specific language governing permissions and
Kojto 111:4336505e4b1c 14 * limitations under the License.
Kojto 111:4336505e4b1c 15 */
Kojto 111:4336505e4b1c 16 #ifndef MBED_PERIPHERALNAMES_H
Kojto 111:4336505e4b1c 17 #define MBED_PERIPHERALNAMES_H
Kojto 111:4336505e4b1c 18
Kojto 111:4336505e4b1c 19 #include <compiler.h>
Kojto 111:4336505e4b1c 20 #include "cmsis.h"
Kojto 111:4336505e4b1c 21 #include "PinNames.h"
Kojto 111:4336505e4b1c 22
Kojto 111:4336505e4b1c 23 #ifdef __cplusplus
Kojto 111:4336505e4b1c 24 extern "C" {
Kojto 111:4336505e4b1c 25 #endif
Kojto 111:4336505e4b1c 26
Kojto 111:4336505e4b1c 27 #define _SERCOM_SPI_NAME(n, unused) \
Kojto 111:4336505e4b1c 28 SPI##n,
Kojto 111:4336505e4b1c 29
Kojto 111:4336505e4b1c 30 #define _SERCOM_PAD_NAME(n, pad) \
Kojto 111:4336505e4b1c 31 SERCOM##n##_PAD##pad = ((n & 0xF) | ((pad & 0xF) << 4)),
Kojto 111:4336505e4b1c 32
Kojto 111:4336505e4b1c 33 #define _SERCOM_I2C_NAME(n, unused) \
Kojto 111:4336505e4b1c 34 I2C##n,
Kojto 111:4336505e4b1c 35
Kojto 111:4336505e4b1c 36
Kojto 111:4336505e4b1c 37
Kojto 111:4336505e4b1c 38 typedef enum {
Kojto 111:4336505e4b1c 39 UART_0 = (int)0x42000800UL, // Base address of SERCOM0
Kojto 111:4336505e4b1c 40 UART_1 = (int)0x42000C00UL, // Base address of SERCOM1
Kojto 111:4336505e4b1c 41 UART_2 = (int)0x42001000UL, // Base address of SERCOM2
Kojto 111:4336505e4b1c 42 UART_3 = (int)0x42001400UL, // Base address of SERCOM3
Kojto 111:4336505e4b1c 43 UART_4 = (int)0x42001800UL, // Base address of SERCOM4
Kojto 111:4336505e4b1c 44 UART_5 = (int)0x42001C00UL // Base address of SERCOM5
Kojto 111:4336505e4b1c 45 } UARTName;
Kojto 111:4336505e4b1c 46
Kojto 111:4336505e4b1c 47 typedef enum {
Kojto 111:4336505e4b1c 48 ADC_0 = 0x0ul,
Kojto 111:4336505e4b1c 49 ADC_1 = 0x1ul,
Kojto 111:4336505e4b1c 50 ADC_2 = 0x2ul,
Kojto 111:4336505e4b1c 51 ADC_3 = 0x3ul,
Kojto 111:4336505e4b1c 52 ADC_4 = 0x4ul,
Kojto 111:4336505e4b1c 53 ADC_5 = 0x5ul,
Kojto 111:4336505e4b1c 54 ADC_6 = 0x6ul,
Kojto 111:4336505e4b1c 55 ADC_7 = 0x7ul,
Kojto 111:4336505e4b1c 56 ADC_10 = 0xAul,
Kojto 111:4336505e4b1c 57 ADC_11 = 0xBul,
Kojto 111:4336505e4b1c 58 ADC_16 = 0x10ul,
Kojto 111:4336505e4b1c 59 ADC_17 = 0x11ul,
Kojto 111:4336505e4b1c 60 ADC_18 = 0x12ul,
Kojto 111:4336505e4b1c 61 ADC_19 = 0x13ul
Kojto 111:4336505e4b1c 62 } ADCName;
Kojto 111:4336505e4b1c 63
Kojto 111:4336505e4b1c 64 typedef enum {
Kojto 111:4336505e4b1c 65 DAC_0 = 0x42004800UL
Kojto 111:4336505e4b1c 66 } DACName;
Kojto 111:4336505e4b1c 67
Kojto 111:4336505e4b1c 68 typedef enum { // for each channel
Kojto 111:4336505e4b1c 69 EXTINT_0 = 0,
Kojto 111:4336505e4b1c 70 EXTINT_1,
Kojto 111:4336505e4b1c 71 EXTINT_2,
Kojto 111:4336505e4b1c 72 EXTINT_3,
Kojto 111:4336505e4b1c 73 EXTINT_4,
Kojto 111:4336505e4b1c 74 EXTINT_5,
Kojto 111:4336505e4b1c 75 EXTINT_6,
Kojto 111:4336505e4b1c 76 EXTINT_7,
Kojto 111:4336505e4b1c 77 EXTINT_8,
Kojto 111:4336505e4b1c 78 EXTINT_9,
Kojto 111:4336505e4b1c 79 EXTINT_10,
Kojto 111:4336505e4b1c 80 EXTINT_11,
Kojto 111:4336505e4b1c 81 EXTINT_12,
Kojto 111:4336505e4b1c 82 EXTINT_13,
Kojto 111:4336505e4b1c 83 EXTINT_14,
Kojto 111:4336505e4b1c 84 EXTINT_15
Kojto 111:4336505e4b1c 85 } EXTINTName;
Kojto 111:4336505e4b1c 86
Kojto 111:4336505e4b1c 87 typedef enum {
Kojto 111:4336505e4b1c 88 MREPEAT(SERCOM_INST_NUM, _SERCOM_SPI_NAME, ~)
Kojto 111:4336505e4b1c 89 } SPIName;
Kojto 111:4336505e4b1c 90
Kojto 111:4336505e4b1c 91 typedef enum {
Kojto 111:4336505e4b1c 92 MREPEAT(SERCOM_INST_NUM, _SERCOM_I2C_NAME, ~)
Kojto 111:4336505e4b1c 93 } I2CName;
Kojto 111:4336505e4b1c 94
Kojto 111:4336505e4b1c 95 typedef enum {
Kojto 111:4336505e4b1c 96 /* Pad 0 definitions */
Kojto 111:4336505e4b1c 97 MREPEAT(SERCOM_INST_NUM, _SERCOM_PAD_NAME, 0)
Kojto 111:4336505e4b1c 98
Kojto 111:4336505e4b1c 99 /* Pad 1 definitions */
Kojto 111:4336505e4b1c 100 MREPEAT(SERCOM_INST_NUM, _SERCOM_PAD_NAME, 1)
Kojto 111:4336505e4b1c 101
Kojto 111:4336505e4b1c 102 /* Pad 2 definitions */
Kojto 111:4336505e4b1c 103 MREPEAT(SERCOM_INST_NUM, _SERCOM_PAD_NAME, 2)
Kojto 111:4336505e4b1c 104
Kojto 111:4336505e4b1c 105 /* Pad 3 definitions */
Kojto 111:4336505e4b1c 106 MREPEAT(SERCOM_INST_NUM, _SERCOM_PAD_NAME, 3)
Kojto 111:4336505e4b1c 107 } SercomPadName;
Kojto 111:4336505e4b1c 108
Kojto 111:4336505e4b1c 109 typedef enum {
Kojto 111:4336505e4b1c 110 PWM_0 = (0x42002000UL), /**< \brief (TCC0) APB Base Address */
Kojto 111:4336505e4b1c 111 PWM_1 = (0x42002400UL), /**< \brief (TCC1) APB Base Address */
Kojto 111:4336505e4b1c 112 PWM_2 = (0x42002800UL), /**< \brief (TCC2) APB Base Address */
Kojto 111:4336505e4b1c 113 } PWMName;
Kojto 111:4336505e4b1c 114
Kojto 111:4336505e4b1c 115 struct pwm_pin_channel {
Kojto 111:4336505e4b1c 116 PinName pin;
Kojto 111:4336505e4b1c 117 PWMName pwm;
Kojto 111:4336505e4b1c 118 uint8_t channel_index;
Kojto 111:4336505e4b1c 119 };
Kojto 111:4336505e4b1c 120
Kojto 111:4336505e4b1c 121 #define STDIO_UART_TX USBTX
Kojto 111:4336505e4b1c 122 #define STDIO_UART_RX USBRX
Kojto 111:4336505e4b1c 123 #define STDIO_UART UART_3
Kojto 111:4336505e4b1c 124
Kojto 111:4336505e4b1c 125 // Default peripherals
Kojto 111:4336505e4b1c 126 #define MBED_SPI0 PA18, PA16, PA19, PA17
Kojto 111:4336505e4b1c 127
Kojto 111:4336505e4b1c 128 #define MBED_UART0 PA04, PA05
Kojto 111:4336505e4b1c 129 #define MBED_UARTUSB USBTX, USBRX
Kojto 111:4336505e4b1c 130
Kojto 111:4336505e4b1c 131 #define MBED_I2C0 PA08, PA09
Kojto 111:4336505e4b1c 132
Kojto 111:4336505e4b1c 133 #define MBED_ANALOGOUT0 PA02
Kojto 111:4336505e4b1c 134
Kojto 111:4336505e4b1c 135 #define MBED_ANALOGIN0 PA03
Kojto 111:4336505e4b1c 136 #define MBED_ANALOGIN1 PA08
Kojto 111:4336505e4b1c 137 #define MBED_ANALOGIN2 PB09
Kojto 111:4336505e4b1c 138 #define MBED_ANALOGIN3 PA04
Kojto 111:4336505e4b1c 139 #define MBED_ANALOGIN4 PA05
Kojto 111:4336505e4b1c 140 #define MBED_ANALOGIN5 PA06
Kojto 111:4336505e4b1c 141 #define MBED_ANALOGIN7 PA07
Kojto 111:4336505e4b1c 142
Kojto 111:4336505e4b1c 143 #define MBED_PWMOUT0 PA18
Kojto 111:4336505e4b1c 144 #define MBED_PWMOUT1 PA19
Kojto 111:4336505e4b1c 145
Kojto 111:4336505e4b1c 146 #ifdef __cplusplus
Kojto 111:4336505e4b1c 147 }
Kojto 111:4336505e4b1c 148 #endif
Kojto 111:4336505e4b1c 149
Kojto 111:4336505e4b1c 150 #endif