stm8l15x_lcd.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. /**
  2. ******************************************************************************
  3. * @file stm8l15x_lcd.h
  4. * @author MCD Application Team
  5. * @version V1.6.1
  6. * @date 30-September-2014
  7. * @brief This file contains all the functions prototypes for the LCD firmware
  8. * library.
  9. ******************************************************************************
  10. * @attention
  11. *
  12. * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
  13. *
  14. * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  15. * You may not use this file except in compliance with the License.
  16. * You may obtain a copy of the License at:
  17. *
  18. * http://www.st.com/software_license_agreement_liberty_v2
  19. *
  20. * Unless required by applicable law or agreed to in writing, software
  21. * distributed under the License is distributed on an "AS IS" BASIS,
  22. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  23. * See the License for the specific language governing permissions and
  24. * limitations under the License.
  25. *
  26. ******************************************************************************
  27. */
  28. /* Define to prevent recursive inclusion -------------------------------------*/
  29. #ifndef __STM8L15x_LCD_H
  30. #define __STM8L15x_LCD_H
  31. /* Includes ------------------------------------------------------------------*/
  32. #include "stm8l15x.h"
  33. /** @addtogroup STM8L15x_StdPeriph_Driver
  34. * @{
  35. */
  36. /** @addtogroup LCD
  37. * @{
  38. */
  39. /* Exported types ------------------------------------------------------------*/
  40. /** @defgroup LCD_Exported_Types
  41. * @{
  42. */
  43. /** @defgroup LCD_Duty
  44. * @brief element values correspond to the bits position
  45. * @{
  46. */
  47. typedef enum {
  48. LCD_Duty_Static = (uint8_t)0x00, /*!< Static duty */
  49. LCD_Duty_1_2 = (uint8_t)0x02, /*!< 1/2 duty */
  50. LCD_Duty_1_3 = (uint8_t)0x04, /*!< 1/3 duty */
  51. LCD_Duty_1_4 = (uint8_t)0x06, /*!< 1/4 duty */
  52. LCD_Duty_1_8 = (uint8_t)0x20 /*!< 1/8 duty */
  53. } LCD_Duty_TypeDef;
  54. #define IS_LCD_DUTY(DUTY) (((DUTY) == LCD_Duty_Static) || ((DUTY) == LCD_Duty_1_2) || \
  55. ((DUTY) == LCD_Duty_1_3) || ((DUTY) == LCD_Duty_1_4) || \
  56. ((DUTY) == LCD_Duty_1_8))
  57. /**
  58. * @}
  59. */
  60. /** @defgroup LCD_Bias
  61. * @brief element values correspond to the bits position
  62. * @{
  63. */
  64. typedef enum {
  65. LCD_Bias_1_4 = (uint8_t)0x10, /*!< 1/4 bias */
  66. LCD_Bias_1_3 = (uint8_t)0x00, /*!< 1/3 bias */
  67. LCD_Bias_1_2 = (uint8_t)0x01 /*!< 1/2 bias */
  68. } LCD_Bias_TypeDef;
  69. #define IS_LCD_BIAS(BIAS) (((BIAS) == LCD_Bias_1_4) || \
  70. ((BIAS) == LCD_Bias_1_3) || \
  71. ((BIAS) == LCD_Bias_1_2))
  72. /**
  73. * @}
  74. */
  75. /** @defgroup LCD_Clock_Prescaler
  76. * @brief element values correspond to the bits position
  77. * @{
  78. */
  79. typedef enum {
  80. LCD_Prescaler_1 = (uint8_t)0x00, /*!< CLKprescaler = ClKinput */
  81. LCD_Prescaler_2 = (uint8_t)0x10, /*!< CLKprescaler = ClKinput/2 */
  82. LCD_Prescaler_4 = (uint8_t)0x20, /*!< CLKprescaler = ClKinput/4 */
  83. LCD_Prescaler_8 = (uint8_t)0x30, /*!< CLKprescaler = ClKinput/8 */
  84. LCD_Prescaler_16 = (uint8_t)0x40, /*!< CLKprescaler = ClKinput/16 */
  85. LCD_Prescaler_32 = (uint8_t)0x50, /*!< CLKprescaler = ClKinput/32 */
  86. LCD_Prescaler_64 = (uint8_t)0x60, /*!< CLKprescaler = ClKinput/64 */
  87. LCD_Prescaler_128 = (uint8_t)0x70, /*!< CLKprescaler = ClKinput/128 */
  88. LCD_Prescaler_256 = (uint8_t)0x80, /*!< CLKprescaler = ClKinput/256 */
  89. LCD_Prescaler_512 = (uint8_t)0x90, /*!< CLKprescaler = ClKinput/512 */
  90. LCD_Prescaler_1024 = (uint8_t)0xA0, /*!< CLKprescaler = ClKinput/1024 */
  91. LCD_Prescaler_2048 = (uint8_t)0xB0, /*!< CLKprescaler = ClKinput/2048 */
  92. LCD_Prescaler_4096 = (uint8_t)0xC0, /*!< CLKprescaler = ClKinput/4096 */
  93. LCD_Prescaler_8192 = (uint8_t)0xD0, /*!< CLKprescaler = ClKinput/8192 */
  94. LCD_Prescaler_16384 = (uint8_t)0xE0, /*!< CLKprescaler = ClKinput/16384 */
  95. LCD_Prescaler_32768 = (uint8_t)0xF0 /*!< CLKprescaler = ClKinput/32768 */
  96. } LCD_Prescaler_TypeDef;
  97. #define IS_LCD_CLOCK_PRESCALER(PRESCALER) (((PRESCALER) == LCD_Prescaler_1) || \
  98. ((PRESCALER) == LCD_Prescaler_2) || \
  99. ((PRESCALER) == LCD_Prescaler_4) || \
  100. ((PRESCALER) == LCD_Prescaler_8) || \
  101. ((PRESCALER) == LCD_Prescaler_16) || \
  102. ((PRESCALER) == LCD_Prescaler_32) || \
  103. ((PRESCALER) == LCD_Prescaler_64) || \
  104. ((PRESCALER) == LCD_Prescaler_128) || \
  105. ((PRESCALER) == LCD_Prescaler_256) || \
  106. ((PRESCALER) == LCD_Prescaler_512) || \
  107. ((PRESCALER) == LCD_Prescaler_1024) || \
  108. ((PRESCALER) == LCD_Prescaler_2048) || \
  109. ((PRESCALER) == LCD_Prescaler_4096) || \
  110. ((PRESCALER) == LCD_Prescaler_8192) || \
  111. ((PRESCALER) == LCD_Prescaler_16384) || \
  112. ((PRESCALER) == LCD_Prescaler_32768))
  113. /**
  114. * @}
  115. */
  116. /** @defgroup LCD_Clock_Divider
  117. * @brief element values correspond to the bits position
  118. * @{
  119. */
  120. typedef enum {
  121. LCD_Divider_16 = (uint8_t)0x00, /*!< LCD frequency = CLKprescaler/16 */
  122. LCD_Divider_17 = (uint8_t)0x01, /*!< LCD frequency = CLKprescaler/17 */
  123. LCD_Divider_18 = (uint8_t)0x02, /*!< LCD frequency = CLKprescaler/18 */
  124. LCD_Divider_19 = (uint8_t)0x03, /*!< LCD frequency = CLKprescaler/19 */
  125. LCD_Divider_20 = (uint8_t)0x04, /*!< LCD frequency = CLKprescaler/20 */
  126. LCD_Divider_21 = (uint8_t)0x05, /*!< LCD frequency = CLKprescaler/21 */
  127. LCD_Divider_22 = (uint8_t)0x06, /*!< LCD frequency = CLKprescaler/22 */
  128. LCD_Divider_23 = (uint8_t)0x07, /*!< LCD frequency = CLKprescaler/23 */
  129. LCD_Divider_24 = (uint8_t)0x08, /*!< LCD frequency = CLKprescaler/24 */
  130. LCD_Divider_25 = (uint8_t)0x09, /*!< LCD frequency = CLKprescaler/25 */
  131. LCD_Divider_26 = (uint8_t)0x0A, /*!< LCD frequency = CLKprescaler/26 */
  132. LCD_Divider_27 = (uint8_t)0x0B, /*!< LCD frequency = CLKprescaler/27 */
  133. LCD_Divider_28 = (uint8_t)0x0C, /*!< LCD frequency = CLKprescaler/28 */
  134. LCD_Divider_29 = (uint8_t)0x0D, /*!< LCD frequency = CLKprescaler/29 */
  135. LCD_Divider_30 = (uint8_t)0x0E, /*!< LCD frequency = CLKprescaler/30 */
  136. LCD_Divider_31 = (uint8_t)0x0F /*!< LCD frequency = CLKprescaler/31 */
  137. } LCD_Divider_TypeDef;
  138. #define IS_LCD_CLOCK_DIVIDER(DIVIDER) (((DIVIDER) == LCD_Divider_16) || \
  139. ((DIVIDER) == LCD_Divider_17) || \
  140. ((DIVIDER) == LCD_Divider_18) || \
  141. ((DIVIDER) == LCD_Divider_19) || \
  142. ((DIVIDER) == LCD_Divider_20) || \
  143. ((DIVIDER) == LCD_Divider_21) || \
  144. ((DIVIDER) == LCD_Divider_22) || \
  145. ((DIVIDER) == LCD_Divider_23) || \
  146. ((DIVIDER) == LCD_Divider_24) || \
  147. ((DIVIDER) == LCD_Divider_25) || \
  148. ((DIVIDER) == LCD_Divider_26) || \
  149. ((DIVIDER) == LCD_Divider_27) || \
  150. ((DIVIDER) == LCD_Divider_28) || \
  151. ((DIVIDER) == LCD_Divider_29) || \
  152. ((DIVIDER) == LCD_Divider_30) || \
  153. ((DIVIDER) == LCD_Divider_31))
  154. /**
  155. * @}
  156. */
  157. /** @defgroup LCD_Contrast
  158. * @brief element values correspond to the bits position
  159. * @{
  160. */
  161. typedef enum {
  162. LCD_Contrast_Level_0 = (uint8_t)0x00, /*!< Medium Density / High Density Maximum Voltage = 2.60V / 2.60V */
  163. LCD_Contrast_Level_1 = (uint8_t)0x02, /*!< Medium Density / High Density Maximum Voltage = 2.70V / 2.73V */
  164. LCD_Contrast_Level_2 = (uint8_t)0x04, /*!< Medium Density / High Density Maximum Voltage = 2.80V / 2.86V */
  165. LCD_Contrast_Level_3 = (uint8_t)0x06, /*!< Medium Density / High Density Maximum Voltage = 2.90V / 2.99V */
  166. LCD_Contrast_Level_4 = (uint8_t)0x08, /*!< Medium Density / High Density Maximum Voltage = 3.00V / 3.12V */
  167. LCD_Contrast_Level_5 = (uint8_t)0x0A, /*!< Medium Density / High Density Maximum Voltage = 3.10V / 3.25V */
  168. LCD_Contrast_Level_6 = (uint8_t)0x0C, /*!< Medium Density / High Density Maximum Voltage = 3.20V / 3.38V */
  169. LCD_Contrast_Level_7 = (uint8_t)0x0E /*!< Medium Density / High Density Maximum Voltage = 3.30V / 3.51V */
  170. } LCD_Contrast_TypeDef;
  171. #define IS_LCD_CONTRAST(CONTRAST) (((CONTRAST) == LCD_Contrast_Level_0) || \
  172. ((CONTRAST) == LCD_Contrast_Level_1) || \
  173. ((CONTRAST) == LCD_Contrast_Level_2) || \
  174. ((CONTRAST) == LCD_Contrast_Level_3) || \
  175. ((CONTRAST) == LCD_Contrast_Level_4) || \
  176. ((CONTRAST) == LCD_Contrast_Level_5) || \
  177. ((CONTRAST) == LCD_Contrast_Level_6) || \
  178. ((CONTRAST) == LCD_Contrast_Level_7))
  179. /**
  180. * @}
  181. */
  182. /** @defgroup LCD_Voltage_Source
  183. * @brief element values correspond to the bits position
  184. * @{
  185. */
  186. typedef enum {
  187. LCD_VoltageSource_Internal = (uint8_t)0x00, /*!< Internal voltage source for the LCD */
  188. LCD_VoltageSource_External = (uint8_t)0x01 /*!< External voltage source for the LCD */
  189. } LCD_VoltageSource_TypeDef;
  190. #define IS_LCD_VOLTAGE_SOURCE(SOURCE) (((SOURCE) == LCD_VoltageSource_Internal) || \
  191. ((SOURCE) == LCD_VoltageSource_External))
  192. /**
  193. * @}
  194. */
  195. /** @defgroup LCD_Pulse_On_Duration
  196. * @brief element values correspond to the bits position
  197. * @{
  198. */
  199. typedef enum {
  200. LCD_PulseOnDuration_0 = (uint8_t)0x00, /*!< Pulse on duration = 0/CLKprescaler */
  201. LCD_PulseOnDuration_1 = (uint8_t)0x20, /*!< Pulse on duration = 1/CLKprescaler */
  202. LCD_PulseOnDuration_2 = (uint8_t)0x40, /*!< Pulse on duration = 2/CLKprescaler */
  203. LCD_PulseOnDuration_3 = (uint8_t)0x60, /*!< Pulse on duration = 3/CLKprescaler */
  204. LCD_PulseOnDuration_4 = (uint8_t)0x80, /*!< Pulse on duration = 4/CLKprescaler */
  205. LCD_PulseOnDuration_5 = (uint8_t)0xA0, /*!< Pulse on duration = 5/CLKprescaler */
  206. LCD_PulseOnDuration_6 = (uint8_t)0xC0, /*!< Pulse on duration = 6/CLKprescaler */
  207. LCD_PulseOnDuration_7 = (uint8_t)0xE0 /*!< Pulse on duration = 7/CLKprescaler */
  208. } LCD_PulseOnDuration_TypeDef;
  209. #define IS_LCD_PULSE_DURATION(DURATION) (((DURATION) == LCD_PulseOnDuration_0) || \
  210. ((DURATION) == LCD_PulseOnDuration_1) || \
  211. ((DURATION) == LCD_PulseOnDuration_2) || \
  212. ((DURATION) == LCD_PulseOnDuration_3) || \
  213. ((DURATION) == LCD_PulseOnDuration_4) || \
  214. ((DURATION) == LCD_PulseOnDuration_5) || \
  215. ((DURATION) == LCD_PulseOnDuration_6) || \
  216. ((DURATION) == LCD_PulseOnDuration_7))
  217. /**
  218. * @}
  219. */
  220. /** @defgroup LCD_Dead_Time
  221. * @brief element values correspond to the bits position
  222. * @{
  223. */
  224. typedef enum {
  225. LCD_DeadTime_0 = (uint8_t)0x00, /*!< No dead Time */
  226. LCD_DeadTime_1 = (uint8_t)0x01, /*!< One Phase between different couple of Frame */
  227. LCD_DeadTime_2 = (uint8_t)0x02, /*!< Two Phase between different couple of Frame */
  228. LCD_DeadTime_3 = (uint8_t)0x03, /*!< Tree Phase between different couple of Frame */
  229. LCD_DeadTime_4 = (uint8_t)0x04, /*!< Four Phase between different couple of Frame */
  230. LCD_DeadTime_5 = (uint8_t)0x05, /*!< Five Phase between different couple of Frame */
  231. LCD_DeadTime_6 = (uint8_t)0x06, /*!< Six Phase between different couple of Frame */
  232. LCD_DeadTime_7 = (uint8_t)0x07 /*!< Seven Phase between different couple of Frame */
  233. } LCD_DeadTime_TypeDef;
  234. #define IS_LCD_DEAD_TIME(TIME) (((TIME) == LCD_DeadTime_0) || \
  235. ((TIME) == LCD_DeadTime_1) || \
  236. ((TIME) == LCD_DeadTime_2) || \
  237. ((TIME) == LCD_DeadTime_3) || \
  238. ((TIME) == LCD_DeadTime_4) || \
  239. ((TIME) == LCD_DeadTime_5) || \
  240. ((TIME) == LCD_DeadTime_6) || \
  241. ((TIME) == LCD_DeadTime_7))
  242. /**
  243. * @}
  244. */
  245. /** @defgroup LCD_BlinkMode
  246. * @{
  247. */
  248. typedef enum {
  249. LCD_BlinkMode_Off = (uint8_t)0x00, /*!< Blink inactive */
  250. LCD_BlinkMode_SEG0_COM0 = (uint8_t)0x40, /*!< SEG0 on COM0 blink */
  251. LCD_BlinkMode_SEG0_AllCOM = (uint8_t)0x80, /*!< SEG0 on All COM blink */
  252. LCD_BlinkMode_AllSEG_AllCOM = (uint8_t)0xC0 /*!< All SEG on All COm Blink */
  253. } LCD_BlinkMode_TypeDef;
  254. #define IS_LCD_BLINK_MODE(BLINK) (((BLINK) == LCD_BlinkMode_Off) || \
  255. ((BLINK) == LCD_BlinkMode_SEG0_COM0) || \
  256. ((BLINK) == LCD_BlinkMode_SEG0_AllCOM) || \
  257. ((BLINK) == LCD_BlinkMode_AllSEG_AllCOM))
  258. /**
  259. * @}
  260. */
  261. /** @defgroup LCD_Blink_Frequency
  262. * @brief element values correspond to the bits position
  263. * @{
  264. */
  265. typedef enum {
  266. LCD_BlinkFrequency_Div8 = (uint8_t)0x00, /*!< The Blink frequency = fLcd/8 */
  267. LCD_BlinkFrequency_Div16 = (uint8_t)0x08, /*!< The Blink frequency = fLcd/16 */
  268. LCD_BlinkFrequency_Div32 = (uint8_t)0x10, /*!< The Blink frequency = fLcd/32 */
  269. LCD_BlinkFrequency_Div64 = (uint8_t)0x18, /*!< The Blink frequency = fLcd/64 */
  270. LCD_BlinkFrequency_Div128 = (uint8_t)0x20, /*!< The Blink frequency = fLcd/128 */
  271. LCD_BlinkFrequency_Div256 = (uint8_t)0x28, /*!< The Blink frequency = fLcd/256 */
  272. LCD_BlinkFrequency_Div512 = (uint8_t)0x30, /*!< The Blink frequency = fLcd/512 */
  273. LCD_BlinkFrequency_Div1024 = (uint8_t)0x38 /*!< The Blink frequency = fLcd/1024 */
  274. } LCD_BlinkFrequency_TypeDef;
  275. #define IS_LCD_BLINK_FREQUENCY(BLINKF) (((BLINKF) == LCD_BlinkFrequency_Div8) || \
  276. ((BLINKF) == LCD_BlinkFrequency_Div16) || \
  277. ((BLINKF) == LCD_BlinkFrequency_Div32) || \
  278. ((BLINKF) == LCD_BlinkFrequency_Div64) || \
  279. ((BLINKF) == LCD_BlinkFrequency_Div128) || \
  280. ((BLINKF) == LCD_BlinkFrequency_Div256) || \
  281. ((BLINKF) == LCD_BlinkFrequency_Div512) || \
  282. ((BLINKF) == LCD_BlinkFrequency_Div1024))
  283. /**
  284. * @}
  285. */
  286. /** @defgroup LCD_RAMRegister
  287. * @{
  288. */
  289. typedef enum {
  290. LCD_RAMRegister_0 = (uint8_t)0x00, /*!< RAM Register 0 */
  291. LCD_RAMRegister_1 = (uint8_t)0x01, /*!< RAM Register 1 */
  292. LCD_RAMRegister_2 = (uint8_t)0x02, /*!< RAM Register 2 */
  293. LCD_RAMRegister_3 = (uint8_t)0x03, /*!< RAM Register 3 */
  294. LCD_RAMRegister_4 = (uint8_t)0x04, /*!< RAM Register 4 */
  295. LCD_RAMRegister_5 = (uint8_t)0x05, /*!< RAM Register 5 */
  296. LCD_RAMRegister_6 = (uint8_t)0x06, /*!< RAM Register 6 */
  297. LCD_RAMRegister_7 = (uint8_t)0x07, /*!< RAM Register 7 */
  298. LCD_RAMRegister_8 = (uint8_t)0x08, /*!< RAM Register 8 */
  299. LCD_RAMRegister_9 = (uint8_t)0x09, /*!< RAM Register 9 */
  300. LCD_RAMRegister_10 = (uint8_t)0x0A, /*!< RAM Register 10 */
  301. LCD_RAMRegister_11 = (uint8_t)0x0B, /*!< RAM Register 11 */
  302. LCD_RAMRegister_12 = (uint8_t)0x0C, /*!< RAM Register 12 */
  303. LCD_RAMRegister_13 = (uint8_t)0x0D, /*!< RAM Register 13 */
  304. LCD_RAMRegister_14 = (uint8_t)0x0E, /*!< RAM Register 14 */
  305. LCD_RAMRegister_15 = (uint8_t)0x0F, /*!< RAM Register 15 */
  306. LCD_RAMRegister_16 = (uint8_t)0x10, /*!< RAM Register 16 */
  307. LCD_RAMRegister_17 = (uint8_t)0x11, /*!< RAM Register 17 */
  308. LCD_RAMRegister_18 = (uint8_t)0x12, /*!< RAM Register 18 */
  309. LCD_RAMRegister_19 = (uint8_t)0x13, /*!< RAM Register 19 */
  310. LCD_RAMRegister_20 = (uint8_t)0x14, /*!< RAM Register 20 */
  311. LCD_RAMRegister_21 = (uint8_t)0x15 /*!< RAM Register 21 */
  312. } LCD_RAMRegister_TypeDef;
  313. #define IS_LCD_RAM_REGISTER(REGISTER) (((REGISTER) == LCD_RAMRegister_0) || \
  314. ((REGISTER) == LCD_RAMRegister_1) || \
  315. ((REGISTER) == LCD_RAMRegister_2) || \
  316. ((REGISTER) == LCD_RAMRegister_3) || \
  317. ((REGISTER) == LCD_RAMRegister_4) || \
  318. ((REGISTER) == LCD_RAMRegister_5) || \
  319. ((REGISTER) == LCD_RAMRegister_6) || \
  320. ((REGISTER) == LCD_RAMRegister_7) || \
  321. ((REGISTER) == LCD_RAMRegister_8) || \
  322. ((REGISTER) == LCD_RAMRegister_9) || \
  323. ((REGISTER) == LCD_RAMRegister_10) || \
  324. ((REGISTER) == LCD_RAMRegister_11) || \
  325. ((REGISTER) == LCD_RAMRegister_12) || \
  326. ((REGISTER) == LCD_RAMRegister_13) || \
  327. ((REGISTER) == LCD_RAMRegister_14) || \
  328. ((REGISTER) == LCD_RAMRegister_15) || \
  329. ((REGISTER) == LCD_RAMRegister_16) || \
  330. ((REGISTER) == LCD_RAMRegister_17) || \
  331. ((REGISTER) == LCD_RAMRegister_18) || \
  332. ((REGISTER) == LCD_RAMRegister_19) || \
  333. ((REGISTER) == LCD_RAMRegister_20) || \
  334. ((REGISTER) == LCD_RAMRegister_21))
  335. /**
  336. * @}
  337. */
  338. /** @defgroup LCD_Port_Mask_Register
  339. * @{
  340. */
  341. typedef enum {
  342. LCD_PortMaskRegister_0 = (uint8_t)0x00, /*!< PortMask Register 0 */
  343. LCD_PortMaskRegister_1 = (uint8_t)0x01, /*!< PortMask Register 1 */
  344. LCD_PortMaskRegister_2 = (uint8_t)0x02, /*!< PortMask Register 2 */
  345. LCD_PortMaskRegister_3 = (uint8_t)0x03, /*!< PortMask Register 3 */
  346. LCD_PortMaskRegister_4 = (uint8_t)0x04, /*!< PortMask Register 4 */
  347. LCD_PortMaskRegister_5 = (uint8_t)0x05 /*!< PortMask Register 5 */
  348. } LCD_PortMaskRegister_TypeDef;
  349. #define IS_LCD_PORT_MASK(MASK) (((MASK) == LCD_PortMaskRegister_0) || \
  350. ((MASK) == LCD_PortMaskRegister_1) || \
  351. ((MASK) == LCD_PortMaskRegister_2) || \
  352. ((MASK) == LCD_PortMaskRegister_3) || \
  353. ((MASK) == LCD_PortMaskRegister_4) || \
  354. ((MASK) == LCD_PortMaskRegister_5))
  355. /**
  356. * @}
  357. */
  358. /** @defgroup LCD_Page_Selection
  359. * @{
  360. */
  361. typedef enum {
  362. LCD_PageSelection_FirstPage = (uint8_t)0x00, /*!< The LCD RAM is selected as the first page */
  363. LCD_PageSelection_SecondPage = (uint8_t)0x04 /*!< The LCD RAM is selected as the second page */
  364. } LCD_PageSelection_TypeDef;
  365. #define IS_LCD_PAGE_SELECT(PAGE) (((PAGE) == LCD_PageSelection_FirstPage) || \
  366. ((PAGE) == LCD_PageSelection_SecondPage))
  367. /**
  368. * @}
  369. */
  370. /**
  371. * @}
  372. */
  373. /* Private define ------------------------------------------------------------*/
  374. /* LCD Legacy defines */
  375. /** @defgroup LCD_Private_Define
  376. * @ brief LCD Legacy defines
  377. * @{
  378. */
  379. #define LCD_Contrast_2V6 ((uint8_t)LCD_Contrast_Level_0)
  380. #define LCD_Contrast_2V7 ((uint8_t)LCD_Contrast_Level_1)
  381. #define LCD_Contrast_2V8 ((uint8_t)LCD_Contrast_Level_2)
  382. #define LCD_Contrast_2V9 ((uint8_t)LCD_Contrast_Level_3)
  383. #define LCD_Contrast_3V0 ((uint8_t)LCD_Contrast_Level_4)
  384. #define LCD_Contrast_3V1 ((uint8_t)LCD_Contrast_Level_5)
  385. #define LCD_Contrast_3V2 ((uint8_t)LCD_Contrast_Level_6)
  386. #define LCD_Contrast_3V3 ((uint8_t)LCD_Contrast_Level_7)
  387. /**
  388. * @}
  389. */
  390. /* Private macros ------------------------------------------------------------*/
  391. /* Exported functions ------------------------------------------------------- */
  392. /* Function used to set the LCD configuration to the default reset state *****/
  393. void LCD_DeInit(void);
  394. /* Initialization and Configuration functions *********************************/
  395. void LCD_Init(LCD_Prescaler_TypeDef LCD_Prescaler, LCD_Divider_TypeDef LCD_Divider,
  396. LCD_Duty_TypeDef LCD_Duty, LCD_Bias_TypeDef LCD_Bias, LCD_VoltageSource_TypeDef LCD_VoltageSource);
  397. void LCD_PortMaskConfig(LCD_PortMaskRegister_TypeDef LCD_PortMaskRegister, uint8_t LCD_Mask);
  398. void LCD_Cmd(FunctionalState NewState);
  399. void LCD_HighDriveCmd(FunctionalState NewState);
  400. void LCD_PulseOnDurationConfig(LCD_PulseOnDuration_TypeDef LCD_PulseOnDuration);
  401. void LCD_DeadTimeConfig(LCD_DeadTime_TypeDef LCD_DeadTime);
  402. void LCD_BlinkConfig(LCD_BlinkMode_TypeDef LCD_BlinkMode, LCD_BlinkFrequency_TypeDef LCD_BlinkFrequency);
  403. void LCD_ContrastConfig(LCD_Contrast_TypeDef LCD_Contrast);
  404. /* LCD RAM memory write functions *********************************************/
  405. void LCD_WriteRAM(LCD_RAMRegister_TypeDef LCD_RAMRegister, uint8_t LCD_Data);
  406. void LCD_PageSelect(LCD_PageSelection_TypeDef LCD_PageSelection);
  407. /* Interrupts and flags management functions **********************************/
  408. void LCD_ITConfig(FunctionalState NewState);
  409. FlagStatus LCD_GetFlagStatus(void);
  410. void LCD_ClearFlag(void);
  411. ITStatus LCD_GetITStatus(void);
  412. void LCD_ClearITPendingBit(void);
  413. #endif /* __STM8L15x_LCD_H */
  414. /**
  415. * @}
  416. */
  417. /**
  418. * @}
  419. */
  420. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/