efm32_lcd.h 20 KB

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