Mistake on this page?
Report an issue in GitHub or email us
DynamicPinList.h
1 /*
2  * Copyright (c) 2019, Arm Limited and affiliates.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef DYNAMIC_PIN_LIST_H
19 #define DYNAMIC_PIN_LIST_H
20 
21 #include "pinmap.h"
22 #include <vector>
23 
25 public:
26 
27  /**
28  * Create an empty pin list
29  */
31 
32  /**
33  * Create a pin list with the given contents
34  *
35  * @param pin_list List of pins to create this list from
36  */
37  DynamicPinList(const PinList *pin_list);
38 
39  /**
40  * Create a copy of another list
41  *
42  * @param other Other object to copy contruct this from
43  */
44  DynamicPinList(const DynamicPinList &other);
45 
46  /**
47  * Add a pin to the pin list
48  *
49  * @param pin Pin to add to this pin list
50  */
51  void add(PinName pin);
52 
53  /**
54  * Check if the given pin is in this list
55  *
56  * @param pin Pin to check for in the list
57  * @return true if the pin is in the list, false otherwise
58  */
59  bool has_pin(PinName pin) const;
60 
61  /**
62  * Empty this pin list
63  */
64  void clear();
65 
66  /**
67  * Return the number of pins in this list
68  *
69  * @return Elements in this list
70  */
71  uint32_t count() const;
72 
73  /**
74  * Get the pin at the given index
75  *
76  * @return Pin at this position
77  */
78  PinName get(uint32_t index) const;
79 
80  /**
81  * Get the location of the given pin
82  *
83  * @param pin Pin to get the index of
84  * @return pin index or -1 if pin is not in the list
85  */
86  int index(PinName pin) const;
87 
88 private:
89  std::vector<PinName> _pins;
90 };
91 
92 #endif
Definition: pinmap.h:37
bool has_pin(PinName pin) const
Check if the given pin is in this list.
int index(PinName pin) const
Get the location of the given pin.
void add(PinName pin)
Add a pin to the pin list.
void clear()
Empty this pin list.
uint32_t count() const
Return the number of pins in this list.
DynamicPinList()
Create an empty pin list.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.