Nordic Thingy:52
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
drv_ext_gpio.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_EXT_GPIO_H__
49 #define __DRV_EXT_GPIO_H__
50 
51 #include <stdint.h>
52 #include "nrf_error.h"
53 #include "drv_sx1509.h"
54 
57 enum
58 {
62 };
63 
64 #define DRV_EXT_GPIO_PIN_HIGHEST_ID DRV_SX1509_DATA_PIN15_Pos
65 #define DRV_EXT_GPIO_NUM_PINS_TOTAL (DRV_EXT_GPIO_PIN_HIGHEST_ID + 1)
66 
67 
69 typedef enum
70 {
74 
77 typedef enum
78 {
82 
85 typedef enum
86 {
91 
94 typedef enum
95 {
99 
102 typedef enum
103 {
107 
125 uint32_t drv_ext_gpio_cfg(
126  uint32_t pin_number,
129  drv_ext_gpio_pin_pull_t pull_config,
131  drv_ext_gpio_pin_slew_rate_t slew_rate);
132 
135 typedef struct
136 {
137  drv_sx1509_cfg_t const * p_cfg;
139 
147 uint32_t drv_ext_gpio_reset(void);
148 
157 uint32_t drv_ext_gpio_cfg_output(uint32_t pin_number);
158 
169 uint32_t drv_ext_gpio_cfg_input(uint32_t pin_number, drv_ext_gpio_pin_pull_t pull_config);
170 
181 uint32_t drv_ext_gpio_pin_dir_modify(uint32_t pin_number, drv_ext_gpio_pin_dir_t direction);
182 
193 uint32_t drv_ext_gpio_pin_slew_rate_modify(uint32_t pin_number, drv_ext_gpio_pin_slew_rate_t slew_rate);
194 
205 uint32_t drv_ext_gpio_pin_drive_type_modify(uint32_t pin_number, drv_ext_gpio_pin_drive_type_t drive_type);
206 
217 uint32_t drv_ext_gpio_pin_input_buffer_modify(uint32_t pin_number, drv_ext_gpio_pin_input_buf_t input_buf);
218 
229 uint32_t drv_ext_gpio_pin_set(uint32_t pin_number);
230 
241 uint32_t drv_ext_gpio_pins_set(uint32_t pin_mask);
242 
253 uint32_t drv_ext_gpio_pin_clear(uint32_t pin_number);
254 
265 uint32_t drv_ext_gpio_pins_clear(uint32_t pin_mask);
266 
277 uint32_t drv_ext_gpio_pin_toggle(uint32_t pin_number);
278 
289 uint32_t drv_ext_gpio_pins_toggle(uint32_t pin_mask);
290 
304 uint32_t drv_ext_gpio_pin_write(uint32_t pin_number, uint32_t value);
305 
320 uint32_t drv_ext_gpio_pin_read(uint32_t pin_number, uint32_t * const p_pin);
321 
333 uint32_t drv_ext_gpio_pins_read(uint32_t * const p_pins);
334 
344 uint32_t drv_ext_gpio_init(drv_ext_gpio_init_t const * const p_init, bool on_init_reset);
345 
346 #endif
347