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_hal_def.h
tushki7 0:60d829a0353a 4 * @author MCD Application Team
tushki7 0:60d829a0353a 5 * @version V1.1.0
tushki7 0:60d829a0353a 6 * @date 19-June-2014
tushki7 0:60d829a0353a 7 * @brief This file contains HAL common defines, enumeration, macros and
tushki7 0:60d829a0353a 8 * structures definitions.
tushki7 0:60d829a0353a 9 ******************************************************************************
tushki7 0:60d829a0353a 10 * @attention
tushki7 0:60d829a0353a 11 *
tushki7 0:60d829a0353a 12 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
tushki7 0:60d829a0353a 13 *
tushki7 0:60d829a0353a 14 * Redistribution and use in source and binary forms, with or without modification,
tushki7 0:60d829a0353a 15 * are permitted provided that the following conditions are met:
tushki7 0:60d829a0353a 16 * 1. Redistributions of source code must retain the above copyright notice,
tushki7 0:60d829a0353a 17 * this list of conditions and the following disclaimer.
tushki7 0:60d829a0353a 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
tushki7 0:60d829a0353a 19 * this list of conditions and the following disclaimer in the documentation
tushki7 0:60d829a0353a 20 * and/or other materials provided with the distribution.
tushki7 0:60d829a0353a 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
tushki7 0:60d829a0353a 22 * may be used to endorse or promote products derived from this software
tushki7 0:60d829a0353a 23 * without specific prior written permission.
tushki7 0:60d829a0353a 24 *
tushki7 0:60d829a0353a 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
tushki7 0:60d829a0353a 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
tushki7 0:60d829a0353a 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
tushki7 0:60d829a0353a 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
tushki7 0:60d829a0353a 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
tushki7 0:60d829a0353a 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
tushki7 0:60d829a0353a 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
tushki7 0:60d829a0353a 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
tushki7 0:60d829a0353a 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
tushki7 0:60d829a0353a 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
tushki7 0:60d829a0353a 35 *
tushki7 0:60d829a0353a 36 ******************************************************************************
tushki7 0:60d829a0353a 37 */
tushki7 0:60d829a0353a 38
tushki7 0:60d829a0353a 39 /* Define to prevent recursive inclusion -------------------------------------*/
tushki7 0:60d829a0353a 40 #ifndef __STM32F4xx_HAL_DEF
tushki7 0:60d829a0353a 41 #define __STM32F4xx_HAL_DEF
tushki7 0:60d829a0353a 42
tushki7 0:60d829a0353a 43 #ifdef __cplusplus
tushki7 0:60d829a0353a 44 extern "C" {
tushki7 0:60d829a0353a 45 #endif
tushki7 0:60d829a0353a 46
tushki7 0:60d829a0353a 47 /* Includes ------------------------------------------------------------------*/
tushki7 0:60d829a0353a 48 #include "stm32f4xx.h"
tushki7 0:60d829a0353a 49
tushki7 0:60d829a0353a 50 /* Exported types ------------------------------------------------------------*/
tushki7 0:60d829a0353a 51
tushki7 0:60d829a0353a 52 /**
tushki7 0:60d829a0353a 53 * @brief HAL Status structures definition
tushki7 0:60d829a0353a 54 */
tushki7 0:60d829a0353a 55 typedef enum
tushki7 0:60d829a0353a 56 {
tushki7 0:60d829a0353a 57 HAL_OK = 0x00,
tushki7 0:60d829a0353a 58 HAL_ERROR = 0x01,
tushki7 0:60d829a0353a 59 HAL_BUSY = 0x02,
tushki7 0:60d829a0353a 60 HAL_TIMEOUT = 0x03
tushki7 0:60d829a0353a 61 } HAL_StatusTypeDef;
tushki7 0:60d829a0353a 62
tushki7 0:60d829a0353a 63 /**
tushki7 0:60d829a0353a 64 * @brief HAL Lock structures definition
tushki7 0:60d829a0353a 65 */
tushki7 0:60d829a0353a 66 typedef enum
tushki7 0:60d829a0353a 67 {
tushki7 0:60d829a0353a 68 HAL_UNLOCKED = 0x00,
tushki7 0:60d829a0353a 69 HAL_LOCKED = 0x01
tushki7 0:60d829a0353a 70 } HAL_LockTypeDef;
tushki7 0:60d829a0353a 71
tushki7 0:60d829a0353a 72 /* Exported macro ------------------------------------------------------------*/
tushki7 0:60d829a0353a 73 #ifndef NULL
tushki7 0:60d829a0353a 74 #define HAL_NULL (void *) 0
tushki7 0:60d829a0353a 75 #endif
tushki7 0:60d829a0353a 76
tushki7 0:60d829a0353a 77 #define HAL_MAX_DELAY 0xFFFFFFFF
tushki7 0:60d829a0353a 78
tushki7 0:60d829a0353a 79 #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET)
tushki7 0:60d829a0353a 80 #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET)
tushki7 0:60d829a0353a 81
tushki7 0:60d829a0353a 82 #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \
tushki7 0:60d829a0353a 83 do{ \
tushki7 0:60d829a0353a 84 (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \
tushki7 0:60d829a0353a 85 (__DMA_HANDLE__).Parent = (__HANDLE__); \
tushki7 0:60d829a0353a 86 } while(0)
tushki7 0:60d829a0353a 87
tushki7 0:60d829a0353a 88 /** @brief Reset the Handle's State field.
tushki7 0:60d829a0353a 89 * @param __HANDLE__: specifies the Peripheral Handle.
tushki7 0:60d829a0353a 90 * @note This macro can be used for the following purpose:
tushki7 0:60d829a0353a 91 * - When the Handle is declared as local variable; before passing it as parameter
tushki7 0:60d829a0353a 92 * to HAL_PPP_Init() for the first time, it is mandatory to use this macro
tushki7 0:60d829a0353a 93 * to set to 0 the Handle's "State" field.
tushki7 0:60d829a0353a 94 * Otherwise, "State" field may have any random value and the first time the function
tushki7 0:60d829a0353a 95 * HAL_PPP_Init() is called, the low level hardware initialization will be missed
tushki7 0:60d829a0353a 96 * (i.e. HAL_PPP_MspInit() will not be executed).
tushki7 0:60d829a0353a 97 * - When there is a need to reconfigure the low level hardware: instead of calling
tushki7 0:60d829a0353a 98 * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init().
tushki7 0:60d829a0353a 99 * In this later function, when the Handle's "State" field is set to 0, it will execute the function
tushki7 0:60d829a0353a 100 * HAL_PPP_MspInit() which will reconfigure the low level hardware.
tushki7 0:60d829a0353a 101 * @retval None
tushki7 0:60d829a0353a 102 */
tushki7 0:60d829a0353a 103 #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0)
tushki7 0:60d829a0353a 104
tushki7 0:60d829a0353a 105 #if (USE_RTOS == 1)
tushki7 0:60d829a0353a 106 /* Reserved for future use */
tushki7 0:60d829a0353a 107 #error “USE_RTOS should be 0 in the current HAL release”
tushki7 0:60d829a0353a 108 #else
tushki7 0:60d829a0353a 109 #define __HAL_LOCK(__HANDLE__) \
tushki7 0:60d829a0353a 110 do{ \
tushki7 0:60d829a0353a 111 if((__HANDLE__)->Lock == HAL_LOCKED) \
tushki7 0:60d829a0353a 112 { \
tushki7 0:60d829a0353a 113 return HAL_BUSY; \
tushki7 0:60d829a0353a 114 } \
tushki7 0:60d829a0353a 115 else \
tushki7 0:60d829a0353a 116 { \
tushki7 0:60d829a0353a 117 (__HANDLE__)->Lock = HAL_LOCKED; \
tushki7 0:60d829a0353a 118 } \
tushki7 0:60d829a0353a 119 }while (0)
tushki7 0:60d829a0353a 120
tushki7 0:60d829a0353a 121 #define __HAL_UNLOCK(__HANDLE__) \
tushki7 0:60d829a0353a 122 do{ \
tushki7 0:60d829a0353a 123 (__HANDLE__)->Lock = HAL_UNLOCKED; \
tushki7 0:60d829a0353a 124 }while (0)
tushki7 0:60d829a0353a 125 #endif /* USE_RTOS */
tushki7 0:60d829a0353a 126
tushki7 0:60d829a0353a 127 #if defined ( __GNUC__ )
tushki7 0:60d829a0353a 128 #ifndef __weak
tushki7 0:60d829a0353a 129 #define __weak __attribute__((weak))
tushki7 0:60d829a0353a 130 #endif /* __weak */
tushki7 0:60d829a0353a 131 #ifndef __packed
tushki7 0:60d829a0353a 132 #define __packed __attribute__((__packed__))
tushki7 0:60d829a0353a 133 #endif /* __packed */
tushki7 0:60d829a0353a 134 #endif /* __GNUC__ */
tushki7 0:60d829a0353a 135
tushki7 0:60d829a0353a 136
tushki7 0:60d829a0353a 137 /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
tushki7 0:60d829a0353a 138 #if defined (__GNUC__) /* GNU Compiler */
tushki7 0:60d829a0353a 139 #ifndef __ALIGN_END
tushki7 0:60d829a0353a 140 #define __ALIGN_END __attribute__ ((aligned (4)))
tushki7 0:60d829a0353a 141 #endif /* __ALIGN_END */
tushki7 0:60d829a0353a 142 #ifndef __ALIGN_BEGIN
tushki7 0:60d829a0353a 143 #define __ALIGN_BEGIN
tushki7 0:60d829a0353a 144 #endif /* __ALIGN_BEGIN */
tushki7 0:60d829a0353a 145 #else
tushki7 0:60d829a0353a 146 #ifndef __ALIGN_END
tushki7 0:60d829a0353a 147 #define __ALIGN_END
tushki7 0:60d829a0353a 148 #endif /* __ALIGN_END */
tushki7 0:60d829a0353a 149 #ifndef __ALIGN_BEGIN
tushki7 0:60d829a0353a 150 #if defined (__CC_ARM) /* ARM Compiler */
tushki7 0:60d829a0353a 151 #define __ALIGN_BEGIN __align(4)
tushki7 0:60d829a0353a 152 #elif defined (__ICCARM__) /* IAR Compiler */
tushki7 0:60d829a0353a 153 #define __ALIGN_BEGIN
tushki7 0:60d829a0353a 154 #endif /* __CC_ARM */
tushki7 0:60d829a0353a 155 #endif /* __ALIGN_BEGIN */
tushki7 0:60d829a0353a 156 #endif /* __GNUC__ */
tushki7 0:60d829a0353a 157
tushki7 0:60d829a0353a 158
tushki7 0:60d829a0353a 159 /**
tushki7 0:60d829a0353a 160 * @brief __RAM_FUNC definition
tushki7 0:60d829a0353a 161 */
tushki7 0:60d829a0353a 162 #if defined ( __CC_ARM )
tushki7 0:60d829a0353a 163 /* ARM Compiler
tushki7 0:60d829a0353a 164 ------------
tushki7 0:60d829a0353a 165 RAM functions are defined using the toolchain options.
tushki7 0:60d829a0353a 166 Functions that are executed in RAM should reside in a separate source module.
tushki7 0:60d829a0353a 167 Using the 'Options for File' dialog you can simply change the 'Code / Const'
tushki7 0:60d829a0353a 168 area of a module to a memory space in physical RAM.
tushki7 0:60d829a0353a 169 Available memory areas are declared in the 'Target' tab of the 'Options for Target'
tushki7 0:60d829a0353a 170 dialog.
tushki7 0:60d829a0353a 171 */
tushki7 0:60d829a0353a 172 #define __RAM_FUNC HAL_StatusTypeDef
tushki7 0:60d829a0353a 173
tushki7 0:60d829a0353a 174 #elif defined ( __ICCARM__ )
tushki7 0:60d829a0353a 175 /* ICCARM Compiler
tushki7 0:60d829a0353a 176 ---------------
tushki7 0:60d829a0353a 177 RAM functions are defined using a specific toolchain keyword "__ramfunc".
tushki7 0:60d829a0353a 178 */
tushki7 0:60d829a0353a 179 #define __RAM_FUNC __ramfunc HAL_StatusTypeDef
tushki7 0:60d829a0353a 180
tushki7 0:60d829a0353a 181 #elif defined ( __GNUC__ )
tushki7 0:60d829a0353a 182 /* GNU Compiler
tushki7 0:60d829a0353a 183 ------------
tushki7 0:60d829a0353a 184 RAM functions are defined using a specific toolchain attribute
tushki7 0:60d829a0353a 185 "__attribute__((section(".RamFunc")))".
tushki7 0:60d829a0353a 186 */
tushki7 0:60d829a0353a 187 #define __RAM_FUNC HAL_StatusTypeDef __attribute__((section(".RamFunc")))
tushki7 0:60d829a0353a 188
tushki7 0:60d829a0353a 189 #endif
tushki7 0:60d829a0353a 190
tushki7 0:60d829a0353a 191
tushki7 0:60d829a0353a 192 #ifdef __cplusplus
tushki7 0:60d829a0353a 193 }
tushki7 0:60d829a0353a 194 #endif
tushki7 0:60d829a0353a 195
tushki7 0:60d829a0353a 196 #endif /* ___STM32F4xx_HAL_DEF */
tushki7 0:60d829a0353a 197
tushki7 0:60d829a0353a 198 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/