meh
Fork of mbed by
Diff: TARGET_NUCLEO_L053R8/stm32l0xx_hal_lcd.h
- Revision:
- 96:487b796308b0
- Parent:
- 92:4fc01daae5a5
--- a/TARGET_NUCLEO_L053R8/stm32l0xx_hal_lcd.h Wed Mar 04 07:31:39 2015 +0100 +++ b/TARGET_NUCLEO_L053R8/stm32l0xx_hal_lcd.h Tue Mar 17 14:27:45 2015 +0000 @@ -2,13 +2,13 @@ ****************************************************************************** * @file stm32l0xx_hal_lcd.h * @author MCD Application Team - * @version V1.1.0 - * @date 18-June-2014 + * @version V1.2.0 + * @date 06-February-2015 * @brief Header file of LCD Controller HAL module. ****************************************************************************** * @attention * - * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> + * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: @@ -35,6 +35,8 @@ ****************************************************************************** */ +#if defined (STM32L053xx) || defined (STM32L063xx) || defined (STM32L073xx) || defined (STM32L083xx) + /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32L0xx_HAL_LCD_H #define __STM32L0xx_HAL_LCD_H @@ -43,7 +45,6 @@ extern "C" { #endif -#if !defined (STM32L051xx) && !defined (STM32L052xx) && !defined (STM32L062xx) && !defined (STM32L061xx) /* Includes ------------------------------------------------------------------*/ #include "stm32l0xx_hal_def.h" @@ -52,11 +53,14 @@ * @{ */ -/** @addtogroup LCD +/** @addtogroup LCD LCD * @{ */ /* Exported types ------------------------------------------------------------*/ +/** @defgroup LCD_Exported_Types LCD Exported Types + * @{ + */ /** * @brief LCD Init structure definition @@ -80,8 +84,8 @@ This parameter can be one value of @ref LCD_DeadTime */ uint32_t PulseOnDuration; /*!< Configures the LCD Pulse On Duration. This parameter can be one value of @ref LCD_PulseOnDuration */ - uint32_t HighDrive; /*!< Enable or disable the low resistance divider. - This parameter can be set to ENABLE or DISABLE. */ + uint32_t HighDrive; /*!< Configures the LCD High Drive. + This parameter can be one value of @ref LCD_HighDrive */ uint32_t BlinkMode; /*!< Configures the LCD Blink Mode. This parameter can be one value of @ref LCD_BlinkMode */ uint32_t BlinkFrequency; /*!< Configures the LCD Blink frequency. @@ -101,44 +105,46 @@ }HAL_LCD_StateTypeDef; /** - * @brief HAL LCD Error Code structure definition - */ -typedef enum -{ - HAL_LCD_ERROR_NONE = 0x00, /*!< No error */ - HAL_LCD_ERROR_FCRSF = 0x01, /*!< Synchro flag timeout error */ - HAL_LCD_ERROR_UDR = 0x02, /*!< Update display request flag timeout error */ - HAL_LCD_ERROR_UDD = 0x04, /*!< Update display done flag timeout error */ - HAL_LCD_ERROR_ENS = 0x08, /*!< LCD enabled status flag timeout error */ - HAL_LCD_ERROR_RDY = 0x10 /*!< LCD Booster ready timeout error */ -}HAL_LCD_ErrorTypeDef; - -/** * @brief UART handle Structure definition */ typedef struct { - LCD_TypeDef *Instance; /* LCD registers base address */ + LCD_TypeDef *Instance; /* LCD registers base address */ - LCD_InitTypeDef Init; /* LCD communication parameters */ + LCD_InitTypeDef Init; /* LCD communication parameters */ - HAL_LockTypeDef Lock; /* Locking object */ + HAL_LockTypeDef Lock; /* Locking object */ - __IO HAL_LCD_StateTypeDef State; /* LCD communication state */ + __IO HAL_LCD_StateTypeDef State; /* LCD communication state */ - __IO HAL_LCD_ErrorTypeDef ErrorCode; /* LCD Error code */ + __IO uint32_t ErrorCode; /* LCD Error code */ }LCD_HandleTypeDef; +/** + * @} + */ + /* Exported constants --------------------------------------------------------*/ -/** @defgroup LCD_Exported_Constants +/** @defgroup LCD_Exported_Constants LCD Exported Constants * @{ */ -#define IS_LCD_ALL_INSTANCE(INSTANCE) ((INSTANCE) == LCD) - -/** @defgroup LCD_Prescaler +/** @defgroup LCD_ErrorCode LCD Error Code + * @{ + */ +#define HAL_LCD_ERROR_NONE ((uint32_t)0x00) /*!< No error */ +#define HAL_LCD_ERROR_FCRSF ((uint32_t)0x01) /*!< Synchro flag timeout error */ +#define HAL_LCD_ERROR_UDR ((uint32_t)0x02) /*!< Update display request flag timeout error */ +#define HAL_LCD_ERROR_UDD ((uint32_t)0x04) /*!< Update display done flag timeout error */ +#define HAL_LCD_ERROR_ENS ((uint32_t)0x08) /*!< LCD enabled status flag timeout error */ +#define HAL_LCD_ERROR_RDY ((uint32_t)0x10) /*!< LCD Booster ready timeout error */ +/** + * @} + */ + +/** @defgroup LCD_Prescaler LCD Prescaler * @{ */ @@ -157,30 +163,30 @@ #define LCD_PRESCALER_4096 ((uint32_t)0x03000000) /*!< CLKPS = LCDCLK/4096 */ #define LCD_PRESCALER_8192 ((uint32_t)0x03400000) /*!< CLKPS = LCDCLK/8192 */ #define LCD_PRESCALER_16384 ((uint32_t)0x03800000) /*!< CLKPS = LCDCLK/16384 */ -#define LCD_PRESCALER_32768 ((uint32_t)0x03C00000) /*!< CLKPS = LCDCLK/32768 */ +#define LCD_PRESCALER_32768 ((uint32_t)LCD_FCR_PS) /*!< CLKPS = LCDCLK/32768 */ -#define IS_LCD_PRESCALER(PRESCALER) (((PRESCALER) == LCD_PRESCALER_1) || \ - ((PRESCALER) == LCD_PRESCALER_2) || \ - ((PRESCALER) == LCD_PRESCALER_4) || \ - ((PRESCALER) == LCD_PRESCALER_8) || \ - ((PRESCALER) == LCD_PRESCALER_16) || \ - ((PRESCALER) == LCD_PRESCALER_32) || \ - ((PRESCALER) == LCD_PRESCALER_64) || \ - ((PRESCALER) == LCD_PRESCALER_128) || \ - ((PRESCALER) == LCD_PRESCALER_256) || \ - ((PRESCALER) == LCD_PRESCALER_512) || \ - ((PRESCALER) == LCD_PRESCALER_1024) || \ - ((PRESCALER) == LCD_PRESCALER_2048) || \ - ((PRESCALER) == LCD_PRESCALER_4096) || \ - ((PRESCALER) == LCD_PRESCALER_8192) || \ - ((PRESCALER) == LCD_PRESCALER_16384) || \ - ((PRESCALER) == LCD_PRESCALER_32768)) +#define IS_LCD_PRESCALER(__PRESCALER__) (((__PRESCALER__) == LCD_PRESCALER_1) || \ + ((__PRESCALER__) == LCD_PRESCALER_2) || \ + ((__PRESCALER__) == LCD_PRESCALER_4) || \ + ((__PRESCALER__) == LCD_PRESCALER_8) || \ + ((__PRESCALER__) == LCD_PRESCALER_16) || \ + ((__PRESCALER__) == LCD_PRESCALER_32) || \ + ((__PRESCALER__) == LCD_PRESCALER_64) || \ + ((__PRESCALER__) == LCD_PRESCALER_128) || \ + ((__PRESCALER__) == LCD_PRESCALER_256) || \ + ((__PRESCALER__) == LCD_PRESCALER_512) || \ + ((__PRESCALER__) == LCD_PRESCALER_1024) || \ + ((__PRESCALER__) == LCD_PRESCALER_2048) || \ + ((__PRESCALER__) == LCD_PRESCALER_4096) || \ + ((__PRESCALER__) == LCD_PRESCALER_8192) || \ + ((__PRESCALER__) == LCD_PRESCALER_16384) || \ + ((__PRESCALER__) == LCD_PRESCALER_32768)) /** * @} */ -/** @defgroup LCD_Divider +/** @defgroup LCD_Divider LCD Divider * @{ */ @@ -199,52 +205,52 @@ #define LCD_DIVIDER_28 ((uint32_t)0x00300000) /*!< LCD frequency = CLKPS/28 */ #define LCD_DIVIDER_29 ((uint32_t)0x00340000) /*!< LCD frequency = CLKPS/29 */ #define LCD_DIVIDER_30 ((uint32_t)0x00380000) /*!< LCD frequency = CLKPS/30 */ -#define LCD_DIVIDER_31 ((uint32_t)0x003C0000) /*!< LCD frequency = CLKPS/31 */ +#define LCD_DIVIDER_31 ((uint32_t)LCD_FCR_DIV) /*!< LCD frequency = CLKPS/31 */ -#define IS_LCD_DIVIDER(DIVIDER) (((DIVIDER) == LCD_DIVIDER_16) || \ - ((DIVIDER) == LCD_DIVIDER_17) || \ - ((DIVIDER) == LCD_DIVIDER_18) || \ - ((DIVIDER) == LCD_DIVIDER_19) || \ - ((DIVIDER) == LCD_DIVIDER_20) || \ - ((DIVIDER) == LCD_DIVIDER_21) || \ - ((DIVIDER) == LCD_DIVIDER_22) || \ - ((DIVIDER) == LCD_DIVIDER_23) || \ - ((DIVIDER) == LCD_DIVIDER_24) || \ - ((DIVIDER) == LCD_DIVIDER_25) || \ - ((DIVIDER) == LCD_DIVIDER_26) || \ - ((DIVIDER) == LCD_DIVIDER_27) || \ - ((DIVIDER) == LCD_DIVIDER_28) || \ - ((DIVIDER) == LCD_DIVIDER_29) || \ - ((DIVIDER) == LCD_DIVIDER_30) || \ - ((DIVIDER) == LCD_DIVIDER_31)) +#define IS_LCD_DIVIDER(__DIVIDER__) (((__DIVIDER__) == LCD_DIVIDER_16) || \ + ((__DIVIDER__) == LCD_DIVIDER_17) || \ + ((__DIVIDER__) == LCD_DIVIDER_18) || \ + ((__DIVIDER__) == LCD_DIVIDER_19) || \ + ((__DIVIDER__) == LCD_DIVIDER_20) || \ + ((__DIVIDER__) == LCD_DIVIDER_21) || \ + ((__DIVIDER__) == LCD_DIVIDER_22) || \ + ((__DIVIDER__) == LCD_DIVIDER_23) || \ + ((__DIVIDER__) == LCD_DIVIDER_24) || \ + ((__DIVIDER__) == LCD_DIVIDER_25) || \ + ((__DIVIDER__) == LCD_DIVIDER_26) || \ + ((__DIVIDER__) == LCD_DIVIDER_27) || \ + ((__DIVIDER__) == LCD_DIVIDER_28) || \ + ((__DIVIDER__) == LCD_DIVIDER_29) || \ + ((__DIVIDER__) == LCD_DIVIDER_30) || \ + ((__DIVIDER__) == LCD_DIVIDER_31)) /** * @} */ -/** @defgroup LCD_Duty +/** @defgroup LCD_Duty LCD Duty * @{ */ -#define LCD_DUTY_STATIC ((uint32_t)0x00000000) /*!< Static duty */ -#define LCD_DUTY_1_2 ((uint32_t)0x00000004) /*!< 1/2 duty */ -#define LCD_DUTY_1_3 ((uint32_t)0x00000008) /*!< 1/3 duty */ -#define LCD_DUTY_1_4 ((uint32_t)0x0000000C) /*!< 1/4 duty */ -#define LCD_DUTY_1_8 ((uint32_t)0x00000010) /*!< 1/4 duty */ +#define LCD_DUTY_STATIC ((uint32_t)0x00000000) /*!< Static duty */ +#define LCD_DUTY_1_2 (LCD_CR_DUTY_0) /*!< 1/2 duty */ +#define LCD_DUTY_1_3 (LCD_CR_DUTY_1) /*!< 1/3 duty */ +#define LCD_DUTY_1_4 ((LCD_CR_DUTY_1 | LCD_CR_DUTY_0)) /*!< 1/4 duty */ +#define LCD_DUTY_1_8 (LCD_CR_DUTY_2) /*!< 1/8 duty */ -#define IS_LCD_DUTY(DUTY) (((DUTY) == LCD_DUTY_STATIC) || \ - ((DUTY) == LCD_DUTY_1_2) || \ - ((DUTY) == LCD_DUTY_1_3) || \ - ((DUTY) == LCD_DUTY_1_4) || \ - ((DUTY) == LCD_DUTY_1_8)) +#define IS_LCD_DUTY(__DUTY__) (((__DUTY__) == LCD_DUTY_STATIC) || \ + ((__DUTY__) == LCD_DUTY_1_2) || \ + ((__DUTY__) == LCD_DUTY_1_3) || \ + ((__DUTY__) == LCD_DUTY_1_4) || \ + ((__DUTY__) == LCD_DUTY_1_8)) /** * @} */ -/** @defgroup LCD_Bias +/** @defgroup LCD_Bias LCD Bias * @{ */ @@ -252,14 +258,14 @@ #define LCD_BIAS_1_2 LCD_CR_BIAS_0 /*!< 1/2 Bias */ #define LCD_BIAS_1_3 LCD_CR_BIAS_1 /*!< 1/3 Bias */ -#define IS_LCD_BIAS(BIAS) (((BIAS) == LCD_BIAS_1_4) || \ - ((BIAS) == LCD_BIAS_1_2) || \ - ((BIAS) == LCD_BIAS_1_3)) +#define IS_LCD_BIAS(__BIAS__) (((__BIAS__) == LCD_BIAS_1_4) || \ + ((__BIAS__) == LCD_BIAS_1_2) || \ + ((__BIAS__) == LCD_BIAS_1_3)) /** * @} */ -/** @defgroup LCD_Voltage_Source +/** @defgroup LCD_Voltage_Source LCD Voltage Source * @{ */ @@ -273,140 +279,148 @@ * @} */ -/** @defgroup LCD_Interrupts +/** @defgroup LCD_Interrupts LCD Interrupts * @{ */ #define LCD_IT_SOF LCD_FCR_SOFIE #define LCD_IT_UDD LCD_FCR_UDDIE -#define IS_LCD_IT(IT) ((((IT) & (uint32_t)0xFFFFFFF5) == 0x00) && ((IT) != 0x00)) +/** + * @} + */ + +/** @defgroup LCD_PulseOnDuration LCD Pulse On Duration + * @{ + */ -#define IS_LCD_GET_IT(IT) (((IT) == LCD_IT_SOF) || ((IT) == LCD_IT_UDD)) - +#define LCD_PULSEONDURATION_0 ((uint32_t)0x00000000) /*!< Pulse ON duration = 0 pulse */ +#define LCD_PULSEONDURATION_1 (LCD_FCR_PON_0) /*!< Pulse ON duration = 1/CK_PS */ +#define LCD_PULSEONDURATION_2 (LCD_FCR_PON_1) /*!< Pulse ON duration = 2/CK_PS */ +#define LCD_PULSEONDURATION_3 (LCD_FCR_PON_1 | LCD_FCR_PON_0) /*!< Pulse ON duration = 3/CK_PS */ +#define LCD_PULSEONDURATION_4 (LCD_FCR_PON_2) /*!< Pulse ON duration = 4/CK_PS */ +#define LCD_PULSEONDURATION_5 (LCD_FCR_PON_2 | LCD_FCR_PON_0) /*!< Pulse ON duration = 5/CK_PS */ +#define LCD_PULSEONDURATION_6 (LCD_FCR_PON_2 | LCD_FCR_PON_1) /*!< Pulse ON duration = 6/CK_PS */ +#define LCD_PULSEONDURATION_7 (LCD_FCR_PON) /*!< Pulse ON duration = 7/CK_PS */ + +#define IS_LCD_PULSE_ON_DURATION(__DURATION__) (((__DURATION__) == LCD_PULSEONDURATION_0) || \ + ((__DURATION__) == LCD_PULSEONDURATION_1) || \ + ((__DURATION__) == LCD_PULSEONDURATION_2) || \ + ((__DURATION__) == LCD_PULSEONDURATION_3) || \ + ((__DURATION__) == LCD_PULSEONDURATION_4) || \ + ((__DURATION__) == LCD_PULSEONDURATION_5) || \ + ((__DURATION__) == LCD_PULSEONDURATION_6) || \ + ((__DURATION__) == LCD_PULSEONDURATION_7)) /** * @} */ -/** @defgroup LCD_PulseOnDuration +/** @defgroup LCD_HighDrive LCD HighDrive * @{ */ -#define LCD_PULSEONDURATION_0 ((uint32_t)0x00000000) /*!< Pulse ON duration = 0 pulse */ -#define LCD_PULSEONDURATION_1 ((uint32_t)0x00000010) /*!< Pulse ON duration = 1/CK_PS */ -#define LCD_PULSEONDURATION_2 ((uint32_t)0x00000020) /*!< Pulse ON duration = 2/CK_PS */ -#define LCD_PULSEONDURATION_3 ((uint32_t)0x00000030) /*!< Pulse ON duration = 3/CK_PS */ -#define LCD_PULSEONDURATION_4 ((uint32_t)0x00000040) /*!< Pulse ON duration = 4/CK_PS */ -#define LCD_PULSEONDURATION_5 ((uint32_t)0x00000050) /*!< Pulse ON duration = 5/CK_PS */ -#define LCD_PULSEONDURATION_6 ((uint32_t)0x00000060) /*!< Pulse ON duration = 6/CK_PS */ -#define LCD_PULSEONDURATION_7 ((uint32_t)0x00000070) /*!< Pulse ON duration = 7/CK_PS */ +#define LCD_HIGHDRIVE_0 ((uint32_t)0x00000000) /*!< Low resistance Drive */ +#define LCD_HIGHDRIVE_1 (LCD_FCR_HD) /*!< High resistance Drive */ -#define IS_LCD_PULSE_ON_DURATION(DURATION) (((DURATION) == LCD_PULSEONDURATION_0) || \ - ((DURATION) == LCD_PULSEONDURATION_1) || \ - ((DURATION) == LCD_PULSEONDURATION_2) || \ - ((DURATION) == LCD_PULSEONDURATION_3) || \ - ((DURATION) == LCD_PULSEONDURATION_4) || \ - ((DURATION) == LCD_PULSEONDURATION_5) || \ - ((DURATION) == LCD_PULSEONDURATION_6) || \ - ((DURATION) == LCD_PULSEONDURATION_7)) +#define IS_LCD_HIGHDRIVE(__HIGHDRIVE__) (((__HIGHDRIVE__) == LCD_HIGHDRIVE_0) || \ + ((__HIGHDRIVE__) == LCD_HIGHDRIVE_1)) /** * @} */ - -/** @defgroup LCD_DeadTime +/** @defgroup LCD_DeadTime LCD Dead Time * @{ */ -#define LCD_DEADTIME_0 ((uint32_t)0x00000000) /*!< No dead Time */ -#define LCD_DEADTIME_1 ((uint32_t)0x00000080) /*!< One Phase between different couple of Frame */ -#define LCD_DEADTIME_2 ((uint32_t)0x00000100) /*!< Two Phase between different couple of Frame */ -#define LCD_DEADTIME_3 ((uint32_t)0x00000180) /*!< Three Phase between different couple of Frame */ -#define LCD_DEADTIME_4 ((uint32_t)0x00000200) /*!< Four Phase between different couple of Frame */ -#define LCD_DEADTIME_5 ((uint32_t)0x00000280) /*!< Five Phase between different couple of Frame */ -#define LCD_DEADTIME_6 ((uint32_t)0x00000300) /*!< Six Phase between different couple of Frame */ -#define LCD_DEADTIME_7 ((uint32_t)0x00000380) /*!< Seven Phase between different couple of Frame */ +#define LCD_DEADTIME_0 ((uint32_t)0x00000000) /*!< No dead Time */ +#define LCD_DEADTIME_1 (LCD_FCR_DEAD_0) /*!< One Phase between different couple of Frame */ +#define LCD_DEADTIME_2 (LCD_FCR_DEAD_1) /*!< Two Phase between different couple of Frame */ +#define LCD_DEADTIME_3 (LCD_FCR_DEAD_1 | LCD_FCR_DEAD_0) /*!< Three Phase between different couple of Frame */ +#define LCD_DEADTIME_4 (LCD_FCR_DEAD_2) /*!< Four Phase between different couple of Frame */ +#define LCD_DEADTIME_5 (LCD_FCR_DEAD_2 | LCD_FCR_DEAD_0) /*!< Five Phase between different couple of Frame */ +#define LCD_DEADTIME_6 (LCD_FCR_DEAD_2 | LCD_FCR_DEAD_1) /*!< Six Phase between different couple of Frame */ +#define LCD_DEADTIME_7 (LCD_FCR_DEAD) /*!< Seven Phase between different couple of Frame */ -#define IS_LCD_DEAD_TIME(TIME) (((TIME) == LCD_DEADTIME_0) || \ - ((TIME) == LCD_DEADTIME_1) || \ - ((TIME) == LCD_DEADTIME_2) || \ - ((TIME) == LCD_DEADTIME_3) || \ - ((TIME) == LCD_DEADTIME_4) || \ - ((TIME) == LCD_DEADTIME_5) || \ - ((TIME) == LCD_DEADTIME_6) || \ - ((TIME) == LCD_DEADTIME_7)) +#define IS_LCD_DEAD_TIME(__TIME__) (((__TIME__) == LCD_DEADTIME_0) || \ + ((__TIME__) == LCD_DEADTIME_1) || \ + ((__TIME__) == LCD_DEADTIME_2) || \ + ((__TIME__) == LCD_DEADTIME_3) || \ + ((__TIME__) == LCD_DEADTIME_4) || \ + ((__TIME__) == LCD_DEADTIME_5) || \ + ((__TIME__) == LCD_DEADTIME_6) || \ + ((__TIME__) == LCD_DEADTIME_7)) /** * @} */ -/** @defgroup LCD_BlinkMode +/** @defgroup LCD_BlinkMode LCD Blink Mode * @{ */ -#define LCD_BLINKMODE_OFF ((uint32_t)0x00000000) /*!< Blink disabled */ -#define LCD_BLINKMODE_SEG0_COM0 ((uint32_t)0x00010000) /*!< Blink enabled on SEG[0], COM[0] (1 pixel) */ -#define LCD_BLINKMODE_SEG0_ALLCOM ((uint32_t)0x00020000) /*!< Blink enabled on SEG[0], all COM (up to +#define LCD_BLINKMODE_OFF ((uint32_t)0x00000000) /*!< Blink disabled */ +#define LCD_BLINKMODE_SEG0_COM0 (LCD_FCR_BLINK_0) /*!< Blink enabled on SEG[0], COM[0] (1 pixel) */ +#define LCD_BLINKMODE_SEG0_ALLCOM (LCD_FCR_BLINK_1) /*!< Blink enabled on SEG[0], all COM (up to 8 pixels according to the programmed duty) */ -#define LCD_BLINKMODE_ALLSEG_ALLCOM ((uint32_t)0x00030000) /*!< Blink enabled on all SEG and all COM (all pixels) */ +#define LCD_BLINKMODE_ALLSEG_ALLCOM (LCD_FCR_BLINK) /*!< Blink enabled on all SEG and all COM (all pixels) */ -#define IS_LCD_BLINK_MODE(MODE) (((MODE) == LCD_BLINKMODE_OFF) || \ - ((MODE) == LCD_BLINKMODE_SEG0_COM0) || \ - ((MODE) == LCD_BLINKMODE_SEG0_ALLCOM) || \ - ((MODE) == LCD_BLINKMODE_ALLSEG_ALLCOM)) +#define IS_LCD_BLINK_MODE(__MODE__) (((__MODE__) == LCD_BLINKMODE_OFF) || \ + ((__MODE__) == LCD_BLINKMODE_SEG0_COM0) || \ + ((__MODE__) == LCD_BLINKMODE_SEG0_ALLCOM) || \ + ((__MODE__) == LCD_BLINKMODE_ALLSEG_ALLCOM)) /** * @} */ -/** @defgroup LCD_BlinkFrequency +/** @defgroup LCD_BlinkFrequency LCD Blink Frequency * @{ */ -#define LCD_BLINKFREQUENCY_DIV8 ((uint32_t)0x00000000) /*!< The Blink frequency = fLCD/8 */ -#define LCD_BLINKFREQUENCY_DIV16 ((uint32_t)0x00002000) /*!< The Blink frequency = fLCD/16 */ -#define LCD_BLINKFREQUENCY_DIV32 ((uint32_t)0x00004000) /*!< The Blink frequency = fLCD/32 */ -#define LCD_BLINKFREQUENCY_DIV64 ((uint32_t)0x00006000) /*!< The Blink frequency = fLCD/64 */ -#define LCD_BLINKFREQUENCY_DIV128 ((uint32_t)0x00008000) /*!< The Blink frequency = fLCD/128 */ -#define LCD_BLINKFREQUENCY_DIV256 ((uint32_t)0x0000A000) /*!< The Blink frequency = fLCD/256 */ -#define LCD_BLINKFREQUENCY_DIV512 ((uint32_t)0x0000C000) /*!< The Blink frequency = fLCD/512 */ -#define LCD_BLINKFREQUENCY_DIV1024 ((uint32_t)0x0000E000) /*!< The Blink frequency = fLCD/1024 */ +#define LCD_BLINKFREQUENCY_DIV8 ((uint32_t)0x00000000) /*!< The Blink frequency = fLCD/8 */ +#define LCD_BLINKFREQUENCY_DIV16 (LCD_FCR_BLINKF_0) /*!< The Blink frequency = fLCD/16 */ +#define LCD_BLINKFREQUENCY_DIV32 (LCD_FCR_BLINKF_1) /*!< The Blink frequency = fLCD/32 */ +#define LCD_BLINKFREQUENCY_DIV64 (LCD_FCR_BLINKF_1 | LCD_FCR_BLINKF_0) /*!< The Blink frequency = fLCD/64 */ +#define LCD_BLINKFREQUENCY_DIV128 (LCD_FCR_BLINKF_2) /*!< The Blink frequency = fLCD/128 */ +#define LCD_BLINKFREQUENCY_DIV256 (LCD_FCR_BLINKF_2 |LCD_FCR_BLINKF_0) /*!< The Blink frequency = fLCD/256 */ +#define LCD_BLINKFREQUENCY_DIV512 (LCD_FCR_BLINKF_2 |LCD_FCR_BLINKF_1) /*!< The Blink frequency = fLCD/512 */ +#define LCD_BLINKFREQUENCY_DIV1024 (LCD_FCR_BLINKF) /*!< The Blink frequency = fLCD/1024 */ -#define IS_LCD_BLINK_FREQUENCY(FREQUENCY) (((FREQUENCY) == LCD_BLINKFREQUENCY_DIV8) || \ - ((FREQUENCY) == LCD_BLINKFREQUENCY_DIV16) || \ - ((FREQUENCY) == LCD_BLINKFREQUENCY_DIV32) || \ - ((FREQUENCY) == LCD_BLINKFREQUENCY_DIV64) || \ - ((FREQUENCY) == LCD_BLINKFREQUENCY_DIV128) || \ - ((FREQUENCY) == LCD_BLINKFREQUENCY_DIV256) || \ - ((FREQUENCY) == LCD_BLINKFREQUENCY_DIV512) || \ - ((FREQUENCY) == LCD_BLINKFREQUENCY_DIV1024)) +#define IS_LCD_BLINK_FREQUENCY(__FREQUENCY__) (((__FREQUENCY__) == LCD_BLINKFREQUENCY_DIV8) || \ + ((__FREQUENCY__) == LCD_BLINKFREQUENCY_DIV16) || \ + ((__FREQUENCY__) == LCD_BLINKFREQUENCY_DIV32) || \ + ((__FREQUENCY__) == LCD_BLINKFREQUENCY_DIV64) || \ + ((__FREQUENCY__) == LCD_BLINKFREQUENCY_DIV128) || \ + ((__FREQUENCY__) == LCD_BLINKFREQUENCY_DIV256) || \ + ((__FREQUENCY__) == LCD_BLINKFREQUENCY_DIV512) || \ + ((__FREQUENCY__) == LCD_BLINKFREQUENCY_DIV1024)) /** * @} */ -/** @defgroup LCD_Contrast +/** @defgroup LCD_Contrast LCD Contrast * @{ */ -#define LCD_CONTRASTLEVEL_0 ((uint32_t)0x00000000) /*!< Maximum Voltage = 2.60V */ -#define LCD_CONTRASTLEVEL_1 ((uint32_t)0x00000400) /*!< Maximum Voltage = 2.73V */ -#define LCD_CONTRASTLEVEL_2 ((uint32_t)0x00000800) /*!< Maximum Voltage = 2.86V */ -#define LCD_CONTRASTLEVEL_3 ((uint32_t)0x00000C00) /*!< Maximum Voltage = 2.99V */ -#define LCD_CONTRASTLEVEL_4 ((uint32_t)0x00001000) /*!< Maximum Voltage = 3.12V */ -#define LCD_CONTRASTLEVEL_5 ((uint32_t)0x00001400) /*!< Maximum Voltage = 3.25V */ -#define LCD_CONTRASTLEVEL_6 ((uint32_t)0x00001800) /*!< Maximum Voltage = 3.38V */ -#define LCD_CONTRASTLEVEL_7 ((uint32_t)0x00001C00) /*!< Maximum Voltage = 3.51V */ +#define LCD_CONTRASTLEVEL_0 ((uint32_t)0x00000000) /*!< Maximum Voltage = 2.60V */ +#define LCD_CONTRASTLEVEL_1 (LCD_FCR_CC_0) /*!< Maximum Voltage = 2.73V */ +#define LCD_CONTRASTLEVEL_2 (LCD_FCR_CC_1) /*!< Maximum Voltage = 2.86V */ +#define LCD_CONTRASTLEVEL_3 (LCD_FCR_CC_1 | LCD_FCR_CC_0) /*!< Maximum Voltage = 2.99V */ +#define LCD_CONTRASTLEVEL_4 (LCD_FCR_CC_2) /*!< Maximum Voltage = 3.12V */ +#define LCD_CONTRASTLEVEL_5 (LCD_FCR_CC_2 | LCD_FCR_CC_0) /*!< Maximum Voltage = 3.25V */ +#define LCD_CONTRASTLEVEL_6 (LCD_FCR_CC_2 | LCD_FCR_CC_1) /*!< Maximum Voltage = 3.38V */ +#define LCD_CONTRASTLEVEL_7 (LCD_FCR_CC) /*!< Maximum Voltage = 3.51V */ -#define IS_LCD_CONTRAST(CONTRAST) (((CONTRAST) == LCD_CONTRASTLEVEL_0) || \ - ((CONTRAST) == LCD_CONTRASTLEVEL_1) || \ - ((CONTRAST) == LCD_CONTRASTLEVEL_2) || \ - ((CONTRAST) == LCD_CONTRASTLEVEL_3) || \ - ((CONTRAST) == LCD_CONTRASTLEVEL_4) || \ - ((CONTRAST) == LCD_CONTRASTLEVEL_5) || \ - ((CONTRAST) == LCD_CONTRASTLEVEL_6) || \ - ((CONTRAST) == LCD_CONTRASTLEVEL_7)) +#define IS_LCD_CONTRAST(__CONTRAST__) (((__CONTRAST__) == LCD_CONTRASTLEVEL_0) || \ + ((__CONTRAST__) == LCD_CONTRASTLEVEL_1) || \ + ((__CONTRAST__) == LCD_CONTRASTLEVEL_2) || \ + ((__CONTRAST__) == LCD_CONTRASTLEVEL_3) || \ + ((__CONTRAST__) == LCD_CONTRASTLEVEL_4) || \ + ((__CONTRAST__) == LCD_CONTRASTLEVEL_5) || \ + ((__CONTRAST__) == LCD_CONTRASTLEVEL_6) || \ + ((__CONTRAST__) == LCD_CONTRASTLEVEL_7)) /** * @} */ -/** @defgroup LCD_Flag +/** @defgroup LCD_Flag LCD Flag * @{ */ @@ -417,16 +431,11 @@ #define LCD_FLAG_RDY LCD_SR_RDY #define LCD_FLAG_FCRSF LCD_SR_FCRSR -#define IS_LCD_GET_FLAG(FLAG) (((FLAG) == LCD_FLAG_ENS) || ((FLAG) == LCD_FLAG_SOF) || \ - ((FLAG) == LCD_FLAG_UDR) || ((FLAG) == LCD_FLAG_UDD) || \ - ((FLAG) == LCD_FLAG_RDY) || ((FLAG) == LCD_FLAG_FCRSF)) - -#define IS_LCD_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFFF5) == 0x00) && ((FLAG) != 0x00)) /** * @} */ -/** @defgroup LCD_RAMRegister +/** @defgroup LCD_RAMRegister LCD RAMRegister * @{ */ @@ -447,22 +456,22 @@ #define LCD_RAM_REGISTER14 ((uint32_t)0x0000000E) /*!< LCD RAM Register 14 */ #define LCD_RAM_REGISTER15 ((uint32_t)0x0000000F) /*!< LCD RAM Register 15 */ -#define IS_LCD_RAM_REGISTER(REGISTER) (((REGISTER) == LCD_RAM_REGISTER0) || \ - ((REGISTER) == LCD_RAM_REGISTER1) || \ - ((REGISTER) == LCD_RAM_REGISTER2) || \ - ((REGISTER) == LCD_RAM_REGISTER3) || \ - ((REGISTER) == LCD_RAM_REGISTER4) || \ - ((REGISTER) == LCD_RAM_REGISTER5) || \ - ((REGISTER) == LCD_RAM_REGISTER6) || \ - ((REGISTER) == LCD_RAM_REGISTER7) || \ - ((REGISTER) == LCD_RAM_REGISTER8) || \ - ((REGISTER) == LCD_RAM_REGISTER9) || \ - ((REGISTER) == LCD_RAM_REGISTER10) || \ - ((REGISTER) == LCD_RAM_REGISTER11) || \ - ((REGISTER) == LCD_RAM_REGISTER12) || \ - ((REGISTER) == LCD_RAM_REGISTER13) || \ - ((REGISTER) == LCD_RAM_REGISTER14) || \ - ((REGISTER) == LCD_RAM_REGISTER15)) +#define IS_LCD_RAM_REGISTER(__REGISTER__) (((__REGISTER__) == LCD_RAM_REGISTER0) || \ + ((__REGISTER__) == LCD_RAM_REGISTER1) || \ + ((__REGISTER__) == LCD_RAM_REGISTER2) || \ + ((__REGISTER__) == LCD_RAM_REGISTER3) || \ + ((__REGISTER__) == LCD_RAM_REGISTER4) || \ + ((__REGISTER__) == LCD_RAM_REGISTER5) || \ + ((__REGISTER__) == LCD_RAM_REGISTER6) || \ + ((__REGISTER__) == LCD_RAM_REGISTER7) || \ + ((__REGISTER__) == LCD_RAM_REGISTER8) || \ + ((__REGISTER__) == LCD_RAM_REGISTER9) || \ + ((__REGISTER__) == LCD_RAM_REGISTER10) || \ + ((__REGISTER__) == LCD_RAM_REGISTER11) || \ + ((__REGISTER__) == LCD_RAM_REGISTER12) || \ + ((__REGISTER__) == LCD_RAM_REGISTER13) || \ + ((__REGISTER__) == LCD_RAM_REGISTER14) || \ + ((__REGISTER__) == LCD_RAM_REGISTER15)) /** * @} @@ -474,7 +483,7 @@ /* Exported macro ------------------------------------------------------------*/ -/** @defgroup LCD_Exported_Macros +/** @defgroup LCD_Exported_Macros LCD Exported Macros * @{ */ @@ -482,14 +491,14 @@ * @param __HANDLE__: specifies the LCD Handle. * @retval None */ -#define __HAL_LCD_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_LCD_STATE_RESET) +#define __HAL_LCD_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_LCD_STATE_RESET) /** @brief macros to enables or disables the LCD * @param __HANDLE__: specifies the LCD Handle. * @retval None */ -#define __HAL_LCD_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= LCD_CR_LCDEN) -#define __HAL_LCD_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~LCD_CR_LCDEN) +#define __HAL_LCD_ENABLE(__HANDLE__) (SET_BIT((__HANDLE__)->Instance->CR, LCD_CR_LCDEN)) +#define __HAL_LCD_DISABLE(__HANDLE__) (CLEAR_BIT((__HANDLE__)->Instance->CR, LCD_CR_LCDEN)) /** @brief Macros to enable or disable the low resistance divider. Displays with high * internal resistance may need a longer drive time to achieve @@ -502,15 +511,16 @@ */ #define __HAL_LCD_HIGHDRIVER_ENABLE(__HANDLE__) \ do{ \ - ((__HANDLE__)->Instance->FCR |= LCD_FCR_HD); \ + SET_BIT((__HANDLE__)->Instance->FCR, LCD_FCR_HD); \ LCD_WaitForSynchro(__HANDLE__); \ }while(0) #define __HAL_LCD_HIGHDRIVER_DISABLE(__HANDLE__) \ do{ \ - ((__HANDLE__)->Instance->FCR &= ~LCD_FCR_HD); \ + CLEAR_BIT((__HANDLE__)->Instance->FCR, LCD_FCR_HD); \ LCD_WaitForSynchro(__HANDLE__); \ }while(0) + /** * @brief Macro to configure the LCD pulses on duration. * @param __HANDLE__: specifies the LCD Handle. @@ -574,6 +584,7 @@ MODIFY_REG((__HANDLE__)->Instance->FCR, LCD_FCR_CC, (__CONTRAST__)); \ LCD_WaitForSynchro(__HANDLE__); \ } while(0) + /** * @brief Macro to configure the LCD Blink mode and Blink frequency. * @param __HANDLE__: specifies the LCD Handle. @@ -610,16 +621,17 @@ * @arg LCD_IT_UDD: Update Display Done Interrupt * @retval None */ -#define __HAL_LCD_ENABLE_IT(__HANDLE__, __INTERRUPT__) \ - do{ \ - ((__HANDLE__)->Instance->FCR |= (__INTERRUPT__)); \ - LCD_WaitForSynchro(__HANDLE__); \ +#define __HAL_LCD_ENABLE_IT(__HANDLE__, __INTERRUPT__) \ + do{ \ + SET_BIT((__HANDLE__)->Instance->FCR, (__INTERRUPT__)); \ + LCD_WaitForSynchro(__HANDLE__); \ }while(0) -#define __HAL_LCD_DISABLE_IT(__HANDLE__, __INTERRUPT__) \ - do{ \ - ((__HANDLE__)->Instance->FCR &= ~(__INTERRUPT__));\ - LCD_WaitForSynchro(__HANDLE__); \ - }while(0) +#define __HAL_LCD_DISABLE_IT(__HANDLE__, __INTERRUPT__) \ + do{ \ + CLEAR_BIT((__HANDLE__)->Instance->FCR, (__INTERRUPT__)); \ + LCD_WaitForSynchro(__HANDLE__); \ + }while(0) + /** @brief Checks whether the specified LCD interrupt is enabled or not. * @param __HANDLE__: specifies the LCD Handle. * @param __IT__: specifies the LCD interrupt source to check. @@ -653,48 +665,62 @@ * in the LCDCLK domain. * @retval The new state of __FLAG__ (TRUE or FALSE). */ -#define __HAL_LCD_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__)) +#define __HAL_LCD_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__)) /** @brief Clears the specified LCD pending flag. * @param __HANDLE__: specifies the LCD Handle. - * @param __FLAG__: specifies the flag to check. + * @param __FLAG__: specifies the flag to clear. * This parameter can be any combination of the following values: * @arg LCD_FLAG_SOF: Start of Frame Interrupt * @arg LCD_FLAG_UDD: Update Display Done Interrupt * @retval None */ -#define __HAL_LCD_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->CLR = (__FLAG__)) +#define __HAL_LCD_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->CLR = (__FLAG__)) /** * @} */ /* Exported functions ------------------------------------------------------- */ + +/** @addtogroup LCD_Exported_Functions + * @{ + */ + +/** @addtogroup LCD_Exported_Functions_Group1 + * @{ + */ + /* Initialization/de-initialization methods **********************************/ -HAL_StatusTypeDef HAL_LCD_DeInit(LCD_HandleTypeDef *hlcd); -HAL_StatusTypeDef HAL_LCD_Init(LCD_HandleTypeDef *hlcd); -void HAL_LCD_MspInit(LCD_HandleTypeDef *hlcd); -void HAL_LCD_MspDeInit(LCD_HandleTypeDef *hlcd); - +HAL_StatusTypeDef HAL_LCD_DeInit(LCD_HandleTypeDef *hlcd); +HAL_StatusTypeDef HAL_LCD_Init(LCD_HandleTypeDef *hlcd); +void HAL_LCD_MspInit(LCD_HandleTypeDef *hlcd); +void HAL_LCD_MspDeInit(LCD_HandleTypeDef *hlcd); + +/** + * @} + */ + +/** @addtogroup LCD_Exported_Functions_Group2 + * @{ + */ + /* IO operation methods *******************************************************/ -HAL_StatusTypeDef HAL_LCD_Write(LCD_HandleTypeDef *hlcd, uint32_t RAMRegisterIndex, uint32_t RAMRegisterMask, uint32_t Data); -HAL_StatusTypeDef HAL_LCD_Clear(LCD_HandleTypeDef *hlcd); -HAL_StatusTypeDef HAL_LCD_UpdateDisplayRequest(LCD_HandleTypeDef *hlcd); +HAL_StatusTypeDef HAL_LCD_Write(LCD_HandleTypeDef *hlcd, uint32_t RAMRegisterIndex, uint32_t RAMRegisterMask, uint32_t Data); +HAL_StatusTypeDef HAL_LCD_Clear(LCD_HandleTypeDef *hlcd); +HAL_StatusTypeDef HAL_LCD_UpdateDisplayRequest(LCD_HandleTypeDef *hlcd); + +/** + * @} + */ + +/** @addtogroup LCD_Exported_Functions_Group3 + * @{ + */ /* Peripheral State methods **************************************************/ -HAL_LCD_StateTypeDef HAL_LCD_GetState(LCD_HandleTypeDef *hlcd); -uint32_t HAL_LCD_GetError(LCD_HandleTypeDef *hlcd); - -/* Private functions ---------------------------------------------------------*/ -HAL_StatusTypeDef LCD_WaitForSynchro(LCD_HandleTypeDef *hlcd); - -#endif /* STM32L051xx && STM32L052xx && STM32L062xx && STM32L061xx*/ - -#ifdef __cplusplus -} -#endif - -#endif /* __STM32L0xx_HAL_LCD_H */ +HAL_LCD_StateTypeDef HAL_LCD_GetState(LCD_HandleTypeDef *hlcd); +uint32_t HAL_LCD_GetError(LCD_HandleTypeDef *hlcd); /** * @} @@ -704,4 +730,33 @@ * @} */ -/******************* (C) COPYRIGHT 2014 STMicroelectronics *****END OF FILE****/ +/** @addtogroup LCD_Private_Functions + * @{ + */ + +/* Private functions ---------------------------------------------------------*/ +HAL_StatusTypeDef LCD_WaitForSynchro(LCD_HandleTypeDef *hlcd); + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32L0xx_HAL_LCD_H */ + + +#endif /* STM32L053xx || STM32L063xx || STM32L073xx || STM32L083xx */ + +/******************* (C) COPYRIGHT 2015 STMicroelectronics *****END OF FILE****/ +