Skip to content

Commit b4be996

Browse files
author
Filip Jagodzinski
committed
Add HAL API for GPIO-IRQ pinmap
1 parent 2f136b9 commit b4be996

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

hal/gpio_irq_api.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#define MBED_GPIO_IRQ_API_H
2222

2323
#include "device.h"
24+
#include "pinmap.h"
2425

2526
#if DEVICE_INTERRUPTIN
2627

@@ -85,6 +86,18 @@ void gpio_irq_enable(gpio_irq_t *obj);
8586
*/
8687
void gpio_irq_disable(gpio_irq_t *obj);
8788

89+
/** Get the pins that support all GPIO IRQ tests
90+
*
91+
* Return a PinMap array of pins that support GPIO IRQ.
92+
* The array is terminated with {NC, NC, 0}.
93+
*
94+
* Targets should override the weak implementation of this
95+
* function to provide the actual pinmap for GPIO IRQ testing.
96+
*
97+
* @return PinMap array
98+
*/
99+
const PinMap *gpio_irq_pinmap(void);
100+
88101
/**@}*/
89102

90103
#ifdef __cplusplus

hal/mbed_gpio_irq.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2019 ARM Limited
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+
#include "hal/gpio_irq_api.h"
18+
19+
#if DEVICE_INTERRUPTIN
20+
21+
#include "platform/mbed_toolchain.h"
22+
#include "hal/gpio_api.h"
23+
24+
MBED_WEAK const PinMap *gpio_irq_pinmap()
25+
{
26+
// Targets should override this weak implementation to provide correct data.
27+
// By default, this is exactly the same as GPIO PinMap.
28+
return gpio_pinmap();
29+
}
30+
31+
#endif

0 commit comments

Comments
 (0)