diff --git a/app/sample.yaml b/app/sample.yaml index e343db9..9eb2434 100644 --- a/app/sample.yaml +++ b/app/sample.yaml @@ -7,8 +7,7 @@ sample: common: build_only: true integration_platforms: - - custom_plank - - nucleo_f302r8 + - nucleo_f446re tests: app.default: {} app.debug: diff --git a/app/src/main.c b/app/src/main.c index dffdf41..c43bc3c 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -4,77 +4,19 @@ */ #include -#include #include -#include - #include LOG_MODULE_REGISTER(main, CONFIG_APP_LOG_LEVEL); -#define BLINK_PERIOD_MS_STEP 100U -#define BLINK_PERIOD_MS_MAX 1000U +int main(void) { + printk("Zephyr Example Application %s\n", APP_VERSION_STRING); -int main(void) -{ - int ret; - unsigned int period_ms = BLINK_PERIOD_MS_MAX; - const struct device *sensor, *blink; - struct sensor_value last_val = { 0 }, val; + while (1) { + printk("Running...\n"); + k_sleep(K_SECONDS(5)); + } - printk("Zephyr Example Application %s\n", APP_VERSION_STRING); - - sensor = DEVICE_DT_GET(DT_NODELABEL(example_sensor)); - if (!device_is_ready(sensor)) { - LOG_ERR("Sensor not ready"); - return 0; - } - - blink = DEVICE_DT_GET(DT_NODELABEL(blink_led)); - if (!device_is_ready(blink)) { - LOG_ERR("Blink LED not ready"); - return 0; - } - - ret = blink_off(blink); - if (ret < 0) { - LOG_ERR("Could not turn off LED (%d)", ret); - return 0; - } - - printk("Use the sensor to change LED blinking period\n"); - - while (1) { - ret = sensor_sample_fetch(sensor); - if (ret < 0) { - LOG_ERR("Could not fetch sample (%d)", ret); - return 0; - } - - ret = sensor_channel_get(sensor, SENSOR_CHAN_PROX, &val); - if (ret < 0) { - LOG_ERR("Could not get sample (%d)", ret); - return 0; - } - - if ((last_val.val1 == 0) && (val.val1 == 1)) { - if (period_ms == 0U) { - period_ms = BLINK_PERIOD_MS_MAX; - } else { - period_ms -= BLINK_PERIOD_MS_STEP; - } - - printk("Proximity detected, setting LED period to %u ms\n", - period_ms); - blink_set_period_ms(blink, period_ms); - } - - last_val = val; - - k_sleep(K_MSEC(100)); - } - - return 0; + return 0; } - diff --git a/west.yml b/west.yml index c3e4067..6cb9bdd 100644 --- a/west.yml +++ b/west.yml @@ -18,5 +18,4 @@ manifest: # strictly needed by the application. name-allowlist: - cmsis_6 # required by the ARM port for Cortex-M - - hal_nordic # required by the custom_plank board (Nordic based) - - hal_stm32 # required by the nucleo_f302r8 board (STM32 based) + - hal_stm32 # required by the nucleo_f446re board (STM32 based)