Coder Social home page Coder Social logo

nrfx_test's Introduction

nrfx use example

Overview

This sample demonstrates the usage of nrfx library in Zephyr. GPIOTE and DPPI/PPI are used as examples of nrfx drivers.

The code shows how to initialize the GPIOTE interrupt in Zephyr so that the nrfx_gpiote driver can use it. Additionally, it shows how the DPPI/PPI subsystem can be used to connect tasks and events of nRF peripherals, enabling those peripherals to interact with each other without any intervention from the CPU.

Zephyr GPIO driver is disabled to prevent it from registering its own handler for the GPIOTE interrupt. Button 1 is configured to create an event when pushed. This calls the button_handler() callback and triggers the LED 1 pin OUT task. LED is then toggled.

Please note that no debouncing mechanism is used for the button, so it may happen that one press results in multiple events. And because the event-task connection is handled in hardware, for very fast coming events, toggling of the LED may sometimes be even unnoticeable.

Requirements

This sample has been tested on the NordicSemiconductor nRF9160 DK (nrf9160dk_nrf9160) and nRF52840 DK (nrf52840dk_nrf52840) boards.

Building and Running

The code can be found in :zephyr_file:`samples/boards/nrf/nrfx`.

To build and flash the application:

.. zephyr-app-commands::
   :zephyr-app: samples/boards/nrf/nrfx
   :board: nrf9160dk_nrf9160
   :goals: build flash
   :compact:

Push Button 1 to toggle the LED 1.

Connect to the serial port - notice that each time the button is pressed, the button_handler() function is called.

See nrfx_repository for more information about nrfx.

nrfx_test's People

Watchers

Linh Hoang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.