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_dma2d.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 Header file of DMA2D HAL module.
tushki7 0:60d829a0353a 8 ******************************************************************************
tushki7 0:60d829a0353a 9 * @attention
tushki7 0:60d829a0353a 10 *
tushki7 0:60d829a0353a 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
tushki7 0:60d829a0353a 12 *
tushki7 0:60d829a0353a 13 * Redistribution and use in source and binary forms, with or without modification,
tushki7 0:60d829a0353a 14 * are permitted provided that the following conditions are met:
tushki7 0:60d829a0353a 15 * 1. Redistributions of source code must retain the above copyright notice,
tushki7 0:60d829a0353a 16 * this list of conditions and the following disclaimer.
tushki7 0:60d829a0353a 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
tushki7 0:60d829a0353a 18 * this list of conditions and the following disclaimer in the documentation
tushki7 0:60d829a0353a 19 * and/or other materials provided with the distribution.
tushki7 0:60d829a0353a 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
tushki7 0:60d829a0353a 21 * may be used to endorse or promote products derived from this software
tushki7 0:60d829a0353a 22 * without specific prior written permission.
tushki7 0:60d829a0353a 23 *
tushki7 0:60d829a0353a 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
tushki7 0:60d829a0353a 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
tushki7 0:60d829a0353a 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
tushki7 0:60d829a0353a 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
tushki7 0:60d829a0353a 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
tushki7 0:60d829a0353a 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
tushki7 0:60d829a0353a 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
tushki7 0:60d829a0353a 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
tushki7 0:60d829a0353a 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
tushki7 0:60d829a0353a 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
tushki7 0:60d829a0353a 34 *
tushki7 0:60d829a0353a 35 ******************************************************************************
tushki7 0:60d829a0353a 36 */
tushki7 0:60d829a0353a 37
tushki7 0:60d829a0353a 38 /* Define to prevent recursive inclusion -------------------------------------*/
tushki7 0:60d829a0353a 39 #ifndef __STM32F4xx_HAL_DMA2D_H
tushki7 0:60d829a0353a 40 #define __STM32F4xx_HAL_DMA2D_H
tushki7 0:60d829a0353a 41
tushki7 0:60d829a0353a 42 #ifdef __cplusplus
tushki7 0:60d829a0353a 43 extern "C" {
tushki7 0:60d829a0353a 44 #endif
tushki7 0:60d829a0353a 45
tushki7 0:60d829a0353a 46 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
tushki7 0:60d829a0353a 47 /* Includes ------------------------------------------------------------------*/
tushki7 0:60d829a0353a 48 #include "stm32f4xx_hal_def.h"
tushki7 0:60d829a0353a 49
tushki7 0:60d829a0353a 50 /** @addtogroup STM32F4xx_HAL_Driver
tushki7 0:60d829a0353a 51 * @{
tushki7 0:60d829a0353a 52 */
tushki7 0:60d829a0353a 53
tushki7 0:60d829a0353a 54 /** @addtogroup DMA2D
tushki7 0:60d829a0353a 55 * @{
tushki7 0:60d829a0353a 56 */
tushki7 0:60d829a0353a 57
tushki7 0:60d829a0353a 58 /* Exported types ------------------------------------------------------------*/
tushki7 0:60d829a0353a 59
tushki7 0:60d829a0353a 60 #define MAX_DMA2D_LAYER 2
tushki7 0:60d829a0353a 61
tushki7 0:60d829a0353a 62 /**
tushki7 0:60d829a0353a 63 * @brief DMA2D color Structure definition
tushki7 0:60d829a0353a 64 */
tushki7 0:60d829a0353a 65 typedef struct
tushki7 0:60d829a0353a 66 {
tushki7 0:60d829a0353a 67 uint32_t Blue; /*!< Configures the blue value.
tushki7 0:60d829a0353a 68 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */
tushki7 0:60d829a0353a 69
tushki7 0:60d829a0353a 70 uint32_t Green; /*!< Configures the green value.
tushki7 0:60d829a0353a 71 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */
tushki7 0:60d829a0353a 72
tushki7 0:60d829a0353a 73 uint32_t Red; /*!< Configures the red value.
tushki7 0:60d829a0353a 74 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */
tushki7 0:60d829a0353a 75 } DMA2D_ColorTypeDef;
tushki7 0:60d829a0353a 76
tushki7 0:60d829a0353a 77 /**
tushki7 0:60d829a0353a 78 * @brief DMA2D CLUT Structure definition
tushki7 0:60d829a0353a 79 */
tushki7 0:60d829a0353a 80 typedef struct
tushki7 0:60d829a0353a 81 {
tushki7 0:60d829a0353a 82 uint32_t *pCLUT; /*!< Configures the DMA2D CLUT memory address.*/
tushki7 0:60d829a0353a 83
tushki7 0:60d829a0353a 84 uint32_t CLUTColorMode; /*!< configures the DMA2D CLUT color mode.
tushki7 0:60d829a0353a 85 This parameter can be one value of @ref DMA2D_CLUT_CM */
tushki7 0:60d829a0353a 86
tushki7 0:60d829a0353a 87 uint32_t Size; /*!< configures the DMA2D CLUT size.
tushki7 0:60d829a0353a 88 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF.*/
tushki7 0:60d829a0353a 89 } DMA2D_CLUTCfgTypeDef;
tushki7 0:60d829a0353a 90
tushki7 0:60d829a0353a 91 /**
tushki7 0:60d829a0353a 92 * @brief DMA2D Init structure definition
tushki7 0:60d829a0353a 93 */
tushki7 0:60d829a0353a 94 typedef struct
tushki7 0:60d829a0353a 95 {
tushki7 0:60d829a0353a 96 uint32_t Mode; /*!< configures the DMA2D transfer mode.
tushki7 0:60d829a0353a 97 This parameter can be one value of @ref DMA2D_Mode */
tushki7 0:60d829a0353a 98
tushki7 0:60d829a0353a 99 uint32_t ColorMode; /*!< configures the color format of the output image.
tushki7 0:60d829a0353a 100 This parameter can be one value of @ref DMA2D_Color_Mode */
tushki7 0:60d829a0353a 101
tushki7 0:60d829a0353a 102 uint32_t OutputOffset; /*!< Specifies the Offset value.
tushki7 0:60d829a0353a 103 This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0x3FFF. */
tushki7 0:60d829a0353a 104 } DMA2D_InitTypeDef;
tushki7 0:60d829a0353a 105
tushki7 0:60d829a0353a 106 /**
tushki7 0:60d829a0353a 107 * @brief DMA2D Layer structure definition
tushki7 0:60d829a0353a 108 */
tushki7 0:60d829a0353a 109 typedef struct
tushki7 0:60d829a0353a 110 {
tushki7 0:60d829a0353a 111 uint32_t InputOffset; /*!< configures the DMA2D foreground offset.
tushki7 0:60d829a0353a 112 This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0x3FFF. */
tushki7 0:60d829a0353a 113
tushki7 0:60d829a0353a 114 uint32_t InputColorMode; /*!< configures the DMA2D foreground color mode .
tushki7 0:60d829a0353a 115 This parameter can be one value of @ref DMA2D_Input_Color_Mode */
tushki7 0:60d829a0353a 116
tushki7 0:60d829a0353a 117 uint32_t AlphaMode; /*!< configures the DMA2D foreground alpha mode.
tushki7 0:60d829a0353a 118 This parameter can be one value of @ref DMA2D_ALPHA_MODE */
tushki7 0:60d829a0353a 119
tushki7 0:60d829a0353a 120 uint32_t InputAlpha; /*!< Specifies the DMA2D foreground alpha value and color value in case of A8 or A4 color mode.
tushki7 0:60d829a0353a 121 This parameter must be a number between Min_Data = 0x00000000 and Max_Data = 0xFFFFFFFF
tushki7 0:60d829a0353a 122 in case of A8 or A4 color mode (ARGB).
tushki7 0:60d829a0353a 123 Otherwise, This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF.*/
tushki7 0:60d829a0353a 124
tushki7 0:60d829a0353a 125 } DMA2D_LayerCfgTypeDef;
tushki7 0:60d829a0353a 126
tushki7 0:60d829a0353a 127 /**
tushki7 0:60d829a0353a 128 * @brief HAL DMA2D State structures definition
tushki7 0:60d829a0353a 129 */
tushki7 0:60d829a0353a 130 typedef enum
tushki7 0:60d829a0353a 131 {
tushki7 0:60d829a0353a 132 HAL_DMA2D_STATE_RESET = 0x00, /*!< DMA2D not yet initialized or disabled */
tushki7 0:60d829a0353a 133 HAL_DMA2D_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */
tushki7 0:60d829a0353a 134 HAL_DMA2D_STATE_BUSY = 0x02, /*!< an internal process is ongoing */
tushki7 0:60d829a0353a 135 HAL_DMA2D_STATE_TIMEOUT = 0x03, /*!< Timeout state */
tushki7 0:60d829a0353a 136 HAL_DMA2D_STATE_ERROR = 0x04, /*!< DMA2D state error */
tushki7 0:60d829a0353a 137 HAL_DMA2D_STATE_SUSPEND = 0x05 /*!< DMA2D process is suspended */
tushki7 0:60d829a0353a 138 }HAL_DMA2D_StateTypeDef;
tushki7 0:60d829a0353a 139
tushki7 0:60d829a0353a 140 /**
tushki7 0:60d829a0353a 141 * @brief DMA2D handle Structure definition
tushki7 0:60d829a0353a 142 */
tushki7 0:60d829a0353a 143 typedef struct __DMA2D_HandleTypeDef
tushki7 0:60d829a0353a 144 {
tushki7 0:60d829a0353a 145 DMA2D_TypeDef *Instance; /*!< DMA2D Register base address */
tushki7 0:60d829a0353a 146
tushki7 0:60d829a0353a 147 DMA2D_InitTypeDef Init; /*!< DMA2D communication parameters */
tushki7 0:60d829a0353a 148
tushki7 0:60d829a0353a 149 void (* XferCpltCallback)(struct __DMA2D_HandleTypeDef * hdma2d); /*!< DMA2D transfer complete callback */
tushki7 0:60d829a0353a 150
tushki7 0:60d829a0353a 151 void (* XferErrorCallback)(struct __DMA2D_HandleTypeDef * hdma2d); /*!< DMA2D transfer error callback */
tushki7 0:60d829a0353a 152
tushki7 0:60d829a0353a 153 DMA2D_LayerCfgTypeDef LayerCfg[MAX_DMA2D_LAYER]; /*!< DMA2D Layers parameters */
tushki7 0:60d829a0353a 154
tushki7 0:60d829a0353a 155 HAL_LockTypeDef Lock; /*!< DMA2D Lock */
tushki7 0:60d829a0353a 156
tushki7 0:60d829a0353a 157 __IO HAL_DMA2D_StateTypeDef State; /*!< DMA2D transfer state */
tushki7 0:60d829a0353a 158
tushki7 0:60d829a0353a 159 __IO uint32_t ErrorCode; /*!< DMA2D Error code */
tushki7 0:60d829a0353a 160 } DMA2D_HandleTypeDef;
tushki7 0:60d829a0353a 161
tushki7 0:60d829a0353a 162
tushki7 0:60d829a0353a 163 /* Exported constants --------------------------------------------------------*/
tushki7 0:60d829a0353a 164
tushki7 0:60d829a0353a 165 /** @defgroup DMA2D_Exported_Constants
tushki7 0:60d829a0353a 166 * @{
tushki7 0:60d829a0353a 167 */
tushki7 0:60d829a0353a 168
tushki7 0:60d829a0353a 169 /** @defgroup DMA2D_Layer
tushki7 0:60d829a0353a 170 * @{
tushki7 0:60d829a0353a 171 */
tushki7 0:60d829a0353a 172 #define IS_DMA2D_LAYER(LAYER) ((LAYER) <= MAX_DMA2D_LAYER)
tushki7 0:60d829a0353a 173 /**
tushki7 0:60d829a0353a 174 * @}
tushki7 0:60d829a0353a 175 */
tushki7 0:60d829a0353a 176
tushki7 0:60d829a0353a 177 /** @defgroup DMA2D_Error_Code
tushki7 0:60d829a0353a 178 * @{
tushki7 0:60d829a0353a 179 */
tushki7 0:60d829a0353a 180 #define HAL_DMA2D_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */
tushki7 0:60d829a0353a 181 #define HAL_DMA2D_ERROR_TE ((uint32_t)0x00000001) /*!< Transfer error */
tushki7 0:60d829a0353a 182 #define HAL_DMA2D_ERROR_CE ((uint32_t)0x00000002) /*!< Configuration error */
tushki7 0:60d829a0353a 183 #define HAL_DMA2D_ERROR_TIMEOUT ((uint32_t)0x00000020) /*!< Timeout error */
tushki7 0:60d829a0353a 184 /**
tushki7 0:60d829a0353a 185 * @}
tushki7 0:60d829a0353a 186 */
tushki7 0:60d829a0353a 187
tushki7 0:60d829a0353a 188 /** @defgroup DMA2D_Mode
tushki7 0:60d829a0353a 189 * @{
tushki7 0:60d829a0353a 190 */
tushki7 0:60d829a0353a 191 #define DMA2D_M2M ((uint32_t)0x00000000) /*!< DMA2D memory to memory transfer mode */
tushki7 0:60d829a0353a 192 #define DMA2D_M2M_PFC ((uint32_t)0x00010000) /*!< DMA2D memory to memory with pixel format conversion transfer mode */
tushki7 0:60d829a0353a 193 #define DMA2D_M2M_BLEND ((uint32_t)0x00020000) /*!< DMA2D memory to memory with blending transfer mode */
tushki7 0:60d829a0353a 194 #define DMA2D_R2M ((uint32_t)0x00030000) /*!< DMA2D register to memory transfer mode */
tushki7 0:60d829a0353a 195
tushki7 0:60d829a0353a 196 #define IS_DMA2D_MODE(MODE) (((MODE) == DMA2D_M2M) || ((MODE) == DMA2D_M2M_PFC) || \
tushki7 0:60d829a0353a 197 ((MODE) == DMA2D_M2M_BLEND) || ((MODE) == DMA2D_R2M))
tushki7 0:60d829a0353a 198 /**
tushki7 0:60d829a0353a 199 * @}
tushki7 0:60d829a0353a 200 */
tushki7 0:60d829a0353a 201
tushki7 0:60d829a0353a 202 /** @defgroup DMA2D_Color_Mode
tushki7 0:60d829a0353a 203 * @{
tushki7 0:60d829a0353a 204 */
tushki7 0:60d829a0353a 205 #define DMA2D_ARGB8888 ((uint32_t)0x00000000) /*!< ARGB8888 DMA2D color mode */
tushki7 0:60d829a0353a 206 #define DMA2D_RGB888 ((uint32_t)0x00000001) /*!< RGB888 DMA2D color mode */
tushki7 0:60d829a0353a 207 #define DMA2D_RGB565 ((uint32_t)0x00000002) /*!< RGB565 DMA2D color mode */
tushki7 0:60d829a0353a 208 #define DMA2D_ARGB1555 ((uint32_t)0x00000003) /*!< ARGB1555 DMA2D color mode */
tushki7 0:60d829a0353a 209 #define DMA2D_ARGB4444 ((uint32_t)0x00000004) /*!< ARGB4444 DMA2D color mode */
tushki7 0:60d829a0353a 210
tushki7 0:60d829a0353a 211 #define IS_DMA2D_CMODE(MODE_ARGB) (((MODE_ARGB) == DMA2D_ARGB8888) || ((MODE_ARGB) == DMA2D_RGB888) || \
tushki7 0:60d829a0353a 212 ((MODE_ARGB) == DMA2D_RGB565) || ((MODE_ARGB) == DMA2D_ARGB1555) || \
tushki7 0:60d829a0353a 213 ((MODE_ARGB) == DMA2D_ARGB4444))
tushki7 0:60d829a0353a 214 /**
tushki7 0:60d829a0353a 215 * @}
tushki7 0:60d829a0353a 216 */
tushki7 0:60d829a0353a 217
tushki7 0:60d829a0353a 218 /** @defgroup DMA2D_COLOR_VALUE
tushki7 0:60d829a0353a 219 * @{
tushki7 0:60d829a0353a 220 */
tushki7 0:60d829a0353a 221
tushki7 0:60d829a0353a 222 #define COLOR_VALUE ((uint32_t)0x000000FF) /*!< color value mask */
tushki7 0:60d829a0353a 223
tushki7 0:60d829a0353a 224 #define IS_DMA2D_COLOR(COLOR) ((COLOR) <= COLOR_VALUE)
tushki7 0:60d829a0353a 225 /**
tushki7 0:60d829a0353a 226 * @}
tushki7 0:60d829a0353a 227 */
tushki7 0:60d829a0353a 228
tushki7 0:60d829a0353a 229 /** @defgroup DMA2D_SIZE
tushki7 0:60d829a0353a 230 * @{
tushki7 0:60d829a0353a 231 */
tushki7 0:60d829a0353a 232 #define DMA2D_PIXEL (DMA2D_NLR_PL >> 16) /*!< DMA2D pixel per line */
tushki7 0:60d829a0353a 233 #define DMA2D_LINE DMA2D_NLR_NL /*!< DMA2D number of line */
tushki7 0:60d829a0353a 234
tushki7 0:60d829a0353a 235 #define IS_DMA2D_LINE(LINE) ((LINE) <= DMA2D_LINE)
tushki7 0:60d829a0353a 236 #define IS_DMA2D_PIXEL(PIXEL) ((PIXEL) <= DMA2D_PIXEL)
tushki7 0:60d829a0353a 237 /**
tushki7 0:60d829a0353a 238 * @}
tushki7 0:60d829a0353a 239 */
tushki7 0:60d829a0353a 240
tushki7 0:60d829a0353a 241 /** @defgroup DMA2D_Offset
tushki7 0:60d829a0353a 242 * @{
tushki7 0:60d829a0353a 243 */
tushki7 0:60d829a0353a 244 #define DMA2D_OFFSET DMA2D_FGOR_LO /*!< Line Offset */
tushki7 0:60d829a0353a 245
tushki7 0:60d829a0353a 246 #define IS_DMA2D_OFFSET(OOFFSET) ((OOFFSET) <= DMA2D_OFFSET)
tushki7 0:60d829a0353a 247 /**
tushki7 0:60d829a0353a 248 * @}
tushki7 0:60d829a0353a 249 */
tushki7 0:60d829a0353a 250
tushki7 0:60d829a0353a 251 /** @defgroup DMA2D_Input_Color_Mode
tushki7 0:60d829a0353a 252 * @{
tushki7 0:60d829a0353a 253 */
tushki7 0:60d829a0353a 254 #define CM_ARGB8888 ((uint32_t)0x00000000) /*!< ARGB8888 color mode */
tushki7 0:60d829a0353a 255 #define CM_RGB888 ((uint32_t)0x00000001) /*!< RGB888 color mode */
tushki7 0:60d829a0353a 256 #define CM_RGB565 ((uint32_t)0x00000002) /*!< RGB565 color mode */
tushki7 0:60d829a0353a 257 #define CM_ARGB1555 ((uint32_t)0x00000003) /*!< ARGB1555 color mode */
tushki7 0:60d829a0353a 258 #define CM_ARGB4444 ((uint32_t)0x00000004) /*!< ARGB4444 color mode */
tushki7 0:60d829a0353a 259 #define CM_L8 ((uint32_t)0x00000005) /*!< L8 color mode */
tushki7 0:60d829a0353a 260 #define CM_AL44 ((uint32_t)0x00000006) /*!< AL44 color mode */
tushki7 0:60d829a0353a 261 #define CM_AL88 ((uint32_t)0x00000007) /*!< AL88 color mode */
tushki7 0:60d829a0353a 262 #define CM_L4 ((uint32_t)0x00000008) /*!< L4 color mode */
tushki7 0:60d829a0353a 263 #define CM_A8 ((uint32_t)0x00000009) /*!< A8 color mode */
tushki7 0:60d829a0353a 264 #define CM_A4 ((uint32_t)0x0000000A) /*!< A4 color mode */
tushki7 0:60d829a0353a 265
tushki7 0:60d829a0353a 266 #define IS_DMA2D_INPUT_COLOR_MODE(INPUT_CM) (((INPUT_CM) == CM_ARGB8888) || ((INPUT_CM) == CM_RGB888) || \
tushki7 0:60d829a0353a 267 ((INPUT_CM) == CM_RGB565) || ((INPUT_CM) == CM_ARGB1555) || \
tushki7 0:60d829a0353a 268 ((INPUT_CM) == CM_ARGB4444) || ((INPUT_CM) == CM_L8) || \
tushki7 0:60d829a0353a 269 ((INPUT_CM) == CM_AL44) || ((INPUT_CM) == CM_AL88) || \
tushki7 0:60d829a0353a 270 ((INPUT_CM) == CM_L4) || ((INPUT_CM) == CM_A8) || \
tushki7 0:60d829a0353a 271 ((INPUT_CM) == CM_A4))
tushki7 0:60d829a0353a 272 /**
tushki7 0:60d829a0353a 273 * @}
tushki7 0:60d829a0353a 274 */
tushki7 0:60d829a0353a 275
tushki7 0:60d829a0353a 276 /** @defgroup DMA2D_ALPHA_MODE
tushki7 0:60d829a0353a 277 * @{
tushki7 0:60d829a0353a 278 */
tushki7 0:60d829a0353a 279 #define DMA2D_NO_MODIF_ALPHA ((uint32_t)0x00000000) /*!< No modification of the alpha channel value */
tushki7 0:60d829a0353a 280 #define DMA2D_REPLACE_ALPHA ((uint32_t)0x00000001) /*!< Replace original alpha channel value by programmed alpha value */
tushki7 0:60d829a0353a 281 #define DMA2D_COMBINE_ALPHA ((uint32_t)0x00000002) /*!< Replace original alpha channel value by programmed alpha value
tushki7 0:60d829a0353a 282 with original alpha channel value */
tushki7 0:60d829a0353a 283
tushki7 0:60d829a0353a 284 #define IS_DMA2D_ALPHA_MODE(AlphaMode) (((AlphaMode) == DMA2D_NO_MODIF_ALPHA) || \
tushki7 0:60d829a0353a 285 ((AlphaMode) == DMA2D_REPLACE_ALPHA) || \
tushki7 0:60d829a0353a 286 ((AlphaMode) == DMA2D_COMBINE_ALPHA))
tushki7 0:60d829a0353a 287 /**
tushki7 0:60d829a0353a 288 * @}
tushki7 0:60d829a0353a 289 */
tushki7 0:60d829a0353a 290
tushki7 0:60d829a0353a 291 /** @defgroup DMA2D_CLUT_CM
tushki7 0:60d829a0353a 292 * @{
tushki7 0:60d829a0353a 293 */
tushki7 0:60d829a0353a 294 #define DMA2D_CCM_ARGB8888 ((uint32_t)0x00000000) /*!< ARGB8888 DMA2D C-LUT color mode */
tushki7 0:60d829a0353a 295 #define DMA2D_CCM_RGB888 ((uint32_t)0x00000001) /*!< RGB888 DMA2D C-LUT color mode */
tushki7 0:60d829a0353a 296
tushki7 0:60d829a0353a 297 #define IS_DMA2D_CLUT_CM(CLUT_CM) (((CLUT_CM) == DMA2D_CCM_ARGB8888) || ((CLUT_CM) == DMA2D_CCM_RGB888))
tushki7 0:60d829a0353a 298 /**
tushki7 0:60d829a0353a 299 * @}
tushki7 0:60d829a0353a 300 */
tushki7 0:60d829a0353a 301
tushki7 0:60d829a0353a 302 /** @defgroup DMA2D_Size_Clut
tushki7 0:60d829a0353a 303 * @{
tushki7 0:60d829a0353a 304 */
tushki7 0:60d829a0353a 305 #define DMA2D_CLUT_SIZE (DMA2D_FGPFCCR_CS >> 8) /*!< DMA2D C-LUT size */
tushki7 0:60d829a0353a 306
tushki7 0:60d829a0353a 307 #define IS_DMA2D_CLUT_SIZE(CLUT_SIZE) ((CLUT_SIZE) <= DMA2D_CLUT_SIZE)
tushki7 0:60d829a0353a 308 /**
tushki7 0:60d829a0353a 309 * @}
tushki7 0:60d829a0353a 310 */
tushki7 0:60d829a0353a 311
tushki7 0:60d829a0353a 312 /** @defgroup DMA2D_DeadTime
tushki7 0:60d829a0353a 313 * @{
tushki7 0:60d829a0353a 314 */
tushki7 0:60d829a0353a 315 #define LINE_WATERMARK DMA2D_LWR_LW
tushki7 0:60d829a0353a 316
tushki7 0:60d829a0353a 317 #define IS_DMA2D_LineWatermark(LineWatermark) ((LineWatermark) <= LINE_WATERMARK)
tushki7 0:60d829a0353a 318 /**
tushki7 0:60d829a0353a 319 * @}
tushki7 0:60d829a0353a 320 */
tushki7 0:60d829a0353a 321
tushki7 0:60d829a0353a 322 /** @defgroup DMA2D_Interrupts
tushki7 0:60d829a0353a 323 * @{
tushki7 0:60d829a0353a 324 */
tushki7 0:60d829a0353a 325 #define DMA2D_IT_CE DMA2D_CR_CEIE /*!< Configuration Error Interrupt */
tushki7 0:60d829a0353a 326 #define DMA2D_IT_CTC DMA2D_CR_CTCIE /*!< C-LUT Transfer Complete Interrupt */
tushki7 0:60d829a0353a 327 #define DMA2D_IT_CAE DMA2D_CR_CAEIE /*!< C-LUT Access Error Interrupt */
tushki7 0:60d829a0353a 328 #define DMA2D_IT_TW DMA2D_CR_TWIE /*!< Transfer Watermark Interrupt */
tushki7 0:60d829a0353a 329 #define DMA2D_IT_TC DMA2D_CR_TCIE /*!< Transfer Complete Interrupt */
tushki7 0:60d829a0353a 330 #define DMA2D_IT_TE DMA2D_CR_TEIE /*!< Transfer Error Interrupt */
tushki7 0:60d829a0353a 331
tushki7 0:60d829a0353a 332 #define IS_DMA2D_IT(IT) (((IT) == DMA2D_IT_CTC) || ((IT) == DMA2D_IT_CAE) || \
tushki7 0:60d829a0353a 333 ((IT) == DMA2D_IT_TW) || ((IT) == DMA2D_IT_TC) || \
tushki7 0:60d829a0353a 334 ((IT) == DMA2D_IT_TE) || ((IT) == DMA2D_IT_CE))
tushki7 0:60d829a0353a 335 /**
tushki7 0:60d829a0353a 336 * @}
tushki7 0:60d829a0353a 337 */
tushki7 0:60d829a0353a 338
tushki7 0:60d829a0353a 339 /** @defgroup DMA2D_Flag
tushki7 0:60d829a0353a 340 * @{
tushki7 0:60d829a0353a 341 */
tushki7 0:60d829a0353a 342 #define DMA2D_FLAG_CE DMA2D_ISR_CEIF /*!< Configuration Error Interrupt Flag */
tushki7 0:60d829a0353a 343 #define DMA2D_FLAG_CTC DMA2D_ISR_CTCIF /*!< C-LUT Transfer Complete Interrupt Flag */
tushki7 0:60d829a0353a 344 #define DMA2D_FLAG_CAE DMA2D_ISR_CAEIF /*!< C-LUT Access Error Interrupt Flag */
tushki7 0:60d829a0353a 345 #define DMA2D_FLAG_TW DMA2D_ISR_TWIF /*!< Transfer Watermark Interrupt Flag */
tushki7 0:60d829a0353a 346 #define DMA2D_FLAG_TC DMA2D_ISR_TCIF /*!< Transfer Complete Interrupt Flag */
tushki7 0:60d829a0353a 347 #define DMA2D_FLAG_TE DMA2D_ISR_TEIF /*!< Transfer Error Interrupt Flag */
tushki7 0:60d829a0353a 348
tushki7 0:60d829a0353a 349 #define IS_DMA2D_GET_FLAG(FLAG) (((FLAG) == DMA2D_FLAG_CTC) || ((FLAG) == DMA2D_FLAG_CAE) || \
tushki7 0:60d829a0353a 350 ((FLAG) == DMA2D_FLAG_TW) || ((FLAG) == DMA2D_FLAG_TC) || \
tushki7 0:60d829a0353a 351 ((FLAG) == DMA2D_FLAG_TE) || ((FLAG) == DMA2D_FLAG_CE))
tushki7 0:60d829a0353a 352 /**
tushki7 0:60d829a0353a 353 * @}
tushki7 0:60d829a0353a 354 */
tushki7 0:60d829a0353a 355
tushki7 0:60d829a0353a 356 /**
tushki7 0:60d829a0353a 357 * @}
tushki7 0:60d829a0353a 358 */
tushki7 0:60d829a0353a 359 /* Exported macro ------------------------------------------------------------*/
tushki7 0:60d829a0353a 360
tushki7 0:60d829a0353a 361 /** @brief Reset DMA2D handle state
tushki7 0:60d829a0353a 362 * @param __HANDLE__: specifies the DMA2D handle.
tushki7 0:60d829a0353a 363 * @retval None
tushki7 0:60d829a0353a 364 */
tushki7 0:60d829a0353a 365 #define __HAL_DMA2D_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DMA2D_STATE_RESET)
tushki7 0:60d829a0353a 366
tushki7 0:60d829a0353a 367 /**
tushki7 0:60d829a0353a 368 * @brief Enable the DMA2D.
tushki7 0:60d829a0353a 369 * @param __HANDLE__: DMA2D handle
tushki7 0:60d829a0353a 370 * @retval None.
tushki7 0:60d829a0353a 371 */
tushki7 0:60d829a0353a 372 #define __HAL_DMA2D_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= DMA2D_CR_START)
tushki7 0:60d829a0353a 373
tushki7 0:60d829a0353a 374 /**
tushki7 0:60d829a0353a 375 * @brief Disable the DMA2D.
tushki7 0:60d829a0353a 376 * @param __HANDLE__: DMA2D handle
tushki7 0:60d829a0353a 377 * @retval None.
tushki7 0:60d829a0353a 378 */
tushki7 0:60d829a0353a 379 #define __HAL_DMA2D_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~DMA2D_CR_START)
tushki7 0:60d829a0353a 380
tushki7 0:60d829a0353a 381 /* Interrupt & Flag management */
tushki7 0:60d829a0353a 382 /**
tushki7 0:60d829a0353a 383 * @brief Get the DMA2D pending flags.
tushki7 0:60d829a0353a 384 * @param __HANDLE__: DMA2D handle
tushki7 0:60d829a0353a 385 * @param __FLAG__: Get the specified flag.
tushki7 0:60d829a0353a 386 * This parameter can be any combination of the following values:
tushki7 0:60d829a0353a 387 * @arg DMA2D_FLAG_CE: Configuration error flag
tushki7 0:60d829a0353a 388 * @arg DMA2D_FLAG_CTC: C-LUT transfer complete flag
tushki7 0:60d829a0353a 389 * @arg DMA2D_FLAG_CAE: C-LUT access error flag
tushki7 0:60d829a0353a 390 * @arg DMA2D_FLAG_TW: Transfer Watermark flag
tushki7 0:60d829a0353a 391 * @arg DMA2D_FLAG_TC: Transfer complete flag
tushki7 0:60d829a0353a 392 * @arg DMA2D_FLAG_TE: Transfer error flag
tushki7 0:60d829a0353a 393 * @retval The state of FLAG.
tushki7 0:60d829a0353a 394 */
tushki7 0:60d829a0353a 395 #define __HAL_DMA2D_GET_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR & (__FLAG__))
tushki7 0:60d829a0353a 396
tushki7 0:60d829a0353a 397 /**
tushki7 0:60d829a0353a 398 * @brief Clears the DMA2D pending flags.
tushki7 0:60d829a0353a 399 * @param __HANDLE__: DMA2D handle
tushki7 0:60d829a0353a 400 * @param __FLAG__: specifies the flag to clear.
tushki7 0:60d829a0353a 401 * This parameter can be any combination of the following values:
tushki7 0:60d829a0353a 402 * @arg DMA2D_FLAG_CE: Configuration error flag
tushki7 0:60d829a0353a 403 * @arg DMA2D_FLAG_CTC: C-LUT transfer complete flag
tushki7 0:60d829a0353a 404 * @arg DMA2D_FLAG_CAE: C-LUT access error flag
tushki7 0:60d829a0353a 405 * @arg DMA2D_FLAG_TW: Transfer Watermark flag
tushki7 0:60d829a0353a 406 * @arg DMA2D_FLAG_TC: Transfer complete flag
tushki7 0:60d829a0353a 407 * @arg DMA2D_FLAG_TE: Transfer error flag
tushki7 0:60d829a0353a 408 * @retval None
tushki7 0:60d829a0353a 409 */
tushki7 0:60d829a0353a 410 #define __HAL_DMA2D_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->IFCR = (__FLAG__))
tushki7 0:60d829a0353a 411
tushki7 0:60d829a0353a 412 /**
tushki7 0:60d829a0353a 413 * @brief Enables the specified DMA2D interrupts.
tushki7 0:60d829a0353a 414 * @param __HANDLE__: DMA2D handle
tushki7 0:60d829a0353a 415 * @param __INTERRUPT__: specifies the DMA2D interrupt sources to be enabled.
tushki7 0:60d829a0353a 416 * This parameter can be any combination of the following values:
tushki7 0:60d829a0353a 417 * @arg DMA2D_IT_CE: Configuration error interrupt mask
tushki7 0:60d829a0353a 418 * @arg DMA2D_IT_CTC: C-LUT transfer complete interrupt mask
tushki7 0:60d829a0353a 419 * @arg DMA2D_IT_CAE: C-LUT access error interrupt mask
tushki7 0:60d829a0353a 420 * @arg DMA2D_IT_TW: Transfer Watermark interrupt mask
tushki7 0:60d829a0353a 421 * @arg DMA2D_IT_TC: Transfer complete interrupt mask
tushki7 0:60d829a0353a 422 * @arg DMA2D_IT_TE: Transfer error interrupt mask
tushki7 0:60d829a0353a 423 * @retval None
tushki7 0:60d829a0353a 424 */
tushki7 0:60d829a0353a 425 #define __HAL_DMA2D_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
tushki7 0:60d829a0353a 426
tushki7 0:60d829a0353a 427 /**
tushki7 0:60d829a0353a 428 * @brief Disables the specified DMA2D interrupts.
tushki7 0:60d829a0353a 429 * @param __HANDLE__: DMA2D handle
tushki7 0:60d829a0353a 430 * @param __INTERRUPT__: specifies the DMA2D interrupt sources to be disabled.
tushki7 0:60d829a0353a 431 * This parameter can be any combination of the following values:
tushki7 0:60d829a0353a 432 * @arg DMA2D_IT_CE: Configuration error interrupt mask
tushki7 0:60d829a0353a 433 * @arg DMA2D_IT_CTC: C-LUT transfer complete interrupt mask
tushki7 0:60d829a0353a 434 * @arg DMA2D_IT_CAE: C-LUT access error interrupt mask
tushki7 0:60d829a0353a 435 * @arg DMA2D_IT_TW: Transfer Watermark interrupt mask
tushki7 0:60d829a0353a 436 * @arg DMA2D_IT_TC: Transfer complete interrupt mask
tushki7 0:60d829a0353a 437 * @arg DMA2D_IT_TE: Transfer error interrupt mask
tushki7 0:60d829a0353a 438 * @retval None
tushki7 0:60d829a0353a 439 */
tushki7 0:60d829a0353a 440 #define __HAL_DMA2D_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
tushki7 0:60d829a0353a 441
tushki7 0:60d829a0353a 442 /**
tushki7 0:60d829a0353a 443 * @brief Checks whether the specified DMA2D interrupt has occurred or not.
tushki7 0:60d829a0353a 444 * @param __HANDLE__: DMA2D handle
tushki7 0:60d829a0353a 445 * @param __INTERRUPT__: specifies the DMA2D interrupt source to check.
tushki7 0:60d829a0353a 446 * This parameter can be one of the following values:
tushki7 0:60d829a0353a 447 * @arg DMA2D_IT_CE: Configuration error interrupt mask
tushki7 0:60d829a0353a 448 * @arg DMA2D_IT_CTC: C-LUT transfer complete interrupt mask
tushki7 0:60d829a0353a 449 * @arg DMA2D_IT_CAE: C-LUT access error interrupt mask
tushki7 0:60d829a0353a 450 * @arg DMA2D_IT_TW: Transfer Watermark interrupt mask
tushki7 0:60d829a0353a 451 * @arg DMA2D_IT_TC: Transfer complete interrupt mask
tushki7 0:60d829a0353a 452 * @arg DMA2D_IT_TE: Transfer error interrupt mask
tushki7 0:60d829a0353a 453 * @retval The state of INTERRUPT.
tushki7 0:60d829a0353a 454 */
tushki7 0:60d829a0353a 455 #define __HAL_DMA2D_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR & (__INTERRUPT__))
tushki7 0:60d829a0353a 456
tushki7 0:60d829a0353a 457 /* Exported functions --------------------------------------------------------*/
tushki7 0:60d829a0353a 458
tushki7 0:60d829a0353a 459 /* Initialization and de-initialization functions *******************************/
tushki7 0:60d829a0353a 460 HAL_StatusTypeDef HAL_DMA2D_Init(DMA2D_HandleTypeDef *hdma2d);
tushki7 0:60d829a0353a 461 HAL_StatusTypeDef HAL_DMA2D_DeInit (DMA2D_HandleTypeDef *hdma2d);
tushki7 0:60d829a0353a 462 void HAL_DMA2D_MspInit(DMA2D_HandleTypeDef* hdma2d);
tushki7 0:60d829a0353a 463 void HAL_DMA2D_MspDeInit(DMA2D_HandleTypeDef* hdma2d);
tushki7 0:60d829a0353a 464
tushki7 0:60d829a0353a 465 /* IO operation functions *******************************************************/
tushki7 0:60d829a0353a 466 HAL_StatusTypeDef HAL_DMA2D_Start(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Heigh);
tushki7 0:60d829a0353a 467 HAL_StatusTypeDef HAL_DMA2D_BlendingStart(DMA2D_HandleTypeDef *hdma2d, uint32_t SrcAddress1, uint32_t SrcAddress2, uint32_t DstAddress, uint32_t Width, uint32_t Heigh);
tushki7 0:60d829a0353a 468 HAL_StatusTypeDef HAL_DMA2D_Start_IT(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Heigh);
tushki7 0:60d829a0353a 469 HAL_StatusTypeDef HAL_DMA2D_BlendingStart_IT(DMA2D_HandleTypeDef *hdma2d, uint32_t SrcAddress1, uint32_t SrcAddress2, uint32_t DstAddress, uint32_t Width, uint32_t Heigh);
tushki7 0:60d829a0353a 470 HAL_StatusTypeDef HAL_DMA2D_Suspend(DMA2D_HandleTypeDef *hdma2d);
tushki7 0:60d829a0353a 471 HAL_StatusTypeDef HAL_DMA2D_Resume(DMA2D_HandleTypeDef *hdma2d);
tushki7 0:60d829a0353a 472 HAL_StatusTypeDef HAL_DMA2D_Abort(DMA2D_HandleTypeDef *hdma2d);
tushki7 0:60d829a0353a 473 HAL_StatusTypeDef HAL_DMA2D_PollForTransfer(DMA2D_HandleTypeDef *hdma2d, uint32_t Timeout);
tushki7 0:60d829a0353a 474 void HAL_DMA2D_IRQHandler(DMA2D_HandleTypeDef *hdma2d);
tushki7 0:60d829a0353a 475
tushki7 0:60d829a0353a 476 /* Peripheral Control functions *************************************************/
tushki7 0:60d829a0353a 477 HAL_StatusTypeDef HAL_DMA2D_ConfigLayer(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx);
tushki7 0:60d829a0353a 478 HAL_StatusTypeDef HAL_DMA2D_ConfigCLUT(DMA2D_HandleTypeDef *hdma2d, DMA2D_CLUTCfgTypeDef CLUTCfg, uint32_t LayerIdx);
tushki7 0:60d829a0353a 479 HAL_StatusTypeDef HAL_DMA2D_EnableCLUT(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx);
tushki7 0:60d829a0353a 480 HAL_StatusTypeDef HAL_DMA2D_DisableCLUT(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx);
tushki7 0:60d829a0353a 481 HAL_StatusTypeDef HAL_DMA2D_ProgramLineEvent(DMA2D_HandleTypeDef *hdma2d, uint32_t Line);
tushki7 0:60d829a0353a 482
tushki7 0:60d829a0353a 483 /* Peripheral State functions ***************************************************/
tushki7 0:60d829a0353a 484 HAL_DMA2D_StateTypeDef HAL_DMA2D_GetState(DMA2D_HandleTypeDef *hdma2d);
tushki7 0:60d829a0353a 485 uint32_t HAL_DMA2D_GetError(DMA2D_HandleTypeDef *hdma2d);
tushki7 0:60d829a0353a 486
tushki7 0:60d829a0353a 487 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
tushki7 0:60d829a0353a 488
tushki7 0:60d829a0353a 489 /**
tushki7 0:60d829a0353a 490 * @}
tushki7 0:60d829a0353a 491 */
tushki7 0:60d829a0353a 492
tushki7 0:60d829a0353a 493 /**
tushki7 0:60d829a0353a 494 * @}
tushki7 0:60d829a0353a 495 */
tushki7 0:60d829a0353a 496
tushki7 0:60d829a0353a 497 #ifdef __cplusplus
tushki7 0:60d829a0353a 498 }
tushki7 0:60d829a0353a 499 #endif
tushki7 0:60d829a0353a 500
tushki7 0:60d829a0353a 501 #endif /* __STM32F4xx_HAL_DMA2D_H */
tushki7 0:60d829a0353a 502
tushki7 0:60d829a0353a 503
tushki7 0:60d829a0353a 504 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/