Controlling nPM1300 LEDs
This application note describes how to configure nPM1300 LEDs in Zephyr BSP and use it in the user application.
The nPM1300 LEDs device is declared in nrf9151som_nrf9151_ns.dts as a child node of the npm1300_pmic device:
npm1300_pmic: pmic@6b {
compatible = "nordic,npm1300";
...
npm1300_leds: npm1300_leds {
compatible = "nordic,npm1300-led";
nordic,led0-mode = "host";
nordic,led1-mode = "host";
nordic,led2-mode = "host";
};
...
};The devicetree node configures the following parameters:
Parameter | Value | Description |
|---|---|---|
|
| Enables the |
|
| LED |
|
| |
|
|
The Customized Asset Tracker v2 application makes use of the Zephyr LED API to control nPM1300 LEDs:
Function | Description | Comments |
| Turn on the LED. |
Returns zero on success, otherwise a negative error code is returned. |
| Turn off the LED. |
Returns zero on success, otherwise a negative error code is returned. |
The Customized Asset Tracker v2 application provides a set of Zephyr shell commands for nPM1300 LEDs:
Command | Parameters | Comments |
|
| Turn the LED on. |
|
| Turn the LED off. |
Turn on the Charging LED and verify that the green LED has been turned on:
uart:~$ led on npm1300_leds 0 npm1300_leds: turning on LED 0Turn on the Charging LED and verify that the green LED has been turned off:
uart:~$ led off npm1300_leds 0 npm1300_leds: turning off LED 0Turn on the Error LED and verify that the red LED has been turned on:
uart:~$ led on npm1300_leds 1 npm1300_leds: turning on LED 1Turn on the Error LED and verify that the red LED has been turned off:
uart:~$ led off npm1300_leds 1 npm1300_leds: turning off LED 1