@@ -16,7 +16,10 @@ LOG_MODULE_REGISTER(golioth_rd_template, LOG_LEVEL_DBG);
1616#include "app_state.h"
1717#include "app_work.h"
1818#include "dfu/app_dfu.h"
19- #include "libostentus/libostentus.h"
19+
20+ #ifdef CONFIG_LIB_OSTENTUS
21+ #include <libostentus.h>
22+ #endif
2023#ifdef CONFIG_ALUDEL_BATTERY_MONITOR
2124#include "battery_monitor/battery.h"
2225#endif
@@ -40,7 +43,6 @@ static struct gpio_callback button_cb_data;
4043
4144/* forward declarations */
4245void golioth_connection_led_set (uint8_t state );
43- void network_led_set (uint8_t state );
4446
4547void wake_system_thread (void )
4648{
@@ -67,7 +69,9 @@ static void golioth_on_connect(struct golioth_client *client)
6769#ifdef CONFIG_SOC_NRF9160
6870static void process_lte_connected (void )
6971{
70- network_led_set (1 );
72+ /* Change the state of the Internet LED on Ostentus */
73+ IF_ENABLED (CONFIG_LIB_OSTENTUS , (led_internet_set (1 );));
74+
7175 golioth_system_client_start ();
7276}
7377
@@ -164,15 +168,7 @@ void golioth_connection_led_set(uint8_t state)
164168 /* Turn on Golioth logo LED once connected */
165169 gpio_pin_set_dt (& golioth_led , pin_state );
166170 /* Change the state of the Golioth LED on Ostentus */
167- led_golioth_set (pin_state );
168- }
169-
170- /* Set (unset) LED indicators for active internet connection */
171- void network_led_set (uint8_t state )
172- {
173- uint8_t pin_state = state ? 1 : 0 ;
174- /* Change the state of the Internet LED on Ostentus */
175- led_internet_set (pin_state );
171+ IF_ENABLED (CONFIG_LIB_OSTENTUS , (led_golioth_set (pin_state );));
176172}
177173
178174int main (void )
@@ -184,11 +180,12 @@ int main(void)
184180 LOG_INF ("Firmware version: %s" , CONFIG_MCUBOOT_IMAGE_VERSION );
185181 IF_ENABLED (CONFIG_MODEM_INFO , (log_modem_firmware_version ();) );
186182
187- /* Update Ostentus LEDS using bitmask (Power On and Battery)*/
188- led_bitmask (LED_POW | LED_BAT );
189-
190- /* Show Golioth Logo on Ostentus ePaper screen */
191- show_splash ();
183+ IF_ENABLED (CONFIG_LIB_OSTENTUS , (
184+ /* Update Ostentus LEDS using bitmask (Power On and Battery) */
185+ led_bitmask (LED_POW | LED_BAT );
186+ /* Show Golioth Logo on Ostentus ePaper screen */
187+ show_splash ();
188+ ) );
192189
193190 /* Get system thread id so loop delay change event can wake main */
194191 _system_thread = k_current_get ();
@@ -258,26 +255,29 @@ int main(void)
258255 gpio_init_callback (& button_cb_data , button_pressed , BIT (user_btn .pin ));
259256 gpio_add_callback (user_btn .port , & button_cb_data );
260257
261- /* Set up a slideshow on Ostentus
262- * - add up to 256 slides
263- * - use the enum in app_work.h to add new keys
264- * - values are updated using these keys (see app_work.c)
265- */
266- slide_add (UP_COUNTER , LABEL_UP_COUNTER , strlen (LABEL_UP_COUNTER ));
267- slide_add (DN_COUNTER , LABEL_DN_COUNTER , strlen (LABEL_DN_COUNTER ));
268- IF_ENABLED (CONFIG_ALUDEL_BATTERY_MONITOR ,
269- (slide_add (BATTERY_V , LABEL_BATTERY , strlen (LABEL_BATTERY ));
270- slide_add (BATTERY_LVL , LABEL_BATTERY , strlen (LABEL_BATTERY ));));
271- slide_add (FIRMWARE , LABEL_FIRMWARE , strlen (LABEL_FIRMWARE ));
272-
273- /* Set the title ofthe Ostentus summary slide (optional) */
274- summary_title (SUMMARY_TITLE , strlen (SUMMARY_TITLE ));
275-
276- /* Update the Firmware slide with the firmware version */
277- slide_set (FIRMWARE , CONFIG_MCUBOOT_IMAGE_VERSION , strlen (CONFIG_MCUBOOT_IMAGE_VERSION ));
278-
279- /* Start Ostentus slideshow with 30 second delay between slides */
280- slideshow (30000 );
258+ IF_ENABLED (CONFIG_LIB_OSTENTUS ,(
259+ /* Set up a slideshow on Ostentus
260+ * - add up to 256 slides
261+ * - use the enum in app_work.h to add new keys
262+ * - values are updated using these keys (see app_work.c)
263+ */
264+ slide_add (UP_COUNTER , LABEL_UP_COUNTER , strlen (LABEL_UP_COUNTER ));
265+ slide_add (DN_COUNTER , LABEL_DN_COUNTER , strlen (LABEL_DN_COUNTER ));
266+ IF_ENABLED (CONFIG_ALUDEL_BATTERY_MONITOR , (
267+ slide_add (BATTERY_V , LABEL_BATTERY , strlen (LABEL_BATTERY ));
268+ slide_add (BATTERY_LVL , LABEL_BATTERY , strlen (LABEL_BATTERY ));
269+ ));
270+ slide_add (FIRMWARE , LABEL_FIRMWARE , strlen (LABEL_FIRMWARE ));
271+
272+ /* Set the title ofthe Ostentus summary slide (optional) */
273+ summary_title (SUMMARY_TITLE , strlen (SUMMARY_TITLE ));
274+
275+ /* Update the Firmware slide with the firmware version */
276+ slide_set (FIRMWARE , CONFIG_MCUBOOT_IMAGE_VERSION , strlen (CONFIG_MCUBOOT_IMAGE_VERSION ));
277+
278+ /* Start Ostentus slideshow with 30 second delay between slides */
279+ slideshow (30000 );
280+ ));
281281
282282 while (true) {
283283 app_work_sensor_read ();
0 commit comments