drivers: gpio: nrfx: Use GPIOTE HAL for checking allocated channels

Replaces direct accesses to the peripheral registers structure
with the proper GPIOTE HAL function added recently to nrfx.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
Andrzej Głąbek 2018-09-11 15:26:59 +02:00 committed by Anas Nashif
commit 61eb2a1c80

View file

@ -47,11 +47,7 @@ static inline const struct gpio_nrfx_cfg *get_port_cfg(struct device *port)
static int gpiote_channel_alloc(u32_t abs_pin, nrf_gpiote_polarity_t polarity) static int gpiote_channel_alloc(u32_t abs_pin, nrf_gpiote_polarity_t polarity)
{ {
for (u8_t channel = 0; channel < GPIOTE_CH_NUM; ++channel) { for (u8_t channel = 0; channel < GPIOTE_CH_NUM; ++channel) {
/* @TODO Add GPIOTE HAL function for checking if (!nrf_gpiote_te_is_enabled(channel)) {
* if channel is enabled
*/
if ((NRF_GPIOTE->CONFIG[channel] & GPIOTE_CONFIG_MODE_Msk)
== GPIOTE_CONFIG_MODE_Disabled) {
nrf_gpiote_events_t evt = nrf_gpiote_events_t evt =
offsetof(NRF_GPIOTE_Type, EVENTS_IN[channel]); offsetof(NRF_GPIOTE_Type, EVENTS_IN[channel]);