Hi,
I'm modifying the Nodric Developer Academy example for GPIO (https://github.com/NordicDeveloperAcademy/ncs-fund/blob/main/v2.x.x/lesson2/fund_less2_exer2_solution/src/main.c), using the nRF52840DK.
I'm trying to trigger an interrupt based on high pin level, using the following code:
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
* Copyright (c) 2016 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/gpio.h>
/* 1000 msec = 1 sec */
#define SLEEP_TIME_MS 1000
/* The devicetree node identifier for the "led0" alias. */
#define LED0_NODE DT_ALIAS(led0)
#define BUTTON0_NODE DT_NODELABEL(button0)
#define BUTTON1_NODE DT_NODELABEL(button1)
#define BUTTON2_NODE DT_NODELABEL(button2)
//#define BUTTON_PORT DEVICE_DT_GET(DT_GPIO_CTLR(DT_NODELABEL(button0), gpios))
But button 2 (and the interrupt callback) will only work with a low level (triggered when connected to ground). How can I change this to active high (triggers when connected to VDD)?
Thanks in advance.