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/pinmap_function.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 PINMAP_FUNCTION_H
Kojto 111:4336505e4b1c 17 #define PINMAP_FUNCTION_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 #include "pinmux.h"
Kojto 111:4336505e4b1c 23 #include "pinmap.h"
Kojto 111:4336505e4b1c 24
Kojto 111:4336505e4b1c 25 #include "PeripheralPins.h"
Kojto 111:4336505e4b1c 26
Kojto 111:4336505e4b1c 27 #ifdef __cplusplus
Kojto 111:4336505e4b1c 28 extern "C" {
Kojto 111:4336505e4b1c 29 #endif
Kojto 111:4336505e4b1c 30
Kojto 111:4336505e4b1c 31 enum sercom_pad_selection {
Kojto 111:4336505e4b1c 32 SERCOM_USE_DEFAULT_PAD,
Kojto 111:4336505e4b1c 33 SERCOM_USE_EXTENDED_PAD,
Kojto 111:4336505e4b1c 34 };
Kojto 111:4336505e4b1c 35
Kojto 111:4336505e4b1c 36 /** Find the SERCOM peripheral of given pin
Kojto 111:4336505e4b1c 37 *
Kojto 111:4336505e4b1c 38 * Find and return the SERCOM peripheral of input pin, either from default pas, or from extended pads
Kojto 111:4336505e4b1c 39 * @param[in] pin1 First pin
Kojto 111:4336505e4b1c 40 * @param[in] pad_select Second pin
Kojto 111:4336505e4b1c 41 * @return SERCOM peripheral if found, else, NC
Kojto 111:4336505e4b1c 42 */
Kojto 111:4336505e4b1c 43 uint32_t pinmap_find_peripheral_from_pad(PinName pin, enum sercom_pad_selection pad_select);
Kojto 111:4336505e4b1c 44
Kojto 111:4336505e4b1c 45 /** Find the common SERCOM shared by two pins
Kojto 111:4336505e4b1c 46 *
Kojto 111:4336505e4b1c 47 * Finds the common SERCOM index of two input pins.
Kojto 111:4336505e4b1c 48 * If swapping the input argument gives different result, it means, two SERCOMs share both pins
Kojto 111:4336505e4b1c 49 * @param[in] pin1 First pin
Kojto 111:4336505e4b1c 50 * @param[in] pin2 Second pin
Kojto 111:4336505e4b1c 51 * @return SERCOM index if found, else, NC
Kojto 111:4336505e4b1c 52 */
Kojto 111:4336505e4b1c 53 uint32_t pinmap_merge_sercom(PinName pin1, PinName pin2);
Kojto 111:4336505e4b1c 54
Kojto 111:4336505e4b1c 55 /** Find the common SERCOM shared by four pins
Kojto 111:4336505e4b1c 56 *
Kojto 111:4336505e4b1c 57 * Finds the common SERCOM index shared by four input pins.
Kojto 111:4336505e4b1c 58 * If reversing the input argument order gives different result, it means, two SERCOMs share the pins
Kojto 111:4336505e4b1c 59 * @param[in] pin1 First pin
Kojto 111:4336505e4b1c 60 * @param[in] pin2 Second pin
Kojto 111:4336505e4b1c 61 * @param[in] pin3 Third pin
Kojto 111:4336505e4b1c 62 * @param[in] pin4 Fourth pin
Kojto 111:4336505e4b1c 63 * @return SERCOM index if found, else, NC
Kojto 111:4336505e4b1c 64 */
Kojto 111:4336505e4b1c 65 uint32_t pinmap_find_sercom(PinName pin1, PinName pin2, PinName pin3, PinName pin4);
Kojto 111:4336505e4b1c 66
Kojto 111:4336505e4b1c 67 /** Find the MUX function of input pin specific to given SERCOM index
Kojto 111:4336505e4b1c 68 *
Kojto 111:4336505e4b1c 69 * @param[in] pin Pin whose function is to be found out
Kojto 111:4336505e4b1c 70 * @param[in] sercom_index SERCOM index
Kojto 111:4336505e4b1c 71 * @return MUX function if found, else, NC
Kojto 111:4336505e4b1c 72 */
Kojto 111:4336505e4b1c 73 uint32_t pinmap_function_sercom(PinName pin, uint32_t sercom_index);
Kojto 111:4336505e4b1c 74
Kojto 111:4336505e4b1c 75 /** Find the MUX pad of input pin specific to given SERCOM index
Kojto 111:4336505e4b1c 76 *
Kojto 111:4336505e4b1c 77 * @param[in] pin Pin whose function is to be found out
Kojto 111:4336505e4b1c 78 * @param[in] sercom_index SERCOM index
Kojto 111:4336505e4b1c 79 * @return MUX pad if found, else, NC
Kojto 111:4336505e4b1c 80 */
Kojto 111:4336505e4b1c 81 uint32_t pinmap_pad_sercom(PinName pin, uint32_t sercom_index);
Kojto 111:4336505e4b1c 82
Kojto 111:4336505e4b1c 83 /** Find the MUX function of input pin specific to given SERCOM index
Kojto 111:4336505e4b1c 84 *
Kojto 111:4336505e4b1c 85 * @param[in] pin unused
Kojto 111:4336505e4b1c 86 * @param[in] sercom_index SERCOM index
Kojto 111:4336505e4b1c 87 * @return base address to SERCOM if found, else NC
Kojto 111:4336505e4b1c 88 */
Kojto 111:4336505e4b1c 89 uint32_t pinmap_peripheral_sercom(PinName pin, uint32_t sercom_index);
Kojto 111:4336505e4b1c 90
Kojto 111:4336505e4b1c 91 /** Find the channel index of a pin specific to a PWM instance
Kojto 111:4336505e4b1c 92 *
Kojto 111:4336505e4b1c 93 * @param[in] pin pin name
Kojto 111:4336505e4b1c 94 * @param[in] pwm pwm peripheral (unused now)
Kojto 111:4336505e4b1c 95 * @return Channel index of the specified pin
Kojto 111:4336505e4b1c 96 */
Kojto 111:4336505e4b1c 97 uint32_t pinmap_channel_pwm(PinName pin, PWMName pwm);
Kojto 111:4336505e4b1c 98
Kojto 111:4336505e4b1c 99 #ifdef __cplusplus
Kojto 111:4336505e4b1c 100 }
Kojto 111:4336505e4b1c 101 #endif
Kojto 111:4336505e4b1c 102
Kojto 111:4336505e4b1c 103 #endif /* PINMAP_FUNCTION_H */