EVE 1.0
lcd-pcf85162.h
Go to the documentation of this file.
1 #ifndef DRIVER_LCD_DRIVER_PCF85162_H
2 #define DRIVER_LCD_DRIVER_PCF85162_H
3 /**********************************************************************/
4 /*
5  * Copyright (c) 2014, Jetro AS
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without modification,
9  * are permitted provided that the following conditions are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright notice,
12  * this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright notice,
14  * this list of conditions and the following disclaimer in the documentation
15  * and/or other materials provided with the distribution.
16  * 3. The name of the author may not be used to endorse or promote products
17  * derived from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONRIBUTORS ``AS IS'' AND ANY EXPRESS
20  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
22  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
24  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
27  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
28  * OF SUCH DAMAGE.
29  *
30  * This file is part of the EVE platform.
31  */
32 
33 /**
34  * \file
35  * @brief Driver for I2C-based LCD driver type NXP PCF85162.
36  *
37  * @author KLO, Jetro AS
38  */ /******************************************************************/
39 
40 #include <dev/i2c-master.h>
41 
42 /**
43  * \defgroup pcf85162 NXP PCF85162 LCD driver
44  * \ingroup extdrv
45  * \{
46  *
47  * This driver supports the I2C-based LCD driver type NXP PCF85162.
48  * The LCD driver IC has 32 segment driver outputs and up to 4 backplanes,
49  * and can operate in static mode or multiplexing modes 1:2, 1:3 or 1:4.
50  * The LCD driver IC has also built-in versatile blinking modes.
51  * Wide IC power supply range from 1.8V to 5.5V, and wide logic LCD supply
52  * range from 2.5V to 6.5V.
53  *
54  * The LCD driver IC has 1 address line.
55  * The I2C address range is 0x38 - 0x39. Max baudrate is 400 kbit/s.
56  * Typical current consumption is 6ľA for the IC and 18ľA for the LCD.
57  *
58  * Both initialization, flashing control and printing at the LCD are supported.
59  *
60  * The selected I2C port must be initialized before using the driver.
61  */
62 
63 /***********************************************************************
64  * Global defines
65 ***********************************************************************/
66 /**
67  * lcd_driver_flashing_t structure defines flashing intervals.
68  *
69  */
71 {
72  LCD_FLASHING_INTERVAL_OFF = 0x00,
73  LCD_FLASHING_INTERVAL_400MS = 0x01,
74  LCD_FLASHING_INTERVAL_800MS = 0x02,
75  LCD_FLASHING_INTERVAL_1600MS = 0x03,
76 };
77 
78 /**
79  * lcd_driver_mode_t structure defines static mode or multiplexed mode 1:2, 1:3 or 1:4.
80  *
81  */
83 {
84  LCD_MULTIPLEX_MODE_STATIC = 0x01,
85  LCD_MULTIPLEX_MODE_1_2 = 0x02,
86  LCD_MULTIPLEX_MODE_1_3 = 0x03,
87  LCD_MULTIPLEX_MODE_1_4 = 0x00,
88 };
89 
90 /**
91  * lcd_bias_mode_t structure defines the bias mode 1/2 or 1/3.
92  *
93  */
95 {
96  LCD_BIAS_MODE_1_2 = 0x04,
97  LCD_BIAS_MODE_1_3 = 0x00,
98 };
99 
100 /**
101  * lcd_driver_t structure holds I2C port, slave address to be used and LCD driving mode.
102  *
103  */
105 {
106  const struct i2c_t *I2c;
107  uint8_t SlaveAddress; // I2C slave address 0x38 - 0x39
108  enum lcd_multiplex_mode_t MultiplexMode; // LCD multiplex mode - static or multiplexed 1:2, 1:3 or 1:4.
109  enum lcd_bias_mode_t Bias; // LCD bias mode 1/2 or 1/3.
110 };
111 
112 /**
113  * @name Functions called from application programs
114  * @{
115  */
116 
117 /**********************************************************************/
118 /**
119  * @brief Name: LcdInit\n
120  * Initializes the I2C-based LCD driver.
121  * I2C address range is 0x38 - 0x39. Max baudrate is 400 kbit/s.
122  *
123  * @param LcdDriver Parameters for the LCD driver to be used
124  * @return true if OK, else false
125  ***********************************************************************/
126 extern bool LcdInit(const struct lcd_driver_t *LcdDriver);
127 
128 /**********************************************************************/
129 /**
130  * @brief Name: LcdFlashing\n
131  * Sets LCD flashing mode.
132  *
133  * @param LcdDriver Parameters for the LCD driver to be used
134  * @param Flashing Flashing parameter
135  * @return true if OK, else false
136  ***********************************************************************/
137 extern bool LcdFlashing(const struct lcd_driver_t *LcdDriver, enum lcd_driver_flashing_t Flashing);
138 
139 /**********************************************************************/
140 /**
141  * @brief Name: LcdPrint\n
142  * Prints characters on LCD.
143  *
144  * @param LcdDriver Parameters for the LCD driver to be used
145  * @param SrcBuffer Pointer to ASCII character buffer to print from
146  * @param CharCount Numbers of characters to print
147  * @return true if OK, else false
148  ***********************************************************************/
149 extern bool LcdPrint(const struct lcd_driver_t *LcdDriver, const void *SrcBuffer, uint8_t CharCount);
150 
151 /** @} */
152 /** \} */
153 
154 #endif // DRIVER_LCD_DRIVER_PCF85162_H
lcd_driver_flashing_t
Definition: lcd-pcf85162.h:70
bool LcdPrint(const struct lcd_driver_t *LcdDriver, const void *SrcBuffer, uint8_t CharCount)
Name: LcdPrint Prints characters on LCD.
lcd_bias_mode_t
Definition: lcd-pcf85162.h:94
bool LcdFlashing(const struct lcd_driver_t *LcdDriver, enum lcd_driver_flashing_t Flashing)
Name: LcdFlashing Sets LCD flashing mode.
Driver for I2C in nRF52 uC.
bool LcdInit(const struct lcd_driver_t *LcdDriver)
Name: LcdInit Initializes the I2C-based LCD driver. I2C address range is 0x38 - 0x39. Max baudrate is 400 kbit/s.
lcd_multiplex_mode_t
Definition: lcd-pcf85162.h:82