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 explain the device driver model used in nRF Connect SDK. We will use the General-Purpose Input/Output (GPIO) hardware peripheral and driver as a case study. We will do a line-by-line walkthrough of 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 device pointer
  • 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
Register an account
Already have an account? Log in
(All fields are required unless specified optional)

Forgot your password?
Enter your email address, and we will send a link to reset your password.