1.. _nrfx_sample:
2
3nrfx use example
4################
5
6Overview
7********
8
9This sample demonstrates the usage of nrfx library in Zephyr.
10GPIOTE and DPPI/PPI are used as examples of nrfx drivers.
11
12The code shows how to initialize the GPIOTE interrupt in Zephyr
13so that the nrfx_gpiote driver can use it. Additionally, it shows
14how the DPPI/PPI subsystem can be used to connect tasks and events of
15nRF peripherals, enabling those peripherals to interact with each
16other without any intervention from the CPU.
17
18Zephyr GPIO driver is disabled to prevent it from registering its own handler
19for the GPIOTE interrupt. Button 1 is configured to create an event when pushed.
20This calls the ``button_handler()`` callback and triggers the LED 1 pin OUT task.
21LED is then toggled.
22
23Please note that no debouncing mechanism is used for the button, so it may
24happen that one press results in multiple events. And because the event-task
25connection is handled in hardware, for very fast coming events, toggling of
26the LED may sometimes be even unnoticeable.
27
28Requirements
29************
30
31This sample has been tested on the NordicSemiconductor nRF9160 DK
32(nrf9160dk_nrf9160) and nRF52840 DK (nrf52840dk_nrf52840) boards.
33
34Building and Running
35********************
36
37The code can be found in :zephyr_file:`samples/boards/nrf/nrfx`.
38
39To build and flash the application:
40
41.. zephyr-app-commands::
42   :zephyr-app: samples/boards/nrf/nrfx
43   :board: nrf9160dk_nrf9160
44   :goals: build flash
45   :compact:
46
47Push Button 1 to toggle the LED 1.
48
49Connect to the serial port - notice that each time the button is pressed,
50the ``button_handler()`` function is called.
51
52See nrfx_repository_ for more information about nrfx.
53
54.. _nrfx_repository: https://github.com/NordicSemiconductor/nrfx
55