STM8S/A Standard Peripherals Firmware Library
|
stm8s_eval_lcd.h
Go to the documentation of this file.
00001 /** 00002 ****************************************************************************** 00003 * @file stm8s_eval_lcd.h 00004 * @author MCD Application Team 00005 * @version V1.0.1 00006 * @date 30-September-2014 00007 * @brief This file contains all the functions prototypes for the Dot matrix 00008 * LCD firmware driver. 00009 ****************************************************************************** 00010 * 00011 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 00012 * You may not use this file except in compliance with the License. 00013 * You may obtain a copy of the License at: 00014 * 00015 * http://www.st.com/software_license_agreement_liberty_v2 00016 * 00017 * Unless required by applicable law or agreed to in writing, software 00018 * distributed under the License is distributed on an "AS IS" BASIS, 00019 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00020 * See the License for the specific language governing permissions and 00021 * limitations under the License. 00022 * 00023 ****************************************************************************** 00024 */ 00025 00026 /* Define to prevent recursive inclusion -------------------------------------*/ 00027 #ifndef __STM8S_EVAL_LCD_H 00028 #define __STM8S_EVAL_LCD_H 00029 00030 /* Includes ------------------------------------------------------------------*/ 00031 #include "stm8s_eval.h" 00032 /** @addtogroup Utilities 00033 * @{ 00034 */ 00035 00036 /** @addtogroup STM8S_EVAL 00037 * @{ 00038 */ 00039 00040 /** @addtogroup Common 00041 * @{ 00042 */ 00043 00044 /* Exported constants --------------------------------------------------------*/ 00045 00046 /* 00047 * Uncomment the line below if you want to use user defined Delay function 00048 * (for precise timing), otherwise default _delay_ function defined within 00049 * this driver is used (less precise timing). 00050 */ 00051 00052 /* #define USE_Delay */ 00053 00054 #ifdef USE_Delay 00055 #include "main.h" 00056 00057 #define _delay_ Delay /* !< User can provide more timing precise _delay_ 00058 function (with at least 1ms time base), using 00059 Timer for example */ 00060 #else 00061 #define _delay_ delay /* !< Default _delay_ function with less precise timing */ 00062 #endif 00063 00064 00065 /** @addtogroup STM8-128_EVAL_LOW_LEVEL_DOT_MATRIX_LCD 00066 * @{ 00067 */ 00068 /** 00069 * @brief Defines for the SPI and GPIO pins used to drive the SPI Flash 00070 */ 00071 00072 #define LCD_SPI SPI 00073 #define LCD_NCS_GPIO_PORT GPIOF /* LCD Chip Select I/O definition */ 00074 #define LCD_NCS_PIN GPIO_PIN_0 00075 #define LCD_SPI_CLK CLK_PERIPHERAL_SPI 00076 #define LCD_BACKLIGHT_PORT GPIOH 00077 #define LCD_BACKLIGHT_PIN GPIO_PIN_4 00078 #define LCD_SPI_SCK_PIN GPIO_PIN_5 00079 #define LCD_SPI_MOSI_PIN GPIO_PIN_6 00080 #define LCD_SPI_MISO_PIN GPIO_PIN_7 00081 #define LCD_SPI_GPIO_PORT GPIOC 00082 00083 /** 00084 * @} 00085 */ 00086 00087 00088 /* LCD managed as 2 Lines of 15 characters (2Lines * 15Char) */ 00089 #define LCD_LINE_MAX_CHAR ((uint8_t)15) 00090 #define LCD_LINE1 ((uint8_t)0x80) 00091 #define LCD_LINE2 ((uint8_t)0x90) 00092 00093 /* LCD Commands */ 00094 #define COMMAND_TYPE ((uint8_t)0xF8) 00095 #define DATA_TYPE ((uint8_t)0xFA) 00096 #define SET_TEXT_MODE ((uint8_t)0x30) /* 8-Bits Interface, Normal inst., Text mode */ 00097 #define SET_EXTENDED_INST ((uint8_t)0x34) 00098 #define SET_GRAPHIC_MODE ((uint8_t)0x36) /* 8-Bits Interface, Extended inst., Graphic mode */ 00099 #define DISPLAY_ON ((uint8_t)0x0C) /* Cursor and blink off */ 00100 #define DISPLAY_OFF ((uint8_t)0x08) 00101 #define DISPLAY_CLR ((uint8_t)0x01) 00102 #define ENTRY_MODE_SET_INC ((uint8_t)0x06) 00103 00104 00105 /** @defgroup STM8S_EVAL_LCD_Exported_Macros 00106 * @{ 00107 */ 00108 00109 /** 00110 * @brief Deselect LCD: ChipSelect pin low : LCD disabled 00111 */ 00112 #define LCD_NCS_LOW() GPIO_WriteLow(LCD_NCS_GPIO_PORT, LCD_NCS_PIN) 00113 /** 00114 * @brief Select LCD : ChipSelect pin high : LCD enabled 00115 */ 00116 #define LCD_NCS_HIGH() GPIO_WriteHigh(LCD_NCS_GPIO_PORT, LCD_NCS_PIN) 00117 /** 00118 * @} 00119 */ 00120 00121 /* Exported functions --------------------------------------------------------*/ 00122 void STM8S_EVAL_LCD_Init(void); 00123 void LCD_BacklightCmd(FunctionalState NewState); 00124 void LCD_SetCursorPos(uint8_t Line, uint8_t Offset); 00125 void LCD_SendByte(uint8_t DataType, uint8_t DataToSend); 00126 void LCD_Clear(void); 00127 void LCD_Print(uint8_t *ptr); 00128 void LCD_DisplayLogo(uint8_t address); 00129 void LCD_RollString(uint8_t Line, uint8_t *ptr, uint16_t speed); 00130 00131 #endif /* __STM8S_EVAL_LCD_H */ 00132 00133 /** 00134 * @} 00135 */ 00136 00137 /** 00138 * @} 00139 */ 00140 00141 /** 00142 * @} 00143 */ 00144 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/