/*
 * 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);
	}
}

