diff --git a/samples/boards/96b_argonkey/prj.conf b/samples/boards/96b_argonkey/prj.conf index 21b981bc01..6886223a8b 100644 --- a/samples/boards/96b_argonkey/prj.conf +++ b/samples/boards/96b_argonkey/prj.conf @@ -7,3 +7,4 @@ CONFIG_HTS221=y CONFIG_LPS22HB=y CONFIG_VL53L0X=y CONFIG_LSM6DSL=y +CONFIG_LP3943=y diff --git a/samples/boards/96b_argonkey/src/main.c b/samples/boards/96b_argonkey/src/main.c index 86812b3ab8..b078e3e5f6 100644 --- a/samples/boards/96b_argonkey/src/main.c +++ b/samples/boards/96b_argonkey/src/main.c @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -98,6 +99,9 @@ static void lsm6dsl_trigger_handler(struct device *dev, } #endif +#define NUM_LEDS 12 +#define DELAY_TIME K_MSEC(50) + void main(void) { int cnt = 0; @@ -105,6 +109,42 @@ void main(void) static struct device *led0, *led1; int i, on = 1; +#ifdef CONFIG_LP3943 + static struct device *ledc; + + ledc = device_get_binding(CONFIG_LP3943_DEV_NAME); + if (!ledc) { + printk("Could not get pointer to %s sensor\n", + CONFIG_LP3943_DEV_NAME); + return; + } + + /* turn all leds on */ + for (i = 0; i < NUM_LEDS; i++) { + led_on(ledc, i); + k_sleep(DELAY_TIME); + } + + /* turn all leds off */ + for (i = 0; i < NUM_LEDS; i++) { + led_off(ledc, i); + k_sleep(DELAY_TIME); + } + + /* blink all leds */ + for (i = 0; i < NUM_LEDS; i++) { + led_blink(ledc, i, 200, 50); + } + + k_sleep(1000); + + /* turn all leds off */ + for (i = 0; i < NUM_LEDS; i++) { + led_off(ledc, i); + k_sleep(5); + } +#endif + led0 = device_get_binding(LED0_GPIO_CONTROLLER); gpio_pin_configure(led0, LED0_GPIO_PIN, GPIO_DIR_OUT); gpio_pin_write(led0, LED0_GPIO_PIN, 1);