summaryrefslogtreecommitdiff
path: root/code/main/teensy_goalie
diff options
context:
space:
mode:
Diffstat (limited to 'code/main/teensy_goalie')
-rw-r--r--code/main/teensy_goalie/Kconfig29
-rw-r--r--code/main/teensy_goalie/prj.conf2
-rw-r--r--code/main/teensy_goalie/src/main.c20
-rw-r--r--code/main/teensy_goalie/teensy41.overlay22
4 files changed, 41 insertions, 32 deletions
diff --git a/code/main/teensy_goalie/Kconfig b/code/main/teensy_goalie/Kconfig
new file mode 100644
index 0000000..6d66ff8
--- /dev/null
+++ b/code/main/teensy_goalie/Kconfig
@@ -0,0 +1,29 @@
+# Copyright (c) 2024 TOKITA Hiroshi
+# SPDX-License-Identifier: Apache-2.0
+
+config BLINK_DELAY_SHORT
+ int "Blinking delay for short cycle demo"
+ default 100
+ help
+ Specifies the LED on/off delay in milliseconds for short cycle
+ blinking demonstration.
+ If set to 0, the short-cycle blinking demo will not be performed.
+
+config BLINK_DELAY_LONG
+ int "Blinking delay for long cycle demo"
+ default 1000
+ help
+ Specifies the LED on/off delay in milliseconds for long cycle
+ blinking demonstration.
+ If set to 0, the long-cycle blinking demo will not be performed.
+
+config FADE_DELAY
+ int "Delay time for fade demo"
+ default 10
+ help
+ Specifies the delay in milliseconds for the fade demo of the
+ PWM-LED sample.
+ The brightness gradually increases by one level each time this
+ delay elapses.
+
+source "Kconfig.zephyr"
diff --git a/code/main/teensy_goalie/prj.conf b/code/main/teensy_goalie/prj.conf
index 8379fac..0c1e16f 100644
--- a/code/main/teensy_goalie/prj.conf
+++ b/code/main/teensy_goalie/prj.conf
@@ -7,3 +7,5 @@ CONFIG_PWM=y
CONFIG_LOG=y
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_PWM_LOG_LEVEL_DBG=y
+CONFIG_LED=y
+CONFIG_LED_PWM=y
diff --git a/code/main/teensy_goalie/src/main.c b/code/main/teensy_goalie/src/main.c
index 137e898..4dd3f24 100644
--- a/code/main/teensy_goalie/src/main.c
+++ b/code/main/teensy_goalie/src/main.c
@@ -1,17 +1,3 @@
-#include <stdio.h>
-#include <zephyr/kernel.h>
-#include <zephyr/sys/printk.h>
-#include <zephyr/device.h>
-#include <zephyr/drivers/pwm.h>
-#include <zephyr/devicetree.h>
-#include <zephyr/drivers/gpio.h>
-
-// Settings
-#define PWM_PERIOD_NS 20000000
-#define PWM_PULSE_WIDTH 1400000
-static const int32_t sleep_time_ms = 100;
-static const struct gpio_dt_spec btn = GPIO_DT_SPEC_GET(DT_ALIAS(powerswitch), gpios);
-static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(DT_ALIAS(redled), gpios);
-
-#define LED0_NODE DT_ALIAS(redled)
-#define PWM_LED0 DT_ALIAS(en3a)
+#include <zephyr.h>
+#include <drivers/pwm.h>
+#include <sys/printk.h>
diff --git a/code/main/teensy_goalie/teensy41.overlay b/code/main/teensy_goalie/teensy41.overlay
index 3b023e3..96707e8 100644
--- a/code/main/teensy_goalie/teensy41.overlay
+++ b/code/main/teensy_goalie/teensy41.overlay
@@ -7,13 +7,14 @@
* https://www.digikey.be/en/maker/tutorials/2025/introduction-to-zephyr-part-4-devicetree-tutorial
*
*/
+
/ {
aliases {
powerswitch = &soft_power_switch;
redled = &red_led;
greenled = &green_led;
bueled = &blue_led;
- en3a = &pwm_dev0;
+
};
buttons {
@@ -40,19 +41,10 @@
label = "LED Pin 16 --> BLUE";
};
};
- pwmdevs {
- compatible = "imx-pwm";
- pwm_dev0: pwm_dev_0 {
- pwms = <&gpio2 10>;
- };
- };
-
-};
-&flexpwm1 {
- status = "ok";
- flexpwm1_pwm0: flexpwm1_pwm0 {
- status = "ok";
+ flexpwm{
+ compatible = "nxp,flexio-pwm";
+ test: blue-test {
+ label = "GPIO4_5 --> PIN3 --> Driver";
+ };
};
-
};
-