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
Parent:
TARGET_SAMR21G18A/TARGET_Atmel/TARGET_SAM_CortexM0P/TARGET_SAMR21G18A/PeripheralNames.h@111:4336505e4b1c
mbed library. Release version 164

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 { // for each input control mux 4,5,6,7,16,17,10,11 used in R21
Kojto 111:4336505e4b1c 48 ADC_2 = 0x2ul,
Kojto 111:4336505e4b1c 49 ADC_3 = 0x3ul,
Kojto 111:4336505e4b1c 50 ADC_4 = 0x4ul,
Kojto 111:4336505e4b1c 51 ADC_5 = 0x5ul,
Kojto 111:4336505e4b1c 52 ADC_6 = 0x6ul,
Kojto 111:4336505e4b1c 53 ADC_7 = 0x7ul,
Kojto 111:4336505e4b1c 54 ADC_8 = 0x8ul,
Kojto 111:4336505e4b1c 55 ADC_10 = 0xAul,
Kojto 111:4336505e4b1c 56 ADC_11 = 0xBul,
Kojto 111:4336505e4b1c 57 ADC_16 = 0x10ul,
Kojto 111:4336505e4b1c 58 ADC_17 = 0x11ul,
Kojto 111:4336505e4b1c 59 ADC_18 = 0x12ul,
Kojto 111:4336505e4b1c 60 ADC_19 = 0x13ul
Kojto 111:4336505e4b1c 61 } ADCName;
Kojto 111:4336505e4b1c 62
Kojto 111:4336505e4b1c 63 typedef enum { // for each channel
Kojto 111:4336505e4b1c 64 EXTINT_0 = 0,
Kojto 111:4336505e4b1c 65 EXTINT_1,
Kojto 111:4336505e4b1c 66 EXTINT_2,
Kojto 111:4336505e4b1c 67 EXTINT_3,
Kojto 111:4336505e4b1c 68 EXTINT_4,
Kojto 111:4336505e4b1c 69 EXTINT_5,
Kojto 111:4336505e4b1c 70 EXTINT_6,
Kojto 111:4336505e4b1c 71 EXTINT_7,
Kojto 111:4336505e4b1c 72 EXTINT_8,
Kojto 111:4336505e4b1c 73 EXTINT_9,
Kojto 111:4336505e4b1c 74 EXTINT_10,
Kojto 111:4336505e4b1c 75 EXTINT_11,
Kojto 111:4336505e4b1c 76 EXTINT_12,
Kojto 111:4336505e4b1c 77 EXTINT_13,
Kojto 111:4336505e4b1c 78 EXTINT_14,
Kojto 111:4336505e4b1c 79 EXTINT_15
Kojto 111:4336505e4b1c 80 } EXTINTName;
Kojto 111:4336505e4b1c 81
Kojto 111:4336505e4b1c 82 typedef enum {
Kojto 111:4336505e4b1c 83 MREPEAT(SERCOM_INST_NUM, _SERCOM_SPI_NAME, ~)
Kojto 111:4336505e4b1c 84 } SPIName;
Kojto 111:4336505e4b1c 85
Kojto 111:4336505e4b1c 86 typedef enum {
Kojto 111:4336505e4b1c 87 MREPEAT(SERCOM_INST_NUM, _SERCOM_I2C_NAME, ~)
Kojto 111:4336505e4b1c 88 } I2CName;
Kojto 111:4336505e4b1c 89
Kojto 111:4336505e4b1c 90 typedef enum {
Kojto 111:4336505e4b1c 91 /* Pad 0 definitions */
Kojto 111:4336505e4b1c 92 MREPEAT(SERCOM_INST_NUM, _SERCOM_PAD_NAME, 0)
Kojto 111:4336505e4b1c 93
Kojto 111:4336505e4b1c 94 /* Pad 1 definitions */
Kojto 111:4336505e4b1c 95 MREPEAT(SERCOM_INST_NUM, _SERCOM_PAD_NAME, 1)
Kojto 111:4336505e4b1c 96
Kojto 111:4336505e4b1c 97 /* Pad 2 definitions */
Kojto 111:4336505e4b1c 98 MREPEAT(SERCOM_INST_NUM, _SERCOM_PAD_NAME, 2)
Kojto 111:4336505e4b1c 99
Kojto 111:4336505e4b1c 100 /* Pad 3 definitions */
Kojto 111:4336505e4b1c 101 MREPEAT(SERCOM_INST_NUM, _SERCOM_PAD_NAME, 3)
Kojto 111:4336505e4b1c 102 } SercomPadName;
Kojto 111:4336505e4b1c 103
Kojto 111:4336505e4b1c 104 typedef enum {
Kojto 111:4336505e4b1c 105 PWM_0 = (0x42002000UL), /**< \brief (TCC0) APB Base Address */
Kojto 111:4336505e4b1c 106 PWM_1 = (0x42002400UL), /**< \brief (TCC1) APB Base Address */
Kojto 111:4336505e4b1c 107 PWM_2 = (0x42002800UL), /**< \brief (TCC2) APB Base Address */
Kojto 111:4336505e4b1c 108 } PWMName;
Kojto 111:4336505e4b1c 109
Kojto 111:4336505e4b1c 110 struct pwm_pin_channel {
Kojto 111:4336505e4b1c 111 PinName pin;
Kojto 111:4336505e4b1c 112 PWMName pwm;
Kojto 111:4336505e4b1c 113 uint8_t channel_index;
Kojto 111:4336505e4b1c 114 };
Kojto 111:4336505e4b1c 115
Kojto 111:4336505e4b1c 116 #define STDIO_UART_TX USBTX
Kojto 111:4336505e4b1c 117 #define STDIO_UART_RX USBRX
Kojto 111:4336505e4b1c 118 #define STDIO_UART UART_0
Kojto 111:4336505e4b1c 119
Kojto 111:4336505e4b1c 120 // Default peripherals
Kojto 111:4336505e4b1c 121 #define MBED_SPI0 PB22, PB02, PB23, PA14
Kojto 111:4336505e4b1c 122
Kojto 111:4336505e4b1c 123 #define MBED_UART0 PA04, PA05
Kojto 111:4336505e4b1c 124 #define MBED_UARTUSB USBTX, USBRX
Kojto 111:4336505e4b1c 125
Kojto 111:4336505e4b1c 126 #define MBED_I2C0 PA16, PA17
Kojto 111:4336505e4b1c 127
Kojto 111:4336505e4b1c 128 #define MBED_ANALOGIN0 PA04
Kojto 111:4336505e4b1c 129 #define MBED_ANALOGIN1 PA05
Kojto 111:4336505e4b1c 130 #define MBED_ANALOGIN2 PA06
Kojto 111:4336505e4b1c 131 #define MBED_ANALOGIN3 PA07
Kojto 111:4336505e4b1c 132 #define MBED_ANALOGIN4 PB02
Kojto 111:4336505e4b1c 133 #define MBED_ANALOGIN5 PB03
Kojto 111:4336505e4b1c 134 #define MBED_ANALOGIN7 PA08
Kojto 111:4336505e4b1c 135 #define MBED_ANALOGIN8 PA09
Kojto 111:4336505e4b1c 136
Kojto 111:4336505e4b1c 137 #define MBED_PWMOUT0 PA18
Kojto 111:4336505e4b1c 138 #define MBED_PWMOUT1 PA19
Kojto 111:4336505e4b1c 139
Kojto 111:4336505e4b1c 140 #ifdef __cplusplus
Kojto 111:4336505e4b1c 141 }
Kojto 111:4336505e4b1c 142 #endif
Kojto 111:4336505e4b1c 143
Kojto 111:4336505e4b1c 144 #endif