Nordic Thingy:52
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
drv_sx1509.h
1 /*
2  Copyright (c) 2010 - 2017, Nordic Semiconductor ASA
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without modification,
6  are permitted provided that the following conditions are met:
7 
8  1. Redistributions of source code must retain the above copyright notice, this
9  list of conditions and the following disclaimer.
10 
11  2. Redistributions in binary form, except as embedded into a Nordic
12  Semiconductor ASA integrated circuit in a product or a software update for
13  such product, must reproduce the above copyright notice, this list of
14  conditions and the following disclaimer in the documentation and/or other
15  materials provided with the distribution.
16 
17  3. Neither the name of Nordic Semiconductor ASA nor the names of its
18  contributors may be used to endorse or promote products derived from this
19  software without specific prior written permission.
20 
21  4. This software, with or without modification, must only be used with a
22  Nordic Semiconductor ASA integrated circuit.
23 
24  5. Any software provided in binary form under this license must not be reverse
25  engineered, decompiled, modified and/or disassembled.
26 
27  THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
28  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
29  OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
30  DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
31  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
33  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
36  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37  */
38 
48 #ifndef DRV_SX1509_H__
49 #define DRV_SX1509_H__
50 
51 #include "drv_sx1509_bitfields.h"
52 #include "nrf_drv_twi.h"
53 
54 #include <stdint.h>
55 
56 
59 enum
60 {
65 };
66 
67 
70 typedef struct
71 {
72  uint8_t twi_addr;
73  nrf_drv_twi_t const * p_twi_instance;
74  nrf_drv_twi_config_t const * p_twi_cfg;
76 
79 void drv_sx1509_init(void);
80 
83 uint32_t drv_sx1509_reg_get(uint8_t reg_addr, uint8_t * p_value);
84 
85 
93 uint32_t drv_sx1509_open(drv_sx1509_cfg_t const * const p_drv_sx1509_cfg);
94 
95 
103 uint32_t drv_sx1509_inpbufdisable_get(uint16_t * p_inputdisable);
104 
105 
115 uint32_t drv_sx1509_inpbufdisable_modify(uint16_t set_mask, uint16_t clr_mask);
116 
117 
125 uint32_t drv_sx1509_longslewrate_get(uint16_t * p_longslewrate);
126 
127 
137 uint32_t drv_sx1509_longslewrate_modify(uint16_t set_mask, uint16_t clr_mask);
138 
139 
147 uint32_t drv_sx1509_lowdrive_get(uint16_t * p_lowdrive);
148 
149 
159 uint32_t drv_sx1509_lowdrive_modify(uint16_t set_mask, uint16_t clr_mask);
160 
161 
169 uint32_t drv_sx1509_pullup_get(uint16_t * p_pullup);
170 
171 
181 uint32_t drv_sx1509_pullup_modify(uint16_t set_mask, uint16_t clr_mask);
182 
183 
191 uint32_t drv_sx1509_pulldown_get(uint16_t * p_pulldown);
192 
193 
203 uint32_t drv_sx1509_pulldown_modify(uint16_t set_mask, uint16_t clr_mask);
204 
205 
213 uint32_t drv_sx1509_opendrain_get(uint16_t * p_opendrain);
214 
215 
225 uint32_t drv_sx1509_opendrain_modify(uint16_t set_mask, uint16_t clr_mask);
226 
227 
235 uint32_t drv_sx1509_polarity_get(uint16_t * p_polarity);
236 
237 
247 uint32_t drv_sx1509_polarity_modify(uint16_t set_mask, uint16_t clr_mask);
248 
249 
257 uint32_t drv_sx1509_dir_get(uint16_t * p_dir);
258 
259 
269 uint32_t drv_sx1509_dir_modify(uint16_t set_mask, uint16_t clr_mask);
270 
271 
279 uint32_t drv_sx1509_data_get(uint16_t * p_data);
280 
281 
291 uint32_t drv_sx1509_data_modify(uint16_t set_mask, uint16_t clr_mask);
292 
293 
301 uint32_t drv_sx1509_interruptmask_get(uint16_t * p_interruptmask);
302 
303 
313 uint32_t drv_sx1509_interruptmask_modify(uint16_t set_mask, uint16_t clr_mask);
314 
315 
323 uint32_t drv_sx1509_sense_get(uint32_t * p_sense);
324 
325 
339 uint32_t drv_sx1509_sense_modify(uint32_t set_mask, uint32_t clr_mask);
340 
341 
349 uint32_t drv_sx1509_interruptsource_get(uint16_t * p_interruptsource);
350 
351 
360 uint32_t drv_sx1509_interruptsource_clr(uint16_t clr_mask);
361 
362 
370 uint32_t drv_sx1509_eventstatus_get(uint16_t * p_eventstatus);
371 
372 
381 uint32_t drv_sx1509_eventstatus_clr(uint16_t clr_mask);
382 
383 
391 uint32_t drv_sx1509_levelshifter_get(uint16_t * p_levelshifter);
392 
393 
407 uint32_t drv_sx1509_levelshifter_modify(uint16_t set_mask, uint16_t clr_mask);
408 
409 
417 uint32_t drv_sx1509_clock_get(uint8_t * p_clock);
418 
419 
433 uint32_t drv_sx1509_clock_modify(uint8_t set_mask, uint8_t clr_mask);
434 
435 
443 uint32_t drv_sx1509_misc_get(uint8_t * p_misc);
444 
445 
455 uint32_t drv_sx1509_misc_modify(uint8_t set_mask, uint8_t clr_mask);
456 
457 
465 uint32_t drv_sx1509_leddriverenable_get(uint16_t * p_leddriverenable);
466 
467 
477 uint32_t drv_sx1509_leddriverenable_modify(uint16_t set_mask, uint16_t clr_mask);
478 
479 
487 uint32_t drv_sx1509_debounceconfig_get(uint8_t * p_debounceconfig);
488 
489 
499 uint32_t drv_sx1509_debounceconfig_modify(uint8_t set_mask, uint8_t clr_mask);
500 
501 
509 uint32_t drv_sx1509_debounceenable_get(uint16_t * p_debounceenable);
510 
511 
521 uint32_t drv_sx1509_debounceenable_modify(uint16_t set_mask, uint16_t clr_mask);
522 
523 
531 uint32_t drv_sx1509_keyconfig_get(uint16_t * p_keyconfig);
532 
533 
543 uint32_t drv_sx1509_keyconfig_modify(uint16_t set_mask, uint16_t clr_mask);
544 
545 
556 uint32_t drv_sx1509_keydata_get(uint16_t * p_keydata);
557 
558 
567 uint32_t drv_sx1509_onoffcfgx_get(uint8_t pin_no, uint32_t * p_onoffcfgx);
568 
569 
584 uint32_t drv_sx1509_onoffcfgx_modify(uint8_t pin_no, uint32_t set_mask, uint32_t clr_mask);
585 
586 
595 uint32_t drv_sx1509_risefallcfgx_get(uint8_t pin_no,uint16_t * p_risefallcfgx);
596 
597 
612 uint32_t drv_sx1509_risefallcfgx_modify(uint8_t pin_no, uint16_t set_mask, uint16_t clr_mask);
613 
614 
622 uint32_t drv_sx1509_highinpmode_get(uint16_t * p_highinpmode);
623 
624 
634 uint32_t drv_sx1509_highinpmode_modify(uint16_t set_mask, uint16_t clr_mask);
635 
636 
642 uint32_t drv_sx1509_reset(void);
643 
644 
650 uint32_t drv_sx1509_close(void);
651 
652 #endif // DRV_SX1509_H__
653