Added support for the WNC M14A2A Cellular LTE Data Module.
Dependencies: WNC14A2AInterface
radio_gpio.h
00001 /** 00002 ****************************************************************************** 00003 * @file radio_gpio.h 00004 * @author System Lab - NOIDA 00005 * @version V1.0.0 00006 * @date 15-May-2014 00007 * @brief This file contains all the functions prototypes for the gpio 00008 ****************************************************************************** 00009 * @attention 00010 * 00011 * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> 00012 * 00013 * Redistribution and use in source and binary forms, with or without modification, 00014 * are permitted provided that the following conditions are met: 00015 * 1. Redistributions of source code must retain the above copyright notice, 00016 * this list of conditions and the following disclaimer. 00017 * 2. Redistributions in binary form must reproduce the above copyright notice, 00018 * this list of conditions and the following disclaimer in the documentation 00019 * and/or other materials provided with the distribution. 00020 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00021 * may be used to endorse or promote products derived from this software 00022 * without specific prior written permission. 00023 * 00024 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00025 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00026 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00027 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00028 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00029 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00030 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00031 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00032 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00033 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00034 * 00035 ****************************************************************************** 00036 */ 00037 /* Exported types ------------------------------------------------------------*/ 00038 /* Exported constants --------------------------------------------------------*/ 00039 /* Exported macro ------------------------------------------------------------*/ 00040 /* Exported Variables ------------------------------------------------------------*/ 00041 /* Exported functions ------------------------------------------------------- */ 00042 00043 /* Define to prevent recursive inclusion -------------------------------------*/ 00044 #ifndef __RADIO_GPIO_H 00045 #define __RADIO_GPIO_H 00046 #ifdef __cplusplus 00047 extern "C" { 00048 #endif 00049 00050 /* Includes ------------------------------------------------------------------*/ 00051 #ifdef USE_STM32L1XX_NUCLEO 00052 #include "stm32l1xx_hal.h" 00053 #endif 00054 00055 #ifdef USE_STM32F4XX_NUCLEO 00056 #include "stm32f4xx_hal.h" 00057 #endif 00058 #include "SPIRIT_Types.h" 00059 00060 /** 00061 * @addtogroup BSP 00062 * @{ 00063 */ 00064 00065 00066 /* Exported types ------------------------------------------------------------*/ 00067 /* MCU GPIO pin working mode for GPIO */ 00068 typedef enum 00069 { 00070 RADIO_MODE_GPIO_IN = 0x00, /*!< Work as GPIO input */ 00071 RADIO_MODE_EXTI_IN , /*!< Work as EXTI */ 00072 RADIO_MODE_GPIO_OUT , /*!< Work as GPIO output */ 00073 }RadioGpioMode ; 00074 00075 /* MCU GPIO pin enumeration for GPIO */ 00076 typedef enum 00077 { 00078 RADIO_GPIO_0 = 0x00, /*!< GPIO_0 selected */ 00079 RADIO_GPIO_1 = 0x01, /*!< GPIO_1 selected */ 00080 RADIO_GPIO_2 = 0x02, /*!< GPIO_2 selected */ 00081 RADIO_GPIO_3 = 0x03, /*!< GPIO_3 selected */ 00082 RADIO_GPIO_SDN = 0x04, /*!< GPIO_SDN selected */ 00083 } 00084 RadioGpioPin ; 00085 00086 00087 /* Exported constants --------------------------------------------------------*/ 00088 00089 00090 /* Exported macro ------------------------------------------------------------*/ 00091 /* MCU GPIO pin working mode for GPIO */ 00092 #define IS_RADIO_GPIO_MODE(MODE) (((MODE) == RADIO_MODE_GPIO_IN) || \ 00093 ((MODE) == RADIO_MODE_EXTI_IN) || \ 00094 ((MODE) == RADIO_MODE_GPIO_OUT)) 00095 00096 /* Number of Arduino pins used for RADIO GPIO interface */ 00097 #define RADIO_GPIO_NUMBER ((uint8_t)5) 00098 00099 /* MCU GPIO pin enumeration for GPIO */ 00100 #define IS_RADIO_GPIO_PIN(PIN) (((PIN) == RADIO_GPIO_0) || \ 00101 ((PIN) == RADIO_GPIO_1) || \ 00102 ((PIN) == RADIO_GPIO_2) || \ 00103 ((PIN) == RADIO_GPIO_3) || \ 00104 ((PIN) == RADIO_GPIO_SDN)) 00105 00106 /* Define for RADIO board */ 00107 #if !defined (USE_SPIRIT1_DEFAULT) 00108 #define USE_SPIRIT1_DEFAULT 00109 #endif 00110 00111 /* @defgroup Radio_Gpio_config_Define */ 00112 /*NOTE: GPIO0, GPIO1, GPIO2 of SPIRIT1 is not used in the shield*/ 00113 00114 #define RADIO_GPIO_0_PORT GPIOC 00115 #define RADIO_GPIO_0_PIN GPIO_PIN_1 00116 #define RADIO_GPIO_0_CLOCK_ENABLE() __GPIOC_CLK_ENABLE() 00117 #define RADIO_GPIO_0_CLOCK_DISABLE() __GPIOC_CLK_ENABLE() 00118 #define RADIO_GPIO_0_SPEED GPIO_SPEED_HIGH 00119 #define RADIO_GPIO_0_PUPD GPIO_NOPULL 00120 #define RADIO_GPIO_0_EXTI_LINE GPIO_PIN_1 00121 #define RADIO_GPIO_0_EXTI_MODE GPIO_MODE_IT_FALLING 00122 #define RADIO_GPIO_0_EXTI_IRQN EXTI1_IRQn 00123 #define RADIO_GPIO_0_EXTI_PREEMPTION_PRIORITY 2 00124 #define RADIO_GPIO_0_EXTI_SUB_PRIORITY 2 00125 #define RADIO_GPIO_0_EXTI_IRQ_HANDLER EXTI1_IRQHandler 00126 00127 #define RADIO_GPIO_1_PORT GPIOB 00128 #define RADIO_GPIO_1_PIN GPIO_PIN_0 00129 #define RADIO_GPIO_1_CLOCK_ENABLE() __GPIOB_CLK_ENABLE() 00130 #define RADIO_GPIO_1_CLOCK_DISABLE() __GPIOB_CLK_ENABLE() 00131 #define RADIO_GPIO_1_SPEED GPIO_SPEED_HIGH 00132 #define RADIO_GPIO_1_PUPD GPIO_NOPULL 00133 #define RADIO_GPIO_1_EXTI_LINE GPIO_PIN_0 00134 #define RADIO_GPIO_1_EXTI_MODE GPIO_MODE_IT_FALLING 00135 #define RADIO_GPIO_1_EXTI_IRQN EXTI0_IRQn 00136 #define RADIO_GPIO_1_EXTI_PREEMPTION_PRIORITY 2 00137 #define RADIO_GPIO_1_EXTI_SUB_PRIORITY 2 00138 #define RADIO_GPIO_1_EXTI_IRQ_HANDLER EXTI0_IRQHandler 00139 00140 #define RADIO_GPIO_2_PORT GPIOA 00141 #define RADIO_GPIO_2_PIN GPIO_PIN_4 00142 #define RADIO_GPIO_2_CLOCK_ENABLE() __GPIOA_CLK_ENABLE() 00143 #define RADIO_GPIO_2_CLOCK_DISABLE() __GPIOA_CLK_ENABLE() 00144 #define RADIO_GPIO_2_SPEED GPIO_SPEED_HIGH 00145 #define RADIO_GPIO_2_PUPD GPIO_NOPULL 00146 #define RADIO_GPIO_2_EXTI_LINE GPIO_PIN_4 00147 #define RADIO_GPIO_2_EXTI_MODE GPIO_MODE_IT_FALLING 00148 #define RADIO_GPIO_2_EXTI_IRQN EXTI4_IRQn 00149 #define RADIO_GPIO_2_EXTI_PREEMPTION_PRIORITY 2 00150 #define RADIO_GPIO_2_EXTI_SUB_PRIORITY 2 00151 #define RADIO_GPIO_2_EXTI_IRQ_HANDLER EXTI4_IRQHandler 00152 00153 00154 #if defined (USE_SPIRIT1_DEFAULT) 00155 00156 00157 #define RADIO_GPIO_3_PORT GPIOC 00158 #define RADIO_GPIO_3_PIN GPIO_PIN_7 00159 #define RADIO_GPIO_3_CLOCK_ENABLE() __GPIOC_CLK_ENABLE() 00160 #define RADIO_GPIO_3_CLOCK_DISABLE() __GPIOC_CLK_DISABLE() 00161 #define RADIO_GPIO_3_SPEED GPIO_SPEED_HIGH 00162 #define RADIO_GPIO_3_PUPD GPIO_NOPULL 00163 #define RADIO_GPIO_3_EXTI_LINE GPIO_PIN_7 00164 #define RADIO_GPIO_3_EXTI_MODE GPIO_MODE_IT_FALLING 00165 #define RADIO_GPIO_3_EXTI_IRQN EXTI9_5_IRQn 00166 #define RADIO_GPIO_3_EXTI_PREEMPTION_PRIORITY 2 00167 #define RADIO_GPIO_3_EXTI_SUB_PRIORITY 2 00168 #define RADIO_GPIO_3_EXTI_IRQ_HANDLER EXTI9_5_IRQHandler 00169 00170 #else 00171 00172 #define RADIO_GPIO_3_PORT GPIOA 00173 #define RADIO_GPIO_3_PIN GPIO_PIN_0 00174 #define RADIO_GPIO_3_CLOCK_ENABLE() __GPIOA_CLK_ENABLE() 00175 #define RADIO_GPIO_3_CLOCK_DISABLE() __GPIOA_CLK_DISABLE() 00176 #define RADIO_GPIO_3_SPEED GPIO_SPEED_HIGH 00177 #define RADIO_GPIO_3_PUPD GPIO_NOPULL 00178 #define RADIO_GPIO_3_EXTI_LINE GPIO_PIN_0 00179 #define RADIO_GPIO_3_EXTI_MODE GPIO_MODE_IT_FALLING 00180 #define RADIO_GPIO_3_EXTI_IRQN EXTI0_IRQn 00181 #define RADIO_GPIO_3_EXTI_PREEMPTION_PRIORITY 2 00182 #define RADIO_GPIO_3_EXTI_SUB_PRIORITY 2 00183 #define RADIO_GPIO_3_EXTI_IRQ_HANDLER EXTI0_IRQHandler 00184 00185 #endif 00186 00187 #define RADIO_GPIO_SDN_PORT GPIOA 00188 #define RADIO_GPIO_SDN_PIN GPIO_PIN_10 00189 #define RADIO_GPIO_SDN_CLOCK_ENABLE() __GPIOA_CLK_ENABLE() 00190 #define RADIO_GPIO_SDN_CLOCK_DISABLE() __GPIOA_CLK_DISABLE() 00191 #define RADIO_GPIO_SDN_SPEED GPIO_SPEED_HIGH 00192 #define RADIO_GPIO_SDN_PUPD GPIO_PULLUP 00193 00194 00195 #define RADIO_GPIO_IRQ RADIO_GPIO_3 00196 #define SPIRIT_GPIO_IRQ SPIRIT_GPIO_3 00197 00198 /* Exported Variables ------------------------------------------------------------*/ 00199 00200 00201 /* Exported functions ------------------------------------------------------- */ 00202 FlagStatus RadioGpioGetLevel(RadioGpioPin xGpio); 00203 void RadioGpioSetLevel(RadioGpioPin xGpio, GPIO_PinState xState); 00204 void SdkEvalEnterShutdown(void); 00205 void SdkEvalExitShutdown(void); 00206 SpiritFlagStatus SdkEvalCheckShutdown(void); 00207 void RadioGpioInit(RadioGpioPin xGpio, RadioGpioMode xGpioMode); 00208 void RadioGpioInterruptCmd(RadioGpioPin xGpio, uint8_t nPreemption, uint8_t nSubpriority, FunctionalState xNewState); 00209 00210 00211 #ifdef __cplusplus 00212 } 00213 #endif 00214 #endif /*__RADIO_GPIO_H */ 00215 00216 /** 00217 * @} 00218 */ 00219 00220 /** 00221 * @} 00222 */ 00223 00224 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Tue Jul 12 2022 19:09:04 by 1.7.2