Reorganized GPIO drivers

This commit is contained in:
Silvano Seva 2024-10-12 15:18:00 +02:00
parent b7ccbd5eb6
commit a310a0a2d1
6 changed files with 39 additions and 10 deletions

View File

@ -80,6 +80,7 @@ openrtx_inc = ['openrtx/include',
'platform/drivers/GPS', 'platform/drivers/GPS',
'platform/drivers/SPI', 'platform/drivers/SPI',
'platform/drivers/USB', 'platform/drivers/USB',
'platform/drivers/GPIO',
'platform/drivers/tones', 'platform/drivers/tones',
'platform/drivers/baseband', 'platform/drivers/baseband',
'platform/drivers/backlight', 'platform/drivers/backlight',
@ -210,7 +211,6 @@ stm32f405_src = ['platform/mcu/STM32F4xx/boot/startup.cpp',
'platform/mcu/STM32F4xx/drivers/usb/usbd_ioreq.c', 'platform/mcu/STM32F4xx/drivers/usb/usbd_ioreq.c',
'platform/mcu/STM32F4xx/drivers/usb/usbd_req.c', 'platform/mcu/STM32F4xx/drivers/usb/usbd_req.c',
'platform/mcu/STM32F4xx/drivers/usb/usbd_usr.c', 'platform/mcu/STM32F4xx/drivers/usb/usbd_usr.c',
'platform/mcu/STM32F4xx/drivers/gpio.c',
'platform/mcu/STM32F4xx/drivers/usb_vcom.c', 'platform/mcu/STM32F4xx/drivers/usb_vcom.c',
'platform/mcu/STM32F4xx/drivers/delays.cpp', 'platform/mcu/STM32F4xx/drivers/delays.cpp',
'platform/mcu/STM32F4xx/drivers/rtc.c', 'platform/mcu/STM32F4xx/drivers/rtc.c',
@ -221,6 +221,7 @@ stm32f405_src = ['platform/mcu/STM32F4xx/boot/startup.cpp',
'platform/mcu/STM32F4xx/drivers/i2c_stm32.c', 'platform/mcu/STM32F4xx/drivers/i2c_stm32.c',
'platform/mcu/STM32F4xx/drivers/adc_stm32.c', 'platform/mcu/STM32F4xx/drivers/adc_stm32.c',
'platform/drivers/SPI/spi_stm32.c', 'platform/drivers/SPI/spi_stm32.c',
'platform/drivers/GPIO/gpio_stm32.c',
'platform/drivers/audio/stm32_dac.cpp', 'platform/drivers/audio/stm32_dac.cpp',
'platform/drivers/audio/stm32_adc.cpp', 'platform/drivers/audio/stm32_adc.cpp',
'platform/drivers/audio/stm32_pwm.cpp', 'platform/drivers/audio/stm32_pwm.cpp',
@ -242,7 +243,6 @@ stm32f405_def = {'STM32F405xx': '', 'HSE_VALUE':'8000000'}
mk22fn512_src = ['platform/mcu/MK22FN512xxx12/boot/startup.cpp', mk22fn512_src = ['platform/mcu/MK22FN512xxx12/boot/startup.cpp',
'platform/mcu/MK22FN512xxx12/boot/bsp.cpp', 'platform/mcu/MK22FN512xxx12/boot/bsp.cpp',
'platform/mcu/MK22FN512xxx12/boot/libc_integration.cpp', 'platform/mcu/MK22FN512xxx12/boot/libc_integration.cpp',
'platform/mcu/MK22FN512xxx12/drivers/gpio.c',
'platform/mcu/MK22FN512xxx12/drivers/delays.cpp', 'platform/mcu/MK22FN512xxx12/drivers/delays.cpp',
'platform/mcu/MK22FN512xxx12/drivers/I2C0.c', 'platform/mcu/MK22FN512xxx12/drivers/I2C0.c',
'platform/mcu/MK22FN512xxx12/drivers/rng.c', 'platform/mcu/MK22FN512xxx12/drivers/rng.c',
@ -254,6 +254,7 @@ mk22fn512_src = ['platform/mcu/MK22FN512xxx12/boot/startup.cpp',
'platform/mcu/MK22FN512xxx12/drivers/usb/usb_osa_bm.c', 'platform/mcu/MK22FN512xxx12/drivers/usb/usb_osa_bm.c',
'platform/mcu/MK22FN512xxx12/drivers/usb_vcom.c', 'platform/mcu/MK22FN512xxx12/drivers/usb_vcom.c',
'platform/drivers/SPI/spi_mk22.c', 'platform/drivers/SPI/spi_mk22.c',
'platform/drivers/GPIO/gpio_mk22.c',
'platform/mcu/CMSIS/Device/NXP/MK22FN512xxx12/Source/system_MK22F51212.c'] 'platform/mcu/CMSIS/Device/NXP/MK22FN512xxx12/Source/system_MK22F51212.c']
mk22fn512_inc = ['platform/mcu/CMSIS/Include', mk22fn512_inc = ['platform/mcu/CMSIS/Include',

View File

@ -0,0 +1,28 @@
/***************************************************************************
* Copyright (C) 2024 by Silvano Seva IU2KWO *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, see <http://www.gnu.org/licenses/> *
***************************************************************************/
#ifndef GPIO_NATIVE_H
#define GPIO_NATIVE_H
#if defined(PLATFORM_MD3x0) || defined(PLATFORM_MDUV3x0) \
|| defined(PLATFORM_MD9600) || defined(PLATFORM_MOD17)
#include <gpio_stm32.h>
#elif defined(PLATFORM_GD77) || defined(PLATFORM_DM1801)
#include <gpio_mk22.h>
#endif
#endif /* GPIO_NATIVE_H */

View File

@ -16,7 +16,7 @@
***************************************************************************/ ***************************************************************************/
#include <errno.h> #include <errno.h>
#include "MK22F51212.h" #include "MK22F51212.h"
#include "gpio-native.h" #include "gpio_mk22.h"
/* /*
* MK22 GPIO management is a bit convoluted: instead of having all the registers * MK22 GPIO management is a bit convoluted: instead of having all the registers

View File

@ -15,8 +15,8 @@
* along with this program; if not, see <http://www.gnu.org/licenses/> * * along with this program; if not, see <http://www.gnu.org/licenses/> *
***************************************************************************/ ***************************************************************************/
#ifndef GPIO_NATIVE_H #ifndef GPIO_MK22_H
#define GPIO_NATIVE_H #define GPIO_MK22_H
#include <peripherals/gpio.h> #include <peripherals/gpio.h>
#include <hwconfig.h> #include <hwconfig.h>
@ -109,4 +109,4 @@ static inline uint8_t gpio_readPin(const void *port, const uint8_t pin)
} }
#endif #endif
#endif /* GPIO_NATIVE_H */ #endif /* GPIO_MK22_H */

View File

@ -17,7 +17,7 @@
#include <errno.h> #include <errno.h>
#include "stm32f4xx.h" #include "stm32f4xx.h"
#include "gpio-native.h" #include "gpio_stm32.h"
static inline void setGpioAf(GPIO_TypeDef *port, uint8_t pin, const uint8_t af) static inline void setGpioAf(GPIO_TypeDef *port, uint8_t pin, const uint8_t af)
{ {

View File

@ -15,8 +15,8 @@
* along with this program; if not, see <http://www.gnu.org/licenses/> * * along with this program; if not, see <http://www.gnu.org/licenses/> *
***************************************************************************/ ***************************************************************************/
#ifndef GPIO_NATIVE_H #ifndef GPIO_STM32_H
#define GPIO_NATIVE_H #define GPIO_STM32_H
#include <peripherals/gpio.h> #include <peripherals/gpio.h>
#include <stm32f4xx.h> #include <stm32f4xx.h>
@ -111,4 +111,4 @@ static inline uint8_t gpio_readPin(const void *port, const uint8_t pin)
} }
#endif #endif
#endif /* GPIO_NATIVE_H */ #endif /* GPIO_STM32_H */