Debian Codegraph @

thirdparty/analogdevicesinc/no-OS/drivers/ADP5589/ADP5589.h

raw symbols SCIP
1 /***************************************************************************//**
2 * @file ADP5589.h
3 * @brief Header file of ADP5589 Driver.
4 * @author Mihai Bancisor ([email protected])
5 ********************************************************************************
6 * Copyright 2012(c) Analog Devices, Inc.
7 *
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are met:
12 * - Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * - Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * - Neither the name of Analog Devices, Inc. nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 * - The use of this software may or may not infringe the patent rights
22 * of one or more patent holders. This license does not release you
23 * from the requirement that you obtain separate licenses from these
24 * patent holders to use this software.
25 * - Use of the software either in source or binary form, must be run
26 * on or directly connected to an Analog Devices Inc. component.
27 *
28 * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
29 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
30 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
31 * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
34 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
36 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 *
39 ********************************************************************************
40 * SVN Revision: $WCREV$
41 *******************************************************************************/
42 #ifndef __ADP5589_H__
43 #define __ADP5589_H__
44
45 /******************************************************************************/
46 /************************** ADP5589 Definitions *******************************/
47 /******************************************************************************/
48
49 #define PMOD_IOXP_J1 0 // J1 port of PmodIOXP
50 #define PMOD_IOXP_J2 1 // J2 port of PmodIOXP
51 #define ADP5589_ADDRESS 0x34 // I2C ADDRESS
52 #define ADP5589_ID 0x10 // Manufacturer ID
53
54 /* Register address definitions */
55 #define ADP5589_ADR_ID 0x00
56 #define ADP5589_ADR_INT_STATUS 0x01
57 #define ADP5589_ADR_STATUS 0x02
58 #define ADP5589_ADR_FIFO1 0x03
59 #define ADP5589_ADR_FIFO2 0x04
60 #define ADP5589_ADR_FIFO3 0x05
61 #define ADP5589_ADR_FIFO4 0x06
62 #define ADP5589_ADR_FIFO5 0x07
63 #define ADP5589_ADR_FIFO6 0x08
64 #define ADP5589_ADR_FIFO7 0x09
65 #define ADP5589_ADR_FIFO8 0x0A
66 #define ADP5589_ADR_FIFO9 0x0B
67 #define ADP5589_ADR_FIFO10 0x0C
68 #define ADP5589_ADR_FIFO11 0x0D
69 #define ADP5589_ADR_FIFO12 0x0E
70 #define ADP5589_ADR_FIFO13 0x0F
71 #define ADP5589_ADR_FIFO14 0x10
72 #define ADP5589_ADR_FIFO15 0x11
73 #define ADP5589_ADR_FIFO16 0x12
74 #define ADP5589_ADR_GPI_INT_STATUS_A 0x13
75 #define ADP5589_ADR_GPI_INT_STATUS_B 0x14
76 #define ADP5589_ADR_GPI_INT_STATUS_C 0x15
77 #define ADP5589_ADR_GPI_STATUS_A 0x16
78 #define ADP5589_ADR_GPI_STATUS_B 0x17
79 #define ADP5589_ADR_GPI_STATUS_C 0x18
80 #define ADP5589_ADR_RPULL_CONFIG_A 0x19
81 #define ADP5589_ADR_RPULL_CONFIG_B 0x1A
82 #define ADP5589_ADR_RPULL_CONFIG_C 0x1B
83 #define ADP5589_ADR_RPULL_CONFIG_D 0x1C
84 #define ADP5589_ADR_RPULL_CONFIG_E 0x1D
85 #define ADP5589_ADR_GPI_INT_LEVEL_A 0x1E
86 #define ADP5589_ADR_GPI_INT_LEVEL_B 0x1F
87 #define ADP5589_ADR_GPI_INT_LEVEL_C 0x20
88 #define ADP5589_ADR_GPI_EVENT_EN_A 0x21
89 #define ADP5589_ADR_GPI_EVENT_EN_B 0x22
90 #define ADP5589_ADR_GPI_EVENT_EN_C 0x23
91 #define ADP5589_ADR_GPI_INTERRUPT_EN_A 0x24
92 #define ADP5589_ADR_GPI_INTERRUPT_EN_B 0x25
93 #define ADP5589_ADR_GPI_INTERRUPT_EN_C 0x26
94 #define ADP5589_ADR_DEBOUNCE_DIS_A 0x27
95 #define ADP5589_ADR_DEBOUNCE_DIS_B 0x28
96 #define ADP5589_ADR_DEBOUNCE_DIS_C 0x29
97 #define ADP5589_ADR_GPO_DATA_OUT_A 0x2A
98 #define ADP5589_ADR_GPO_DATA_OUT_B 0x2B
99 #define ADP5589_ADR_GPO_DATA_OUT_C 0x2C
100 #define ADP5589_ADR_GPO_OUT_MODE_A 0x2D
101 #define ADP5589_ADR_GPO_OUT_MODE_B 0x2E
102 #define ADP5589_ADR_GPO_OUT_MODE_C 0x2F
103 #define ADP5589_ADR_GPIO_DIRECTION_A 0x30
104 #define ADP5589_ADR_GPIO_DIRECTION_B 0x31
105 #define ADP5589_ADR_GPIO_DIRECTION_C 0x32
106 #define ADP5589_ADR_UNLOCK1 0x33
107 #define ADP5589_ADR_UNLOCK2 0x34
108 #define ADP5589_ADR_EXT_LOCK_EVENT 0x35
109 #define ADP5589_ADR_UNLOCK_TIMERS 0x36
110 #define ADP5589_ADR_LOCK_CFG 0x37
111 #define ADP5589_ADR_RESET1_EVENT_A 0x38
112 #define ADP5589_ADR_RESET1_EVENT_B 0x39
113 #define ADP5589_ADR_RESET1_EVENT_C 0x3A
114 #define ADP5589_ADR_RESET2_EVENT_A 0x3B
115 #define ADP5589_ADR_RESET2_EVENT_B 0x3C
116 #define ADP5589_ADR_RESET_CFG 0x3D
117 #define ADP5589_ADR_PWM_OFFT_LOW 0x3E
118 #define ADP5589_ADR_PWM_OFFT_HIGH 0x3F
119 #define ADP5589_ADR_PWM_ONT_LOW 0x40
120 #define ADP5589_ADR_PWM_ONT_HIGH 0x41
121 #define ADP5589_ADR_PWM_CFG 0x42
122 #define ADP5589_ADR_CLOCK_DIV_CFG 0x43
123 #define ADP5589_ADR_LOGIC_1_CFG 0x44
124 #define ADP5589_ADR_LOGIC_2_CFG 0x45
125 #define ADP5589_ADR_LOGIC_FF_CFG 0x46
126 #define ADP5589_ADR_LOGIC_INT_EVENT 0x47
127 #define ADP5589_ADR_POLL_TIME_CFG 0x48
128 #define ADP5589_ADR_PIN_CONFIG_A 0x49
129 #define ADP5589_ADR_PIN_CONFIG_B 0x4A
130 #define ADP5589_ADR_PIN_CONFIG_C 0x4B
131 #define ADP5589_ADR_PIN_CONFIG_D 0x4C
132 #define ADP5589_ADR_GENERAL_CFG_B 0x4D
133 #define ADP5589_ADR_INT_EN 0x4E
134
135
136 /* Register Bit Mask Definitions. */
137 /* ID Register bits 0x00. */
138 #define ADP5589_ID_MAN_ID (0xF0)
139 #define ADP5589_ID_REV_ID (0x0F)
140 /* INT_STATUS Register bits 0x01. */
141 #define ADP5589_INT_STATUS_EVENT_INT (1 << 0)
142 #define ADP5589_INT_STATUS_GPI_INT (1 << 1)
143 #define ADP5589_INT_STATUS_OVERFLOW_INT (1 << 2)
144 #define ADP5589_INT_STATUS_LOCK_INT (1 << 3)
145 #define ADP5589_INT_STATUS_LOGIC1_INT (1 << 4)
146 #define ADP5589_INT_STATUS_LOGIC2_INT (1 << 5)
147 /* STATUS Register bits 0x02. */
148 #define ADP5589_STATUS_EC(x) (((x) & 0x1F) << 0)
149 #define ADP5589_STATUS_LOCK_STAT (1 << 5)
150 #define ADP5589_STATUS_LOGIC1_STAT (1 << 6)
151 #define ADP5589_STATUS_LOGIC2_STAT (1 << 7)
152 /* INT_EN Register bits 0x4E. */
153 #define ADP5589_INT_EN_EVENT_IEN (1 << 0)
154 #define ADP5589_INT_EN_GPI_IEN (1 << 1)
155 #define ADP5589_INT_EN_OVERFLOW_IEN (1 << 2)
156 #define ADP5589_INT_EN_LOCK_IEN (1 << 3)
157 #define ADP5589_INT_EN_LOGIC1_INT (1 << 4)
158 #define ADP5589_INT_EN_LOGIC2_INT (1 << 5)
159 /* GENERAL_CFG_B Register bits 0x4D. */
160 #define ADP5589_GENERAL_CFG_B_RST_CFG (1 << 0)
161 #define ADP5589_GENERAL_CFG_B_INT_CFG (1 << 1)
162 #define ADP5589_GENERAL_CFG_B_LCK_TRK_GPI (1 << 3)
163 #define ADP5589_GENERAL_CFG_B_LCK_TRK_LOGIC (1 << 4)
164 #define ADP5589_GENERAL_CFG_B_CORE_FREQ(x) (((x) & 0x03) << 5)
165 #define ADP5589_GENERAL_CFG_B_OSC_EN (1 << 7)
166 /* PIN_CONFIG_D Register bits 0x4C. */
167 #define ADP5589_PIN_CONFIG_D_R0_EXTEND (1 << 0)
168 #define ADP5589_PIN_CONFIG_D_C9_EXTEND (1 << 1)
169 #define ADP5589_PIN_CONFIG_D_R3_EXTEND(x) (((x) & 0x03) << 2)
170 #define ADP5589_PIN_CONFIG_D_C6_EXTEND (1 << 4)
171 #define ADP5589_PIN_CONFIG_D_R4_EXTEND (1 << 5)
172 #define ADP5589_PIN_CONFIG_D_C4_EXTEND (1 << 6)
173 #define ADP5589_PIN_CONFIG_D_PULL_SELECT (1 << 7)
174 /* GPI_STATUS_A Register bits 0x16. */
175 #define ADP5589_GPI_STATUS_GPI_1_STAT (1 << 0)
176 #define ADP5589_GPI_STATUS_GPI_2_STAT (1 << 1)
177 #define ADP5589_GPI_STATUS_GPI_3_STAT (1 << 2)
178 #define ADP5589_GPI_STATUS_GPI_4_STAT (1 << 3)
179 #define ADP5589_GPI_STATUS_GPI_5_STAT (1 << 4)
180 #define ADP5589_GPI_STATUS_GPI_6_STAT (1 << 5)
181 #define ADP5589_GPI_STATUS_GPI_7_STAT (1 << 6)
182 #define ADP5589_GPI_STATUS_GPI_8_STAT (1 << 7)
183 /* GPI_STATUS_B Register bits 0x17. */
184 #define ADP5589_GPI_STATUS_GPI_9_STAT (1 << 0)
185 #define ADP5589_GPI_STATUS_GPI_10_STAT (1 << 1)
186 #define ADP5589_GPI_STATUS_GPI_11_STAT (1 << 2)
187 #define ADP5589_GPI_STATUS_GPI_12_STAT (1 << 3)
188 #define ADP5589_GPI_STATUS_GPI_13_STAT (1 << 4)
189 #define ADP5589_GPI_STATUS_GPI_14_STAT (1 << 5)
190 #define ADP5589_GPI_STATUS_GPI_15_STAT (1 << 6)
191 #define ADP5589_GPI_STATUS_GPI_16_STAT (1 << 7)
192 /* GPI_STATUS_C Register bits 0x18. */
193 #define ADP5589_GPI_STATUS_GPI_17_STAT (1 << 0)
194 #define ADP5589_GPI_STATUS_GPI_18_STAT (1 << 1)
195 #define ADP5589_GPI_STATUS_GPI_19_STAT (1 << 2)
196 /* GPI_EVENT_EN_A Register bits 0x21. */
197 #define ADP5589_GPI_EVENT_EN_GPI_1_STAT (1 << 0)
198 #define ADP5589_GPI_EVENT_EN_GPI_2_STAT (1 << 1)
199 #define ADP5589_GPI_EVENT_EN_GPI_3_STAT (1 << 2)
200 #define ADP5589_GPI_EVENT_EN_GPI_4_STAT (1 << 3)
201 #define ADP5589_GPI_EVENT_EN_GPI_5_STAT (1 << 4)
202 #define ADP5589_GPI_EVENT_EN_GPI_6_STAT (1 << 5)
203 #define ADP5589_GPI_EVENT_EN_GPI_7_STAT (1 << 6)
204 #define ADP5589_GPI_EVENT_EN_GPI_8_STAT (1 << 7)
205 /* GPI_EVENT_EN_B Register bits 0x22. */
206 #define ADP5589_GPI_EVENT_EN_GPI_9_STAT (1 << 0)
207 #define ADP5589_GPI_EVENT_EN_GPI_10_STAT (1 << 1)
208 #define ADP5589_GPI_EVENT_EN_GPI_11_STAT (1 << 2)
209 #define ADP5589_GPI_EVENT_EN_GPI_12_STAT (1 << 3)
210 #define ADP5589_GPI_EVENT_EN_GPI_13_STAT (1 << 4)
211 #define ADP5589_GPI_EVENT_EN_GPI_14_STAT (1 << 5)
212 #define ADP5589_GPI_EVENT_EN_GPI_15_STAT (1 << 6)
213 #define ADP5589_GPI_EVENT_EN_GPI_16_STAT (1 << 7)
214 /* GPI_EVENT_EN_C Register bits 0x23. */
215 #define ADP5589_GPI_EVENT_EN_GPI_17_STAT (1 << 0)
216 #define ADP5589_GPI_EVENT_EN_GPI_18_STAT (1 << 1)
217 #define ADP5589_GPI_EVENT_EN_GPI_19_STAT (1 << 2)
218
219 /* UNLOCK1 Register bits 0x33. */
220 #define ADP5589_UNLOCK1_UNLOCK1_STATE (1 << 7)
221 #define ADP5589_UNLOCK1_UNLOCK1_UNLOCK1(x) (((x) & 0x7F) << 0)
222 /* UNLOCK2 Register bits 0x34. */
223 #define ADP5589_UNLOCK2_UNLOCK2_STATE (1 << 7)
224 #define ADP5589_UNLOCK2_UNLOCK2_UNLOCK2(x) (((x) & 0x7F) << 0)
225 /* EXT_LOCK_EVENT Register bits 0x35. */
226 #define ADP5589_EXT_LOCK_EXT_LOCK_STATE (1 << 7)
227 #define ADP5589_EXT_LOCK_EXT_LOCK_EVENT(x) (((x) & 0x7F) << 0)
228 /* UNLOCK_TIMERS Register bits 0x36. */
229 #define ADP5589_UNLOCK_TIMERS_INT_MASK_TIMER(x) (((x) & 0xF8) << 3)
230 #define ADP5589_UNLOCK_TIMERS_UNLOCK_TIMER(x) (((x) & 0x07) << 0)
231 /* UNLOCK_TIMER bits. */
232 #define ADP5589_UNLOCK_TIMER_DIS 0
233 #define ADP5589_UNLOCK_TIMER_1SEC 1
234 #define ADP5589_UNLOCK_TIMER_2SEC 2
235 #define ADP5589_UNLOCK_TIMER_3SEC 3
236 #define ADP5589_UNLOCK_TIMER_4SEC 4
237 #define ADP5589_UNLOCK_TIMER_5SEC 5
238 #define ADP5589_UNLOCK_TIMER_6SEC 6
239 #define ADP5589_UNLOCK_TIMER_7SEC 7
240 /* INT_MASK_TIMER bits. */
241 #define ADP5589_INT_MASTER_TIMER_DIS 0
242 #define ADP5589_INT_MASTER_TIMER_1SEC 1
243 #define ADP5589_INT_MASTER_TIMER_2SEC 2
244 #define ADP5589_INT_MASTER_TIMER_30SEC (0X1E)
245 #define ADP5589_INT_MASTER_TIMER_31SEC (0X1F)
246 /* LOCK_CFG Register bits 0x37. */
247 #define ADP5589_LOCK_CFG_LOCK_EN (1 << 0)
248 /* RESET_CFG Register bits 0x3D. */
249 #define ADP5589_RESET_CFG_RESET_PULSE_WIDTH(x) (((x) & 0x03) << 0)
250 #define ADP5589_RESET_CFG_RESET_TRIGGER_TIME(x) (((x) & 0x07) << 2)
251 #define ADP5589_RESET_CFG_RST_PASSTHRU_EN (1 << 5)
252 #define ADP5589_RESET_CFG_RESET1_POL (1 << 6)
253 #define ADP5589_RESET_CFG_RESET2_POL (1 << 7)
254 /* RESET_TRIGGER_TIME bits. */
255 #define ADP5589_RESET_CFG_RESET_TRIGGER_TIME_IMMED 0
256 #define ADP5589_RESET_CFG_RESET_TRIGGER_TIME_1D0SEC 1
257 #define ADP5589_RESET_CFG_RESET_TRIGGER_TIME_1D5SEC 2
258 #define ADP5589_RESET_CFG_RESET_TRIGGER_TIME_2D0SEC 3
259 #define ADP5589_RESET_CFG_RESET_TRIGGER_TIME_2D5SEC 4
260 #define ADP5589_RESET_CFG_RESET_TRIGGER_TIME_3D0SEC 5
261 #define ADP5589_RESET_CFG_RESET_TRIGGER_TIME_3D5SEC 6
262 #define ADP5589_RESET_CFG_RESET_TRIGGER_TIME_4D0SEC 7
263 /* RESET_PULSE_WIDTH bits. */
264 #define ADP5589_RESET_CFG_RESET_PULSE_WIDTH_500US 0
265 #define ADP5589_RESET_CFG_RESET_PULSE_WIDTH_1MS 1
266 #define ADP5589_RESET_CFG_RESET_PULSE_WIDTH_2MS 2
267 #define ADP5589_RESET_CFG_RESET_PULSE_WIDTH_10MS 3
268 /* PWM_CFG Register bits 0x42. */
269 #define ADP5589_PWM_CFG_PWM_EN (1 << 0)
270 #define ADP5589_PWM_CFG_PWM_MODE (1 << 1)
271 #define ADP5589_PWM_CFG_PWM_IN_AND (1 << 2)
272 /* CLOCK_DIV_CFG Register bits 0x43. */
273 #define ADP5589_CLOCK_DIV_CFG_CLK_INV (1 << 6)
274 #define ADP5589_CLOCK_DIV_CFG_CLK_DIV(x) (((x) & 0x1F) << 1)
275 #define ADP5589_CLOCK_DIV_CFG_CLK_DIV_EN (1 << 0)
276 /* CLK_DIV bits. */
277 #define ADP5589_CLOCK_DIV_CFG_CLK_DIV_DIV1 (0X00)
278 #define ADP5589_CLOCK_DIV_CFG_CLK_DIV_DIV2 (0X01)
279 #define ADP5589_CLOCK_DIV_CFG_CLK_DIV_DIV3 (0X02)
280 #define ADP5589_CLOCK_DIV_CFG_CLK_DIV_DIV4 (0X03)
281 #define ADP5589_CLOCK_DIV_CFG_CLK_DIV_DIV32 (0X1F)
282 /* LOGIC_1_CFG Register bits 0x44. */
283 #define ADP5589_LOGIC_1_CFG_LOGIC1_SEL(x) (((x) & 0x07) << 0)
284 #define ADP5589_LOGIC_1_LA1_INV (1 << 3)
285 #define ADP5589_LOGIC_1_LB1_INV (1 << 4)
286 #define ADP5589_LOGIC_1_LC1_INV (1 << 5)
287 #define ADP5589_LOGIC_1_LY1_INV (1 << 6)
288 /* LOGIC1_SEL bits. */
289 #define ADP5589_LOGIC_CFG_LOGIC_SEL_OFF (0x00)
290 #define ADP5589_LOGIC_CFG_LOGIC_SEL_AND (0x01)
291 #define ADP5589_LOGIC_CFG_LOGIC_SEL_OR (0x02)
292 #define ADP5589_LOGIC_CFG_LOGIC_SEL_XOR (0x03)
293 #define ADP5589_LOGIC_CFG_LOGIC_SEL_FF (0x04)
294 #define ADP5589_LOGIC_CFG_LOGIC_SEL_IN_LA (0x05)
295 #define ADP5589_LOGIC_CFG_LOGIC_SEL_IN_LB (0x06)
296 #define ADP5589_LOGIC_CFG_LOGIC_SEL_IN_LC (0x07)
297 /* LOGIC_2_CFG Register bits 0x45. */
298 #define ADP5589_LOGIC_2_CFG_LOGIC2_SEL(x) (((x) & 0x07) << 0)
299 #define ADP5589_LOGIC_2_LA2_INV (1 << 3)
300 #define ADP5589_LOGIC_2_LB2_INV (1 << 4)
301 #define ADP5589_LOGIC_2_LC2_INV (1 << 5)
302 #define ADP5589_LOGIC_2_LY2_INV (1 << 6)
303 #define ADP5589_LOGIC_2_LY1_CASCADE (1 << 7)
304 /* LOGIC_FF_CFG Register bits 0x46. */
305 #define ADP5589_LOGIC_FF_CFG_FF1_CLR (1 << 0)
306 #define ADP5589_LOGIC_FF_CFG_FF1_SET (1 << 1)
307 #define ADP5589_LOGIC_FF_CFG_FF2_CLR (1 << 2)
308 #define ADP5589_LOGIC_FF_CFG_FF2_SET (1 << 3)
309 /* LOGIC_INT_EVENT_EN Register bits 0x47. */
310 #define ADP5589_LOGIC_INT_EVENT_EN_LOGIC1_INT_LEVEL (1 << 0)
311 #define ADP5589_LOGIC_INT_EVENT_EN_LOGIC1_EVENT_EN (1 << 1)
312 #define ADP5589_LOGIC_INT_EVENT_EN_LY1_DBNC_DIS (1 << 2)
313 #define ADP5589_LOGIC_INT_EVENT_EN_LOGIC2_INT_LEVEL (1 << 3)
314 #define ADP5589_LOGIC_INT_EVENT_EN_LOGIC2_EVENT_EN (1 << 4)
315 #define ADP5589_LOGIC_INT_EVENT_EN_LY2_DBNC_DIS (1 << 5)
316 /* POLL_TIME_CFG Register bits 0x48. */
317 #define ADP5589_POLL_TIME_CFG_KEY_POLL_TIME(x) (((x) & 0x03) << 0)
318 /* KEY_POLL_TIME bits. */
319 #define ADP5589_POLL_TIME_CFG_KEY_POLL_TIME_10MS (0x00)
320 #define ADP5589_POLL_TIME_CFG_KEY_POLL_TIME_20MS (0x01)
321 #define ADP5589_POLL_TIME_CFG_KEY_POLL_TIME_30MS (0x02)
322 #define ADP5589_POLL_TIME_CFG_KEY_POLL_TIME_40MS (0x03)
323
324 #define ADP5589_EVENT_KEY_RELEASED 0
325 #define ADP5589_EVENT_KEY_PRESSED 1
326
327 /******************************************************************************/
328 /************************ Functions Declarations ******************************/
329 /******************************************************************************/
330
331 /*! Writes data into a register. */
332 void ADP5589_SetRegisterValue(unsigned char registerAddress,
333 unsigned char registerValue);
334
335 /*! Reads the value of a register. */
336 unsigned char ADP5589_GetRegisterValue(unsigned char registerAddress);
337
338 /* Initializes the communication peripheral and checks if the ADP5589
339 part is present. */
340 char ADP5589_Init(void);
341
342 /*! Initializes the PWM generator in continuous mode. */
343 void ADP5589_InitPwm(void);
344
345 /* Sets the PWM On and Off times. */
346 void ADP5589_SetPwm(unsigned short pwmOffTime, unsigned short pwmOnTime);
347
348 /*! Sets the direction of the pins. */
349 void ADP5589_GpioDirection(unsigned char reg, unsigned char val);
350
351 /*! Reads the state of the pins. */
352 unsigned char ADP5589_GetPinState(unsigned char reg);
353
354 /*! Sets the state of the pins.*/
355 void ADP5589_SetPinState(unsigned char reg, unsigned char state);
356
357 /*! Initializes keyboard decoder. */
358 void ADP5589_InitKey(unsigned char pmodPort);
359
360 /*! Decodes the key on the Pmod-KYPD. */
361 unsigned char ADP5589_KeyDecode(unsigned char reg,
362 unsigned char eventType,
363 unsigned char pmodPort);
364
365 /*! Locks the ADP5589 and requests Password for unlock. */
366 void ADP5589_KeyLock(unsigned char firstEvent,
367 unsigned char secondEvent,
368 unsigned char pmodPort);
369
370 #endif /* __ADP5589_H__ */