Add HAL API for GPIO-IRQ pinmap

pull/11074/head
Filip Jagodzinski 2019-07-18 17:20:08 +02:00
parent c5c745804d
commit bd5ecaadcd
2 changed files with 44 additions and 0 deletions

View File

@ -21,6 +21,7 @@
#define MBED_GPIO_IRQ_API_H
#include "device.h"
#include "pinmap.h"
#if DEVICE_INTERRUPTIN
@ -85,6 +86,18 @@ void gpio_irq_enable(gpio_irq_t *obj);
*/
void gpio_irq_disable(gpio_irq_t *obj);
/** Get the pins that support all GPIO IRQ tests
*
* Return a PinMap array of pins that support GPIO IRQ.
* The array is terminated with {NC, NC, 0}.
*
* Targets should override the weak implementation of this
* function to provide the actual pinmap for GPIO IRQ testing.
*
* @return PinMap array
*/
const PinMap *gpio_irq_pinmap(void);
/**@}*/
#ifdef __cplusplus

31
hal/mbed_gpio_irq.c Normal file
View File

@ -0,0 +1,31 @@
/* mbed Microcontroller Library
* Copyright (c) 2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "hal/gpio_irq_api.h"
#if DEVICE_INTERRUPTIN
#include "platform/mbed_toolchain.h"
#include "hal/gpio_api.h"
MBED_WEAK const PinMap *gpio_irq_pinmap()
{
// Targets should override this weak implementation to provide correct data.
// By default, this is exactly the same as GPIO PinMap.
return gpio_pinmap();
}
#endif