A simple 128x32 graphical LCD program to quickstart with LCD on ARM mbed IoT Starter Kit. This requires mbed Applciation Shield with FRDM-K64F platform.

Dependencies:   C12832

Committer:
tushki7
Date:
Sun Apr 12 15:45:52 2015 +0000
Revision:
1:eb68c94a8ee5
Parent:
0:60d829a0353a
A simple 128x32 LCD program with ARM mbed IoT Starter Kit;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tushki7 0:60d829a0353a 1 /**
tushki7 0:60d829a0353a 2 ******************************************************************************
tushki7 0:60d829a0353a 3 * @file stm32f4xx.h
tushki7 0:60d829a0353a 4 * @author MCD Application Team
tushki7 0:60d829a0353a 5 * @version V2.1.0
tushki7 0:60d829a0353a 6 * @date 19-June-2014
tushki7 0:60d829a0353a 7 * @brief CMSIS STM32F4xx Device Peripheral Access Layer Header File.
tushki7 0:60d829a0353a 8 *
tushki7 0:60d829a0353a 9 * The file is the unique include file that the application programmer
tushki7 0:60d829a0353a 10 * is using in the C source code, usually in main.c. This file contains:
tushki7 0:60d829a0353a 11 * - Configuration section that allows to select:
tushki7 0:60d829a0353a 12 * - The STM32F4xx device used in the target application
tushki7 0:60d829a0353a 13 * - To use or not the peripheral’s drivers in application code(i.e.
tushki7 0:60d829a0353a 14 * code will be based on direct access to peripheral’s registers
tushki7 0:60d829a0353a 15 * rather than drivers API), this option is controlled by
tushki7 0:60d829a0353a 16 * "#define USE_HAL_DRIVER"
tushki7 0:60d829a0353a 17 *
tushki7 0:60d829a0353a 18 ******************************************************************************
tushki7 0:60d829a0353a 19 * @attention
tushki7 0:60d829a0353a 20 *
tushki7 0:60d829a0353a 21 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
tushki7 0:60d829a0353a 22 *
tushki7 0:60d829a0353a 23 * Redistribution and use in source and binary forms, with or without modification,
tushki7 0:60d829a0353a 24 * are permitted provided that the following conditions are met:
tushki7 0:60d829a0353a 25 * 1. Redistributions of source code must retain the above copyright notice,
tushki7 0:60d829a0353a 26 * this list of conditions and the following disclaimer.
tushki7 0:60d829a0353a 27 * 2. Redistributions in binary form must reproduce the above copyright notice,
tushki7 0:60d829a0353a 28 * this list of conditions and the following disclaimer in the documentation
tushki7 0:60d829a0353a 29 * and/or other materials provided with the distribution.
tushki7 0:60d829a0353a 30 * 3. Neither the name of STMicroelectronics nor the names of its contributors
tushki7 0:60d829a0353a 31 * may be used to endorse or promote products derived from this software
tushki7 0:60d829a0353a 32 * without specific prior written permission.
tushki7 0:60d829a0353a 33 *
tushki7 0:60d829a0353a 34 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
tushki7 0:60d829a0353a 35 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
tushki7 0:60d829a0353a 36 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
tushki7 0:60d829a0353a 37 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
tushki7 0:60d829a0353a 38 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
tushki7 0:60d829a0353a 39 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
tushki7 0:60d829a0353a 40 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
tushki7 0:60d829a0353a 41 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
tushki7 0:60d829a0353a 42 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
tushki7 0:60d829a0353a 43 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
tushki7 0:60d829a0353a 44 *
tushki7 0:60d829a0353a 45 ******************************************************************************
tushki7 0:60d829a0353a 46 */
tushki7 0:60d829a0353a 47
tushki7 0:60d829a0353a 48 /** @addtogroup CMSIS
tushki7 0:60d829a0353a 49 * @{
tushki7 0:60d829a0353a 50 */
tushki7 0:60d829a0353a 51
tushki7 0:60d829a0353a 52 /** @addtogroup stm32f4xx
tushki7 0:60d829a0353a 53 * @{
tushki7 0:60d829a0353a 54 */
tushki7 0:60d829a0353a 55
tushki7 0:60d829a0353a 56 #ifndef __STM32F4xx_H
tushki7 0:60d829a0353a 57 #define __STM32F4xx_H
tushki7 0:60d829a0353a 58
tushki7 0:60d829a0353a 59 #ifdef __cplusplus
tushki7 0:60d829a0353a 60 extern "C" {
tushki7 0:60d829a0353a 61 #endif /* __cplusplus */
tushki7 0:60d829a0353a 62
tushki7 0:60d829a0353a 63 /** @addtogroup Library_configuration_section
tushki7 0:60d829a0353a 64 * @{
tushki7 0:60d829a0353a 65 */
tushki7 0:60d829a0353a 66
tushki7 0:60d829a0353a 67 /* Uncomment the line below according to the target STM32 device used in your
tushki7 0:60d829a0353a 68 application
tushki7 0:60d829a0353a 69 */
tushki7 0:60d829a0353a 70 #if !defined (STM32F405xx) && !defined (STM32F415xx) && !defined (STM32F407xx) && !defined (STM32F417xx) && \
tushki7 0:60d829a0353a 71 !defined (STM32F427xx) && !defined (STM32F437xx) && !defined (STM32F429xx) && !defined (STM32F439xx) && \
tushki7 0:60d829a0353a 72 !defined (STM32F401xC) && !defined (STM32F401xE) && !defined (STM32F411xE)
tushki7 0:60d829a0353a 73 /* #define STM32F405xx */ /*!< STM32F405RG, STM32F405VG and STM32F405ZG Devices */
tushki7 0:60d829a0353a 74 /* #define STM32F415xx */ /*!< STM32F415RG, STM32F415VG and STM32F415ZG Devices */
tushki7 0:60d829a0353a 75 /* #define STM32F407xx */ /*!< STM32F407VG, STM32F407VE, STM32F407ZG, STM32F407ZE, STM32F407IG and STM32F407IE Devices */
tushki7 0:60d829a0353a 76 /* #define STM32F417xx */ /*!< STM32F417VG, STM32F417VE, STM32F417ZG, STM32F417ZE, STM32F417IG and STM32F417IE Devices */
tushki7 0:60d829a0353a 77 /* #define STM32F427xx */ /*!< STM32F427VG, STM32F427VI, STM32F427ZG, STM32F427ZI, STM32F427IG and STM32F427II Devices */
tushki7 0:60d829a0353a 78 /* #define STM32F437xx */ /*!< STM32F437VG, STM32F437VI, STM32F437ZG, STM32F437ZI, STM32F437IG and STM32F437II Devices */
tushki7 0:60d829a0353a 79 /* #define STM32F429xx */ /*!< STM32F429VG, STM32F429VI, STM32F429ZG, STM32F429ZI, STM32F429BG, STM32F429BI, STM32F429NG,
tushki7 0:60d829a0353a 80 STM32F439NI, STM32F429IG and STM32F429II Devices */
tushki7 0:60d829a0353a 81 /* #define STM32F439xx */ /*!< STM32F439VG, STM32F439VI, STM32F439ZG, STM32F439ZI, STM32F439BG, STM32F439BI, STM32F439NG,
tushki7 0:60d829a0353a 82 STM32F439NI, STM32F439IG and STM32F439II Devices */
tushki7 0:60d829a0353a 83 /* #define STM32F401xC */ /*!< STM32F401CB, STM32F401CC, STM32F401RB, STM32F401RC, STM32F401VB and STM32F401VC Devices */
tushki7 0:60d829a0353a 84 /* #define STM32F401xE */ /*!< STM32F401CD, STM32F401RD, STM32F401VD, STM32F401CE, STM32F401RE and STM32F401VE Devices */
tushki7 0:60d829a0353a 85 #define STM32F411xE /*!< STM32F411CD, STM32F411RD, STM32F411VD, STM32F411CE, STM32F411RE and STM32F411VE Devices */
tushki7 0:60d829a0353a 86 #endif
tushki7 0:60d829a0353a 87
tushki7 0:60d829a0353a 88 /* Tip: To avoid modifying this file each time you need to switch between these
tushki7 0:60d829a0353a 89 devices, you can define the device in your toolchain compiler preprocessor.
tushki7 0:60d829a0353a 90 */
tushki7 0:60d829a0353a 91 #if !defined (USE_HAL_DRIVER)
tushki7 0:60d829a0353a 92 /**
tushki7 0:60d829a0353a 93 * @brief Comment the line below if you will not use the peripherals drivers.
tushki7 0:60d829a0353a 94 In this case, these drivers will not be included and the application code will
tushki7 0:60d829a0353a 95 be based on direct access to peripherals registers
tushki7 0:60d829a0353a 96 */
tushki7 0:60d829a0353a 97 #define USE_HAL_DRIVER
tushki7 0:60d829a0353a 98 #endif /* USE_HAL_DRIVER */
tushki7 0:60d829a0353a 99
tushki7 0:60d829a0353a 100 /**
tushki7 0:60d829a0353a 101 * @brief CMSIS Device version number V2.1.0
tushki7 0:60d829a0353a 102 */
tushki7 0:60d829a0353a 103 #define __STM32F4xx_CMSIS_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */
tushki7 0:60d829a0353a 104 #define __STM32F4xx_CMSIS_DEVICE_VERSION_SUB1 (0x01) /*!< [23:16] sub1 version */
tushki7 0:60d829a0353a 105 #define __STM32F4xx_CMSIS_DEVICE_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
tushki7 0:60d829a0353a 106 #define __STM32F4xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
tushki7 0:60d829a0353a 107 #define __STM32F4xx_CMSIS_DEVICE_VERSION ((__STM32F4xx_CMSIS_DEVICE_VERSION_MAIN << 24)\
tushki7 0:60d829a0353a 108 |(__STM32F4xx_CMSIS_DEVICE_VERSION_SUB1 << 16)\
tushki7 0:60d829a0353a 109 |(__STM32F4xx_CMSIS_DEVICE_VERSION_SUB2 << 8 )\
tushki7 0:60d829a0353a 110 |(__STM32F4xx_CMSIS_DEVICE_VERSION))
tushki7 0:60d829a0353a 111
tushki7 0:60d829a0353a 112 /**
tushki7 0:60d829a0353a 113 * @}
tushki7 0:60d829a0353a 114 */
tushki7 0:60d829a0353a 115
tushki7 0:60d829a0353a 116 /** @addtogroup Device_Included
tushki7 0:60d829a0353a 117 * @{
tushki7 0:60d829a0353a 118 */
tushki7 0:60d829a0353a 119
tushki7 0:60d829a0353a 120 #if defined(STM32F405xx)
tushki7 0:60d829a0353a 121 #include "stm32f405xx.h"
tushki7 0:60d829a0353a 122 #elif defined(STM32F415xx)
tushki7 0:60d829a0353a 123 #include "stm32f415xx.h"
tushki7 0:60d829a0353a 124 #elif defined(STM32F407xx)
tushki7 0:60d829a0353a 125 #include "stm32f407xx.h"
tushki7 0:60d829a0353a 126 #elif defined(STM32F417xx)
tushki7 0:60d829a0353a 127 #include "stm32f417xx.h"
tushki7 0:60d829a0353a 128 #elif defined(STM32F427xx)
tushki7 0:60d829a0353a 129 #include "stm32f427xx.h"
tushki7 0:60d829a0353a 130 #elif defined(STM32F437xx)
tushki7 0:60d829a0353a 131 #include "stm32f437xx.h"
tushki7 0:60d829a0353a 132 #elif defined(STM32F429xx)
tushki7 0:60d829a0353a 133 #include "stm32f429xx.h"
tushki7 0:60d829a0353a 134 #elif defined(STM32F439xx)
tushki7 0:60d829a0353a 135 #include "stm32f439xx.h"
tushki7 0:60d829a0353a 136 #elif defined(STM32F401xC)
tushki7 0:60d829a0353a 137 #include "stm32f401xc.h"
tushki7 0:60d829a0353a 138 #elif defined(STM32F401xE)
tushki7 0:60d829a0353a 139 #include "stm32f401xe.h"
tushki7 0:60d829a0353a 140 #elif defined(STM32F411xE)
tushki7 0:60d829a0353a 141 #include "stm32f411xe.h"
tushki7 0:60d829a0353a 142 #else
tushki7 0:60d829a0353a 143 #error "Please select first the target STM32F4xx device used in your application (in stm32f4xx.h file)"
tushki7 0:60d829a0353a 144 #endif
tushki7 0:60d829a0353a 145
tushki7 0:60d829a0353a 146 /**
tushki7 0:60d829a0353a 147 * @}
tushki7 0:60d829a0353a 148 */
tushki7 0:60d829a0353a 149
tushki7 0:60d829a0353a 150 /** @addtogroup Exported_types
tushki7 0:60d829a0353a 151 * @{
tushki7 0:60d829a0353a 152 */
tushki7 0:60d829a0353a 153 typedef enum
tushki7 0:60d829a0353a 154 {
tushki7 0:60d829a0353a 155 RESET = 0,
tushki7 0:60d829a0353a 156 SET = !RESET
tushki7 0:60d829a0353a 157 } FlagStatus, ITStatus;
tushki7 0:60d829a0353a 158
tushki7 0:60d829a0353a 159 typedef enum
tushki7 0:60d829a0353a 160 {
tushki7 0:60d829a0353a 161 DISABLE = 0,
tushki7 0:60d829a0353a 162 ENABLE = !DISABLE
tushki7 0:60d829a0353a 163 } FunctionalState;
tushki7 0:60d829a0353a 164 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
tushki7 0:60d829a0353a 165
tushki7 0:60d829a0353a 166 typedef enum
tushki7 0:60d829a0353a 167 {
tushki7 0:60d829a0353a 168 ERROR = 0,
tushki7 0:60d829a0353a 169 SUCCESS = !ERROR
tushki7 0:60d829a0353a 170 } ErrorStatus;
tushki7 0:60d829a0353a 171
tushki7 0:60d829a0353a 172 /**
tushki7 0:60d829a0353a 173 * @}
tushki7 0:60d829a0353a 174 */
tushki7 0:60d829a0353a 175
tushki7 0:60d829a0353a 176
tushki7 0:60d829a0353a 177 /** @addtogroup Exported_macro
tushki7 0:60d829a0353a 178 * @{
tushki7 0:60d829a0353a 179 */
tushki7 0:60d829a0353a 180 #define SET_BIT(REG, BIT) ((REG) |= (BIT))
tushki7 0:60d829a0353a 181
tushki7 0:60d829a0353a 182 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
tushki7 0:60d829a0353a 183
tushki7 0:60d829a0353a 184 #define READ_BIT(REG, BIT) ((REG) & (BIT))
tushki7 0:60d829a0353a 185
tushki7 0:60d829a0353a 186 #define CLEAR_REG(REG) ((REG) = (0x0))
tushki7 0:60d829a0353a 187
tushki7 0:60d829a0353a 188 #define WRITE_REG(REG, VAL) ((REG) = (VAL))
tushki7 0:60d829a0353a 189
tushki7 0:60d829a0353a 190 #define READ_REG(REG) ((REG))
tushki7 0:60d829a0353a 191
tushki7 0:60d829a0353a 192 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
tushki7 0:60d829a0353a 193
tushki7 0:60d829a0353a 194 #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
tushki7 0:60d829a0353a 195
tushki7 0:60d829a0353a 196
tushki7 0:60d829a0353a 197 /**
tushki7 0:60d829a0353a 198 * @}
tushki7 0:60d829a0353a 199 */
tushki7 0:60d829a0353a 200
tushki7 0:60d829a0353a 201 #if defined (USE_HAL_DRIVER)
tushki7 0:60d829a0353a 202 #include "stm32f4xx_hal.h"
tushki7 0:60d829a0353a 203 #endif /* USE_HAL_DRIVER */
tushki7 0:60d829a0353a 204
tushki7 0:60d829a0353a 205 #ifdef __cplusplus
tushki7 0:60d829a0353a 206 }
tushki7 0:60d829a0353a 207 #endif /* __cplusplus */
tushki7 0:60d829a0353a 208
tushki7 0:60d829a0353a 209 #endif /* __STM32F4xx_H */
tushki7 0:60d829a0353a 210 /**
tushki7 0:60d829a0353a 211 * @}
tushki7 0:60d829a0353a 212 */
tushki7 0:60d829a0353a 213
tushki7 0:60d829a0353a 214 /**
tushki7 0:60d829a0353a 215 * @}
tushki7 0:60d829a0353a 216 */
tushki7 0:60d829a0353a 217
tushki7 0:60d829a0353a 218
tushki7 0:60d829a0353a 219
tushki7 0:60d829a0353a 220
tushki7 0:60d829a0353a 221 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/