no-OS
adp5589.h
Go to the documentation of this file.
1 /***************************************************************************/
39 #ifndef __ADP5589_H__
40 #define __ADP5589_H__
41 
42 /******************************************************************************/
43 /***************************** Include Files **********************************/
44 /******************************************************************************/
45 #include <stdint.h>
46 #include "no_os_i2c.h"
47 
48 /******************************************************************************/
49 /************************** ADP5589 Definitions *******************************/
50 /******************************************************************************/
51 
52 #define PMOD_IOXP_J1 0 // J1 port of PmodIOXP
53 #define PMOD_IOXP_J2 1 // J2 port of PmodIOXP
54 #define ADP5589_ADDRESS 0x34 // I2C ADDRESS
55 #define ADP5589_ID 0x10 // Manufacturer ID
56 
57 /* Register address definitions */
58 #define ADP5589_ADR_ID 0x00
59 #define ADP5589_ADR_INT_STATUS 0x01
60 #define ADP5589_ADR_STATUS 0x02
61 #define ADP5589_ADR_FIFO1 0x03
62 #define ADP5589_ADR_FIFO2 0x04
63 #define ADP5589_ADR_FIFO3 0x05
64 #define ADP5589_ADR_FIFO4 0x06
65 #define ADP5589_ADR_FIFO5 0x07
66 #define ADP5589_ADR_FIFO6 0x08
67 #define ADP5589_ADR_FIFO7 0x09
68 #define ADP5589_ADR_FIFO8 0x0A
69 #define ADP5589_ADR_FIFO9 0x0B
70 #define ADP5589_ADR_FIFO10 0x0C
71 #define ADP5589_ADR_FIFO11 0x0D
72 #define ADP5589_ADR_FIFO12 0x0E
73 #define ADP5589_ADR_FIFO13 0x0F
74 #define ADP5589_ADR_FIFO14 0x10
75 #define ADP5589_ADR_FIFO15 0x11
76 #define ADP5589_ADR_FIFO16 0x12
77 #define ADP5589_ADR_GPI_INT_STATUS_A 0x13
78 #define ADP5589_ADR_GPI_INT_STATUS_B 0x14
79 #define ADP5589_ADR_GPI_INT_STATUS_C 0x15
80 #define ADP5589_ADR_GPI_STATUS_A 0x16
81 #define ADP5589_ADR_GPI_STATUS_B 0x17
82 #define ADP5589_ADR_GPI_STATUS_C 0x18
83 #define ADP5589_ADR_RPULL_CONFIG_A 0x19
84 #define ADP5589_ADR_RPULL_CONFIG_B 0x1A
85 #define ADP5589_ADR_RPULL_CONFIG_C 0x1B
86 #define ADP5589_ADR_RPULL_CONFIG_D 0x1C
87 #define ADP5589_ADR_RPULL_CONFIG_E 0x1D
88 #define ADP5589_ADR_GPI_INT_LEVEL_A 0x1E
89 #define ADP5589_ADR_GPI_INT_LEVEL_B 0x1F
90 #define ADP5589_ADR_GPI_INT_LEVEL_C 0x20
91 #define ADP5589_ADR_GPI_EVENT_EN_A 0x21
92 #define ADP5589_ADR_GPI_EVENT_EN_B 0x22
93 #define ADP5589_ADR_GPI_EVENT_EN_C 0x23
94 #define ADP5589_ADR_GPI_INTERRUPT_EN_A 0x24
95 #define ADP5589_ADR_GPI_INTERRUPT_EN_B 0x25
96 #define ADP5589_ADR_GPI_INTERRUPT_EN_C 0x26
97 #define ADP5589_ADR_DEBOUNCE_DIS_A 0x27
98 #define ADP5589_ADR_DEBOUNCE_DIS_B 0x28
99 #define ADP5589_ADR_DEBOUNCE_DIS_C 0x29
100 #define ADP5589_ADR_GPO_DATA_OUT_A 0x2A
101 #define ADP5589_ADR_GPO_DATA_OUT_B 0x2B
102 #define ADP5589_ADR_GPO_DATA_OUT_C 0x2C
103 #define ADP5589_ADR_GPO_OUT_MODE_A 0x2D
104 #define ADP5589_ADR_GPO_OUT_MODE_B 0x2E
105 #define ADP5589_ADR_GPO_OUT_MODE_C 0x2F
106 #define ADP5589_ADR_GPIO_DIRECTION_A 0x30
107 #define ADP5589_ADR_GPIO_DIRECTION_B 0x31
108 #define ADP5589_ADR_GPIO_DIRECTION_C 0x32
109 #define ADP5589_ADR_UNLOCK1 0x33
110 #define ADP5589_ADR_UNLOCK2 0x34
111 #define ADP5589_ADR_EXT_LOCK_EVENT 0x35
112 #define ADP5589_ADR_UNLOCK_TIMERS 0x36
113 #define ADP5589_ADR_LOCK_CFG 0x37
114 #define ADP5589_ADR_RESET1_EVENT_A 0x38
115 #define ADP5589_ADR_RESET1_EVENT_B 0x39
116 #define ADP5589_ADR_RESET1_EVENT_C 0x3A
117 #define ADP5589_ADR_RESET2_EVENT_A 0x3B
118 #define ADP5589_ADR_RESET2_EVENT_B 0x3C
119 #define ADP5589_ADR_RESET_CFG 0x3D
120 #define ADP5589_ADR_PWM_OFFT_LOW 0x3E
121 #define ADP5589_ADR_PWM_OFFT_HIGH 0x3F
122 #define ADP5589_ADR_PWM_ONT_LOW 0x40
123 #define ADP5589_ADR_PWM_ONT_HIGH 0x41
124 #define ADP5589_ADR_PWM_CFG 0x42
125 #define ADP5589_ADR_CLOCK_DIV_CFG 0x43
126 #define ADP5589_ADR_LOGIC_1_CFG 0x44
127 #define ADP5589_ADR_LOGIC_2_CFG 0x45
128 #define ADP5589_ADR_LOGIC_FF_CFG 0x46
129 #define ADP5589_ADR_LOGIC_INT_EVENT 0x47
130 #define ADP5589_ADR_POLL_TIME_CFG 0x48
131 #define ADP5589_ADR_PIN_CONFIG_A 0x49
132 #define ADP5589_ADR_PIN_CONFIG_B 0x4A
133 #define ADP5589_ADR_PIN_CONFIG_C 0x4B
134 #define ADP5589_ADR_PIN_CONFIG_D 0x4C
135 #define ADP5589_ADR_GENERAL_CFG_B 0x4D
136 #define ADP5589_ADR_INT_EN 0x4E
137 
138 
139 /* Register Bit Mask Definitions. */
140 /* ID Register bits 0x00. */
141 #define ADP5589_ID_MAN_ID (0xF0)
142 #define ADP5589_ID_REV_ID (0x0F)
143 /* INT_STATUS Register bits 0x01. */
144 #define ADP5589_INT_STATUS_EVENT_INT (1 << 0)
145 #define ADP5589_INT_STATUS_GPI_INT (1 << 1)
146 #define ADP5589_INT_STATUS_OVERFLOW_INT (1 << 2)
147 #define ADP5589_INT_STATUS_LOCK_INT (1 << 3)
148 #define ADP5589_INT_STATUS_LOGIC1_INT (1 << 4)
149 #define ADP5589_INT_STATUS_LOGIC2_INT (1 << 5)
150 /* STATUS Register bits 0x02. */
151 #define ADP5589_STATUS_EC(x) (((x) & 0x1F) << 0)
152 #define ADP5589_STATUS_LOCK_STAT (1 << 5)
153 #define ADP5589_STATUS_LOGIC1_STAT (1 << 6)
154 #define ADP5589_STATUS_LOGIC2_STAT (1 << 7)
155 /* INT_EN Register bits 0x4E. */
156 #define ADP5589_INT_EN_EVENT_IEN (1 << 0)
157 #define ADP5589_INT_EN_GPI_IEN (1 << 1)
158 #define ADP5589_INT_EN_OVERFLOW_IEN (1 << 2)
159 #define ADP5589_INT_EN_LOCK_IEN (1 << 3)
160 #define ADP5589_INT_EN_LOGIC1_INT (1 << 4)
161 #define ADP5589_INT_EN_LOGIC2_INT (1 << 5)
162 /* GENERAL_CFG_B Register bits 0x4D. */
163 #define ADP5589_GENERAL_CFG_B_RST_CFG (1 << 0)
164 #define ADP5589_GENERAL_CFG_B_INT_CFG (1 << 1)
165 #define ADP5589_GENERAL_CFG_B_LCK_TRK_GPI (1 << 3)
166 #define ADP5589_GENERAL_CFG_B_LCK_TRK_LOGIC (1 << 4)
167 #define ADP5589_GENERAL_CFG_B_CORE_FREQ(x) (((x) & 0x03) << 5)
168 #define ADP5589_GENERAL_CFG_B_OSC_EN (1 << 7)
169 /* PIN_CONFIG_D Register bits 0x4C. */
170 #define ADP5589_PIN_CONFIG_D_R0_EXTEND (1 << 0)
171 #define ADP5589_PIN_CONFIG_D_C9_EXTEND (1 << 1)
172 #define ADP5589_PIN_CONFIG_D_R3_EXTEND(x) (((x) & 0x03) << 2)
173 #define ADP5589_PIN_CONFIG_D_C6_EXTEND (1 << 4)
174 #define ADP5589_PIN_CONFIG_D_R4_EXTEND (1 << 5)
175 #define ADP5589_PIN_CONFIG_D_C4_EXTEND (1 << 6)
176 #define ADP5589_PIN_CONFIG_D_PULL_SELECT (1 << 7)
177 /* GPI_STATUS_A Register bits 0x16. */
178 #define ADP5589_GPI_STATUS_GPI_1_STAT (1 << 0)
179 #define ADP5589_GPI_STATUS_GPI_2_STAT (1 << 1)
180 #define ADP5589_GPI_STATUS_GPI_3_STAT (1 << 2)
181 #define ADP5589_GPI_STATUS_GPI_4_STAT (1 << 3)
182 #define ADP5589_GPI_STATUS_GPI_5_STAT (1 << 4)
183 #define ADP5589_GPI_STATUS_GPI_6_STAT (1 << 5)
184 #define ADP5589_GPI_STATUS_GPI_7_STAT (1 << 6)
185 #define ADP5589_GPI_STATUS_GPI_8_STAT (1 << 7)
186 /* GPI_STATUS_B Register bits 0x17. */
187 #define ADP5589_GPI_STATUS_GPI_9_STAT (1 << 0)
188 #define ADP5589_GPI_STATUS_GPI_10_STAT (1 << 1)
189 #define ADP5589_GPI_STATUS_GPI_11_STAT (1 << 2)
190 #define ADP5589_GPI_STATUS_GPI_12_STAT (1 << 3)
191 #define ADP5589_GPI_STATUS_GPI_13_STAT (1 << 4)
192 #define ADP5589_GPI_STATUS_GPI_14_STAT (1 << 5)
193 #define ADP5589_GPI_STATUS_GPI_15_STAT (1 << 6)
194 #define ADP5589_GPI_STATUS_GPI_16_STAT (1 << 7)
195 /* GPI_STATUS_C Register bits 0x18. */
196 #define ADP5589_GPI_STATUS_GPI_17_STAT (1 << 0)
197 #define ADP5589_GPI_STATUS_GPI_18_STAT (1 << 1)
198 #define ADP5589_GPI_STATUS_GPI_19_STAT (1 << 2)
199 /* GPI_EVENT_EN_A Register bits 0x21. */
200 #define ADP5589_GPI_EVENT_EN_GPI_1_STAT (1 << 0)
201 #define ADP5589_GPI_EVENT_EN_GPI_2_STAT (1 << 1)
202 #define ADP5589_GPI_EVENT_EN_GPI_3_STAT (1 << 2)
203 #define ADP5589_GPI_EVENT_EN_GPI_4_STAT (1 << 3)
204 #define ADP5589_GPI_EVENT_EN_GPI_5_STAT (1 << 4)
205 #define ADP5589_GPI_EVENT_EN_GPI_6_STAT (1 << 5)
206 #define ADP5589_GPI_EVENT_EN_GPI_7_STAT (1 << 6)
207 #define ADP5589_GPI_EVENT_EN_GPI_8_STAT (1 << 7)
208 /* GPI_EVENT_EN_B Register bits 0x22. */
209 #define ADP5589_GPI_EVENT_EN_GPI_9_STAT (1 << 0)
210 #define ADP5589_GPI_EVENT_EN_GPI_10_STAT (1 << 1)
211 #define ADP5589_GPI_EVENT_EN_GPI_11_STAT (1 << 2)
212 #define ADP5589_GPI_EVENT_EN_GPI_12_STAT (1 << 3)
213 #define ADP5589_GPI_EVENT_EN_GPI_13_STAT (1 << 4)
214 #define ADP5589_GPI_EVENT_EN_GPI_14_STAT (1 << 5)
215 #define ADP5589_GPI_EVENT_EN_GPI_15_STAT (1 << 6)
216 #define ADP5589_GPI_EVENT_EN_GPI_16_STAT (1 << 7)
217 /* GPI_EVENT_EN_C Register bits 0x23. */
218 #define ADP5589_GPI_EVENT_EN_GPI_17_STAT (1 << 0)
219 #define ADP5589_GPI_EVENT_EN_GPI_18_STAT (1 << 1)
220 #define ADP5589_GPI_EVENT_EN_GPI_19_STAT (1 << 2)
221 
222 /* UNLOCK1 Register bits 0x33. */
223 #define ADP5589_UNLOCK1_UNLOCK1_STATE (1 << 7)
224 #define ADP5589_UNLOCK1_UNLOCK1_UNLOCK1(x) (((x) & 0x7F) << 0)
225 /* UNLOCK2 Register bits 0x34. */
226 #define ADP5589_UNLOCK2_UNLOCK2_STATE (1 << 7)
227 #define ADP5589_UNLOCK2_UNLOCK2_UNLOCK2(x) (((x) & 0x7F) << 0)
228 /* EXT_LOCK_EVENT Register bits 0x35. */
229 #define ADP5589_EXT_LOCK_EXT_LOCK_STATE (1 << 7)
230 #define ADP5589_EXT_LOCK_EXT_LOCK_EVENT(x) (((x) & 0x7F) << 0)
231 /* UNLOCK_TIMERS Register bits 0x36. */
232 #define ADP5589_UNLOCK_TIMERS_INT_MASK_TIMER(x) (((x) & 0xF8) << 3)
233 #define ADP5589_UNLOCK_TIMERS_UNLOCK_TIMER(x) (((x) & 0x07) << 0)
234 /* UNLOCK_TIMER bits. */
235 #define ADP5589_UNLOCK_TIMER_DIS 0
236 #define ADP5589_UNLOCK_TIMER_1SEC 1
237 #define ADP5589_UNLOCK_TIMER_2SEC 2
238 #define ADP5589_UNLOCK_TIMER_3SEC 3
239 #define ADP5589_UNLOCK_TIMER_4SEC 4
240 #define ADP5589_UNLOCK_TIMER_5SEC 5
241 #define ADP5589_UNLOCK_TIMER_6SEC 6
242 #define ADP5589_UNLOCK_TIMER_7SEC 7
243 /* INT_MASK_TIMER bits. */
244 #define ADP5589_INT_MASTER_TIMER_DIS 0
245 #define ADP5589_INT_MASTER_TIMER_1SEC 1
246 #define ADP5589_INT_MASTER_TIMER_2SEC 2
247 #define ADP5589_INT_MASTER_TIMER_30SEC (0X1E)
248 #define ADP5589_INT_MASTER_TIMER_31SEC (0X1F)
249 /* LOCK_CFG Register bits 0x37. */
250 #define ADP5589_LOCK_CFG_LOCK_EN (1 << 0)
251 /* RESET_CFG Register bits 0x3D. */
252 #define ADP5589_RESET_CFG_RESET_PULSE_WIDTH(x) (((x) & 0x03) << 0)
253 #define ADP5589_RESET_CFG_RESET_TRIGGER_TIME(x) (((x) & 0x07) << 2)
254 #define ADP5589_RESET_CFG_RST_PASSTHRU_EN (1 << 5)
255 #define ADP5589_RESET_CFG_RESET1_POL (1 << 6)
256 #define ADP5589_RESET_CFG_RESET2_POL (1 << 7)
257 /* RESET_TRIGGER_TIME bits. */
258 #define ADP5589_RESET_CFG_RESET_TRIGGER_TIME_IMMED 0
259 #define ADP5589_RESET_CFG_RESET_TRIGGER_TIME_1D0SEC 1
260 #define ADP5589_RESET_CFG_RESET_TRIGGER_TIME_1D5SEC 2
261 #define ADP5589_RESET_CFG_RESET_TRIGGER_TIME_2D0SEC 3
262 #define ADP5589_RESET_CFG_RESET_TRIGGER_TIME_2D5SEC 4
263 #define ADP5589_RESET_CFG_RESET_TRIGGER_TIME_3D0SEC 5
264 #define ADP5589_RESET_CFG_RESET_TRIGGER_TIME_3D5SEC 6
265 #define ADP5589_RESET_CFG_RESET_TRIGGER_TIME_4D0SEC 7
266 /* RESET_PULSE_WIDTH bits. */
267 #define ADP5589_RESET_CFG_RESET_PULSE_WIDTH_500US 0
268 #define ADP5589_RESET_CFG_RESET_PULSE_WIDTH_1MS 1
269 #define ADP5589_RESET_CFG_RESET_PULSE_WIDTH_2MS 2
270 #define ADP5589_RESET_CFG_RESET_PULSE_WIDTH_10MS 3
271 /* PWM_CFG Register bits 0x42. */
272 #define ADP5589_PWM_CFG_PWM_EN (1 << 0)
273 #define ADP5589_PWM_CFG_PWM_MODE (1 << 1)
274 #define ADP5589_PWM_CFG_PWM_IN_AND (1 << 2)
275 /* CLOCK_DIV_CFG Register bits 0x43. */
276 #define ADP5589_CLOCK_DIV_CFG_CLK_INV (1 << 6)
277 #define ADP5589_CLOCK_DIV_CFG_CLK_DIV(x) (((x) & 0x1F) << 1)
278 #define ADP5589_CLOCK_DIV_CFG_CLK_DIV_EN (1 << 0)
279 /* CLK_DIV bits. */
280 #define ADP5589_CLOCK_DIV_CFG_CLK_DIV_DIV1 (0X00)
281 #define ADP5589_CLOCK_DIV_CFG_CLK_DIV_DIV2 (0X01)
282 #define ADP5589_CLOCK_DIV_CFG_CLK_DIV_DIV3 (0X02)
283 #define ADP5589_CLOCK_DIV_CFG_CLK_DIV_DIV4 (0X03)
284 #define ADP5589_CLOCK_DIV_CFG_CLK_DIV_DIV32 (0X1F)
285 /* LOGIC_1_CFG Register bits 0x44. */
286 #define ADP5589_LOGIC_1_CFG_LOGIC1_SEL(x) (((x) & 0x07) << 0)
287 #define ADP5589_LOGIC_1_LA1_INV (1 << 3)
288 #define ADP5589_LOGIC_1_LB1_INV (1 << 4)
289 #define ADP5589_LOGIC_1_LC1_INV (1 << 5)
290 #define ADP5589_LOGIC_1_LY1_INV (1 << 6)
291 /* LOGIC1_SEL bits. */
292 #define ADP5589_LOGIC_CFG_LOGIC_SEL_OFF (0x00)
293 #define ADP5589_LOGIC_CFG_LOGIC_SEL_AND (0x01)
294 #define ADP5589_LOGIC_CFG_LOGIC_SEL_OR (0x02)
295 #define ADP5589_LOGIC_CFG_LOGIC_SEL_XOR (0x03)
296 #define ADP5589_LOGIC_CFG_LOGIC_SEL_FF (0x04)
297 #define ADP5589_LOGIC_CFG_LOGIC_SEL_IN_LA (0x05)
298 #define ADP5589_LOGIC_CFG_LOGIC_SEL_IN_LB (0x06)
299 #define ADP5589_LOGIC_CFG_LOGIC_SEL_IN_LC (0x07)
300 /* LOGIC_2_CFG Register bits 0x45. */
301 #define ADP5589_LOGIC_2_CFG_LOGIC2_SEL(x) (((x) & 0x07) << 0)
302 #define ADP5589_LOGIC_2_LA2_INV (1 << 3)
303 #define ADP5589_LOGIC_2_LB2_INV (1 << 4)
304 #define ADP5589_LOGIC_2_LC2_INV (1 << 5)
305 #define ADP5589_LOGIC_2_LY2_INV (1 << 6)
306 #define ADP5589_LOGIC_2_LY1_CASCADE (1 << 7)
307 /* LOGIC_FF_CFG Register bits 0x46. */
308 #define ADP5589_LOGIC_FF_CFG_FF1_CLR (1 << 0)
309 #define ADP5589_LOGIC_FF_CFG_FF1_SET (1 << 1)
310 #define ADP5589_LOGIC_FF_CFG_FF2_CLR (1 << 2)
311 #define ADP5589_LOGIC_FF_CFG_FF2_SET (1 << 3)
312 /* LOGIC_INT_EVENT_EN Register bits 0x47. */
313 #define ADP5589_LOGIC_INT_EVENT_EN_LOGIC1_INT_LEVEL (1 << 0)
314 #define ADP5589_LOGIC_INT_EVENT_EN_LOGIC1_EVENT_EN (1 << 1)
315 #define ADP5589_LOGIC_INT_EVENT_EN_LY1_DBNC_DIS (1 << 2)
316 #define ADP5589_LOGIC_INT_EVENT_EN_LOGIC2_INT_LEVEL (1 << 3)
317 #define ADP5589_LOGIC_INT_EVENT_EN_LOGIC2_EVENT_EN (1 << 4)
318 #define ADP5589_LOGIC_INT_EVENT_EN_LY2_DBNC_DIS (1 << 5)
319 /* POLL_TIME_CFG Register bits 0x48. */
320 #define ADP5589_POLL_TIME_CFG_KEY_POLL_TIME(x) (((x) & 0x03) << 0)
321 /* KEY_POLL_TIME bits. */
322 #define ADP5589_POLL_TIME_CFG_KEY_POLL_TIME_10MS (0x00)
323 #define ADP5589_POLL_TIME_CFG_KEY_POLL_TIME_20MS (0x01)
324 #define ADP5589_POLL_TIME_CFG_KEY_POLL_TIME_30MS (0x02)
325 #define ADP5589_POLL_TIME_CFG_KEY_POLL_TIME_40MS (0x03)
326 
327 #define ADP5589_EVENT_KEY_RELEASED 0
328 #define ADP5589_EVENT_KEY_PRESSED 1
329 
330 /******************************************************************************/
331 /*************************** Types Declarations *******************************/
332 /******************************************************************************/
333 
334 struct adp5589_dev {
335  /* I2C */
337 };
338 
340  /* I2C */
342 };
343 
344 
345 /******************************************************************************/
346 /************************ Functions Declarations ******************************/
347 /******************************************************************************/
348 
350 void adp5589_set_register_value(struct adp5589_dev *dev,
351  uint8_t register_address,
352  uint8_t register_value);
353 
355 uint8_t adp5589_get_register_value(struct adp5589_dev *dev,
356  uint8_t register_address);
357 
360 int8_t adp5589_init(struct adp5589_dev **device,
362 
364 int32_t adp5589_remove(struct adp5589_dev *dev);
365 
367 void adp5589_init_pwm(struct adp5589_dev *dev);
368 
370 void adp5589_set_pwm(struct adp5589_dev *dev,
371  uint16_t pwm_off_time,
372  uint16_t pwm_on_time);
373 
375 void adp5589_gpio_direction(struct adp5589_dev *dev,
376  uint8_t reg,
377  uint8_t val);
378 
380 uint8_t adp5589_get_pin_state(struct adp5589_dev *dev,
381  uint8_t reg);
382 
384 void adp5589_set_pin_state(struct adp5589_dev *dev,
385  uint8_t reg,
386  uint8_t state);
387 
389 void adp5589_init_key(struct adp5589_dev *dev,
390  uint8_t pmod_port);
391 
393 uint8_t adp5589_key_decode(uint8_t reg,
394  uint8_t event_type,
395  uint8_t pmod_port);
396 
398 void adp5589_key_lock(struct adp5589_dev *dev,
399  uint8_t first_event,
400  uint8_t second_event,
401  uint8_t pmod_port);
402 
403 #endif /* __ADP5589_H__ */
ADP5589_ADR_UNLOCK1
#define ADP5589_ADR_UNLOCK1
Definition: adp5589.h:109
adp5589_init_pwm
void adp5589_init_pwm(struct adp5589_dev *dev)
Initializes the PWM generator in continuous mode.
Definition: adp5589.c:157
ADP5589_ADR_PWM_ONT_HIGH
#define ADP5589_ADR_PWM_ONT_HIGH
Definition: adp5589.h:123
no_os_i2c_write
int32_t no_os_i2c_write(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Write data to slave device.
Definition: no_os_i2c.c:85
no_os_i2c_init
int32_t no_os_i2c_init(struct no_os_i2c_desc **desc, const struct no_os_i2c_init_param *param)
Initialize the I2C communication peripheral.
Definition: no_os_i2c.c:51
ADP5589_ADR_ID
#define ADP5589_ADR_ID
Definition: adp5589.h:58
adp5589_init_key
void adp5589_init_key(struct adp5589_dev *dev, uint8_t pmod_port)
Initializes keyboard decoder.
Definition: adp5589.c:177
ADP5589_ADR_STATUS
#define ADP5589_ADR_STATUS
Definition: adp5589.h:60
adp5589_gpio_direction
void adp5589_gpio_direction(struct adp5589_dev *dev, uint8_t reg, uint8_t val)
Sets the direction of the pins.
Definition: adp5589.c:243
ADP5589_ID_MAN_ID
#define ADP5589_ID_MAN_ID
Definition: adp5589.h:141
adp5589.h
Header file of ADP5589 Driver.
no_os_i2c_remove
int32_t no_os_i2c_remove(struct no_os_i2c_desc *desc)
Free the resources allocated by no_os_i2c_init().
Definition: no_os_i2c.c:70
ADP5589_STATUS_LOCK_STAT
#define ADP5589_STATUS_LOCK_STAT
Definition: adp5589.h:152
adp5589_gpio_direction
void adp5589_gpio_direction(struct adp5589_dev *dev, uint8_t reg, uint8_t val)
Sets the direction of the pins.
Definition: adp5589.c:243
ADP5589_PWM_CFG_PWM_EN
#define ADP5589_PWM_CFG_PWM_EN
Definition: adp5589.h:272
ADP5589_GENERAL_CFG_B_CORE_FREQ
#define ADP5589_GENERAL_CFG_B_CORE_FREQ(x)
Definition: adp5589.h:167
adp5589_get_pin_state
uint8_t adp5589_get_pin_state(struct adp5589_dev *dev, uint8_t reg)
Reads the state of the pins.
Definition: adp5589.c:259
adp5589_init_key
void adp5589_init_key(struct adp5589_dev *dev, uint8_t pmod_port)
Initializes keyboard decoder.
Definition: adp5589.c:177
device
Definition: ad9361_util.h:75
ADP5589_LOCK_CFG_LOCK_EN
#define ADP5589_LOCK_CFG_LOCK_EN
Definition: adp5589.h:250
ADP5589_ADR_UNLOCK2
#define ADP5589_ADR_UNLOCK2
Definition: adp5589.h:110
ADP5589_GENERAL_CFG_B_OSC_EN
#define ADP5589_GENERAL_CFG_B_OSC_EN
Definition: adp5589.h:168
ADP5589_ADR_PWM_OFFT_HIGH
#define ADP5589_ADR_PWM_OFFT_HIGH
Definition: adp5589.h:121
ADP5589_ADR_PIN_CONFIG_B
#define ADP5589_ADR_PIN_CONFIG_B
Definition: adp5589.h:132
adp5589_key_lock
void adp5589_key_lock(struct adp5589_dev *dev, uint8_t first_event, uint8_t second_event, uint8_t pmod_port)
Locks the ADP5589 and requests Password for unlock.
Definition: adp5589.c:380
adp5589_key_decode
uint8_t adp5589_key_decode(uint8_t reg, uint8_t event_type, uint8_t pmod_port)
Decodes the key on the Pmod-KYPD.
Definition: adp5589.c:301
ADP5589_ID
#define ADP5589_ID
Definition: adp5589.h:55
adp5589_init_param::i2c_init
struct no_os_i2c_init_param i2c_init
Definition: adp5589.h:341
ADP5589_UNLOCK2_UNLOCK2_STATE
#define ADP5589_UNLOCK2_UNLOCK2_STATE
Definition: adp5589.h:226
ADP5589_ADR_PWM_CFG
#define ADP5589_ADR_PWM_CFG
Definition: adp5589.h:124
ADP5589_ADR_LOCK_CFG
#define ADP5589_ADR_LOCK_CFG
Definition: adp5589.h:113
ADP5589_ADR_PIN_CONFIG_D
#define ADP5589_ADR_PIN_CONFIG_D
Definition: adp5589.h:134
ADP5589_ADR_PWM_OFFT_LOW
#define ADP5589_ADR_PWM_OFFT_LOW
Definition: adp5589.h:120
adp5589_key_decode
uint8_t adp5589_key_decode(uint8_t reg, uint8_t event_type, uint8_t pmod_port)
Decodes the key on the Pmod-KYPD.
Definition: adp5589.c:301
adp5589_get_register_value
uint8_t adp5589_get_register_value(struct adp5589_dev *dev, uint8_t register_address)
Reads the value of a register.
Definition: adp5589.c:78
adp5589_init
int8_t adp5589_init(struct adp5589_dev **device, struct adp5589_init_param init_param)
Initializes the communication peripheral and checks if the ADP5589 part is present.
Definition: adp5589.c:106
adp5589_dev
Definition: adp5589.h:334
adp5589_set_pin_state
void adp5589_set_pin_state(struct adp5589_dev *dev, uint8_t reg, uint8_t state)
Sets the state of the pins.
Definition: adp5589.c:279
adp5589_init
int8_t adp5589_init(struct adp5589_dev **device, struct adp5589_init_param init_param)
Initializes the communication peripheral and checks if the ADP5589 part is present.
Definition: adp5589.c:106
adp5589_init_param
Definition: adp5589.h:339
adp5589_dev::i2c_desc
struct no_os_i2c_desc * i2c_desc
Definition: adp5589.h:336
adp5589_get_register_value
uint8_t adp5589_get_register_value(struct adp5589_dev *dev, uint8_t register_address)
Reads the value of a register.
Definition: adp5589.c:78
no_os_i2c_desc
Structure holding I2C descriptor.
Definition: no_os_i2c.h:81
no_os_i2c_read
int32_t no_os_i2c_read(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Read data from slave device.
Definition: no_os_i2c.c:104
no_os_i2c.h
Header file of I2C Interface.
ADP5589_ADR_PWM_ONT_LOW
#define ADP5589_ADR_PWM_ONT_LOW
Definition: adp5589.h:122
adp5589_set_register_value
void adp5589_set_register_value(struct adp5589_dev *dev, uint8_t register_address, uint8_t register_value)
Writes data into a register.
Definition: adp5589.c:59
adp5589_set_pin_state
void adp5589_set_pin_state(struct adp5589_dev *dev, uint8_t reg, uint8_t state)
Sets the state of the pins.
Definition: adp5589.c:279
adp5589_key_lock
void adp5589_key_lock(struct adp5589_dev *dev, uint8_t first_event, uint8_t second_event, uint8_t pmod_port)
Locks the ADP5589 and requests Password for unlock.
Definition: adp5589.c:380
no_os_i2c_init_param
Structure holding the parameters for I2C initialization.
Definition: no_os_i2c.h:64
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:96
adp5589_init_pwm
void adp5589_init_pwm(struct adp5589_dev *dev)
Initializes the PWM generator in continuous mode.
Definition: adp5589.c:157
adp5589_set_register_value
void adp5589_set_register_value(struct adp5589_dev *dev, uint8_t register_address, uint8_t register_value)
Writes data into a register.
Definition: adp5589.c:59
adp5589_get_pin_state
uint8_t adp5589_get_pin_state(struct adp5589_dev *dev, uint8_t reg)
Reads the state of the pins.
Definition: adp5589.c:259
adp5589_remove
int32_t adp5589_remove(struct adp5589_dev *dev)
Free the resources allocated by adp5589_init().
Definition: adp5589.c:139
ADP5589_ADR_PIN_CONFIG_A
#define ADP5589_ADR_PIN_CONFIG_A
Definition: adp5589.h:131
ADP5589_ADR_GENERAL_CFG_B
#define ADP5589_ADR_GENERAL_CFG_B
Definition: adp5589.h:135
adp5589_set_pwm
void adp5589_set_pwm(struct adp5589_dev *dev, uint16_t pwm_off_time, uint16_t pwm_on_time)
Sets the PWM On and Off times.
Definition: adp5589.c:210
ADP5589_PIN_CONFIG_D_R3_EXTEND
#define ADP5589_PIN_CONFIG_D_R3_EXTEND(x)
Definition: adp5589.h:172
adp5589_set_pwm
void adp5589_set_pwm(struct adp5589_dev *dev, uint16_t pwm_off_time, uint16_t pwm_on_time)
Sets the PWM On and Off times.
Definition: adp5589.c:210
ADP5589_EVENT_KEY_PRESSED
#define ADP5589_EVENT_KEY_PRESSED
Definition: adp5589.h:328
adp5589_remove
int32_t adp5589_remove(struct adp5589_dev *dev)
Free the resources allocated by adp5589_init().
Definition: adp5589.c:139
ADP5589_UNLOCK1_UNLOCK1_STATE
#define ADP5589_UNLOCK1_UNLOCK1_STATE
Definition: adp5589.h:223