⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stm8l15x_lcd.h

📁 STM8L的tim4定时器使用
💻 H
📖 第 1 页 / 共 2 页
字号:
/**
  ******************************************************************************
  * @file    stm8l15x_lcd.h
  * @author  MCD Application Team
  * @version V1.5.0
  * @date    13-May-2011
  * @brief   This file contains all the functions prototypes for the LCD firmware
  *          library.
  ******************************************************************************
  * @attention
  *
  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  *
  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
  ******************************************************************************  
  */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM8L15x_LCD_H
#define __STM8L15x_LCD_H

/* Includes ------------------------------------------------------------------*/
#include "stm8l15x.h"

/** @addtogroup STM8L15x_StdPeriph_Driver
  * @{
  */
  
/** @addtogroup LCD
  * @{
  */ 
  
/* Exported types ------------------------------------------------------------*/

/** @defgroup LCD_Exported_Types
  * @{
  */

/** @defgroup LCD_Duty
  * @brief element values correspond to the bits position
  * @{
  */

typedef enum {
  LCD_Duty_Static = (uint8_t)0x00, /*!< Static duty */
  LCD_Duty_1_2    = (uint8_t)0x02, /*!< 1/2 duty    */
  LCD_Duty_1_3    = (uint8_t)0x04, /*!< 1/3 duty    */
  LCD_Duty_1_4    = (uint8_t)0x06, /*!< 1/4 duty    */
  LCD_Duty_1_8    = (uint8_t)0x20  /*!< 1/8 duty    */
} LCD_Duty_TypeDef;

#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
  * @brief element values correspond to the bits position
  * @{
  */
typedef enum {
  LCD_Bias_1_4  = (uint8_t)0x10,  /*!< 1/4 bias  */
  LCD_Bias_1_3  = (uint8_t)0x00,  /*!< 1/3 bias  */
  LCD_Bias_1_2  = (uint8_t)0x01   /*!< 1/2 bias  */
} LCD_Bias_TypeDef;

#define IS_LCD_BIAS(BIAS) (((BIAS) == LCD_Bias_1_4) || \
                           ((BIAS) == LCD_Bias_1_3) || \
                           ((BIAS) == LCD_Bias_1_2))

/**
  * @}
  */
                           
/** @defgroup LCD_Clock_Prescaler
  * @brief element values correspond to the bits position
  * @{
  */
typedef enum {
  LCD_Prescaler_1     = (uint8_t)0x00, /*!< CLKprescaler = ClKinput       */
  LCD_Prescaler_2     = (uint8_t)0x10, /*!< CLKprescaler = ClKinput/2     */
  LCD_Prescaler_4     = (uint8_t)0x20, /*!< CLKprescaler = ClKinput/4     */
  LCD_Prescaler_8     = (uint8_t)0x30, /*!< CLKprescaler = ClKinput/8     */
  LCD_Prescaler_16    = (uint8_t)0x40, /*!< CLKprescaler = ClKinput/16    */
  LCD_Prescaler_32    = (uint8_t)0x50, /*!< CLKprescaler = ClKinput/32    */
  LCD_Prescaler_64    = (uint8_t)0x60, /*!< CLKprescaler = ClKinput/64    */
  LCD_Prescaler_128   = (uint8_t)0x70, /*!< CLKprescaler = ClKinput/128   */
  LCD_Prescaler_256   = (uint8_t)0x80, /*!< CLKprescaler = ClKinput/256   */
  LCD_Prescaler_512   = (uint8_t)0x90, /*!< CLKprescaler = ClKinput/512   */
  LCD_Prescaler_1024  = (uint8_t)0xA0, /*!< CLKprescaler = ClKinput/1024  */
  LCD_Prescaler_2048  = (uint8_t)0xB0, /*!< CLKprescaler = ClKinput/2048  */
  LCD_Prescaler_4096  = (uint8_t)0xC0, /*!< CLKprescaler = ClKinput/4096  */
  LCD_Prescaler_8192  = (uint8_t)0xD0, /*!< CLKprescaler = ClKinput/8192  */
  LCD_Prescaler_16384 = (uint8_t)0xE0, /*!< CLKprescaler = ClKinput/16384 */
  LCD_Prescaler_32768 = (uint8_t)0xF0  /*!< CLKprescaler = ClKinput/32768 */
} LCD_Prescaler_TypeDef;

#define IS_LCD_CLOCK_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_Clock_Divider
  * @brief element values correspond to the bits position
  * @{
  */
typedef enum {
  LCD_Divider_16 = (uint8_t)0x00, /*!< LCD frequency = CLKprescaler/16 */
  LCD_Divider_17 = (uint8_t)0x01, /*!< LCD frequency = CLKprescaler/17 */
  LCD_Divider_18 = (uint8_t)0x02, /*!< LCD frequency = CLKprescaler/18 */
  LCD_Divider_19 = (uint8_t)0x03, /*!< LCD frequency = CLKprescaler/19 */
  LCD_Divider_20 = (uint8_t)0x04, /*!< LCD frequency = CLKprescaler/20 */
  LCD_Divider_21 = (uint8_t)0x05, /*!< LCD frequency = CLKprescaler/21 */
  LCD_Divider_22 = (uint8_t)0x06, /*!< LCD frequency = CLKprescaler/22 */
  LCD_Divider_23 = (uint8_t)0x07, /*!< LCD frequency = CLKprescaler/23 */
  LCD_Divider_24 = (uint8_t)0x08, /*!< LCD frequency = CLKprescaler/24 */
  LCD_Divider_25 = (uint8_t)0x09, /*!< LCD frequency = CLKprescaler/25 */
  LCD_Divider_26 = (uint8_t)0x0A, /*!< LCD frequency = CLKprescaler/26 */
  LCD_Divider_27 = (uint8_t)0x0B, /*!< LCD frequency = CLKprescaler/27 */
  LCD_Divider_28 = (uint8_t)0x0C, /*!< LCD frequency = CLKprescaler/28 */
  LCD_Divider_29 = (uint8_t)0x0D, /*!< LCD frequency = CLKprescaler/29 */
  LCD_Divider_30 = (uint8_t)0x0E, /*!< LCD frequency = CLKprescaler/30 */
  LCD_Divider_31 = (uint8_t)0x0F  /*!< LCD frequency = CLKprescaler/31 */
} LCD_Divider_TypeDef;

#define IS_LCD_CLOCK_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_Contrast
  * @brief element values correspond to the bits position
  * @{
  */
typedef enum {
  LCD_Contrast_Level_0 = (uint8_t)0x00, /*!< Medium Density / High Density Maximum Voltage = 2.60V / 2.60V */
  LCD_Contrast_Level_1 = (uint8_t)0x02, /*!< Medium Density / High Density Maximum Voltage = 2.70V / 2.73V */
  LCD_Contrast_Level_2 = (uint8_t)0x04, /*!< Medium Density / High Density Maximum Voltage = 2.80V / 2.86V */
  LCD_Contrast_Level_3 = (uint8_t)0x06, /*!< Medium Density / High Density Maximum Voltage = 2.90V / 2.99V */
  LCD_Contrast_Level_4 = (uint8_t)0x08, /*!< Medium Density / High Density Maximum Voltage = 3.00V / 3.12V */
  LCD_Contrast_Level_5 = (uint8_t)0x0A, /*!< Medium Density / High Density Maximum Voltage = 3.10V / 3.25V */
  LCD_Contrast_Level_6 = (uint8_t)0x0C, /*!< Medium Density / High Density Maximum Voltage = 3.20V / 3.38V */
  LCD_Contrast_Level_7 = (uint8_t)0x0E  /*!< Medium Density / High Density Maximum Voltage = 3.30V / 3.51V */
} LCD_Contrast_TypeDef;

#define IS_LCD_CONTRAST(CONTRAST) (((CONTRAST) == LCD_Contrast_Level_0) || \
                                   ((CONTRAST) == LCD_Contrast_Level_1) || \
                                   ((CONTRAST) == LCD_Contrast_Level_2) || \
                                   ((CONTRAST) == LCD_Contrast_Level_3) || \
                                   ((CONTRAST) == LCD_Contrast_Level_4) || \
                                   ((CONTRAST) == LCD_Contrast_Level_5) || \
                                   ((CONTRAST) == LCD_Contrast_Level_6) || \
                                   ((CONTRAST) == LCD_Contrast_Level_7))
                                   
/**
  * @}
  */

/** @defgroup LCD_Voltage_Source
  * @brief element values correspond to the bits position
  * @{
  */
typedef enum {
  LCD_VoltageSource_Internal = (uint8_t)0x00, /*!< Internal voltage source for the LCD */
  LCD_VoltageSource_External = (uint8_t)0x01  /*!< External voltage source for the LCD */
} LCD_VoltageSource_TypeDef;

#define IS_LCD_VOLTAGE_SOURCE(SOURCE) (((SOURCE) == LCD_VoltageSource_Internal) || \
                                       ((SOURCE) == LCD_VoltageSource_External))
                                       
/**
  * @}
  */

/** @defgroup LCD_Pulse_On_Duration
  * @brief element values correspond to the bits position
  * @{
  */
typedef enum {
  LCD_PulseOnDuration_0 = (uint8_t)0x00, /*!< Pulse on duration = 0/CLKprescaler  */
  LCD_PulseOnDuration_1 = (uint8_t)0x20, /*!< Pulse on duration = 1/CLKprescaler  */
  LCD_PulseOnDuration_2 = (uint8_t)0x40, /*!< Pulse on duration = 2/CLKprescaler  */
  LCD_PulseOnDuration_3 = (uint8_t)0x60, /*!< Pulse on duration = 3/CLKprescaler  */
  LCD_PulseOnDuration_4 = (uint8_t)0x80, /*!< Pulse on duration = 4/CLKprescaler  */
  LCD_PulseOnDuration_5 = (uint8_t)0xA0, /*!< Pulse on duration = 5/CLKprescaler  */
  LCD_PulseOnDuration_6 = (uint8_t)0xC0, /*!< Pulse on duration = 6/CLKprescaler  */
  LCD_PulseOnDuration_7 = (uint8_t)0xE0  /*!< Pulse on duration = 7/CLKprescaler  */
} LCD_PulseOnDuration_TypeDef;

#define IS_LCD_PULSE_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) || \

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -