Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Sun May 14 23:18:57 2017 +0000
Revision:
18:6a4db94011d3
Publishing again

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sahilmgandhi 18:6a4db94011d3 1 /**
sahilmgandhi 18:6a4db94011d3 2 ******************************************************************************
sahilmgandhi 18:6a4db94011d3 3 * @file stm32f2xx.h
sahilmgandhi 18:6a4db94011d3 4 * @author MCD Application Team
sahilmgandhi 18:6a4db94011d3 5 * @version V2.1.2
sahilmgandhi 18:6a4db94011d3 6 * @date 29-June-2016
sahilmgandhi 18:6a4db94011d3 7 * @brief CMSIS STM32F2xx Device Peripheral Access Layer Header File.
sahilmgandhi 18:6a4db94011d3 8 *
sahilmgandhi 18:6a4db94011d3 9 * The file is the unique include file that the application programmer
sahilmgandhi 18:6a4db94011d3 10 * is using in the C source code, usually in main.c. This file contains:
sahilmgandhi 18:6a4db94011d3 11 * - Configuration section that allows to select:
sahilmgandhi 18:6a4db94011d3 12 * - The STM32F2xx device used in the target application
sahilmgandhi 18:6a4db94011d3 13 * - To use or not the peripheral’s drivers in application code(i.e.
sahilmgandhi 18:6a4db94011d3 14 * code will be based on direct access to peripheral’s registers
sahilmgandhi 18:6a4db94011d3 15 * rather than drivers API), this option is controlled by
sahilmgandhi 18:6a4db94011d3 16 * "#define USE_HAL_DRIVER"
sahilmgandhi 18:6a4db94011d3 17 *
sahilmgandhi 18:6a4db94011d3 18 ******************************************************************************
sahilmgandhi 18:6a4db94011d3 19 * @attention
sahilmgandhi 18:6a4db94011d3 20 *
sahilmgandhi 18:6a4db94011d3 21 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
sahilmgandhi 18:6a4db94011d3 22 *
sahilmgandhi 18:6a4db94011d3 23 * Redistribution and use in source and binary forms, with or without modification,
sahilmgandhi 18:6a4db94011d3 24 * are permitted provided that the following conditions are met:
sahilmgandhi 18:6a4db94011d3 25 * 1. Redistributions of source code must retain the above copyright notice,
sahilmgandhi 18:6a4db94011d3 26 * this list of conditions and the following disclaimer.
sahilmgandhi 18:6a4db94011d3 27 * 2. Redistributions in binary form must reproduce the above copyright notice,
sahilmgandhi 18:6a4db94011d3 28 * this list of conditions and the following disclaimer in the documentation
sahilmgandhi 18:6a4db94011d3 29 * and/or other materials provided with the distribution.
sahilmgandhi 18:6a4db94011d3 30 * 3. Neither the name of STMicroelectronics nor the names of its contributors
sahilmgandhi 18:6a4db94011d3 31 * may be used to endorse or promote products derived from this software
sahilmgandhi 18:6a4db94011d3 32 * without specific prior written permission.
sahilmgandhi 18:6a4db94011d3 33 *
sahilmgandhi 18:6a4db94011d3 34 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
sahilmgandhi 18:6a4db94011d3 35 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
sahilmgandhi 18:6a4db94011d3 36 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
sahilmgandhi 18:6a4db94011d3 37 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
sahilmgandhi 18:6a4db94011d3 38 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
sahilmgandhi 18:6a4db94011d3 39 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
sahilmgandhi 18:6a4db94011d3 40 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
sahilmgandhi 18:6a4db94011d3 41 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
sahilmgandhi 18:6a4db94011d3 42 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
sahilmgandhi 18:6a4db94011d3 43 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
sahilmgandhi 18:6a4db94011d3 44 *
sahilmgandhi 18:6a4db94011d3 45 ******************************************************************************
sahilmgandhi 18:6a4db94011d3 46 */
sahilmgandhi 18:6a4db94011d3 47
sahilmgandhi 18:6a4db94011d3 48 /** @addtogroup CMSIS
sahilmgandhi 18:6a4db94011d3 49 * @{
sahilmgandhi 18:6a4db94011d3 50 */
sahilmgandhi 18:6a4db94011d3 51
sahilmgandhi 18:6a4db94011d3 52 /** @addtogroup stm32f2xx
sahilmgandhi 18:6a4db94011d3 53 * @{
sahilmgandhi 18:6a4db94011d3 54 */
sahilmgandhi 18:6a4db94011d3 55
sahilmgandhi 18:6a4db94011d3 56 #ifndef __STM32F2xx_H
sahilmgandhi 18:6a4db94011d3 57 #define __STM32F2xx_H
sahilmgandhi 18:6a4db94011d3 58
sahilmgandhi 18:6a4db94011d3 59 #ifdef __cplusplus
sahilmgandhi 18:6a4db94011d3 60 extern "C" {
sahilmgandhi 18:6a4db94011d3 61 #endif /* __cplusplus */
sahilmgandhi 18:6a4db94011d3 62
sahilmgandhi 18:6a4db94011d3 63 /** @addtogroup Library_configuration_section
sahilmgandhi 18:6a4db94011d3 64 * @{
sahilmgandhi 18:6a4db94011d3 65 */
sahilmgandhi 18:6a4db94011d3 66
sahilmgandhi 18:6a4db94011d3 67 /**
sahilmgandhi 18:6a4db94011d3 68 * @brief STM32 Family
sahilmgandhi 18:6a4db94011d3 69 */
sahilmgandhi 18:6a4db94011d3 70 #if !defined (STM32F2)
sahilmgandhi 18:6a4db94011d3 71 #define STM32F2
sahilmgandhi 18:6a4db94011d3 72 #endif /* STM32F2 */
sahilmgandhi 18:6a4db94011d3 73
sahilmgandhi 18:6a4db94011d3 74 /* Uncomment the line below according to the target STM32 device used in your
sahilmgandhi 18:6a4db94011d3 75 application
sahilmgandhi 18:6a4db94011d3 76 */
sahilmgandhi 18:6a4db94011d3 77 #if !defined (STM32F205xx) && !defined (STM32F215xx) && !defined (STM32F207xx) && !defined (STM32F217xx)
sahilmgandhi 18:6a4db94011d3 78
sahilmgandhi 18:6a4db94011d3 79 /* #define STM32F205xx */ /*!< STM32F205RG, STM32F205VG, STM32F205ZG, STM32F205RF, STM32F205VF, STM32F205ZF,
sahilmgandhi 18:6a4db94011d3 80 STM32F205RE, STM32F205VE, STM32F205ZE, STM32F205RC, STM32F205VC, STM32F205ZC,
sahilmgandhi 18:6a4db94011d3 81 STM32F205RB and STM32F205VB Devices */
sahilmgandhi 18:6a4db94011d3 82 /* #define STM32F215xx */ /*!< STM32F215RG, STM32F215VG, STM32F215ZG, STM32F215RE, STM32F215VE and STM32F215ZE Devices */
sahilmgandhi 18:6a4db94011d3 83 #define STM32F207xx /*!< STM32F207VG, STM32F207ZG, STM32F207IG, STM32F207VF, STM32F207ZF, STM32F207IF,
sahilmgandhi 18:6a4db94011d3 84 STM32F207VE, STM32F207ZE, STM32F207IE, STM32F207VC, STM32F207ZC and STM32F207IC Devices */
sahilmgandhi 18:6a4db94011d3 85 /* #define STM32F217xx */ /*!< STM32F217VG, STM32F217ZG, STM32F217IG, STM32F217VE, STM32F217ZE and STM32F217IE Devices */
sahilmgandhi 18:6a4db94011d3 86
sahilmgandhi 18:6a4db94011d3 87 #endif
sahilmgandhi 18:6a4db94011d3 88
sahilmgandhi 18:6a4db94011d3 89 /* Tip: To avoid modifying this file each time you need to switch between these
sahilmgandhi 18:6a4db94011d3 90 devices, you can define the device in your toolchain compiler preprocessor.
sahilmgandhi 18:6a4db94011d3 91 */
sahilmgandhi 18:6a4db94011d3 92 #if !defined (USE_HAL_DRIVER)
sahilmgandhi 18:6a4db94011d3 93 /**
sahilmgandhi 18:6a4db94011d3 94 * @brief Comment the line below if you will not use the peripherals drivers.
sahilmgandhi 18:6a4db94011d3 95 In this case, these drivers will not be included and the application code will
sahilmgandhi 18:6a4db94011d3 96 be based on direct access to peripherals registers
sahilmgandhi 18:6a4db94011d3 97 */
sahilmgandhi 18:6a4db94011d3 98 #define USE_HAL_DRIVER
sahilmgandhi 18:6a4db94011d3 99 #endif /* USE_HAL_DRIVER */
sahilmgandhi 18:6a4db94011d3 100
sahilmgandhi 18:6a4db94011d3 101 /**
sahilmgandhi 18:6a4db94011d3 102 * @brief CMSIS Device version number V2.1.2
sahilmgandhi 18:6a4db94011d3 103 */
sahilmgandhi 18:6a4db94011d3 104 #define __STM32F2xx_CMSIS_VERSION_MAIN (0x02U) /*!< [31:24] main version */
sahilmgandhi 18:6a4db94011d3 105 #define __STM32F2xx_CMSIS_VERSION_SUB1 (0x01U) /*!< [23:16] sub1 version */
sahilmgandhi 18:6a4db94011d3 106 #define __STM32F2xx_CMSIS_VERSION_SUB2 (0x02U) /*!< [15:8] sub2 version */
sahilmgandhi 18:6a4db94011d3 107 #define __STM32F2xx_CMSIS_VERSION_RC (0x00U) /*!< [7:0] release candidate */
sahilmgandhi 18:6a4db94011d3 108 #define __STM32F2xx_CMSIS_VERSION ((__STM32F2xx_CMSIS_VERSION_MAIN << 24)\
sahilmgandhi 18:6a4db94011d3 109 |(__STM32F2xx_CMSIS_VERSION_SUB1 << 16)\
sahilmgandhi 18:6a4db94011d3 110 |(__STM32F2xx_CMSIS_VERSION_SUB2 << 8 )\
sahilmgandhi 18:6a4db94011d3 111 |(__STM32F2xx_CMSIS_VERSION))
sahilmgandhi 18:6a4db94011d3 112
sahilmgandhi 18:6a4db94011d3 113 /**
sahilmgandhi 18:6a4db94011d3 114 * @}
sahilmgandhi 18:6a4db94011d3 115 */
sahilmgandhi 18:6a4db94011d3 116
sahilmgandhi 18:6a4db94011d3 117 /** @addtogroup Device_Included
sahilmgandhi 18:6a4db94011d3 118 * @{
sahilmgandhi 18:6a4db94011d3 119 */
sahilmgandhi 18:6a4db94011d3 120
sahilmgandhi 18:6a4db94011d3 121 #if defined(STM32F205xx)
sahilmgandhi 18:6a4db94011d3 122 #include "stm32f205xx.h"
sahilmgandhi 18:6a4db94011d3 123 #elif defined(STM32F215xx)
sahilmgandhi 18:6a4db94011d3 124 #include "stm32f215xx.h"
sahilmgandhi 18:6a4db94011d3 125 #elif defined(STM32F207xx)
sahilmgandhi 18:6a4db94011d3 126 #include "stm32f207xx.h"
sahilmgandhi 18:6a4db94011d3 127 #elif defined(STM32F217xx)
sahilmgandhi 18:6a4db94011d3 128 #include "stm32f217xx.h"
sahilmgandhi 18:6a4db94011d3 129 #else
sahilmgandhi 18:6a4db94011d3 130 #error "Please select first the target STM32F2xx device used in your application (in stm32f2xx.h file)"
sahilmgandhi 18:6a4db94011d3 131 #endif
sahilmgandhi 18:6a4db94011d3 132
sahilmgandhi 18:6a4db94011d3 133 /**
sahilmgandhi 18:6a4db94011d3 134 * @}
sahilmgandhi 18:6a4db94011d3 135 */
sahilmgandhi 18:6a4db94011d3 136
sahilmgandhi 18:6a4db94011d3 137 /** @addtogroup Exported_types
sahilmgandhi 18:6a4db94011d3 138 * @{
sahilmgandhi 18:6a4db94011d3 139 */
sahilmgandhi 18:6a4db94011d3 140 typedef enum {
sahilmgandhi 18:6a4db94011d3 141 RESET = 0,
sahilmgandhi 18:6a4db94011d3 142 SET = !RESET
sahilmgandhi 18:6a4db94011d3 143 } FlagStatus, ITStatus;
sahilmgandhi 18:6a4db94011d3 144
sahilmgandhi 18:6a4db94011d3 145 typedef enum {
sahilmgandhi 18:6a4db94011d3 146 DISABLE = 0,
sahilmgandhi 18:6a4db94011d3 147 ENABLE = !DISABLE
sahilmgandhi 18:6a4db94011d3 148 } FunctionalState;
sahilmgandhi 18:6a4db94011d3 149 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
sahilmgandhi 18:6a4db94011d3 150
sahilmgandhi 18:6a4db94011d3 151 typedef enum {
sahilmgandhi 18:6a4db94011d3 152 ERROR = 0,
sahilmgandhi 18:6a4db94011d3 153 SUCCESS = !ERROR
sahilmgandhi 18:6a4db94011d3 154 } ErrorStatus;
sahilmgandhi 18:6a4db94011d3 155
sahilmgandhi 18:6a4db94011d3 156 /**
sahilmgandhi 18:6a4db94011d3 157 * @}
sahilmgandhi 18:6a4db94011d3 158 */
sahilmgandhi 18:6a4db94011d3 159
sahilmgandhi 18:6a4db94011d3 160
sahilmgandhi 18:6a4db94011d3 161 /** @addtogroup Exported_macro
sahilmgandhi 18:6a4db94011d3 162 * @{
sahilmgandhi 18:6a4db94011d3 163 */
sahilmgandhi 18:6a4db94011d3 164 #define SET_BIT(REG, BIT) ((REG) |= (BIT))
sahilmgandhi 18:6a4db94011d3 165
sahilmgandhi 18:6a4db94011d3 166 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
sahilmgandhi 18:6a4db94011d3 167
sahilmgandhi 18:6a4db94011d3 168 #define READ_BIT(REG, BIT) ((REG) & (BIT))
sahilmgandhi 18:6a4db94011d3 169
sahilmgandhi 18:6a4db94011d3 170 #define CLEAR_REG(REG) ((REG) = (0x0))
sahilmgandhi 18:6a4db94011d3 171
sahilmgandhi 18:6a4db94011d3 172 #define WRITE_REG(REG, VAL) ((REG) = (VAL))
sahilmgandhi 18:6a4db94011d3 173
sahilmgandhi 18:6a4db94011d3 174 #define READ_REG(REG) ((REG))
sahilmgandhi 18:6a4db94011d3 175
sahilmgandhi 18:6a4db94011d3 176 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
sahilmgandhi 18:6a4db94011d3 177
sahilmgandhi 18:6a4db94011d3 178 #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
sahilmgandhi 18:6a4db94011d3 179
sahilmgandhi 18:6a4db94011d3 180
sahilmgandhi 18:6a4db94011d3 181 /**
sahilmgandhi 18:6a4db94011d3 182 * @}
sahilmgandhi 18:6a4db94011d3 183 */
sahilmgandhi 18:6a4db94011d3 184
sahilmgandhi 18:6a4db94011d3 185 #if defined (USE_HAL_DRIVER)
sahilmgandhi 18:6a4db94011d3 186 #include "stm32f2xx_hal.h"
sahilmgandhi 18:6a4db94011d3 187 #endif /* USE_HAL_DRIVER */
sahilmgandhi 18:6a4db94011d3 188
sahilmgandhi 18:6a4db94011d3 189 #ifdef __cplusplus
sahilmgandhi 18:6a4db94011d3 190 }
sahilmgandhi 18:6a4db94011d3 191 #endif /* __cplusplus */
sahilmgandhi 18:6a4db94011d3 192
sahilmgandhi 18:6a4db94011d3 193 #endif /* __STM32F2xx_H */
sahilmgandhi 18:6a4db94011d3 194
sahilmgandhi 18:6a4db94011d3 195 /**
sahilmgandhi 18:6a4db94011d3 196 * @}
sahilmgandhi 18:6a4db94011d3 197 */
sahilmgandhi 18:6a4db94011d3 198
sahilmgandhi 18:6a4db94011d3 199 /**
sahilmgandhi 18:6a4db94011d3 200 * @}
sahilmgandhi 18:6a4db94011d3 201 */
sahilmgandhi 18:6a4db94011d3 202
sahilmgandhi 18:6a4db94011d3 203
sahilmgandhi 18:6a4db94011d3 204
sahilmgandhi 18:6a4db94011d3 205
sahilmgandhi 18:6a4db94011d3 206 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/