Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
DynamicPinList.h
00001 /* 00002 * Copyright (c) 2019, Arm Limited and affiliates. 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #ifndef DYNAMIC_PIN_LIST_H 00019 #define DYNAMIC_PIN_LIST_H 00020 00021 #include "pinmap.h" 00022 #include <vector> 00023 00024 class DynamicPinList { 00025 public: 00026 00027 /** 00028 * Create an empty pin list 00029 */ 00030 DynamicPinList(); 00031 00032 /** 00033 * Create a pin list with the given contents 00034 * 00035 * @param pin_list List of pins to create this list from 00036 */ 00037 DynamicPinList(const PinList *pin_list); 00038 00039 /** 00040 * Create a copy of another list 00041 * 00042 * @param other Other object to copy contruct this from 00043 */ 00044 DynamicPinList(const DynamicPinList &other); 00045 00046 /** 00047 * Add a pin to the pin list 00048 * 00049 * @param pin Pin to add to this pin list 00050 */ 00051 void add(PinName pin); 00052 00053 /** 00054 * Check if the given pin is in this list 00055 * 00056 * @param pin Pin to check for in the list 00057 * @return true if the pin is in the list, false otherwise 00058 */ 00059 bool has_pin(PinName pin) const; 00060 00061 /** 00062 * Empty this pin list 00063 */ 00064 void clear(); 00065 00066 /** 00067 * Return the number of pins in this list 00068 * 00069 * @return Elements in this list 00070 */ 00071 uint32_t count() const; 00072 00073 /** 00074 * Get the pin at the given index 00075 * 00076 * @return Pin at this position 00077 */ 00078 PinName get(uint32_t index) const; 00079 00080 /** 00081 * Get the location of the given pin 00082 * 00083 * @param pin Pin to get the index of 00084 * @return pin index or -1 if pin is not in the list 00085 */ 00086 int index(PinName pin) const; 00087 00088 private: 00089 std::vector<PinName> _pins; 00090 }; 00091 00092 #endif
Generated on Tue Jul 12 2022 13:54:17 by
