Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updating numbered headings
Table of Contents
stylenone

1.
Anchor
lmutxqjs
lmutxqjs
Overview

This application note describes how to configure nPM1300 LEDs in Zephyr BSP and use it in the user application.

2.
Anchor
iazikyoi
iazikyoi
Configuring nPM1300 LEDs in Zephyr BSP

The nPM1300 LEDs device is declared in nrf9151som_nrf9151_ns.dts as a child node of the npm1300_pmic device:

...

Parameter

Value

Description

compatible

"nordic,npm1300-led"

Enables the led_npm1300.c driver and associates it with the device.

nordic,led0-mode

"host"

LED <0|1|2> mode

nordic,led1-mode

"host"

nordic,led2-mode

"host"

3.
Anchor
h6tf5iy6
h6tf5iy6
Controlling nPM1300 LEDs in User Application

3.1.
Anchor
qfiijkr7
qfiijkr7
nPM1300 LEDs C-binding API

The Customized Asset Tracker v2 application makes use of the Zephyr LED API to control nPM1300 LEDs:

Function

Description

Comments

int led_on (const struct device *dev, uint32_t led);

Turn on the LED.

dev - LED device

led - LED number

Returns zero on success, otherwise a negative error code is returned.

int led_off (const struct device *dev, uint32_t led);

Turn off the LED.

dev - LED device

led - LED number

Returns zero on success, otherwise a negative error code is returned.

3.2.
Anchor
5jhochqp
5jhochqp
nPM1300 LEDs Shell Commands

The Customized Asset Tracker v2 application provides a set of Zephyr shell commands for nPM1300 LEDs:

Command

Parameters

Comments

led on

npm1300_leds <0|1>

Turn the LED on.

led off

npm1300_leds <0|1>

Turn the LED off.

4.
Anchor
36ote77e
36ote77e
Validating nPM1300 LED Operations

  1. Turn on the Charging LED and verify that the green LED has been turned on:

    Code Block
    uart:~$ led on npm1300_leds 0
    npm1300_leds: turning on LED 0
  2. Turn on the Charging LED and verify that the green LED has been turned off:

    Code Block
    uart:~$ led off npm1300_leds 0
    npm1300_leds: turning off LED 0
  3. Turn on the Error LED and verify that the red LED has been turned on:

    Code Block
    uart:~$ led on npm1300_leds 1
    npm1300_leds: turning on LED 1
  4. Turn on the Error LED and verify that the red LED has been turned off:

    Code Block
    uart:~$ led off npm1300_leds 1
    npm1300_leds: turning off LED 1