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 stm32f0xx.h
tushki7 0:60d829a0353a 4 * @author MCD Application Team
tushki7 0:60d829a0353a 5 * @version V2.2.0
tushki7 0:60d829a0353a 6 * @date 05-December-2014
tushki7 0:60d829a0353a 7 * @brief CMSIS STM32F0xx 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 STM32F0xx 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 stm32f0xx
tushki7 0:60d829a0353a 53 * @{
tushki7 0:60d829a0353a 54 */
tushki7 0:60d829a0353a 55
tushki7 0:60d829a0353a 56 #ifndef __STM32F0xx_H
tushki7 0:60d829a0353a 57 #define __STM32F0xx_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 (STM32F030x6) && !defined (STM32F030x8) && \
tushki7 0:60d829a0353a 72 !defined (STM32F031x6) && !defined (STM32F038xx) && \
tushki7 0:60d829a0353a 73 !defined (STM32F042x6) && !defined (STM32F048xx) && !defined (STM32F070x6) && \
tushki7 0:60d829a0353a 74 !defined (STM32F051x8) && !defined (STM32F058xx) && \
tushki7 0:60d829a0353a 75 !defined (STM32F071xB) && !defined (STM32F072xB) && !defined (STM32F078xx) && !defined (STM32F070xB) && \
tushki7 0:60d829a0353a 76 !defined (STM32F091xC) && !defined (STM32F098xx) && !defined (STM32F030xC)
tushki7 0:60d829a0353a 77 /* #define STM32F030x6 */ /*!< STM32F030x4, STM32F030x6 Devices (STM32F030xx microcontrollers where the Flash memory ranges between 16 and 32 Kbytes) */
tushki7 0:60d829a0353a 78 #define STM32F030x8 /*!< STM32F030x8 Devices (STM32F030xx microcontrollers where the Flash memory is 64 Kbytes) */
tushki7 0:60d829a0353a 79 /* #define STM32F031x6 */ /*!< STM32F031x4, STM32F031x6 Devices (STM32F031xx microcontrollers where the Flash memory ranges between 16 and 32 Kbytes) */
tushki7 0:60d829a0353a 80 /* #define STM32F038xx */ /*!< STM32F038xx Devices (STM32F038xx microcontrollers where the Flash memory is 32 Kbytes) */
tushki7 0:60d829a0353a 81 /* #define STM32F042x6 */ /*!< STM32F042x4, STM32F042x6 Devices (STM32F042xx microcontrollers where the Flash memory ranges between 16 and 32 Kbytes) */
tushki7 0:60d829a0353a 82 /* #define STM32F048x6 */ /*!< STM32F048xx Devices (STM32F042xx microcontrollers where the Flash memory is 32 Kbytes) */
tushki7 0:60d829a0353a 83 /* #define STM32F051x8 */ /*!< STM32F051x4, STM32F051x6, STM32F051x8 Devices (STM32F051xx microcontrollers where the Flash memory ranges between 16 and 64 Kbytes) */
tushki7 0:60d829a0353a 84 /* #define STM32F058xx */ /*!< STM32F058xx Devices (STM32F058xx microcontrollers where the Flash memory is 64 Kbytes) */
tushki7 0:60d829a0353a 85 /* #define STM32F070x6 */ /*!< STM32F070x6 Devices (STM32F070x6 microcontrollers where the Flash memory ranges between 16 and 32 Kbytes) */
tushki7 0:60d829a0353a 86 /* #define STM32F070xB */ /*!< STM32F070xB Devices (STM32F070xB microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */
tushki7 0:60d829a0353a 87 /* #define STM32F071xB */ /*!< STM32F071x8, STM32F071xB Devices (STM32F071xx microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */
tushki7 0:60d829a0353a 88 /* #define STM32F072xB */ /*!< STM32F072x8, STM32F072xB Devices (STM32F072xx microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */
tushki7 0:60d829a0353a 89 /* #define STM32F078xx */ /*!< STM32F078xx Devices (STM32F078xx microcontrollers where the Flash memory is 128 Kbytes) */
tushki7 0:60d829a0353a 90 /* #define STM32F030xC */ /*!< STM32F030xC Devices (STM32F030xC microcontrollers where the Flash memory is 256 Kbytes) */
tushki7 0:60d829a0353a 91 /* #define STM32F091xC */ /*!< STM32F091xC Devices (STM32F091xx microcontrollers where the Flash memory is 256 Kbytes) */
tushki7 0:60d829a0353a 92 /* #define STM32F098xx */ /*!< STM32F098xx Devices (STM32F098xx microcontrollers where the Flash memory is 256 Kbytes) */
tushki7 0:60d829a0353a 93 #endif
tushki7 0:60d829a0353a 94
tushki7 0:60d829a0353a 95 /* Tip: To avoid modifying this file each time you need to switch between these
tushki7 0:60d829a0353a 96 devices, you can define the device in your toolchain compiler preprocessor.
tushki7 0:60d829a0353a 97 */
tushki7 0:60d829a0353a 98 #if !defined (USE_HAL_DRIVER)
tushki7 0:60d829a0353a 99 /**
tushki7 0:60d829a0353a 100 * @brief Comment the line below if you will not use the peripherals drivers.
tushki7 0:60d829a0353a 101 In this case, these drivers will not be included and the application code will
tushki7 0:60d829a0353a 102 be based on direct access to peripherals registers
tushki7 0:60d829a0353a 103 */
tushki7 0:60d829a0353a 104 #define USE_HAL_DRIVER
tushki7 0:60d829a0353a 105 #endif /* USE_HAL_DRIVER */
tushki7 0:60d829a0353a 106
tushki7 0:60d829a0353a 107 /**
tushki7 0:60d829a0353a 108 * @brief CMSIS Device version number V2.2.0
tushki7 0:60d829a0353a 109 */
tushki7 0:60d829a0353a 110 #define __STM32F0xx_CMSIS_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */
tushki7 0:60d829a0353a 111 #define __STM32F0xx_CMSIS_DEVICE_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */
tushki7 0:60d829a0353a 112 #define __STM32F0xx_CMSIS_DEVICE_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
tushki7 0:60d829a0353a 113 #define __STM32F0xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
tushki7 0:60d829a0353a 114 #define __STM32F0xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\
tushki7 0:60d829a0353a 115 |(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\
tushki7 0:60d829a0353a 116 |(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\
tushki7 0:60d829a0353a 117 |(__CMSIS_DEVICE_HAL_VERSION_RC))
tushki7 0:60d829a0353a 118
tushki7 0:60d829a0353a 119 /**
tushki7 0:60d829a0353a 120 * @}
tushki7 0:60d829a0353a 121 */
tushki7 0:60d829a0353a 122
tushki7 0:60d829a0353a 123 /** @addtogroup Device_Included
tushki7 0:60d829a0353a 124 * @{
tushki7 0:60d829a0353a 125 */
tushki7 0:60d829a0353a 126
tushki7 0:60d829a0353a 127 #if defined(STM32F030x6)
tushki7 0:60d829a0353a 128 #include "stm32f030x6.h"
tushki7 0:60d829a0353a 129 #elif defined(STM32F030x8)
tushki7 0:60d829a0353a 130 #include "stm32f030x8.h"
tushki7 0:60d829a0353a 131 #elif defined(STM32F031x6)
tushki7 0:60d829a0353a 132 #include "stm32f031x6.h"
tushki7 0:60d829a0353a 133 #elif defined(STM32F038xx)
tushki7 0:60d829a0353a 134 #include "stm32f038xx.h"
tushki7 0:60d829a0353a 135 #elif defined(STM32F042x6)
tushki7 0:60d829a0353a 136 #include "stm32f042x6.h"
tushki7 0:60d829a0353a 137 #elif defined(STM32F048xx)
tushki7 0:60d829a0353a 138 #include "stm32f048xx.h"
tushki7 0:60d829a0353a 139 #elif defined(STM32F051x8)
tushki7 0:60d829a0353a 140 #include "stm32f051x8.h"
tushki7 0:60d829a0353a 141 #elif defined(STM32F058xx)
tushki7 0:60d829a0353a 142 #include "stm32f058xx.h"
tushki7 0:60d829a0353a 143 #elif defined(STM32F070x6)
tushki7 0:60d829a0353a 144 #include "stm32f070x6.h"
tushki7 0:60d829a0353a 145 #elif defined(STM32F070xB)
tushki7 0:60d829a0353a 146 #include "stm32f070xb.h"
tushki7 0:60d829a0353a 147 #elif defined(STM32F071xB)
tushki7 0:60d829a0353a 148 #include "stm32f071xb.h"
tushki7 0:60d829a0353a 149 #elif defined(STM32F072xB)
tushki7 0:60d829a0353a 150 #include "stm32f072xb.h"
tushki7 0:60d829a0353a 151 #elif defined(STM32F078xx)
tushki7 0:60d829a0353a 152 #include "stm32f078xx.h"
tushki7 0:60d829a0353a 153 #elif defined(STM32F091xC)
tushki7 0:60d829a0353a 154 #include "stm32f091xc.h"
tushki7 0:60d829a0353a 155 #elif defined(STM32F098xx)
tushki7 0:60d829a0353a 156 #include "stm32f098xx.h"
tushki7 0:60d829a0353a 157 #elif defined(STM32F030xC)
tushki7 0:60d829a0353a 158 #include "stm32f030xc.h"
tushki7 0:60d829a0353a 159 #else
tushki7 0:60d829a0353a 160 #error "Please select first the target STM32F0xx device used in your application (in stm32f0xx.h file)"
tushki7 0:60d829a0353a 161 #endif
tushki7 0:60d829a0353a 162
tushki7 0:60d829a0353a 163 /**
tushki7 0:60d829a0353a 164 * @}
tushki7 0:60d829a0353a 165 */
tushki7 0:60d829a0353a 166
tushki7 0:60d829a0353a 167 /** @addtogroup Exported_types
tushki7 0:60d829a0353a 168 * @{
tushki7 0:60d829a0353a 169 */
tushki7 0:60d829a0353a 170 typedef enum
tushki7 0:60d829a0353a 171 {
tushki7 0:60d829a0353a 172 RESET = 0,
tushki7 0:60d829a0353a 173 SET = !RESET
tushki7 0:60d829a0353a 174 } FlagStatus, ITStatus;
tushki7 0:60d829a0353a 175
tushki7 0:60d829a0353a 176 typedef enum
tushki7 0:60d829a0353a 177 {
tushki7 0:60d829a0353a 178 DISABLE = 0,
tushki7 0:60d829a0353a 179 ENABLE = !DISABLE
tushki7 0:60d829a0353a 180 } FunctionalState;
tushki7 0:60d829a0353a 181 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
tushki7 0:60d829a0353a 182
tushki7 0:60d829a0353a 183 typedef enum
tushki7 0:60d829a0353a 184 {
tushki7 0:60d829a0353a 185 ERROR = 0,
tushki7 0:60d829a0353a 186 SUCCESS = !ERROR
tushki7 0:60d829a0353a 187 } ErrorStatus;
tushki7 0:60d829a0353a 188
tushki7 0:60d829a0353a 189 /**
tushki7 0:60d829a0353a 190 * @}
tushki7 0:60d829a0353a 191 */
tushki7 0:60d829a0353a 192
tushki7 0:60d829a0353a 193
tushki7 0:60d829a0353a 194 /** @addtogroup Exported_macros
tushki7 0:60d829a0353a 195 * @{
tushki7 0:60d829a0353a 196 */
tushki7 0:60d829a0353a 197 #define SET_BIT(REG, BIT) ((REG) |= (BIT))
tushki7 0:60d829a0353a 198
tushki7 0:60d829a0353a 199 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
tushki7 0:60d829a0353a 200
tushki7 0:60d829a0353a 201 #define READ_BIT(REG, BIT) ((REG) & (BIT))
tushki7 0:60d829a0353a 202
tushki7 0:60d829a0353a 203 #define CLEAR_REG(REG) ((REG) = (0x0))
tushki7 0:60d829a0353a 204
tushki7 0:60d829a0353a 205 #define WRITE_REG(REG, VAL) ((REG) = (VAL))
tushki7 0:60d829a0353a 206
tushki7 0:60d829a0353a 207 #define READ_REG(REG) ((REG))
tushki7 0:60d829a0353a 208
tushki7 0:60d829a0353a 209 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
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 #if defined (USE_HAL_DRIVER)
tushki7 0:60d829a0353a 217 #include "stm32f0xx_hal.h"
tushki7 0:60d829a0353a 218 #endif /* USE_HAL_DRIVER */
tushki7 0:60d829a0353a 219
tushki7 0:60d829a0353a 220
tushki7 0:60d829a0353a 221 #ifdef __cplusplus
tushki7 0:60d829a0353a 222 }
tushki7 0:60d829a0353a 223 #endif /* __cplusplus */
tushki7 0:60d829a0353a 224
tushki7 0:60d829a0353a 225 #endif /* __STM32F0xx_H */
tushki7 0:60d829a0353a 226 /**
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 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/