Skip to content

Commit af14b05

Browse files
committed
Add mbed-os patches
1 parent 92346b0 commit af14b05

File tree

1 file changed

+126
-0
lines changed

1 file changed

+126
-0
lines changed
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
From 9747c709c688d2c34309daa8732439a0a3e2df43 Mon Sep 17 00:00:00 2001
2+
From: Martino Facchin <m.facchin@arduino.cc>
3+
Date: Tue, 6 Nov 2018 16:23:20 +0100
4+
Subject: [PATCH] make gpio apis non static
5+
6+
---
7+
targets/TARGET_STM/gpio_object.c | 69 ++++++++++++++++++++++++++++++++
8+
targets/TARGET_STM/gpio_object.h | 26 ++----------
9+
2 files changed, 72 insertions(+), 23 deletions(-)
10+
create mode 100644 targets/TARGET_STM/gpio_object.c
11+
12+
diff --git a/targets/TARGET_STM/gpio_object.c b/targets/TARGET_STM/gpio_object.c
13+
new file mode 100644
14+
index 000000000..44173403a
15+
--- /dev/null
16+
+++ b/targets/TARGET_STM/gpio_object.c
17+
@@ -0,0 +1,69 @@
18+
+/* mbed Microcontroller Library
19+
+ *******************************************************************************
20+
+ * Copyright (c) 2016, STMicroelectronics
21+
+ * All rights reserved.
22+
+ *
23+
+ * Redistribution and use in source and binary forms, with or without
24+
+ * modification, are permitted provided that the following conditions are met:
25+
+ *
26+
+ * 1. Redistributions of source code must retain the above copyright notice,
27+
+ * this list of conditions and the following disclaimer.
28+
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
29+
+ * this list of conditions and the following disclaimer in the documentation
30+
+ * and/or other materials provided with the distribution.
31+
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
32+
+ * may be used to endorse or promote products derived from this software
33+
+ * without specific prior written permission.
34+
+ *
35+
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
36+
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37+
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
38+
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
39+
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
40+
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
41+
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
42+
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
43+
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
44+
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45+
+ *******************************************************************************
46+
+ */
47+
+
48+
+#include "mbed_assert.h"
49+
+#include "cmsis.h"
50+
+#include "PortNames.h"
51+
+#include "PeripheralNames.h"
52+
+#include "PinNames.h"
53+
+#include "gpio_object.h"
54+
+
55+
+#ifdef __cplusplus
56+
+extern "C" {
57+
+#endif
58+
+
59+
+void gpio_write(gpio_t *obj, int value)
60+
+{
61+
+ if (value) {
62+
+ *obj->reg_set = obj->mask;
63+
+ } else {
64+
+#ifdef GPIO_IP_WITHOUT_BRR
65+
+ *obj->reg_clr = obj->mask << 16;
66+
+#else
67+
+ *obj->reg_clr = obj->mask;
68+
+#endif
69+
+ }
70+
+}
71+
+
72+
+int gpio_read(gpio_t *obj)
73+
+{
74+
+ return ((*obj->reg_in & obj->mask) ? 1 : 0);
75+
+}
76+
+
77+
+int gpio_is_connected(const gpio_t *obj)
78+
+{
79+
+ return obj->pin != (PinName)NC;
80+
+}
81+
+
82+
+
83+
+#ifdef __cplusplus
84+
+}
85+
+#endif
86+
+
87+
diff --git a/targets/TARGET_STM/gpio_object.h b/targets/TARGET_STM/gpio_object.h
88+
index 230c8a0e2..aa7b2c33e 100644
89+
--- a/targets/TARGET_STM/gpio_object.h
90+
+++ b/targets/TARGET_STM/gpio_object.h
91+
@@ -55,29 +55,9 @@ typedef struct {
92+
uint32_t ll_pin;
93+
} gpio_t;
94+
95+
-static inline void gpio_write(gpio_t *obj, int value)
96+
-{
97+
- if (value) {
98+
- *obj->reg_set = obj->mask;
99+
- } else {
100+
-#ifdef GPIO_IP_WITHOUT_BRR
101+
- *obj->reg_clr = obj->mask << 16;
102+
-#else
103+
- *obj->reg_clr = obj->mask;
104+
-#endif
105+
- }
106+
-}
107+
-
108+
-static inline int gpio_read(gpio_t *obj)
109+
-{
110+
- return ((*obj->reg_in & obj->mask) ? 1 : 0);
111+
-}
112+
-
113+
-static inline int gpio_is_connected(const gpio_t *obj)
114+
-{
115+
- return obj->pin != (PinName)NC;
116+
-}
117+
-
118+
+void gpio_write(gpio_t *obj, int value);
119+
+int gpio_read(gpio_t *obj);
120+
+int gpio_is_connected(const gpio_t *obj);
121+
122+
#ifdef __cplusplus
123+
}
124+
--
125+
2.19.1
126+

0 commit comments

Comments
 (0)