init
This commit is contained in:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
build/
|
||||||
|
.vscode/
|
||||||
|
|
||||||
7
CMakeLists.txt
Normal file
7
CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.20.0)
|
||||||
|
|
||||||
|
set(BOARD adafruit_feather_nrf52840)
|
||||||
|
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||||
|
project(passr)
|
||||||
|
|
||||||
|
target_sources(app PRIVATE src/main.c)
|
||||||
0
app.overlay
Normal file
0
app.overlay
Normal file
4
prj.conf
Normal file
4
prj.conf
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
CONFIG_GPIO=y
|
||||||
|
# CONFIG_BT=y
|
||||||
|
# CONFIG_BT_DEBUG_LOG=y
|
||||||
|
# CONFIG_BT_DEVICE_NAME="Test beacon"
|
||||||
37
src/main.c
Normal file
37
src/main.c
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
#include <zephyr/zephyr.h>
|
||||||
|
#include <zephyr/drivers/gpio.h>
|
||||||
|
|
||||||
|
/* 1000 msec = 1 sec */
|
||||||
|
#define SLEEP_TIME_MS 1000
|
||||||
|
|
||||||
|
/* The devicetree node identifier for the "led0" alias. */
|
||||||
|
#define LED0_NODE DT_ALIAS(led1)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
|
||||||
|
void main(void)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (!device_is_ready(led.port)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
|
||||||
|
if (ret < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
ret = gpio_pin_toggle_dt(&led);
|
||||||
|
if (ret < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
k_msleep(SLEEP_TIME_MS);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user