1 /*
2  * Copyright (c) 2023 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_NORDIC_NPM1300_GPIO_H_
7 #define ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_NORDIC_NPM1300_GPIO_H_
8 
9 /**
10  * @brief nPM1300-specific GPIO Flags
11  * @defgroup gpio_interface_npm1300 nPM1300-specific GPIO Flags
12  *
13  * The drive flags are encoded in the 8 upper bits of @ref gpio_dt_flags_t as
14  * follows:
15  *
16  * - Bit 8: Drive strength (0=1mA, 1=6mA)
17  * - Bit 9: Debounce (0=OFF, 1=ON)
18  * - Bit 10: Watchdog reset (0=OFF, 1=ON)
19  * - Bit 11: Power loss warning (0=OFF, 1=ON)
20  *
21  * @ingroup gpio_interface
22  * @{
23  */
24 
25 /**
26  * @name nPM1300 GPIO drive strength flags
27  * @brief nPM1300 GPIO drive strength flags
28  * @{
29  */
30 
31 /** @cond INTERNAL_HIDDEN */
32 /** Drive mode field mask */
33 #define NPM1300_GPIO_DRIVE_MSK 0x0100U
34 /** @endcond */
35 
36 /** 1mA drive */
37 #define NPM1300_GPIO_DRIVE_1MA (0U << 8U)
38 /** 6mA drive */
39 #define NPM1300_GPIO_DRIVE_6MA (1U << 8U)
40 
41 /** @} */
42 
43 /**
44  * @name nPM1300 GPIO debounce flags
45  * @brief nPM1300 GPIO debounce flags
46  * @{
47  */
48 
49 /** @cond INTERNAL_HIDDEN */
50 /** Debounce field mask */
51 #define NPM1300_GPIO_DEBOUNCE_MSK 0x0200U
52 /** @endcond */
53 
54 /** Normal drive */
55 #define NPM1300_GPIO_DEBOUNCE_OFF (0U << 9U)
56 /** High drive */
57 #define NPM1300_GPIO_DEBOUNCE_ON  (1U << 9U)
58 
59 /** @} */
60 
61 /**
62  * @name nPM1300 GPIO watchdog reset flags
63  * @brief nPM1300 GPIO watchdog reset flags
64  * @{
65  */
66 
67 /** @cond INTERNAL_HIDDEN */
68 /** watchdog reset field mask */
69 #define NPM1300_GPIO_WDT_RESET_MSK 0x0400U
70 /** @endcond */
71 
72 /** Off */
73 #define NPM1300_GPIO_WDT_RESET_OFF (0U << 10U)
74 /** On */
75 #define NPM1300_GPIO_WDT_RESET_ON  (1U << 10U)
76 
77 /** @} */
78 
79 /**
80  * @name nPM1300 GPIO power loss warning flags
81  * @brief nPM1300 GPIO power loss warning flags
82  * @{
83  */
84 
85 /** @cond INTERNAL_HIDDEN */
86 /** power loss warning field mask */
87 #define NPM1300_GPIO_PWRLOSSWARN_MSK 0x0800U
88 /** @endcond */
89 
90 /** Off */
91 #define NPM1300_GPIO_PWRLOSSWARN_OFF (0U << 11U)
92 /** On */
93 #define NPM1300_GPIO_PWRLOSSWARN_ON (1U << 11U)
94 
95 /** @} */
96 
97 /** @} */
98 
99 #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_NORDIC_NPM1300_GPIO_H_ */
100