Added IR Lib, samples and specification
All checks were successful
Deploy Docs / build-and-deploy (push) Successful in 12s

This commit is contained in:
2026-01-04 20:53:39 +01:00
parent 2cb0a33b8e
commit 667600c14e
19 changed files with 546 additions and 6 deletions

View 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)

View 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.

View File

@@ -0,0 +1 @@
../../../../boards/nrf52840dk/nrf52840dk_nrf52840.overlay

View 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

View 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);
}
}

View File

@@ -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)

View File

@@ -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)