bugfix for duplicate symbol

Fork of nRF51822 by Nordic Semiconductor

Committer:
rgrover1
Date:
Wed Apr 15 08:59:11 2015 +0100
Revision:
103:138bdc859cc9
Child:
112:737b08b3b995
Synchronized with git rev fa183c40
Author: Rohit Grover
updating to v7.1 of the Nordic SDK.
Re-organized file layout to match that from the SDK.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rgrover1 103:138bdc859cc9 1 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
rgrover1 103:138bdc859cc9 2 *
rgrover1 103:138bdc859cc9 3 * The information contained herein is property of Nordic Semiconductor ASA.
rgrover1 103:138bdc859cc9 4 * Terms and conditions of usage are described in detail in NORDIC
rgrover1 103:138bdc859cc9 5 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
rgrover1 103:138bdc859cc9 6 *
rgrover1 103:138bdc859cc9 7 * Licensees are granted free, non-transferable use of the information. NO
rgrover1 103:138bdc859cc9 8 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
rgrover1 103:138bdc859cc9 9 * the file.
rgrover1 103:138bdc859cc9 10 *
rgrover1 103:138bdc859cc9 11 */
rgrover1 103:138bdc859cc9 12
rgrover1 103:138bdc859cc9 13 #include "app_gpiote.h"
rgrover1 103:138bdc859cc9 14 #include <stdlib.h>
rgrover1 103:138bdc859cc9 15 #include <string.h>
rgrover1 103:138bdc859cc9 16 #include "app_util.h"
rgrover1 103:138bdc859cc9 17 #include "app_util_platform.h"
rgrover1 103:138bdc859cc9 18 #include "nrf_error.h"
rgrover1 103:138bdc859cc9 19 #include "nrf_gpio.h"
rgrover1 103:138bdc859cc9 20
rgrover1 103:138bdc859cc9 21
rgrover1 103:138bdc859cc9 22 /**@brief GPIOTE user type. */
rgrover1 103:138bdc859cc9 23 typedef struct
rgrover1 103:138bdc859cc9 24 {
rgrover1 103:138bdc859cc9 25 uint32_t pins_mask; /**< Mask defining which pins user wants to monitor. */
rgrover1 103:138bdc859cc9 26 uint32_t pins_low_to_high_mask; /**< Mask defining which pins will generate events to this user when toggling low->high. */
rgrover1 103:138bdc859cc9 27 uint32_t pins_high_to_low_mask; /**< Mask defining which pins will generate events to this user when toggling high->low. */
rgrover1 103:138bdc859cc9 28 uint32_t sense_high_pins; /**< Mask defining which pins are configured to generate GPIOTE interrupt on transition to high level. */
rgrover1 103:138bdc859cc9 29 app_gpiote_event_handler_t event_handler; /**< Pointer to function to be executed when an event occurs. */
rgrover1 103:138bdc859cc9 30 } gpiote_user_t;
rgrover1 103:138bdc859cc9 31
rgrover1 103:138bdc859cc9 32 STATIC_ASSERT(sizeof(gpiote_user_t) <= GPIOTE_USER_NODE_SIZE);
rgrover1 103:138bdc859cc9 33 STATIC_ASSERT(sizeof(gpiote_user_t) % 4 == 0);
rgrover1 103:138bdc859cc9 34
rgrover1 103:138bdc859cc9 35 static uint32_t m_enabled_users_mask; /**< Mask for tracking which users are enabled. */
rgrover1 103:138bdc859cc9 36 static uint8_t m_user_array_size; /**< Size of user array. */
rgrover1 103:138bdc859cc9 37 static uint8_t m_user_count; /**< Number of registered users. */
rgrover1 103:138bdc859cc9 38 static gpiote_user_t * mp_users = NULL; /**< Array of GPIOTE users. */
rgrover1 103:138bdc859cc9 39
rgrover1 103:138bdc859cc9 40
rgrover1 103:138bdc859cc9 41 /**@brief Function for toggling sense level for specified pins.
rgrover1 103:138bdc859cc9 42 *
rgrover1 103:138bdc859cc9 43 * @param[in] p_user Pointer to user structure.
rgrover1 103:138bdc859cc9 44 * @param[in] pins Bitmask specifying for which pins the sense level is to be toggled.
rgrover1 103:138bdc859cc9 45 */
rgrover1 103:138bdc859cc9 46 static void sense_level_toggle(gpiote_user_t * p_user, uint32_t pins)
rgrover1 103:138bdc859cc9 47 {
rgrover1 103:138bdc859cc9 48 uint32_t pin_no;
rgrover1 103:138bdc859cc9 49
rgrover1 103:138bdc859cc9 50 for (pin_no = 0; pin_no < NO_OF_PINS; pin_no++)
rgrover1 103:138bdc859cc9 51 {
rgrover1 103:138bdc859cc9 52 uint32_t pin_mask = (1 << pin_no);
rgrover1 103:138bdc859cc9 53
rgrover1 103:138bdc859cc9 54 if ((pins & pin_mask) != 0)
rgrover1 103:138bdc859cc9 55 {
rgrover1 103:138bdc859cc9 56 uint32_t sense;
rgrover1 103:138bdc859cc9 57
rgrover1 103:138bdc859cc9 58 // Invert sensing.
rgrover1 103:138bdc859cc9 59 if ((p_user->sense_high_pins & pin_mask) == 0)
rgrover1 103:138bdc859cc9 60 {
rgrover1 103:138bdc859cc9 61 sense = GPIO_PIN_CNF_SENSE_High << GPIO_PIN_CNF_SENSE_Pos;
rgrover1 103:138bdc859cc9 62 p_user->sense_high_pins |= pin_mask;
rgrover1 103:138bdc859cc9 63 }
rgrover1 103:138bdc859cc9 64 else
rgrover1 103:138bdc859cc9 65 {
rgrover1 103:138bdc859cc9 66 sense = GPIO_PIN_CNF_SENSE_Low << GPIO_PIN_CNF_SENSE_Pos;
rgrover1 103:138bdc859cc9 67 p_user->sense_high_pins &= ~pin_mask;
rgrover1 103:138bdc859cc9 68 }
rgrover1 103:138bdc859cc9 69
rgrover1 103:138bdc859cc9 70 NRF_GPIO->PIN_CNF[pin_no] &= ~GPIO_PIN_CNF_SENSE_Msk;
rgrover1 103:138bdc859cc9 71 NRF_GPIO->PIN_CNF[pin_no] |= sense;
rgrover1 103:138bdc859cc9 72 }
rgrover1 103:138bdc859cc9 73 }
rgrover1 103:138bdc859cc9 74 }
rgrover1 103:138bdc859cc9 75
rgrover1 103:138bdc859cc9 76
rgrover1 103:138bdc859cc9 77 /**@brief Function for handling the GPIOTE interrupt.
rgrover1 103:138bdc859cc9 78 */
rgrover1 103:138bdc859cc9 79 void GPIOTE_IRQHandler(void)
rgrover1 103:138bdc859cc9 80 {
rgrover1 103:138bdc859cc9 81 uint8_t i;
rgrover1 103:138bdc859cc9 82 uint32_t pins_changed;
rgrover1 103:138bdc859cc9 83 uint32_t pins_state = NRF_GPIO->IN;
rgrover1 103:138bdc859cc9 84
rgrover1 103:138bdc859cc9 85 // Clear event.
rgrover1 103:138bdc859cc9 86 NRF_GPIOTE->EVENTS_PORT = 0;
rgrover1 103:138bdc859cc9 87
rgrover1 103:138bdc859cc9 88 // Check all users.
rgrover1 103:138bdc859cc9 89 for (i = 0; i < m_user_count; i++)
rgrover1 103:138bdc859cc9 90 {
rgrover1 103:138bdc859cc9 91 gpiote_user_t * p_user = &mp_users[i];
rgrover1 103:138bdc859cc9 92
rgrover1 103:138bdc859cc9 93 // Check if user is enabled.
rgrover1 103:138bdc859cc9 94 if (((1 << i) & m_enabled_users_mask) != 0)
rgrover1 103:138bdc859cc9 95 {
rgrover1 103:138bdc859cc9 96 uint32_t transition_pins;
rgrover1 103:138bdc859cc9 97 uint32_t event_low_to_high;
rgrover1 103:138bdc859cc9 98 uint32_t event_high_to_low;
rgrover1 103:138bdc859cc9 99
rgrover1 103:138bdc859cc9 100 // Find set of pins on which there has been a transition.
rgrover1 103:138bdc859cc9 101 transition_pins = (pins_state ^ ~p_user->sense_high_pins) & p_user->pins_mask;
rgrover1 103:138bdc859cc9 102
rgrover1 103:138bdc859cc9 103 // Toggle SENSE level for all pins that have changed state.
rgrover1 103:138bdc859cc9 104 sense_level_toggle(p_user, transition_pins);
rgrover1 103:138bdc859cc9 105
rgrover1 103:138bdc859cc9 106 // Second read after setting sense.
rgrover1 103:138bdc859cc9 107 // Check if any pins have changed while serving this interrupt.
rgrover1 103:138bdc859cc9 108 pins_changed = NRF_GPIO->IN ^ pins_state;
rgrover1 103:138bdc859cc9 109 if (pins_changed)
rgrover1 103:138bdc859cc9 110 {
rgrover1 103:138bdc859cc9 111 // Transition pins detected in late stage.
rgrover1 103:138bdc859cc9 112 uint32_t late_transition_pins;
rgrover1 103:138bdc859cc9 113
rgrover1 103:138bdc859cc9 114 pins_state |= pins_changed;
rgrover1 103:138bdc859cc9 115
rgrover1 103:138bdc859cc9 116 // Find set of pins on which there has been a transition.
rgrover1 103:138bdc859cc9 117 late_transition_pins = (pins_state ^ ~p_user->sense_high_pins) & p_user->pins_mask;
rgrover1 103:138bdc859cc9 118
rgrover1 103:138bdc859cc9 119 // Toggle SENSE level for all pins that have changed state in last phase.
rgrover1 103:138bdc859cc9 120 sense_level_toggle(p_user, late_transition_pins);
rgrover1 103:138bdc859cc9 121
rgrover1 103:138bdc859cc9 122 // Update pins that has changed state since the interrupt occurred.
rgrover1 103:138bdc859cc9 123 transition_pins |= late_transition_pins;
rgrover1 103:138bdc859cc9 124 }
rgrover1 103:138bdc859cc9 125
rgrover1 103:138bdc859cc9 126 // Call user event handler if an event has occurred.
rgrover1 103:138bdc859cc9 127 event_high_to_low = (~pins_state & p_user->pins_high_to_low_mask) & transition_pins;
rgrover1 103:138bdc859cc9 128 event_low_to_high = (pins_state & p_user->pins_low_to_high_mask) & transition_pins;
rgrover1 103:138bdc859cc9 129
rgrover1 103:138bdc859cc9 130 if ((event_low_to_high | event_high_to_low) != 0)
rgrover1 103:138bdc859cc9 131 {
rgrover1 103:138bdc859cc9 132 p_user->event_handler(event_low_to_high, event_high_to_low);
rgrover1 103:138bdc859cc9 133 }
rgrover1 103:138bdc859cc9 134 }
rgrover1 103:138bdc859cc9 135 }
rgrover1 103:138bdc859cc9 136 }
rgrover1 103:138bdc859cc9 137
rgrover1 103:138bdc859cc9 138
rgrover1 103:138bdc859cc9 139 /**@brief Function for sense disabling for all pins for specified user.
rgrover1 103:138bdc859cc9 140 *
rgrover1 103:138bdc859cc9 141 * @param[in] user_id User id.
rgrover1 103:138bdc859cc9 142 */
rgrover1 103:138bdc859cc9 143 static void pins_sense_disable(app_gpiote_user_id_t user_id)
rgrover1 103:138bdc859cc9 144 {
rgrover1 103:138bdc859cc9 145 uint32_t pin_no;
rgrover1 103:138bdc859cc9 146
rgrover1 103:138bdc859cc9 147 for (pin_no = 0; pin_no < 32; pin_no++)
rgrover1 103:138bdc859cc9 148 {
rgrover1 103:138bdc859cc9 149 if ((mp_users[user_id].pins_mask & (1 << pin_no)) != 0)
rgrover1 103:138bdc859cc9 150 {
rgrover1 103:138bdc859cc9 151 NRF_GPIO->PIN_CNF[pin_no] &= ~GPIO_PIN_CNF_SENSE_Msk;
rgrover1 103:138bdc859cc9 152 NRF_GPIO->PIN_CNF[pin_no] |= GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos;
rgrover1 103:138bdc859cc9 153 }
rgrover1 103:138bdc859cc9 154 }
rgrover1 103:138bdc859cc9 155 }
rgrover1 103:138bdc859cc9 156
rgrover1 103:138bdc859cc9 157
rgrover1 103:138bdc859cc9 158 uint32_t app_gpiote_init(uint8_t max_users, void * p_buffer)
rgrover1 103:138bdc859cc9 159 {
rgrover1 103:138bdc859cc9 160 if (p_buffer == NULL)
rgrover1 103:138bdc859cc9 161 {
rgrover1 103:138bdc859cc9 162 return NRF_ERROR_INVALID_PARAM;
rgrover1 103:138bdc859cc9 163 }
rgrover1 103:138bdc859cc9 164
rgrover1 103:138bdc859cc9 165 // Check that buffer is correctly aligned.
rgrover1 103:138bdc859cc9 166 if (!is_word_aligned(p_buffer))
rgrover1 103:138bdc859cc9 167 {
rgrover1 103:138bdc859cc9 168 return NRF_ERROR_INVALID_PARAM;
rgrover1 103:138bdc859cc9 169 }
rgrover1 103:138bdc859cc9 170
rgrover1 103:138bdc859cc9 171 // Initialize file globals.
rgrover1 103:138bdc859cc9 172 mp_users = (gpiote_user_t *)p_buffer;
rgrover1 103:138bdc859cc9 173 m_user_array_size = max_users;
rgrover1 103:138bdc859cc9 174 m_user_count = 0;
rgrover1 103:138bdc859cc9 175 m_enabled_users_mask = 0;
rgrover1 103:138bdc859cc9 176
rgrover1 103:138bdc859cc9 177 memset(mp_users, 0, m_user_array_size * sizeof(gpiote_user_t));
rgrover1 103:138bdc859cc9 178
rgrover1 103:138bdc859cc9 179 // Initialize GPIOTE interrupt (will not be enabled until app_gpiote_user_enable() is called).
rgrover1 103:138bdc859cc9 180 NRF_GPIOTE->INTENCLR = 0xFFFFFFFF;
rgrover1 103:138bdc859cc9 181
rgrover1 103:138bdc859cc9 182 NVIC_ClearPendingIRQ(GPIOTE_IRQn);
rgrover1 103:138bdc859cc9 183 NVIC_SetPriority(GPIOTE_IRQn, APP_IRQ_PRIORITY_HIGH);
rgrover1 103:138bdc859cc9 184 NVIC_EnableIRQ(GPIOTE_IRQn);
rgrover1 103:138bdc859cc9 185
rgrover1 103:138bdc859cc9 186 return NRF_SUCCESS;
rgrover1 103:138bdc859cc9 187 }
rgrover1 103:138bdc859cc9 188
rgrover1 103:138bdc859cc9 189
rgrover1 103:138bdc859cc9 190 uint32_t app_gpiote_user_register(app_gpiote_user_id_t * p_user_id,
rgrover1 103:138bdc859cc9 191 uint32_t pins_low_to_high_mask,
rgrover1 103:138bdc859cc9 192 uint32_t pins_high_to_low_mask,
rgrover1 103:138bdc859cc9 193 app_gpiote_event_handler_t event_handler)
rgrover1 103:138bdc859cc9 194 {
rgrover1 103:138bdc859cc9 195 // Check state and parameters.
rgrover1 103:138bdc859cc9 196 if (mp_users == NULL)
rgrover1 103:138bdc859cc9 197 {
rgrover1 103:138bdc859cc9 198 return NRF_ERROR_INVALID_STATE;
rgrover1 103:138bdc859cc9 199 }
rgrover1 103:138bdc859cc9 200 if (event_handler == NULL)
rgrover1 103:138bdc859cc9 201 {
rgrover1 103:138bdc859cc9 202 return NRF_ERROR_INVALID_PARAM;
rgrover1 103:138bdc859cc9 203 }
rgrover1 103:138bdc859cc9 204 if (m_user_count >= m_user_array_size)
rgrover1 103:138bdc859cc9 205 {
rgrover1 103:138bdc859cc9 206 return NRF_ERROR_NO_MEM;
rgrover1 103:138bdc859cc9 207 }
rgrover1 103:138bdc859cc9 208
rgrover1 103:138bdc859cc9 209 // Allocate new user.
rgrover1 103:138bdc859cc9 210 mp_users[m_user_count].pins_mask = pins_low_to_high_mask | pins_high_to_low_mask;
rgrover1 103:138bdc859cc9 211 mp_users[m_user_count].pins_low_to_high_mask = pins_low_to_high_mask;
rgrover1 103:138bdc859cc9 212 mp_users[m_user_count].pins_high_to_low_mask = pins_high_to_low_mask;
rgrover1 103:138bdc859cc9 213 mp_users[m_user_count].event_handler = event_handler;
rgrover1 103:138bdc859cc9 214
rgrover1 103:138bdc859cc9 215 *p_user_id = m_user_count++;
rgrover1 103:138bdc859cc9 216
rgrover1 103:138bdc859cc9 217 // Make sure SENSE is disabled for all pins.
rgrover1 103:138bdc859cc9 218 pins_sense_disable(*p_user_id);
rgrover1 103:138bdc859cc9 219
rgrover1 103:138bdc859cc9 220 return NRF_SUCCESS;
rgrover1 103:138bdc859cc9 221 }
rgrover1 103:138bdc859cc9 222
rgrover1 103:138bdc859cc9 223
rgrover1 103:138bdc859cc9 224 uint32_t app_gpiote_user_enable(app_gpiote_user_id_t user_id)
rgrover1 103:138bdc859cc9 225 {
rgrover1 103:138bdc859cc9 226 uint32_t pin_no;
rgrover1 103:138bdc859cc9 227 uint32_t pins_state;
rgrover1 103:138bdc859cc9 228
rgrover1 103:138bdc859cc9 229 // Check state and parameters.
rgrover1 103:138bdc859cc9 230 if (mp_users == NULL)
rgrover1 103:138bdc859cc9 231 {
rgrover1 103:138bdc859cc9 232 return NRF_ERROR_INVALID_STATE;
rgrover1 103:138bdc859cc9 233 }
rgrover1 103:138bdc859cc9 234 if (user_id >= m_user_count)
rgrover1 103:138bdc859cc9 235 {
rgrover1 103:138bdc859cc9 236 return NRF_ERROR_INVALID_PARAM;
rgrover1 103:138bdc859cc9 237 }
rgrover1 103:138bdc859cc9 238
rgrover1 103:138bdc859cc9 239 // Clear any pending event.
rgrover1 103:138bdc859cc9 240 NRF_GPIOTE->EVENTS_PORT = 0;
rgrover1 103:138bdc859cc9 241 pins_state = NRF_GPIO->IN;
rgrover1 103:138bdc859cc9 242
rgrover1 103:138bdc859cc9 243 // Enable user.
rgrover1 103:138bdc859cc9 244 if (m_enabled_users_mask == 0)
rgrover1 103:138bdc859cc9 245 {
rgrover1 103:138bdc859cc9 246 NRF_GPIOTE->INTENSET = GPIOTE_INTENSET_PORT_Msk;
rgrover1 103:138bdc859cc9 247 }
rgrover1 103:138bdc859cc9 248 m_enabled_users_mask |= (1 << user_id);
rgrover1 103:138bdc859cc9 249
rgrover1 103:138bdc859cc9 250 // Enable sensing for all pins for specified user.
rgrover1 103:138bdc859cc9 251 mp_users[user_id].sense_high_pins = 0;
rgrover1 103:138bdc859cc9 252 for (pin_no = 0; pin_no < 32; pin_no++)
rgrover1 103:138bdc859cc9 253 {
rgrover1 103:138bdc859cc9 254 uint32_t pin_mask = (1 << pin_no);
rgrover1 103:138bdc859cc9 255
rgrover1 103:138bdc859cc9 256 if ((mp_users[user_id].pins_mask & pin_mask) != 0)
rgrover1 103:138bdc859cc9 257 {
rgrover1 103:138bdc859cc9 258 uint32_t sense;
rgrover1 103:138bdc859cc9 259
rgrover1 103:138bdc859cc9 260 if ((pins_state & pin_mask) != 0)
rgrover1 103:138bdc859cc9 261 {
rgrover1 103:138bdc859cc9 262 sense = GPIO_PIN_CNF_SENSE_Low << GPIO_PIN_CNF_SENSE_Pos;
rgrover1 103:138bdc859cc9 263 }
rgrover1 103:138bdc859cc9 264 else
rgrover1 103:138bdc859cc9 265 {
rgrover1 103:138bdc859cc9 266 sense = GPIO_PIN_CNF_SENSE_High << GPIO_PIN_CNF_SENSE_Pos;
rgrover1 103:138bdc859cc9 267 mp_users[user_id].sense_high_pins |= pin_mask;
rgrover1 103:138bdc859cc9 268 }
rgrover1 103:138bdc859cc9 269
rgrover1 103:138bdc859cc9 270 NRF_GPIO->PIN_CNF[pin_no] &= ~GPIO_PIN_CNF_SENSE_Msk;
rgrover1 103:138bdc859cc9 271 NRF_GPIO->PIN_CNF[pin_no] |= sense;
rgrover1 103:138bdc859cc9 272 }
rgrover1 103:138bdc859cc9 273 }
rgrover1 103:138bdc859cc9 274
rgrover1 103:138bdc859cc9 275 return NRF_SUCCESS;
rgrover1 103:138bdc859cc9 276 }
rgrover1 103:138bdc859cc9 277
rgrover1 103:138bdc859cc9 278
rgrover1 103:138bdc859cc9 279 uint32_t app_gpiote_user_disable(app_gpiote_user_id_t user_id)
rgrover1 103:138bdc859cc9 280 {
rgrover1 103:138bdc859cc9 281 // Check state and parameters.
rgrover1 103:138bdc859cc9 282 if (mp_users == NULL)
rgrover1 103:138bdc859cc9 283 {
rgrover1 103:138bdc859cc9 284 return NRF_ERROR_INVALID_STATE;
rgrover1 103:138bdc859cc9 285 }
rgrover1 103:138bdc859cc9 286 if (user_id >= m_user_count)
rgrover1 103:138bdc859cc9 287 {
rgrover1 103:138bdc859cc9 288 return NRF_ERROR_INVALID_PARAM;
rgrover1 103:138bdc859cc9 289 }
rgrover1 103:138bdc859cc9 290
rgrover1 103:138bdc859cc9 291 // Disable sensing for all pins for specified user.
rgrover1 103:138bdc859cc9 292 pins_sense_disable(user_id);
rgrover1 103:138bdc859cc9 293
rgrover1 103:138bdc859cc9 294 // Disable user.
rgrover1 103:138bdc859cc9 295 m_enabled_users_mask &= ~(1UL << user_id);
rgrover1 103:138bdc859cc9 296 if (m_enabled_users_mask == 0)
rgrover1 103:138bdc859cc9 297 {
rgrover1 103:138bdc859cc9 298 NRF_GPIOTE->INTENCLR = GPIOTE_INTENSET_PORT_Msk;
rgrover1 103:138bdc859cc9 299 }
rgrover1 103:138bdc859cc9 300
rgrover1 103:138bdc859cc9 301 return NRF_SUCCESS;
rgrover1 103:138bdc859cc9 302 }
rgrover1 103:138bdc859cc9 303
rgrover1 103:138bdc859cc9 304
rgrover1 103:138bdc859cc9 305 uint32_t app_gpiote_pins_state_get(app_gpiote_user_id_t user_id, uint32_t * p_pins)
rgrover1 103:138bdc859cc9 306 {
rgrover1 103:138bdc859cc9 307 gpiote_user_t * p_user;
rgrover1 103:138bdc859cc9 308
rgrover1 103:138bdc859cc9 309 // Check state and parameters.
rgrover1 103:138bdc859cc9 310 if (mp_users == NULL)
rgrover1 103:138bdc859cc9 311 {
rgrover1 103:138bdc859cc9 312 return NRF_ERROR_INVALID_STATE;
rgrover1 103:138bdc859cc9 313 }
rgrover1 103:138bdc859cc9 314 if (user_id >= m_user_count)
rgrover1 103:138bdc859cc9 315 {
rgrover1 103:138bdc859cc9 316 return NRF_ERROR_INVALID_PARAM;
rgrover1 103:138bdc859cc9 317 }
rgrover1 103:138bdc859cc9 318
rgrover1 103:138bdc859cc9 319 // Get pins.
rgrover1 103:138bdc859cc9 320 p_user = &mp_users[user_id];
rgrover1 103:138bdc859cc9 321 *p_pins = NRF_GPIO->IN & p_user->pins_mask;
rgrover1 103:138bdc859cc9 322
rgrover1 103:138bdc859cc9 323 return NRF_SUCCESS;
rgrover1 103:138bdc859cc9 324 }
rgrover1 103:138bdc859cc9 325
rgrover1 103:138bdc859cc9 326 #if defined(SVCALL_AS_NORMAL_FUNCTION) || defined(SER_CONNECTIVITY)
rgrover1 103:138bdc859cc9 327 uint32_t app_gpiote_input_event_handler_register(const uint8_t channel,
rgrover1 103:138bdc859cc9 328 const uint32_t pin,
rgrover1 103:138bdc859cc9 329 const uint32_t polarity,
rgrover1 103:138bdc859cc9 330 app_gpiote_input_event_handler_t event_handler)
rgrover1 103:138bdc859cc9 331 {
rgrover1 103:138bdc859cc9 332 (void)sense_level_toggle(NULL, pin);
rgrover1 103:138bdc859cc9 333 return NRF_ERROR_NOT_SUPPORTED;
rgrover1 103:138bdc859cc9 334 }
rgrover1 103:138bdc859cc9 335
rgrover1 103:138bdc859cc9 336 uint32_t app_gpiote_input_event_handler_unregister(const uint8_t channel)
rgrover1 103:138bdc859cc9 337 {
rgrover1 103:138bdc859cc9 338 return NRF_ERROR_NOT_SUPPORTED;
rgrover1 103:138bdc859cc9 339 }
rgrover1 103:138bdc859cc9 340
rgrover1 103:138bdc859cc9 341 uint32_t app_gpiote_end_irq_event_handler_register(app_gpiote_input_event_handler_t event_handler)
rgrover1 103:138bdc859cc9 342 {
rgrover1 103:138bdc859cc9 343 return NRF_ERROR_NOT_SUPPORTED;
rgrover1 103:138bdc859cc9 344 }
rgrover1 103:138bdc859cc9 345
rgrover1 103:138bdc859cc9 346 uint32_t app_gpiote_end_irq_event_handler_unregister(void)
rgrover1 103:138bdc859cc9 347 {
rgrover1 103:138bdc859cc9 348 return NRF_ERROR_NOT_SUPPORTED;
rgrover1 103:138bdc859cc9 349 }
rgrover1 103:138bdc859cc9 350
rgrover1 103:138bdc859cc9 351 uint32_t app_gpiote_enable_interrupts(void)
rgrover1 103:138bdc859cc9 352 {
rgrover1 103:138bdc859cc9 353 return NRF_ERROR_NOT_SUPPORTED;
rgrover1 103:138bdc859cc9 354 }
rgrover1 103:138bdc859cc9 355
rgrover1 103:138bdc859cc9 356 uint32_t app_gpiote_disable_interrupts(void)
rgrover1 103:138bdc859cc9 357 {
rgrover1 103:138bdc859cc9 358 return NRF_ERROR_NOT_SUPPORTED;
rgrover1 103:138bdc859cc9 359 }
rgrover1 103:138bdc859cc9 360 #endif // SVCALL_AS_NORMAL_FUNCTION || SER_CONNECTIVITY