summaryrefslogtreecommitdiff
path: root/code/main/teensy_goalie/src
diff options
context:
space:
mode:
authorAbel Tim <git@abeltim.com>2025-06-12 10:28:13 +0200
committerAbel Tim <git@abeltim.com>2025-06-12 10:28:13 +0200
commitf6832123c23f394c3069bad6f8b19a896c705e51 (patch)
tree03301be92270c03498778d1ae0c5bc7f7f686891 /code/main/teensy_goalie/src
parent66a1669fd97feb4d026778c486e0db58baa0c687 (diff)
downloadrobotica-f6832123c23f394c3069bad6f8b19a896c705e51.tar.gz
robotica-f6832123c23f394c3069bad6f8b19a896c705e51.zip
recenltly removed three commit becouse it included files that shouldn't be included.
Did reset hard, localy unstaged commits, deleted files and recommited the good files. think this is all i did since, -changed extra PCB name to bave and _ instead of a space so i dont have to use "" -added button and led to teensy41 goaly overlay -started on PWM, not complete Abel Tim <git@abeltim.com>
Diffstat (limited to 'code/main/teensy_goalie/src')
-rw-r--r--code/main/teensy_goalie/src/main.c55
1 files changed, 12 insertions, 43 deletions
diff --git a/code/main/teensy_goalie/src/main.c b/code/main/teensy_goalie/src/main.c
index f8aff35..137e898 100644
--- a/code/main/teensy_goalie/src/main.c
+++ b/code/main/teensy_goalie/src/main.c
@@ -1,48 +1,17 @@
-/*
- * Copyright (c) 2016 Intel Corporation
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
#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>
-/* 1000 msec = 1 sec */
-#define SLEEP_TIME_MS 1000
-
-/* The devicetree node identifier for the "led0" alias. */
-#define LED0_NODE DT_ALIAS(led0)
-
-/*
- * 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);
-
-int main(void)
-{
- int ret;
- bool led_state = true;
-
- if (!gpio_is_ready_dt(&led)) {
- return 0;
- }
-
- ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
- if (ret < 0) {
- return 0;
- }
-
- while (1) {
- ret = gpio_pin_toggle_dt(&led);
- if (ret < 0) {
- return 0;
- }
+// 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);
- led_state = !led_state;
- printf("LED state: %s\n", led_state ? "ON" : "OFF");
- k_msleep(SLEEP_TIME_MS);
- }
- return 0;
-}
+#define LED0_NODE DT_ALIAS(redled)
+#define PWM_LED0 DT_ALIAS(en3a)