센서보드 RF IRQ 테스트 중

Fork of stm-spirit1-rf-driver by ST

Committer:
Wolfgang Betz
Date:
Thu Jul 06 11:13:31 2017 +0200
Revision:
67:93bec0baf1de
Parent:
34:edda6a7238ec
Clarify some comments

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Wolfgang Betz 67:93bec0baf1de 1 /**
Wolfgang Betz 67:93bec0baf1de 2 ******************************************************************************
Wolfgang Betz 67:93bec0baf1de 3 * @file radio_gpio.h
Wolfgang Betz 67:93bec0baf1de 4 * @author System Lab - NOIDA
Wolfgang Betz 67:93bec0baf1de 5 * @version V1.0.0
Wolfgang Betz 67:93bec0baf1de 6 * @date 15-May-2014
Wolfgang Betz 67:93bec0baf1de 7 * @brief This file contains all the functions prototypes for the gpio
Wolfgang Betz 67:93bec0baf1de 8 ******************************************************************************
Wolfgang Betz 67:93bec0baf1de 9 * @attention
Wolfgang Betz 67:93bec0baf1de 10 *
Wolfgang Betz 67:93bec0baf1de 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
Wolfgang Betz 67:93bec0baf1de 12 *
Wolfgang Betz 67:93bec0baf1de 13 * Redistribution and use in source and binary forms, with or without modification,
Wolfgang Betz 67:93bec0baf1de 14 * are permitted provided that the following conditions are met:
Wolfgang Betz 67:93bec0baf1de 15 * 1. Redistributions of source code must retain the above copyright notice,
Wolfgang Betz 67:93bec0baf1de 16 * this list of conditions and the following disclaimer.
Wolfgang Betz 67:93bec0baf1de 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Wolfgang Betz 67:93bec0baf1de 18 * this list of conditions and the following disclaimer in the documentation
Wolfgang Betz 67:93bec0baf1de 19 * and/or other materials provided with the distribution.
Wolfgang Betz 67:93bec0baf1de 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Wolfgang Betz 67:93bec0baf1de 21 * may be used to endorse or promote products derived from this software
Wolfgang Betz 67:93bec0baf1de 22 * without specific prior written permission.
Wolfgang Betz 67:93bec0baf1de 23 *
Wolfgang Betz 67:93bec0baf1de 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Wolfgang Betz 67:93bec0baf1de 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Wolfgang Betz 67:93bec0baf1de 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Wolfgang Betz 67:93bec0baf1de 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Wolfgang Betz 67:93bec0baf1de 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Wolfgang Betz 67:93bec0baf1de 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Wolfgang Betz 67:93bec0baf1de 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Wolfgang Betz 67:93bec0baf1de 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Wolfgang Betz 67:93bec0baf1de 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Wolfgang Betz 67:93bec0baf1de 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Wolfgang Betz 67:93bec0baf1de 34 *
Wolfgang Betz 67:93bec0baf1de 35 ******************************************************************************
Wolfgang Betz 67:93bec0baf1de 36 */
Wolfgang Betz 67:93bec0baf1de 37 /* Exported types ------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 38 /* Exported constants --------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 39 /* Exported macro ------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 40 /* Exported Variables ------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 41 /* Exported functions ------------------------------------------------------- */
Wolfgang Betz 67:93bec0baf1de 42
Wolfgang Betz 67:93bec0baf1de 43 /* Define to prevent recursive inclusion -------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 44 #ifndef __RADIO_GPIO_H
Wolfgang Betz 67:93bec0baf1de 45 #define __RADIO_GPIO_H
Wolfgang Betz 67:93bec0baf1de 46 #ifdef __cplusplus
Wolfgang Betz 67:93bec0baf1de 47 extern "C" {
Wolfgang Betz 67:93bec0baf1de 48 #endif
Wolfgang Betz 67:93bec0baf1de 49
Wolfgang Betz 67:93bec0baf1de 50 /* Includes ------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 51 #ifdef USE_STM32L1XX_NUCLEO
Wolfgang Betz 67:93bec0baf1de 52 #include "stm32l1xx_hal.h"
Wolfgang Betz 67:93bec0baf1de 53 #endif
Wolfgang Betz 67:93bec0baf1de 54
Wolfgang Betz 67:93bec0baf1de 55 #ifdef USE_STM32F4XX_NUCLEO
Wolfgang Betz 67:93bec0baf1de 56 #include "stm32f4xx_hal.h"
Wolfgang Betz 67:93bec0baf1de 57 #endif
Wolfgang Betz 67:93bec0baf1de 58 #include "SPIRIT_Types.h"
Wolfgang Betz 67:93bec0baf1de 59
Wolfgang Betz 67:93bec0baf1de 60 /**
Wolfgang Betz 67:93bec0baf1de 61 * @addtogroup BSP
Wolfgang Betz 67:93bec0baf1de 62 * @{
Wolfgang Betz 67:93bec0baf1de 63 */
Wolfgang Betz 67:93bec0baf1de 64
Wolfgang Betz 67:93bec0baf1de 65
Wolfgang Betz 67:93bec0baf1de 66 /* Exported types ------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 67 /* MCU GPIO pin working mode for GPIO */
Wolfgang Betz 67:93bec0baf1de 68 typedef enum
Wolfgang Betz 67:93bec0baf1de 69 {
Wolfgang Betz 67:93bec0baf1de 70 RADIO_MODE_GPIO_IN = 0x00, /*!< Work as GPIO input */
Wolfgang Betz 67:93bec0baf1de 71 RADIO_MODE_EXTI_IN, /*!< Work as EXTI */
Wolfgang Betz 67:93bec0baf1de 72 RADIO_MODE_GPIO_OUT, /*!< Work as GPIO output */
Wolfgang Betz 67:93bec0baf1de 73 }RadioGpioMode;
Wolfgang Betz 67:93bec0baf1de 74
Wolfgang Betz 67:93bec0baf1de 75 /* MCU GPIO pin enumeration for GPIO */
Wolfgang Betz 67:93bec0baf1de 76 typedef enum
Wolfgang Betz 67:93bec0baf1de 77 {
Wolfgang Betz 67:93bec0baf1de 78 RADIO_GPIO_0 = 0x00, /*!< GPIO_0 selected */
Wolfgang Betz 67:93bec0baf1de 79 RADIO_GPIO_1 = 0x01, /*!< GPIO_1 selected */
Wolfgang Betz 67:93bec0baf1de 80 RADIO_GPIO_2 = 0x02, /*!< GPIO_2 selected */
Wolfgang Betz 67:93bec0baf1de 81 RADIO_GPIO_3 = 0x03, /*!< GPIO_3 selected */
Wolfgang Betz 67:93bec0baf1de 82 RADIO_GPIO_SDN = 0x04, /*!< GPIO_SDN selected */
Wolfgang Betz 67:93bec0baf1de 83 }
Wolfgang Betz 67:93bec0baf1de 84 RadioGpioPin;
Wolfgang Betz 67:93bec0baf1de 85
Wolfgang Betz 67:93bec0baf1de 86
Wolfgang Betz 67:93bec0baf1de 87 /* Exported constants --------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 88
Wolfgang Betz 67:93bec0baf1de 89
Wolfgang Betz 67:93bec0baf1de 90 /* Exported macro ------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 91 /* MCU GPIO pin working mode for GPIO */
Wolfgang Betz 67:93bec0baf1de 92 #define IS_RADIO_GPIO_MODE(MODE) (((MODE) == RADIO_MODE_GPIO_IN) || \
Wolfgang Betz 67:93bec0baf1de 93 ((MODE) == RADIO_MODE_EXTI_IN) || \
Wolfgang Betz 67:93bec0baf1de 94 ((MODE) == RADIO_MODE_GPIO_OUT))
Wolfgang Betz 67:93bec0baf1de 95
Wolfgang Betz 67:93bec0baf1de 96 /* Number of Arduino pins used for RADIO GPIO interface */
Wolfgang Betz 67:93bec0baf1de 97 #define RADIO_GPIO_NUMBER ((uint8_t)5)
Wolfgang Betz 67:93bec0baf1de 98
Wolfgang Betz 67:93bec0baf1de 99 /* MCU GPIO pin enumeration for GPIO */
Wolfgang Betz 67:93bec0baf1de 100 #define IS_RADIO_GPIO_PIN(PIN) (((PIN) == RADIO_GPIO_0) || \
Wolfgang Betz 67:93bec0baf1de 101 ((PIN) == RADIO_GPIO_1) || \
Wolfgang Betz 67:93bec0baf1de 102 ((PIN) == RADIO_GPIO_2) || \
Wolfgang Betz 67:93bec0baf1de 103 ((PIN) == RADIO_GPIO_3) || \
Wolfgang Betz 67:93bec0baf1de 104 ((PIN) == RADIO_GPIO_SDN))
Wolfgang Betz 67:93bec0baf1de 105
Wolfgang Betz 67:93bec0baf1de 106 /* Define for RADIO board */
Wolfgang Betz 67:93bec0baf1de 107 #if !defined (USE_SPIRIT1_DEFAULT)
Wolfgang Betz 67:93bec0baf1de 108 #define USE_SPIRIT1_DEFAULT
Wolfgang Betz 67:93bec0baf1de 109 #endif
Wolfgang Betz 67:93bec0baf1de 110
Wolfgang Betz 67:93bec0baf1de 111 /* @defgroup Radio_Gpio_config_Define */
Wolfgang Betz 67:93bec0baf1de 112 /*NOTE: GPIO0, GPIO1, GPIO2 of SPIRIT1 is not used in the shield*/
Wolfgang Betz 67:93bec0baf1de 113
Wolfgang Betz 67:93bec0baf1de 114 #define RADIO_GPIO_0_PORT GPIOC
Wolfgang Betz 67:93bec0baf1de 115 #define RADIO_GPIO_0_PIN GPIO_PIN_1
Wolfgang Betz 67:93bec0baf1de 116 #define RADIO_GPIO_0_CLOCK_ENABLE() __GPIOC_CLK_ENABLE()
Wolfgang Betz 67:93bec0baf1de 117 #define RADIO_GPIO_0_CLOCK_DISABLE() __GPIOC_CLK_ENABLE()
Wolfgang Betz 67:93bec0baf1de 118 #define RADIO_GPIO_0_SPEED GPIO_SPEED_HIGH
Wolfgang Betz 67:93bec0baf1de 119 #define RADIO_GPIO_0_PUPD GPIO_NOPULL
Wolfgang Betz 67:93bec0baf1de 120 #define RADIO_GPIO_0_EXTI_LINE GPIO_PIN_1
Wolfgang Betz 67:93bec0baf1de 121 #define RADIO_GPIO_0_EXTI_MODE GPIO_MODE_IT_FALLING
Wolfgang Betz 67:93bec0baf1de 122 #define RADIO_GPIO_0_EXTI_IRQN EXTI1_IRQn
Wolfgang Betz 67:93bec0baf1de 123 #define RADIO_GPIO_0_EXTI_PREEMPTION_PRIORITY 2
Wolfgang Betz 67:93bec0baf1de 124 #define RADIO_GPIO_0_EXTI_SUB_PRIORITY 2
Wolfgang Betz 67:93bec0baf1de 125 #define RADIO_GPIO_0_EXTI_IRQ_HANDLER EXTI1_IRQHandler
Wolfgang Betz 67:93bec0baf1de 126
Wolfgang Betz 67:93bec0baf1de 127 #define RADIO_GPIO_1_PORT GPIOB
Wolfgang Betz 67:93bec0baf1de 128 #define RADIO_GPIO_1_PIN GPIO_PIN_0
Wolfgang Betz 67:93bec0baf1de 129 #define RADIO_GPIO_1_CLOCK_ENABLE() __GPIOB_CLK_ENABLE()
Wolfgang Betz 67:93bec0baf1de 130 #define RADIO_GPIO_1_CLOCK_DISABLE() __GPIOB_CLK_ENABLE()
Wolfgang Betz 67:93bec0baf1de 131 #define RADIO_GPIO_1_SPEED GPIO_SPEED_HIGH
Wolfgang Betz 67:93bec0baf1de 132 #define RADIO_GPIO_1_PUPD GPIO_NOPULL
Wolfgang Betz 67:93bec0baf1de 133 #define RADIO_GPIO_1_EXTI_LINE GPIO_PIN_0
Wolfgang Betz 67:93bec0baf1de 134 #define RADIO_GPIO_1_EXTI_MODE GPIO_MODE_IT_FALLING
Wolfgang Betz 67:93bec0baf1de 135 #define RADIO_GPIO_1_EXTI_IRQN EXTI0_IRQn
Wolfgang Betz 67:93bec0baf1de 136 #define RADIO_GPIO_1_EXTI_PREEMPTION_PRIORITY 2
Wolfgang Betz 67:93bec0baf1de 137 #define RADIO_GPIO_1_EXTI_SUB_PRIORITY 2
Wolfgang Betz 67:93bec0baf1de 138 #define RADIO_GPIO_1_EXTI_IRQ_HANDLER EXTI0_IRQHandler
Wolfgang Betz 67:93bec0baf1de 139
Wolfgang Betz 67:93bec0baf1de 140 #define RADIO_GPIO_2_PORT GPIOA
Wolfgang Betz 67:93bec0baf1de 141 #define RADIO_GPIO_2_PIN GPIO_PIN_4
Wolfgang Betz 67:93bec0baf1de 142 #define RADIO_GPIO_2_CLOCK_ENABLE() __GPIOA_CLK_ENABLE()
Wolfgang Betz 67:93bec0baf1de 143 #define RADIO_GPIO_2_CLOCK_DISABLE() __GPIOA_CLK_ENABLE()
Wolfgang Betz 67:93bec0baf1de 144 #define RADIO_GPIO_2_SPEED GPIO_SPEED_HIGH
Wolfgang Betz 67:93bec0baf1de 145 #define RADIO_GPIO_2_PUPD GPIO_NOPULL
Wolfgang Betz 67:93bec0baf1de 146 #define RADIO_GPIO_2_EXTI_LINE GPIO_PIN_4
Wolfgang Betz 67:93bec0baf1de 147 #define RADIO_GPIO_2_EXTI_MODE GPIO_MODE_IT_FALLING
Wolfgang Betz 67:93bec0baf1de 148 #define RADIO_GPIO_2_EXTI_IRQN EXTI4_IRQn
Wolfgang Betz 67:93bec0baf1de 149 #define RADIO_GPIO_2_EXTI_PREEMPTION_PRIORITY 2
Wolfgang Betz 67:93bec0baf1de 150 #define RADIO_GPIO_2_EXTI_SUB_PRIORITY 2
Wolfgang Betz 67:93bec0baf1de 151 #define RADIO_GPIO_2_EXTI_IRQ_HANDLER EXTI4_IRQHandler
Wolfgang Betz 67:93bec0baf1de 152
Wolfgang Betz 67:93bec0baf1de 153
Wolfgang Betz 67:93bec0baf1de 154 #if defined (USE_SPIRIT1_DEFAULT)
Wolfgang Betz 67:93bec0baf1de 155
Wolfgang Betz 67:93bec0baf1de 156
Wolfgang Betz 67:93bec0baf1de 157 #define RADIO_GPIO_3_PORT GPIOC
Wolfgang Betz 67:93bec0baf1de 158 #define RADIO_GPIO_3_PIN GPIO_PIN_7
Wolfgang Betz 67:93bec0baf1de 159 #define RADIO_GPIO_3_CLOCK_ENABLE() __GPIOC_CLK_ENABLE()
Wolfgang Betz 67:93bec0baf1de 160 #define RADIO_GPIO_3_CLOCK_DISABLE() __GPIOC_CLK_DISABLE()
Wolfgang Betz 67:93bec0baf1de 161 #define RADIO_GPIO_3_SPEED GPIO_SPEED_HIGH
Wolfgang Betz 67:93bec0baf1de 162 #define RADIO_GPIO_3_PUPD GPIO_NOPULL
Wolfgang Betz 67:93bec0baf1de 163 #define RADIO_GPIO_3_EXTI_LINE GPIO_PIN_7
Wolfgang Betz 67:93bec0baf1de 164 #define RADIO_GPIO_3_EXTI_MODE GPIO_MODE_IT_FALLING
Wolfgang Betz 67:93bec0baf1de 165 #define RADIO_GPIO_3_EXTI_IRQN EXTI9_5_IRQn
Wolfgang Betz 67:93bec0baf1de 166 #define RADIO_GPIO_3_EXTI_PREEMPTION_PRIORITY 2
Wolfgang Betz 67:93bec0baf1de 167 #define RADIO_GPIO_3_EXTI_SUB_PRIORITY 2
Wolfgang Betz 67:93bec0baf1de 168 #define RADIO_GPIO_3_EXTI_IRQ_HANDLER EXTI9_5_IRQHandler
Wolfgang Betz 67:93bec0baf1de 169
Wolfgang Betz 67:93bec0baf1de 170 #else
Wolfgang Betz 67:93bec0baf1de 171
Wolfgang Betz 67:93bec0baf1de 172 #define RADIO_GPIO_3_PORT GPIOA
Wolfgang Betz 67:93bec0baf1de 173 #define RADIO_GPIO_3_PIN GPIO_PIN_0
Wolfgang Betz 67:93bec0baf1de 174 #define RADIO_GPIO_3_CLOCK_ENABLE() __GPIOA_CLK_ENABLE()
Wolfgang Betz 67:93bec0baf1de 175 #define RADIO_GPIO_3_CLOCK_DISABLE() __GPIOA_CLK_DISABLE()
Wolfgang Betz 67:93bec0baf1de 176 #define RADIO_GPIO_3_SPEED GPIO_SPEED_HIGH
Wolfgang Betz 67:93bec0baf1de 177 #define RADIO_GPIO_3_PUPD GPIO_NOPULL
Wolfgang Betz 67:93bec0baf1de 178 #define RADIO_GPIO_3_EXTI_LINE GPIO_PIN_0
Wolfgang Betz 67:93bec0baf1de 179 #define RADIO_GPIO_3_EXTI_MODE GPIO_MODE_IT_FALLING
Wolfgang Betz 67:93bec0baf1de 180 #define RADIO_GPIO_3_EXTI_IRQN EXTI0_IRQn
Wolfgang Betz 67:93bec0baf1de 181 #define RADIO_GPIO_3_EXTI_PREEMPTION_PRIORITY 2
Wolfgang Betz 67:93bec0baf1de 182 #define RADIO_GPIO_3_EXTI_SUB_PRIORITY 2
Wolfgang Betz 67:93bec0baf1de 183 #define RADIO_GPIO_3_EXTI_IRQ_HANDLER EXTI0_IRQHandler
Wolfgang Betz 67:93bec0baf1de 184
Wolfgang Betz 67:93bec0baf1de 185 #endif
Wolfgang Betz 67:93bec0baf1de 186
Wolfgang Betz 67:93bec0baf1de 187 #define RADIO_GPIO_SDN_PORT GPIOA
Wolfgang Betz 67:93bec0baf1de 188 #define RADIO_GPIO_SDN_PIN GPIO_PIN_10
Wolfgang Betz 67:93bec0baf1de 189 #define RADIO_GPIO_SDN_CLOCK_ENABLE() __GPIOA_CLK_ENABLE()
Wolfgang Betz 67:93bec0baf1de 190 #define RADIO_GPIO_SDN_CLOCK_DISABLE() __GPIOA_CLK_DISABLE()
Wolfgang Betz 67:93bec0baf1de 191 #define RADIO_GPIO_SDN_SPEED GPIO_SPEED_HIGH
Wolfgang Betz 67:93bec0baf1de 192 #define RADIO_GPIO_SDN_PUPD GPIO_PULLUP
Wolfgang Betz 67:93bec0baf1de 193
Wolfgang Betz 67:93bec0baf1de 194
Wolfgang Betz 67:93bec0baf1de 195 #define RADIO_GPIO_IRQ RADIO_GPIO_3
Wolfgang Betz 67:93bec0baf1de 196 #define SPIRIT_GPIO_IRQ SPIRIT_GPIO_3
Wolfgang Betz 67:93bec0baf1de 197
Wolfgang Betz 67:93bec0baf1de 198 /* Exported Variables ------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 199
Wolfgang Betz 67:93bec0baf1de 200
Wolfgang Betz 67:93bec0baf1de 201 /* Exported functions ------------------------------------------------------- */
Wolfgang Betz 67:93bec0baf1de 202 FlagStatus RadioGpioGetLevel(RadioGpioPin xGpio);
Wolfgang Betz 67:93bec0baf1de 203 void RadioGpioSetLevel(RadioGpioPin xGpio, GPIO_PinState xState);
Wolfgang Betz 67:93bec0baf1de 204 void SdkEvalEnterShutdown(void);
Wolfgang Betz 67:93bec0baf1de 205 void SdkEvalExitShutdown(void);
Wolfgang Betz 67:93bec0baf1de 206 SpiritFlagStatus SdkEvalCheckShutdown(void);
Wolfgang Betz 67:93bec0baf1de 207 void RadioGpioInit(RadioGpioPin xGpio, RadioGpioMode xGpioMode);
Wolfgang Betz 67:93bec0baf1de 208 void RadioGpioInterruptCmd(RadioGpioPin xGpio, uint8_t nPreemption, uint8_t nSubpriority, FunctionalState xNewState);
Wolfgang Betz 67:93bec0baf1de 209
Wolfgang Betz 67:93bec0baf1de 210
Wolfgang Betz 67:93bec0baf1de 211 #ifdef __cplusplus
Wolfgang Betz 67:93bec0baf1de 212 }
Wolfgang Betz 67:93bec0baf1de 213 #endif
Wolfgang Betz 67:93bec0baf1de 214 #endif /*__RADIO_GPIO_H */
Wolfgang Betz 67:93bec0baf1de 215
Wolfgang Betz 67:93bec0baf1de 216 /**
Wolfgang Betz 67:93bec0baf1de 217 * @}
Wolfgang Betz 67:93bec0baf1de 218 */
Wolfgang Betz 67:93bec0baf1de 219
Wolfgang Betz 67:93bec0baf1de 220 /**
Wolfgang Betz 67:93bec0baf1de 221 * @}
Wolfgang Betz 67:93bec0baf1de 222 */
Wolfgang Betz 67:93bec0baf1de 223
Wolfgang Betz 67:93bec0baf1de 224 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/