Added IR Lib, samples and specification
All checks were successful
Deploy Docs / build-and-deploy (push) Successful in 12s
All checks were successful
Deploy Docs / build-and-deploy (push) Successful in 12s
This commit is contained in:
10
firmware/apps/_samples/ir_send/CMakeLists.txt
Normal file
10
firmware/apps/_samples/ir_send/CMakeLists.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
# Tell Zephyr to look into our libs folder for extra modules
|
||||
list(APPEND ZEPHYR_EXTRA_MODULES ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs)
|
||||
|
||||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||
project(ir_send)
|
||||
|
||||
# Define application source files
|
||||
target_sources(app PRIVATE src/main.c)
|
||||
13
firmware/apps/_samples/ir_send/Kconfig
Normal file
13
firmware/apps/_samples/ir_send/Kconfig
Normal file
@@ -0,0 +1,13 @@
|
||||
config IR_SEND_SAMPLE_BURST_US
|
||||
int "IR test burst length (microseconds)"
|
||||
default 1000
|
||||
range 50 100000
|
||||
help
|
||||
Duration of the carrier burst for each test pulse in the sample app.
|
||||
|
||||
config IR_SEND_SAMPLE_PERIOD_MS
|
||||
int "IR test burst period (milliseconds)"
|
||||
default 1000
|
||||
range 10 60000
|
||||
help
|
||||
Interval between consecutive test bursts in the sample app.
|
||||
@@ -0,0 +1 @@
|
||||
../../../../boards/nrf52840dk/nrf52840dk_nrf52840.overlay
|
||||
13
firmware/apps/_samples/ir_send/prj.conf
Normal file
13
firmware/apps/_samples/ir_send/prj.conf
Normal file
@@ -0,0 +1,13 @@
|
||||
# Logging
|
||||
CONFIG_LOG=y
|
||||
|
||||
# IR Send Library
|
||||
CONFIG_IR_SEND=y
|
||||
|
||||
# PWM driver for IR carrier
|
||||
CONFIG_PWM=y
|
||||
CONFIG_PWM_NRFX=y
|
||||
|
||||
# Sample test configuration
|
||||
CONFIG_IR_SEND_SAMPLE_BURST_US=1000
|
||||
CONFIG_IR_SEND_SAMPLE_PERIOD_MS=1000
|
||||
37
firmware/apps/_samples/ir_send/src/main.c
Normal file
37
firmware/apps/_samples/ir_send/src/main.c
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* ir_send sample app - IR transmission test
|
||||
*/
|
||||
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
|
||||
#include "ir_send.h"
|
||||
|
||||
LOG_MODULE_REGISTER(ir_send);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
LOG_INF("=== IR Send Sample ===");
|
||||
LOG_INF("Board: %s", CONFIG_BOARD);
|
||||
|
||||
int ret = ir_send_init();
|
||||
if (ret != 0) {
|
||||
LOG_ERR("Failed to initialize IR send: %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ir_send_set_frequency(CONFIG_IR_SEND_CARRIER_HZ);
|
||||
LOG_INF("Ready to test IR transmission (burst %u us every %u ms @ %u Hz)",
|
||||
CONFIG_IR_SEND_SAMPLE_BURST_US,
|
||||
CONFIG_IR_SEND_SAMPLE_PERIOD_MS,
|
||||
CONFIG_IR_SEND_CARRIER_HZ);
|
||||
|
||||
while (true) {
|
||||
ret = ir_send_pulse(CONFIG_IR_SEND_SAMPLE_BURST_US);
|
||||
if (ret != 0) {
|
||||
LOG_ERR("ir_send_pulse failed: %d", ret);
|
||||
}
|
||||
k_msleep(CONFIG_IR_SEND_SAMPLE_PERIOD_MS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@ cmake_minimum_required(VERSION 3.20)
|
||||
# Tell Zephyr to look into our libs folder for extra modules
|
||||
list(APPEND ZEPHYR_EXTRA_MODULES ${CMAKE_CURRENT_SOURCE_DIR}/../../libs)
|
||||
|
||||
# Set board root to find custom board overlays in firmware/boards
|
||||
set(BOARD_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..)
|
||||
|
||||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||
project(lasertag_leader)
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ cmake_minimum_required(VERSION 3.20)
|
||||
# Zephyr mitteilen, dass unsere Libs Teil des Projekts sind
|
||||
list(APPEND ZEPHYR_EXTRA_MODULES ${CMAKE_CURRENT_SOURCE_DIR}/../../libs)
|
||||
|
||||
# Set board root to find custom board overlays in firmware/boards
|
||||
set(BOARD_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..)
|
||||
|
||||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||
project(lasertag_weapon)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user