Chapter 4. Controling Led; Codes - Waveshare NRF52840 User Manual

Eval kit
Table of Contents

Advertisement

NRF52840 Eval Kit User Manual

CHAPTER 4. CONTROLING LED

In this chapter, we will instruct how to configure GPIO and control LED. The
examples used herein is 001_LED.

CODES

Open led.h files, you can find that the GPIO and related control functions are defined
in this header file:
#ifndef __LED_H__
#define __LED_H__
#include "nrf.h"
#include "nrf_gpio.h"
#define LED0 NRF_GPIO_PIN_MAP(0,13)
#define LED1 NRF_GPIO_PIN_MAP(0,14)
#define LED2 NRF_GPIO_PIN_MAP(0,19)
#define LED3 NRF_GPIO_PIN_MAP(0,16)
void LED_On(uint32_t
void LED_Off(uint32_t
#endif
Functions defined in header file will be realized in led.c file:
#include "led.h"
void LED_On(uint32_t
{
nrf_gpio_cfg_output(led_number);
nrf_gpio_pin_clear(led_number);
}
void LED_Off(uint32_t
{
nrf_gpio_cfg_output(led_number);
nrf_gpio_pin_set(led_number);
}
LED_On(led_number): Turn the LED on
LED_Off(led_number): Turn the LED off
Vision: V1.0.1 Date: 2019.01.19
led_number);
led_number);
led_number)
led_number)
20 / 72

Advertisement

Table of Contents
loading

Table of Contents