Skip to content

Commit 6074b44

Browse files
jhirsirlubos
authored andcommitted
samples: nrf9160: modem_shell: LED #1 to indicate LTE reg status
LED #1 is now on indicating if LTE is registered. Jira: MOSH-154 Signed-off-by: Jani Hirsimäki <[email protected]>
1 parent ba5fbc6 commit 6074b44

File tree

5 files changed

+23
-0
lines changed

5 files changed

+23
-0
lines changed

doc/nrf/releases/release-notes-changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ nRF9160 samples
130130

131131
* Added a new shell command ``cloud`` for establishing an MQTT connection to nRF Cloud.
132132
* Removed support for the GPS driver.
133+
* The LED 1 on the development kit indicates the LTE registration status.
133134

134135
* :ref:`http_application_update_sample` sample:
135136

samples/nrf9160/modem_shell/README.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,14 @@ Button 1:
621621
Button 2:
622622
Enables or disables the UARTs for power consumption measurements. Toggles between UARTs enabled and disabled.
623623

624+
LED indications
625+
===============
626+
627+
The LEDs have the following functions:
628+
629+
LED 1:
630+
Indicates the LTE registration status.
631+
624632
Testing
625633
=======
626634

samples/nrf9160/modem_shell/prj.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ CONFIG_MULTICELL_LOCATION_SERVICE_NRF_CLOUD=y
141141

142142
# Library for buttons and LEDs
143143
CONFIG_DK_LIBRARY=y
144+
CONFIG_DK_LIBRARY_INVERT_LEDS=n
144145

145146
# FOTA
146147
CONFIG_FLASH=y

samples/nrf9160/modem_shell/src/link/link.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include <modem/lte_lc.h>
1818
#include <modem/pdn.h>
1919

20+
#include <dk_buttons_and_leds.h>
21+
2022
#include <nrf_socket.h>
2123

2224
#include "link_settings.h"
@@ -47,6 +49,8 @@ struct pdn_activation_status_info {
4749
uint8_t cid;
4850
};
4951

52+
#define REGISTERED_STATUS_LED DK_LED1
53+
5054
/* Work for getting the modem info that ain't in lte connection ind: */
5155
static struct k_work registered_work;
5256

@@ -147,6 +151,8 @@ static void link_registered_work(struct k_work *unused)
147151

148152
ARG_UNUSED(unused);
149153

154+
dk_set_led_on(REGISTERED_STATUS_LED);
155+
150156
memset(pdn_act_status_arr, 0,
151157
CONFIG_PDN_CONTEXTS_MAX * sizeof(struct pdn_activation_status_info));
152158

@@ -333,6 +339,8 @@ void link_ind_handler(const struct lte_lc_evt *const evt)
333339
evt->nw_reg_status == LTE_LC_NW_REG_REGISTERED_HOME ||
334340
evt->nw_reg_status == LTE_LC_NW_REG_REGISTERED_ROAMING) {
335341
k_work_submit(&registered_work);
342+
} else {
343+
dk_set_led_off(REGISTERED_STATUS_LED);
336344
}
337345
break;
338346
case LTE_LC_EVT_CELL_UPDATE:

samples/nrf9160/modem_shell/src/main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,11 @@ void main(void)
200200
#endif
201201
k_poll_signal_init(&mosh_signal);
202202

203+
err = dk_leds_init();
204+
if (err) {
205+
printk("Cannot initialize LEDs (err: %d)", err);
206+
}
207+
203208
/* Resize terminal width and height of the shell to have proper command editing. */
204209
shell_execute_cmd(shell, "resize");
205210
/* Run empty command because otherwise "resize" would be set to the command line. */

0 commit comments

Comments
 (0)