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