You are currently not logged in and your progress will not be saved. Register or Log in

Lesson 2 – Reading buttons and controlling LEDs

Overview

In this lesson, we will examine how hardware is described in nRF Connect SDK, whether it is a development kit (DK), a System on Chip (SoC), a System in a Package (SiP) or a module. Interaction between applications and hardware is done through pieces of software called device drivers, and we will shed light on the device driver model used in nRF Connect SDK. The General-Purpose Input/Output (GPIO) hardware peripheral and driver is used as a case study. A line-by-line walkthrough is performed on the blinky sample that we flashed on the board in the previous lesson.

In the exercise section of this lesson, we will learn how to use the GPIO peripheral to control LEDs and read the status of buttons using both polling and interrupts methods.

Objectives

  • Examine the devicetree API <devicetree.h>
  • Examine board-level devicetree .dts
  • Examine SoC-level devicetree .dtsi
  • Understand the device driver model <device.h>
  • Analyze the decoupling between a device driver API and a device driver implementation and the need to have a binding
  • Examine the generic GPIO interface APIs <drivers/gpio.h>
  • Practice through hands-on exercises configuring GPIO pins and learn how to read/write to/from GPIO pins and how to set up interrupts for input GPIO pins