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 stm32f3xx.h
tushki7 0:60d829a0353a 4 * @author MCD Application Team
tushki7 0:60d829a0353a 5 * @version V2.1.0
tushki7 0:60d829a0353a 6 * @date 12-Sept-2014
tushki7 0:60d829a0353a 7 * @brief CMSIS STM32F3xx 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 STM32F3xx 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 stm32f3xx
tushki7 0:60d829a0353a 53 * @{
tushki7 0:60d829a0353a 54 */
tushki7 0:60d829a0353a 55
tushki7 0:60d829a0353a 56 #ifndef __STM32F3xx_H
tushki7 0:60d829a0353a 57 #define __STM32F3xx_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
tushki7 0:60d829a0353a 71 #if !defined (STM32F301x8) && !defined (STM32F302x8) && !defined (STM32F318xx) && \
tushki7 0:60d829a0353a 72 !defined (STM32F302xC) && !defined (STM32F303xC) && !defined (STM32F358xx) && \
tushki7 0:60d829a0353a 73 !defined (STM32F303x8) && !defined (STM32F334x8) && !defined (STM32F328xx) && \
tushki7 0:60d829a0353a 74 !defined (STM32F302xE) && !defined (STM32F303xE) && !defined (STM32F398xx) && \
tushki7 0:60d829a0353a 75 !defined (STM32F373xC) && !defined (STM32F378xx)
tushki7 0:60d829a0353a 76
tushki7 0:60d829a0353a 77 /* #define STM32F301x8 */ /*!< STM32F301K6, STM32F301K8, STM32F301C6, STM32F301C8,
tushki7 0:60d829a0353a 78 STM32F301R6 and STM32F301R8 Devices */
tushki7 0:60d829a0353a 79 #define STM32F302x8 /*!< STM32F302K6, STM32F302K8, STM32F302C6, STM32F302C8,
tushki7 0:60d829a0353a 80 STM32F302R6 and STM32F302R8 Devices */
tushki7 0:60d829a0353a 81 /* #define STM32F302xC */ /*!< STM32F302CB, STM32F302CC, STM32F302RB, STM32F302RC, STM32F302VB and STM32F302VC Devices */
tushki7 0:60d829a0353a 82 /* #define STM32F302xE */ /*!< STM32F302CE, STM32F302RE, and STM32F302VE Devices */
tushki7 0:60d829a0353a 83 /* #define STM32F303x8 */ /*!< STM32F303K6, STM32F303K8, STM32F303C6, STM32F303C8,
tushki7 0:60d829a0353a 84 STM32F303R6 and STM32F303R8 Devices */
tushki7 0:60d829a0353a 85 /* #define STM32F303xC */ /*!< STM32F303CB, STM32F303CC, STM32F303RB, STM32F303RC, STM32F303VB and STM32F303VC Devices */
tushki7 0:60d829a0353a 86 /* #define STM32F303xE */ /*!< STM32F303RE, STM32F303VE and STM32F303ZE Devices */
tushki7 0:60d829a0353a 87 /* #define STM32F373xC */ /*!< STM32F373C8, STM32F373CB, STM32F373CC, STM32F373R8, STM32F373RB, STM32F373RC,
tushki7 0:60d829a0353a 88 STM32F373V8, STM32F373VB and STM32F373VC Devices */
tushki7 0:60d829a0353a 89 /* #define STM32F334x8 */ /*!< STM32F334C4, STM32F334C6, STM32F334C8, STM32F334R4, STM32F334R6 and STM32F334R8 Devices */
tushki7 0:60d829a0353a 90 /* #define STM32F318xx */ /*!< STM32F318K8, STM32F318C8: STM32F301x8 with regulator off: STM32F318xx Devices */
tushki7 0:60d829a0353a 91 /* #define STM32F328xx */ /*!< STM32F328C8, STM32F328R8: STM32F334x8 with regulator off: STM32F328xx Devices */
tushki7 0:60d829a0353a 92 /* #define STM32F358xx */ /*!< STM32F358CC, STM32F358RC, STM32F358VC: STM32F303xC with regulator off: STM32F358xx Devices */
tushki7 0:60d829a0353a 93 /* #define STM32F378xx */ /*!< STM32F378CC, STM32F378RC, STM32F378VC: STM32F373xC with regulator off: STM32F378xx Devices */
tushki7 0:60d829a0353a 94 /* #define STM32F398xx */ /*!< STM32F398CE, STM32F398RE, STM32F398VE: STM32F303xE with regulator off: STM32F398xx Devices */
tushki7 0:60d829a0353a 95 #endif
tushki7 0:60d829a0353a 96
tushki7 0:60d829a0353a 97 /* Tip: To avoid modifying this file each time you need to switch between these
tushki7 0:60d829a0353a 98 devices, you can define the device in your toolchain compiler preprocessor.
tushki7 0:60d829a0353a 99 */
tushki7 0:60d829a0353a 100 #if !defined (USE_HAL_DRIVER)
tushki7 0:60d829a0353a 101 /**
tushki7 0:60d829a0353a 102 * @brief Comment the line below if you will not use the peripherals drivers.
tushki7 0:60d829a0353a 103 In this case, these drivers will not be included and the application code will
tushki7 0:60d829a0353a 104 be based on direct access to peripherals registers
tushki7 0:60d829a0353a 105 */
tushki7 0:60d829a0353a 106 #define USE_HAL_DRIVER
tushki7 0:60d829a0353a 107 #endif /* USE_HAL_DRIVER */
tushki7 0:60d829a0353a 108
tushki7 0:60d829a0353a 109 /**
tushki7 0:60d829a0353a 110 * @brief CMSIS Device version number V2.1.0
tushki7 0:60d829a0353a 111 */
tushki7 0:60d829a0353a 112 #define __STM32F3xx_CMSIS_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */
tushki7 0:60d829a0353a 113 #define __STM32F3xx_CMSIS_DEVICE_VERSION_SUB1 (0x01) /*!< [23:16] sub1 version */
tushki7 0:60d829a0353a 114 #define __STM32F3xx_CMSIS_DEVICE_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
tushki7 0:60d829a0353a 115 #define __STM32F3xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
tushki7 0:60d829a0353a 116 #define __STM32F3xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\
tushki7 0:60d829a0353a 117 |(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\
tushki7 0:60d829a0353a 118 |(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\
tushki7 0:60d829a0353a 119 |(__CMSIS_DEVICE_HAL_VERSION_RC))
tushki7 0:60d829a0353a 120
tushki7 0:60d829a0353a 121 /**
tushki7 0:60d829a0353a 122 * @}
tushki7 0:60d829a0353a 123 */
tushki7 0:60d829a0353a 124
tushki7 0:60d829a0353a 125 /** @addtogroup Device_Included
tushki7 0:60d829a0353a 126 * @{
tushki7 0:60d829a0353a 127 */
tushki7 0:60d829a0353a 128
tushki7 0:60d829a0353a 129 #if defined(STM32F301x8)
tushki7 0:60d829a0353a 130 #include "stm32f301x8.h"
tushki7 0:60d829a0353a 131 #elif defined(STM32F302x8)
tushki7 0:60d829a0353a 132 #include "stm32f302x8.h"
tushki7 0:60d829a0353a 133 #elif defined(STM32F302xC)
tushki7 0:60d829a0353a 134 #include "stm32f302xc.h"
tushki7 0:60d829a0353a 135 #elif defined(STM32F302xE)
tushki7 0:60d829a0353a 136 #include "stm32f302xe.h"
tushki7 0:60d829a0353a 137 #elif defined(STM32F303x8)
tushki7 0:60d829a0353a 138 #include "stm32f303x8.h"
tushki7 0:60d829a0353a 139 #elif defined(STM32F303xC)
tushki7 0:60d829a0353a 140 #include "stm32f303xc.h"
tushki7 0:60d829a0353a 141 #elif defined(STM32F303xE)
tushki7 0:60d829a0353a 142 #include "stm32f303xe.h"
tushki7 0:60d829a0353a 143 #elif defined(STM32F373xC)
tushki7 0:60d829a0353a 144 #include "stm32f373xc.h"
tushki7 0:60d829a0353a 145 #elif defined(STM32F334x8)
tushki7 0:60d829a0353a 146 #include "stm32f334x8.h"
tushki7 0:60d829a0353a 147 #elif defined(STM32F318xx)
tushki7 0:60d829a0353a 148 #include "stm32f318xx.h"
tushki7 0:60d829a0353a 149 #elif defined(STM32F328xx)
tushki7 0:60d829a0353a 150 #include "stm32f328xx.h"
tushki7 0:60d829a0353a 151 #elif defined(STM32F358xx)
tushki7 0:60d829a0353a 152 #include "stm32f358xx.h"
tushki7 0:60d829a0353a 153 #elif defined(STM32F378xx)
tushki7 0:60d829a0353a 154 #include "stm32f378xx.h"
tushki7 0:60d829a0353a 155 #elif defined(STM32F398xx)
tushki7 0:60d829a0353a 156 #include "stm32f398xx.h"
tushki7 0:60d829a0353a 157 #else
tushki7 0:60d829a0353a 158 #error "Please select first the target STM32F3xx device used in your application (in stm32f3xx.h file)"
tushki7 0:60d829a0353a 159 #endif
tushki7 0:60d829a0353a 160
tushki7 0:60d829a0353a 161 /**
tushki7 0:60d829a0353a 162 * @}
tushki7 0:60d829a0353a 163 */
tushki7 0:60d829a0353a 164
tushki7 0:60d829a0353a 165 /** @addtogroup Exported_types
tushki7 0:60d829a0353a 166 * @{
tushki7 0:60d829a0353a 167 */
tushki7 0:60d829a0353a 168 typedef enum
tushki7 0:60d829a0353a 169 {
tushki7 0:60d829a0353a 170 RESET = 0,
tushki7 0:60d829a0353a 171 SET = !RESET
tushki7 0:60d829a0353a 172 } FlagStatus, ITStatus;
tushki7 0:60d829a0353a 173
tushki7 0:60d829a0353a 174 typedef enum
tushki7 0:60d829a0353a 175 {
tushki7 0:60d829a0353a 176 DISABLE = 0,
tushki7 0:60d829a0353a 177 ENABLE = !DISABLE
tushki7 0:60d829a0353a 178 } FunctionalState;
tushki7 0:60d829a0353a 179 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
tushki7 0:60d829a0353a 180
tushki7 0:60d829a0353a 181 typedef enum
tushki7 0:60d829a0353a 182 {
tushki7 0:60d829a0353a 183 ERROR = 0,
tushki7 0:60d829a0353a 184 SUCCESS = !ERROR
tushki7 0:60d829a0353a 185 } ErrorStatus;
tushki7 0:60d829a0353a 186
tushki7 0:60d829a0353a 187 /**
tushki7 0:60d829a0353a 188 * @}
tushki7 0:60d829a0353a 189 */
tushki7 0:60d829a0353a 190
tushki7 0:60d829a0353a 191
tushki7 0:60d829a0353a 192 /** @addtogroup Exported_macros
tushki7 0:60d829a0353a 193 * @{
tushki7 0:60d829a0353a 194 */
tushki7 0:60d829a0353a 195 #define SET_BIT(REG, BIT) ((REG) |= (BIT))
tushki7 0:60d829a0353a 196
tushki7 0:60d829a0353a 197 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
tushki7 0:60d829a0353a 198
tushki7 0:60d829a0353a 199 #define READ_BIT(REG, BIT) ((REG) & (BIT))
tushki7 0:60d829a0353a 200
tushki7 0:60d829a0353a 201 #define CLEAR_REG(REG) ((REG) = (0x0))
tushki7 0:60d829a0353a 202
tushki7 0:60d829a0353a 203 #define WRITE_REG(REG, VAL) ((REG) = (VAL))
tushki7 0:60d829a0353a 204
tushki7 0:60d829a0353a 205 #define READ_REG(REG) ((REG))
tushki7 0:60d829a0353a 206
tushki7 0:60d829a0353a 207 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
tushki7 0:60d829a0353a 208
tushki7 0:60d829a0353a 209 #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
tushki7 0:60d829a0353a 210
tushki7 0:60d829a0353a 211
tushki7 0:60d829a0353a 212 #if defined (USE_HAL_DRIVER)
tushki7 0:60d829a0353a 213 #include "stm32f3xx_hal.h"
tushki7 0:60d829a0353a 214 #endif /* USE_HAL_DRIVER */
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
tushki7 0:60d829a0353a 222 #ifdef __cplusplus
tushki7 0:60d829a0353a 223 }
tushki7 0:60d829a0353a 224 #endif /* __cplusplus */
tushki7 0:60d829a0353a 225
tushki7 0:60d829a0353a 226 #endif /* __STM32F3xx_H */
tushki7 0:60d829a0353a 227 /**
tushki7 0:60d829a0353a 228 * @}
tushki7 0:60d829a0353a 229 */
tushki7 0:60d829a0353a 230
tushki7 0:60d829a0353a 231 /**
tushki7 0:60d829a0353a 232 * @}
tushki7 0:60d829a0353a 233 */
tushki7 0:60d829a0353a 234
tushki7 0:60d829a0353a 235
tushki7 0:60d829a0353a 236
tushki7 0:60d829a0353a 237
tushki7 0:60d829a0353a 238 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/