em_lcd.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  1. /***************************************************************************//**
  2. * @file
  3. * @brief Liquid Crystal Display (LCD) peripheral API
  4. * @author Energy Micro AS
  5. * @version 3.0.0
  6. *******************************************************************************
  7. * @section License
  8. * <b>(C) Copyright 2012 Energy Micro AS, http://www.energymicro.com</b>
  9. *******************************************************************************
  10. *
  11. * Permission is granted to anyone to use this software for any purpose,
  12. * including commercial applications, and to alter it and redistribute it
  13. * freely, subject to the following restrictions:
  14. *
  15. * 1. The origin of this software must not be misrepresented; you must not
  16. * claim that you wrote the original software.
  17. * 2. Altered source versions must be plainly marked as such, and must not be
  18. * misrepresented as being the original software.
  19. * 3. This notice may not be removed or altered from any source distribution.
  20. *
  21. * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
  22. * obligation to support this Software. Energy Micro AS is providing the
  23. * Software "AS IS", with no express or implied warranties of any kind,
  24. * including, but not limited to, any implied warranties of merchantability
  25. * or fitness for any particular purpose or warranties against infringement
  26. * of any proprietary rights of a third party.
  27. *
  28. * Energy Micro AS will not be liable for any consequential, incidental, or
  29. * special damages, or any other relief, or for any claim by any third party,
  30. * arising from your use of this Software.
  31. *
  32. ******************************************************************************/
  33. #ifndef __EM_LCD_H
  34. #define __EM_LCD_H
  35. #include "em_part.h"
  36. #if defined(LCD_COUNT) && (LCD_COUNT > 0)
  37. #include <stdint.h>
  38. #include <stdbool.h>
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif
  42. /***************************************************************************//**
  43. * @addtogroup EM_Library
  44. * @{
  45. ******************************************************************************/
  46. /***************************************************************************//**
  47. * @addtogroup LCD
  48. * @{
  49. ******************************************************************************/
  50. /*******************************************************************************
  51. ******************************** ENUMS ************************************
  52. ******************************************************************************/
  53. /** MUX setting */
  54. typedef enum
  55. {
  56. /** Static (segments can be multiplexed with LCD_COM[0]) */
  57. lcdMuxStatic = LCD_DISPCTRL_MUX_STATIC,
  58. /** Duplex / 1/2 Duty cycle (segments can be multiplexed with LCD_COM[0:1]) */
  59. lcdMuxDuplex = LCD_DISPCTRL_MUX_DUPLEX,
  60. /** Triplex / 1/3 Duty cycle (segments can be multiplexed with LCD_COM[0:2]) */
  61. lcdMuxTriplex = LCD_DISPCTRL_MUX_TRIPLEX,
  62. /** Quadruplex / 1/4 Duty cycle (segments can be multiplexed with LCD_COM[0:3]) */
  63. lcdMuxQuadruplex = LCD_DISPCTRL_MUX_QUADRUPLEX,
  64. #if defined(_EFM32_TINY_FAMILY) || defined(_EFM32_GIANT_FAMILY)
  65. /** Sextaplex / 1/6 Duty cycle (segments can be multiplexed with LCD_COM[0:5]) */
  66. lcdMuxSextaplex = LCD_DISPCTRL_MUXE_MUXE | LCD_DISPCTRL_MUX_DUPLEX,
  67. /** Octaplex / 1/6 Duty cycle (segments can be multiplexed with LCD_COM[0:5]) */
  68. lcdMuxOctaplex = LCD_DISPCTRL_MUXE_MUXE | LCD_DISPCTRL_MUX_QUADRUPLEX
  69. #endif
  70. } LCD_Mux_TypeDef;
  71. /** Bias setting */
  72. typedef enum
  73. {
  74. /** Static (2 levels) */
  75. lcdBiasStatic = LCD_DISPCTRL_BIAS_STATIC,
  76. /** 1/2 Bias (3 levels) */
  77. lcdBiasOneHalf = LCD_DISPCTRL_BIAS_ONEHALF,
  78. /** 1/3 Bias (4 levels) */
  79. lcdBiasOneThird = LCD_DISPCTRL_BIAS_ONETHIRD,
  80. #if defined(_EFM32_TINY_FAMILY) || defined(_EFM32_GIANT_FAMILY)
  81. /** 1/4 Bias (5 levels) */
  82. lcdBiasOneFourth = LCD_DISPCTRL_BIAS_ONEFOURTH,
  83. #endif
  84. } LCD_Bias_TypeDef;
  85. /** Wave type */
  86. typedef enum
  87. {
  88. /** Low power optimized waveform output */
  89. lcdWaveLowPower = LCD_DISPCTRL_WAVE_LOWPOWER,
  90. /** Regular waveform output */
  91. lcdWaveNormal = LCD_DISPCTRL_WAVE_NORMAL
  92. } LCD_Wave_TypeDef;
  93. /** VLCD Voltage Source */
  94. typedef enum
  95. {
  96. /** VLCD Powered by VDD */
  97. lcdVLCDSelVDD = LCD_DISPCTRL_VLCDSEL_VDD,
  98. /** VLCD Powered by external VDD / Voltage Boost */
  99. lcdVLCDSelVExtBoost = LCD_DISPCTRL_VLCDSEL_VEXTBOOST
  100. } LCD_VLCDSel_TypeDef;
  101. /** Contrast Configuration */
  102. typedef enum
  103. {
  104. /** Contrast is adjusted relative to VDD (VLCD) */
  105. lcdConConfVLCD = LCD_DISPCTRL_CONCONF_VLCD,
  106. /** Contrast is adjusted relative to Ground */
  107. lcdConConfGND = LCD_DISPCTRL_CONCONF_GND
  108. } LCD_ConConf_TypeDef;
  109. /** Voltage Boost Level - Datasheets document setting for each part number */
  110. typedef enum
  111. {
  112. lcdVBoostLevel0 = LCD_DISPCTRL_VBLEV_LEVEL0, /**< Voltage boost LEVEL0 */
  113. lcdVBoostLevel1 = LCD_DISPCTRL_VBLEV_LEVEL1, /**< Voltage boost LEVEL1 */
  114. lcdVBoostLevel2 = LCD_DISPCTRL_VBLEV_LEVEL2, /**< Voltage boost LEVEL2 */
  115. lcdVBoostLevel3 = LCD_DISPCTRL_VBLEV_LEVEL3, /**< Voltage boost LEVEL3 */
  116. lcdVBoostLevel4 = LCD_DISPCTRL_VBLEV_LEVEL4, /**< Voltage boost LEVEL4 */
  117. lcdVBoostLevel5 = LCD_DISPCTRL_VBLEV_LEVEL5, /**< Voltage boost LEVEL5 */
  118. lcdVBoostLevel6 = LCD_DISPCTRL_VBLEV_LEVEL6, /**< Voltage boost LEVEL6 */
  119. lcdVBoostLevel7 = LCD_DISPCTRL_VBLEV_LEVEL7 /**< Voltage boost LEVEL7 */
  120. } LCD_VBoostLevel_TypeDef;
  121. /** Frame Counter Clock Prescaler, FC-CLK = FrameRate (Hz) / this factor */
  122. typedef enum
  123. {
  124. /** Prescale Div 1 */
  125. lcdFCPrescDiv1 = LCD_BACTRL_FCPRESC_DIV1,
  126. /** Prescale Div 2 */
  127. lcdFCPrescDiv2 = LCD_BACTRL_FCPRESC_DIV2,
  128. /** Prescale Div 4 */
  129. lcdFCPrescDiv4 = LCD_BACTRL_FCPRESC_DIV4,
  130. /** Prescale Div 8 */
  131. lcdFCPrescDiv8 = LCD_BACTRL_FCPRESC_DIV8
  132. } LCD_FCPreScale_TypeDef;
  133. /** Segment selection */
  134. typedef enum
  135. {
  136. /** Select segment lines 0 to 3 */
  137. lcdSegment0_3 = (1 << 0),
  138. /** Select segment lines 4 to 7 */
  139. lcdSegment4_7 = (1 << 1),
  140. /** Select segment lines 8 to 11 */
  141. lcdSegment8_11 = (1 << 2),
  142. /** Select segment lines 12 to 15 */
  143. lcdSegment12_15 = (1 << 3),
  144. /** Select segment lines 16 to 19 */
  145. lcdSegment16_19 = (1 << 4),
  146. /** Select segment lines 20 to 23 */
  147. lcdSegment20_23 = (1 << 5),
  148. #if defined(_EFM32_TINY_FAMILY)
  149. /** Select all segment lines */
  150. lcdSegmentAll = (0x003f)
  151. #endif
  152. #if defined(_EFM32_GECKO_FAMILY) || defined(_EFM32_GIANT_FAMILY)
  153. /** Select segment lines 24 to 27 */
  154. lcdSegment24_27 = (1 << 6),
  155. /** Select segment lines 28 to 31 */
  156. lcdSegment28_31 = (1 << 7),
  157. /** Select segment lines 32 to 35 */
  158. lcdSegment32_35 = (1 << 8),
  159. /** Select segment lines 36 to 39 */
  160. lcdSegment36_39 = (1 << 9),
  161. /** Select all segment lines */
  162. lcdSegmentAll = (0x03ff)
  163. #endif
  164. } LCD_SegmentRange_TypeDef;
  165. /** Update Data Control */
  166. typedef enum
  167. {
  168. /** Regular update, data transfer done immediately */
  169. lcdUpdateCtrlRegular = LCD_CTRL_UDCTRL_REGULAR,
  170. /** Data transfer done at Frame Counter event */
  171. lcdUpdateCtrlFCEvent = LCD_CTRL_UDCTRL_FCEVENT,
  172. /** Data transfer done at Frame Start */
  173. lcdUpdateCtrlFrameStart = LCD_CTRL_UDCTRL_FRAMESTART
  174. } LCD_UpdateCtrl_TypeDef;
  175. /** Animation Shift operation; none, left or right */
  176. typedef enum
  177. {
  178. /** No shift */
  179. lcdAnimShiftNone = _LCD_BACTRL_AREGASC_NOSHIFT,
  180. /** Shift segment bits left */
  181. lcdAnimShiftLeft = _LCD_BACTRL_AREGASC_SHIFTLEFT,
  182. /** Shift segment bits right */
  183. lcdAnimShiftRight = _LCD_BACTRL_AREGASC_SHIFTRIGHT
  184. } LCD_AnimShift_TypeDef;
  185. /** Animation Logic Control, how AReg and BReg should be combined */
  186. typedef enum
  187. {
  188. /** Use bitwise logic AND to mix animation register A (AREGA) and B (AREGB) */
  189. lcdAnimLogicAnd = LCD_BACTRL_ALOGSEL_AND,
  190. /** Use bitwise logic OR to mix animation register A (AREGA) and B (AREGB) */
  191. lcdAnimLogicOr = LCD_BACTRL_ALOGSEL_OR
  192. } LCD_AnimLogic_TypeDef;
  193. /*******************************************************************************
  194. ******************************* STRUCTS ***********************************
  195. ******************************************************************************/
  196. /** LCD Animation Configuration */
  197. typedef struct
  198. {
  199. /** Enable Animation at end of initialization */
  200. bool enable;
  201. /** Initial Animation Register A Value */
  202. uint32_t AReg;
  203. /** Shift operation of Animation Register A */
  204. LCD_AnimShift_TypeDef AShift;
  205. /** Initial Animation Register B Value */
  206. uint32_t BReg;
  207. /** Shift operation of Animation Register B */
  208. LCD_AnimShift_TypeDef BShift;
  209. /** A and B Logical Operation to use for mixing and outputting resulting segments */
  210. LCD_AnimLogic_TypeDef animLogic;
  211. #if defined(_EFM32_GIANT_FAMILY)
  212. /** Number of first segment to animate. Options are 0 or 8 for Giant/Leopard. End is startSeg+7 */
  213. int startSeg;
  214. #endif
  215. } LCD_AnimInit_TypeDef;
  216. /** LCD Frame Control Initialization */
  217. typedef struct
  218. {
  219. /** Enable at end */
  220. bool enable;
  221. /** Frame Counter top value */
  222. uint32_t top;
  223. /** Frame Counter clock prescaler */
  224. LCD_FCPreScale_TypeDef prescale;
  225. } LCD_FrameCountInit_TypeDef;
  226. /** LCD Controller Initialization structure */
  227. typedef struct
  228. {
  229. /** Enable controller at end of initialization */
  230. bool enable;
  231. /** Mux configuration */
  232. LCD_Mux_TypeDef mux;
  233. /** Bias configuration */
  234. LCD_Bias_TypeDef bias;
  235. /** Wave configuration */
  236. LCD_Wave_TypeDef wave;
  237. /** VLCD Select */
  238. LCD_VLCDSel_TypeDef vlcd;
  239. /** Contrast Configuration */
  240. LCD_ConConf_TypeDef contrast;
  241. } LCD_Init_TypeDef;
  242. /** Default config for LCD init structure, enables 160 segments */
  243. #define LCD_INIT_DEFAULT \
  244. { true, \
  245. lcdMuxQuadruplex, \
  246. lcdBiasOneThird, \
  247. lcdWaveLowPower, \
  248. lcdVLCDSelVDD, \
  249. lcdConConfVLCD \
  250. }
  251. /*******************************************************************************
  252. ***************************** PROTOTYPES **********************************
  253. ******************************************************************************/
  254. void LCD_Init(const LCD_Init_TypeDef *lcdInit);
  255. void LCD_VLCDSelect(LCD_VLCDSel_TypeDef vlcd);
  256. void LCD_UpdateCtrl(LCD_UpdateCtrl_TypeDef ud);
  257. void LCD_FrameCountInit(const LCD_FrameCountInit_TypeDef *fcInit);
  258. void LCD_AnimInit(const LCD_AnimInit_TypeDef *animInit);
  259. void LCD_SegmentRangeEnable(LCD_SegmentRange_TypeDef segment, bool enable);
  260. void LCD_SegmentSet(int com, int bit, bool enable);
  261. void LCD_SegmentSetLow(int com, uint32_t mask, uint32_t bits);
  262. #if defined(_EFM32_GECKO_FAMILY) || defined(_EFM32_GIANT_FAMILY)
  263. void LCD_SegmentSetHigh(int com, uint32_t mask, uint32_t bits);
  264. #endif
  265. void LCD_ContrastSet(int level);
  266. void LCD_VBoostSet(LCD_VBoostLevel_TypeDef vboost);
  267. #if defined(_EFM32_TINY_FAMILY) || defined(_EFM32_GIANT_FAMILY)
  268. void LCD_BiasSegmentSet(int segment, int biasLevel);
  269. void LCD_BiasComSet(int com, int biasLevel);
  270. #endif
  271. __STATIC_INLINE void LCD_Enable(bool enable);
  272. __STATIC_INLINE void LCD_AnimEnable(bool enable);
  273. __STATIC_INLINE void LCD_BlinkEnable(bool enable);
  274. __STATIC_INLINE void LCD_BlankEnable(bool enable);
  275. __STATIC_INLINE void LCD_FrameCountEnable(bool enable);
  276. __STATIC_INLINE int LCD_AnimState(void);
  277. __STATIC_INLINE int LCD_BlinkState(void);
  278. __STATIC_INLINE void LCD_FreezeEnable(bool enable);
  279. __STATIC_INLINE uint32_t LCD_SyncBusyGet(void);
  280. __STATIC_INLINE void LCD_SyncBusyDelay(uint32_t flags);
  281. __STATIC_INLINE uint32_t LCD_IntGet(void);
  282. __STATIC_INLINE uint32_t LCD_IntGetEnabled(void);
  283. __STATIC_INLINE void LCD_IntSet(uint32_t flags);
  284. __STATIC_INLINE void LCD_IntEnable(uint32_t flags);
  285. __STATIC_INLINE void LCD_IntDisable(uint32_t flags);
  286. __STATIC_INLINE void LCD_IntClear(uint32_t flags);
  287. #if defined(_EFM32_TINY_FAMILY) || defined(_EFM32_GIANT_FAMILY)
  288. __STATIC_INLINE void LCD_DSCEnable(bool enable);
  289. #endif
  290. /***************************************************************************//**
  291. * @brief
  292. * Enable or disable LCD controller
  293. *
  294. * @param[in] enable
  295. * If true, enables LCD controller with current configuration, if false
  296. * disables LCD controller. CMU clock for LCD must be enabled for correct
  297. * operation.
  298. ******************************************************************************/
  299. __STATIC_INLINE void LCD_Enable(bool enable)
  300. {
  301. if (enable)
  302. {
  303. LCD->CTRL |= LCD_CTRL_EN;
  304. }
  305. else
  306. {
  307. LCD->CTRL &= ~(LCD_CTRL_EN);
  308. }
  309. }
  310. /***************************************************************************//**
  311. * @brief
  312. * Enables or disables LCD Animation feature
  313. *
  314. * @param[in] enable
  315. * Boolean true enables animation, false disables animation
  316. ******************************************************************************/
  317. __STATIC_INLINE void LCD_AnimEnable(bool enable)
  318. {
  319. if (enable)
  320. {
  321. LCD->BACTRL |= LCD_BACTRL_AEN;
  322. }
  323. else
  324. {
  325. LCD->BACTRL &= ~(LCD_BACTRL_AEN);
  326. }
  327. }
  328. /***************************************************************************//**
  329. * @brief
  330. * Enables or disables LCD blink
  331. *
  332. * @param[in] enable
  333. * Boolean true enables blink, false disables blink
  334. ******************************************************************************/
  335. __STATIC_INLINE void LCD_BlinkEnable(bool enable)
  336. {
  337. if (enable)
  338. {
  339. LCD->BACTRL |= LCD_BACTRL_BLINKEN;
  340. }
  341. else
  342. {
  343. LCD->BACTRL &= ~(LCD_BACTRL_BLINKEN);
  344. }
  345. }
  346. /***************************************************************************//**
  347. * @brief
  348. * Disables all segments, while keeping segment state
  349. *
  350. * @param[in] enable
  351. * Boolean true clears all segments, boolean false restores all segment lines
  352. ******************************************************************************/
  353. __STATIC_INLINE void LCD_BlankEnable(bool enable)
  354. {
  355. if (enable)
  356. {
  357. LCD->BACTRL |= LCD_BACTRL_BLANK;
  358. }
  359. else
  360. {
  361. LCD->BACTRL &= ~(LCD_BACTRL_BLANK);
  362. }
  363. }
  364. /***************************************************************************//**
  365. * @brief
  366. * Enables or disables LCD Frame Control
  367. *
  368. * @param[in] enable
  369. * Boolean true enables frame counter, false disables frame counter
  370. ******************************************************************************/
  371. __STATIC_INLINE void LCD_FrameCountEnable(bool enable)
  372. {
  373. if (enable)
  374. {
  375. LCD->BACTRL |= LCD_BACTRL_FCEN;
  376. }
  377. else
  378. {
  379. LCD->BACTRL &= ~(LCD_BACTRL_FCEN);
  380. }
  381. }
  382. /***************************************************************************//**
  383. * @brief
  384. * Returns current animation state
  385. *
  386. * @return
  387. * Animation state, in range 0-15
  388. ******************************************************************************/
  389. __STATIC_INLINE int LCD_AnimState(void)
  390. {
  391. return (int)(LCD->STATUS & _LCD_STATUS_ASTATE_MASK) >> _LCD_STATUS_ASTATE_SHIFT;
  392. }
  393. /***************************************************************************//**
  394. * @brief
  395. * Returns current blink state
  396. *
  397. * @return
  398. * Return value is 1 if segments are enabled, 0 if disabled
  399. ******************************************************************************/
  400. __STATIC_INLINE int LCD_BlinkState(void)
  401. {
  402. return (int)(LCD->STATUS & _LCD_STATUS_BLINK_MASK) >> _LCD_STATUS_BLINK_SHIFT;
  403. }
  404. /***************************************************************************//**
  405. * @brief
  406. * When set, LCD registers will not be updated until cleared,
  407. *
  408. * @param[in] enable
  409. * When enable is true, update is stopped, when false all registers are
  410. * updated
  411. ******************************************************************************/
  412. __STATIC_INLINE void LCD_FreezeEnable(bool enable)
  413. {
  414. if (enable)
  415. {
  416. LCD->FREEZE = LCD_FREEZE_REGFREEZE_FREEZE;
  417. }
  418. else
  419. {
  420. LCD->FREEZE = LCD_FREEZE_REGFREEZE_UPDATE;
  421. }
  422. }
  423. /***************************************************************************//**
  424. * @brief
  425. * Returns SYNCBUSY bits, indicating which registers have pending updates
  426. *
  427. * @return
  428. * Bit fields for LCD registers which have pending updates
  429. ******************************************************************************/
  430. __STATIC_INLINE uint32_t LCD_SyncBusyGet(void)
  431. {
  432. return(LCD->SYNCBUSY);
  433. }
  434. /***************************************************************************//**
  435. * @brief
  436. * Polls LCD SYNCBUSY flags, until flag has been cleared
  437. *
  438. * @param[in] flags
  439. * Bit fields for LCD registers that shall be updated before we continue
  440. ******************************************************************************/
  441. __STATIC_INLINE void LCD_SyncBusyDelay(uint32_t flags)
  442. {
  443. while (LCD->SYNCBUSY & flags)
  444. ;
  445. }
  446. /***************************************************************************//**
  447. * @brief
  448. * Get pending LCD interrupt flags
  449. *
  450. * @return
  451. * Pending LCD interrupt sources. Returns a set of interrupt flags OR-ed
  452. * together for multiple interrupt sources in the LCD module (LCD_IFS_nnn).
  453. ******************************************************************************/
  454. __STATIC_INLINE uint32_t LCD_IntGet(void)
  455. {
  456. return(LCD->IF);
  457. }
  458. /***************************************************************************//**
  459. * @brief
  460. * Get enabled and pending LCD interrupt flags.
  461. *
  462. * @details
  463. * Useful for handling more interrupt sources in the same interrupt handler.
  464. *
  465. * @note
  466. * The event bits are not cleared by the use of this function.
  467. *
  468. * @return
  469. * Pending and enabled LCD interrupt sources.
  470. * The return value is the bitwise AND combination of
  471. * - the OR combination of enabled interrupt sources in LCD_IEN_nnn
  472. * register (LCD_IEN_nnn) and
  473. * - the bitwise OR combination of valid interrupt flags of the LCD module
  474. * (LCD_IF_nnn).
  475. ******************************************************************************/
  476. __STATIC_INLINE uint32_t LCD_IntGetEnabled(void)
  477. {
  478. uint32_t tmp = 0U;
  479. /* Store LCD->IEN in temporary variable in order to define explicit order
  480. * of volatile accesses. */
  481. tmp = LCD->IEN;
  482. /* Bitwise AND of pending and enabled interrupts */
  483. return LCD->IF & tmp;
  484. }
  485. /***************************************************************************//**
  486. * @brief
  487. * Set one or more pending LCD interrupts from SW.
  488. *
  489. * @param[in] flags
  490. * LCD interrupt sources to set to pending. Use a set of interrupt flags
  491. * OR-ed together to set multiple interrupt sources for the LCD module
  492. * (LCD_IFS_nnn).
  493. ******************************************************************************/
  494. __STATIC_INLINE void LCD_IntSet(uint32_t flags)
  495. {
  496. LCD->IFS = flags;
  497. }
  498. /***************************************************************************//**
  499. * @brief
  500. * Enable LCD interrupts
  501. *
  502. * @param[in] flags
  503. * LCD interrupt sources to enable. Use a set of interrupt flags OR-ed
  504. * together to set multiple interrupt sources for the LCD module
  505. * (LCD_IFS_nnn).
  506. ******************************************************************************/
  507. __STATIC_INLINE void LCD_IntEnable(uint32_t flags)
  508. {
  509. LCD->IEN |= flags;
  510. }
  511. /***************************************************************************//**
  512. * @brief
  513. * Disable LCD interrupts
  514. *
  515. * @param[in] flags
  516. * LCD interrupt sources to disable. Use a set of interrupt flags OR-ed
  517. * together to disable multiple interrupt sources for the LCD module
  518. * (LCD_IFS_nnn).
  519. ******************************************************************************/
  520. __STATIC_INLINE void LCD_IntDisable(uint32_t flags)
  521. {
  522. LCD->IEN &= ~(flags);
  523. }
  524. /***************************************************************************//**
  525. * @brief
  526. * Clear one or more interrupt flags
  527. *
  528. * @param[in] flags
  529. * LCD interrupt sources to clear. Use a set of interrupt flags OR-ed
  530. * together to clear multiple interrupt sources for the LCD module
  531. * (LCD_IFS_nnn).
  532. ******************************************************************************/
  533. __STATIC_INLINE void LCD_IntClear(uint32_t flags)
  534. {
  535. LCD->IFC = flags;
  536. }
  537. #if defined(_EFM32_TINY_FAMILY) || defined(_EFM32_GIANT_FAMILY)
  538. /***************************************************************************//**
  539. * @brief
  540. * Enable or disable LCD Direct Segment Control
  541. *
  542. * @param[in] enable
  543. * If true, enables LCD controller Direct Segment Control
  544. * Segment and COM line bias levels needs to be set explicitly with the
  545. * LCD_BiasSegmentSet() and LCD_BiasComSet() function calls.
  546. ******************************************************************************/
  547. __STATIC_INLINE void LCD_DSCEnable(bool enable)
  548. {
  549. if (enable)
  550. {
  551. LCD->CTRL |= LCD_CTRL_DSC;
  552. }
  553. else
  554. {
  555. LCD->CTRL &= ~(LCD_CTRL_DSC);
  556. }
  557. }
  558. #endif
  559. /** @} (end addtogroup LCD) */
  560. /** @} (end addtogroup EM_Library) */
  561. #ifdef __cplusplus
  562. }
  563. #endif
  564. #endif /* defined(LCD_COUNT) && (LCD_COUNT > 0) */
  565. #endif /* __EM_LCD_H */