diff options
author | xengineering <me@xengineering.eu> | 2025-03-21 21:52:38 +0100 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2025-03-21 21:52:38 +0100 |
commit | f0561bc721f783487ebdd3cbd1424cf116d48712 (patch) | |
tree | 44a8b6cd19275eb2fa89b0e4d85a2b432b4d38a1 | |
parent | ff74e7ca54dabf41720e9739ff59ba816e92cec9 (diff) | |
download | iot-contact-f0561bc721f783487ebdd3cbd1424cf116d48712.tar iot-contact-f0561bc721f783487ebdd3cbd1424cf116d48712.tar.zst iot-contact-f0561bc721f783487ebdd3cbd1424cf116d48712.zip |
fw: Remove GPIO-based logic
This makes it easier to develop the whole network-related firmware parts
on a simulation board instead of hardware.
The nucleo_f767zi board has likely a hardware bug making Ethernet
sometimes fail. This is not suitable for development.
-rw-r--r-- | fw/prj.conf | 2 | ||||
-rw-r--r-- | fw/src/main.c | 41 |
2 files changed, 0 insertions, 43 deletions
diff --git a/fw/prj.conf b/fw/prj.conf index 2485227..9c84c48 100644 --- a/fw/prj.conf +++ b/fw/prj.conf @@ -7,5 +7,3 @@ CONFIG_SHELL_PROMPT_UART="[iot-contact] " CONFIG_NETWORKING=y CONFIG_NET_SHELL=y - -CONFIG_GPIO=y diff --git a/fw/src/main.c b/fw/src/main.c index 9390505..228422c 100644 --- a/fw/src/main.c +++ b/fw/src/main.c @@ -4,49 +4,8 @@ * obtain one at https://mozilla.org/MPL/2.0/. */ -#include <zephyr/kernel.h> -#include <zephyr/device.h> -#include <zephyr/drivers/gpio.h> - -#define SW0_NODE DT_ALIAS(sw0) -#if !DT_NODE_HAS_STATUS(SW0_NODE, okay) -#error "Unsupported board: Devicetree alias for button is not defined" -#endif -static const struct gpio_dt_spec button = GPIO_DT_SPEC_GET(SW0_NODE, gpios); -static struct gpio_callback button_cb_data; - -void button_pressed(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) -{ - printk("Button pressed\n"); -} int main(void) { - int ret; - - if (!gpio_is_ready_dt(&button)) { - printk("Error: button device %s is not ready\n", - button.port->name); - return 0; - } - - ret = gpio_pin_configure_dt(&button, GPIO_INPUT); - if (ret != 0) { - printk("Error %d: failed to configure %s pin %d\n", - ret, button.port->name, button.pin); - return 0; - } - - ret = gpio_pin_interrupt_configure_dt(&button, GPIO_INT_EDGE_TO_ACTIVE); - if (ret != 0) { - printk("Error %d: failed to configure interrupt on %s pin %d\n", - ret, button.port->name, button.pin); - return 0; - } - - gpio_init_callback(&button_cb_data, button_pressed, BIT(button.pin)); - gpio_add_callback(button.port, &button_cb_data); - return 0; } |