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_hal_def.h
tushki7 0:60d829a0353a 4 * @author MCD Application Team
tushki7 0:60d829a0353a 5 * @version V1.2.0
tushki7 0:60d829a0353a 6 * @date 11-December-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 __STM32F0xx_HAL_DEF
tushki7 0:60d829a0353a 41 #define __STM32F0xx_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 "stm32f0xx.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 NULL 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 #define UNUSED(x) ((void)(x))
tushki7 0:60d829a0353a 89
tushki7 0:60d829a0353a 90 /** @brief Reset the Handle's State field.
tushki7 0:60d829a0353a 91 * @param __HANDLE__: specifies the Peripheral Handle.
tushki7 0:60d829a0353a 92 * @note This macro can be used for the following purpose:
tushki7 0:60d829a0353a 93 * - When the Handle is declared as local variable; before passing it as parameter
tushki7 0:60d829a0353a 94 * to HAL_PPP_Init() for the first time, it is mandatory to use this macro
tushki7 0:60d829a0353a 95 * to set to 0 the Handle's "State" field.
tushki7 0:60d829a0353a 96 * Otherwise, "State" field may have any random value and the first time the function
tushki7 0:60d829a0353a 97 * HAL_PPP_Init() is called, the low level hardware initialization will be missed
tushki7 0:60d829a0353a 98 * (i.e. HAL_PPP_MspInit() will not be executed).
tushki7 0:60d829a0353a 99 * - When there is a need to reconfigure the low level hardware: instead of calling
tushki7 0:60d829a0353a 100 * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init().
tushki7 0:60d829a0353a 101 * In this later function, when the Handle's "State" field is set to 0, it will execute the function
tushki7 0:60d829a0353a 102 * HAL_PPP_MspInit() which will reconfigure the low level hardware.
tushki7 0:60d829a0353a 103 * @retval None
tushki7 0:60d829a0353a 104 */
tushki7 0:60d829a0353a 105 #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0)
tushki7 0:60d829a0353a 106
tushki7 0:60d829a0353a 107 #if (USE_RTOS == 1)
tushki7 0:60d829a0353a 108 #error " USE_RTOS should be 0 in the current HAL release "
tushki7 0:60d829a0353a 109 #else
tushki7 0:60d829a0353a 110 #define __HAL_LOCK(__HANDLE__) \
tushki7 0:60d829a0353a 111 do{ \
tushki7 0:60d829a0353a 112 if((__HANDLE__)->Lock == HAL_LOCKED) \
tushki7 0:60d829a0353a 113 { \
tushki7 0:60d829a0353a 114 return HAL_BUSY; \
tushki7 0:60d829a0353a 115 } \
tushki7 0:60d829a0353a 116 else \
tushki7 0:60d829a0353a 117 { \
tushki7 0:60d829a0353a 118 (__HANDLE__)->Lock = HAL_LOCKED; \
tushki7 0:60d829a0353a 119 } \
tushki7 0:60d829a0353a 120 }while (0)
tushki7 0:60d829a0353a 121
tushki7 0:60d829a0353a 122 #define __HAL_UNLOCK(__HANDLE__) \
tushki7 0:60d829a0353a 123 do{ \
tushki7 0:60d829a0353a 124 (__HANDLE__)->Lock = HAL_UNLOCKED; \
tushki7 0:60d829a0353a 125 }while (0)
tushki7 0:60d829a0353a 126 #endif /* USE_RTOS */
tushki7 0:60d829a0353a 127
tushki7 0:60d829a0353a 128 #if defined ( __GNUC__ )
tushki7 0:60d829a0353a 129 #ifndef __weak
tushki7 0:60d829a0353a 130 #define __weak __attribute__((weak))
tushki7 0:60d829a0353a 131 #endif /* __weak */
tushki7 0:60d829a0353a 132 #ifndef __packed
tushki7 0:60d829a0353a 133 #define __packed __attribute__((__packed__))
tushki7 0:60d829a0353a 134 #endif /* __packed */
tushki7 0:60d829a0353a 135 #endif /* __GNUC__ */
tushki7 0:60d829a0353a 136
tushki7 0:60d829a0353a 137
tushki7 0:60d829a0353a 138 /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
tushki7 0:60d829a0353a 139 #if defined (__GNUC__) /* GNU Compiler */
tushki7 0:60d829a0353a 140 #ifndef __ALIGN_END
tushki7 0:60d829a0353a 141 #define __ALIGN_END __attribute__ ((aligned (4)))
tushki7 0:60d829a0353a 142 #endif /* __ALIGN_END */
tushki7 0:60d829a0353a 143 #ifndef __ALIGN_BEGIN
tushki7 0:60d829a0353a 144 #define __ALIGN_BEGIN
tushki7 0:60d829a0353a 145 #endif /* __ALIGN_BEGIN */
tushki7 0:60d829a0353a 146 #else
tushki7 0:60d829a0353a 147 #ifndef __ALIGN_END
tushki7 0:60d829a0353a 148 #define __ALIGN_END
tushki7 0:60d829a0353a 149 #endif /* __ALIGN_END */
tushki7 0:60d829a0353a 150 #ifndef __ALIGN_BEGIN
tushki7 0:60d829a0353a 151 #if defined (__CC_ARM) /* ARM Compiler */
tushki7 0:60d829a0353a 152 #define __ALIGN_BEGIN __align(4)
tushki7 0:60d829a0353a 153 #elif defined (__ICCARM__) /* IAR Compiler */
tushki7 0:60d829a0353a 154 #define __ALIGN_BEGIN
tushki7 0:60d829a0353a 155 #endif /* __CC_ARM */
tushki7 0:60d829a0353a 156 #endif /* __ALIGN_BEGIN */
tushki7 0:60d829a0353a 157 #endif /* __GNUC__ */
tushki7 0:60d829a0353a 158
tushki7 0:60d829a0353a 159 /**
tushki7 0:60d829a0353a 160 * @brief __NOINLINE definition
tushki7 0:60d829a0353a 161 */
tushki7 0:60d829a0353a 162 #if defined ( __CC_ARM ) || defined ( __GNUC__ )
tushki7 0:60d829a0353a 163 /* ARM & GNUCompiler
tushki7 0:60d829a0353a 164 ----------------
tushki7 0:60d829a0353a 165 */
tushki7 0:60d829a0353a 166 #define __NOINLINE __attribute__ ( (noinline) )
tushki7 0:60d829a0353a 167
tushki7 0:60d829a0353a 168 #elif defined ( __ICCARM__ )
tushki7 0:60d829a0353a 169 /* ICCARM Compiler
tushki7 0:60d829a0353a 170 ---------------
tushki7 0:60d829a0353a 171 */
tushki7 0:60d829a0353a 172 #define __NOINLINE _Pragma("optimize = no_inline")
tushki7 0:60d829a0353a 173
tushki7 0:60d829a0353a 174 #endif
tushki7 0:60d829a0353a 175
tushki7 0:60d829a0353a 176 #ifdef __cplusplus
tushki7 0:60d829a0353a 177 }
tushki7 0:60d829a0353a 178 #endif
tushki7 0:60d829a0353a 179
tushki7 0:60d829a0353a 180 #endif /* ___STM32F0xx_HAL_DEF */
tushki7 0:60d829a0353a 181
tushki7 0:60d829a0353a 182 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
tushki7 0:60d829a0353a 183