Merge branch 'new'
This commit is contained in:
5
firmware/blinky/CMakeLists.txt
Normal file
5
firmware/blinky/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.20.0)
|
||||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||
project(blinky)
|
||||
|
||||
target_sources(app PRIVATE src/main.c)
|
1
firmware/blinky/prj.conf
Normal file
1
firmware/blinky/prj.conf
Normal file
@ -0,0 +1 @@
|
||||
CONFIG_GPIO=y
|
52
firmware/blinky/src/main.c
Normal file
52
firmware/blinky/src/main.c
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/drivers/gpio.h>
|
||||
|
||||
/* 1000 msec = 1 sec */
|
||||
#define SLEEP_TIME_MS 100
|
||||
|
||||
/* The devicetree node identifier for the "led0" alias. */
|
||||
#define LED0_NODE DT_ALIAS(led0)
|
||||
|
||||
/*
|
||||
* A build error on this line means your board is unsupported.
|
||||
* See the sample documentation for information on how to fix this.
|
||||
*/
|
||||
static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int ret;
|
||||
bool led_state = true;
|
||||
|
||||
if (!gpio_is_ready_dt(&led))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
|
||||
if (ret < 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (1)
|
||||
{
|
||||
ret = gpio_pin_toggle_dt(&led);
|
||||
if (ret < 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
led_state = !led_state;
|
||||
printf("LED state: %s\n", led_state ? "ON" : "OFF");
|
||||
k_msleep(SLEEP_TIME_MS);
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -1,6 +1,3 @@
|
||||
# Copyright (c) 2021 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
manifest:
|
||||
self:
|
||||
west-commands: scripts/west-commands.yml
|
||||
@ -8,23 +5,22 @@ manifest:
|
||||
remotes:
|
||||
- name: zephyrproject-rtos
|
||||
url-base: https://github.com/zephyrproject-rtos
|
||||
- name: mcu-tools
|
||||
url-base: https://github.com/mcu-tools
|
||||
# - name: mcu-tools
|
||||
# url-base: https://github.com/mcu-tools
|
||||
|
||||
projects:
|
||||
- name: zephyr
|
||||
remote: zephyrproject-rtos
|
||||
revision: main
|
||||
# revision: v3.6.0
|
||||
import:
|
||||
# By using name-allowlist we can clone only the modules that are
|
||||
# strictly needed by the application.
|
||||
name-allowlist:
|
||||
- cmsis # required by the ARM port
|
||||
- hal_nordic # required by the custom_plank board (Nordic based)
|
||||
- hal_stm32 # required by the nucleo_f302r8 board (STM32 based)
|
||||
- zcbor # required by mcuboot serial
|
||||
- tinycrypt
|
||||
- name: mcuboot
|
||||
remote: mcu-tools
|
||||
revision: main
|
||||
import: true
|
||||
# # By using name-allowlist we can clone only the modules that are
|
||||
# # strictly needed by the application.
|
||||
# name-allowlist:
|
||||
# - cmsis # required by the ARM port
|
||||
# - hal_nordic # required by the custom_plank board (Nordic based)
|
||||
# - hal_stm32 # required by the nucleo_f302r8 board (STM32 based)
|
||||
# - zcbor # required by mcuboot serial
|
||||
# - tinycrypt
|
||||
# - name: mcuboot
|
||||
# remote: mcu-tools
|
||||
# revision: main
|
||||
|
Reference in New Issue
Block a user