Ehu shubham shaw contribution --> Hardware support (#306)
* feat: add ZeroClaw firmware for ESP32 and Nucleo * Introduced new firmware for ZeroClaw on ESP32 and Nucleo-F401RE, enabling JSON-over-serial communication for GPIO control. * Added `zeroclaw-esp32` with support for commands like `gpio_read` and `gpio_write`, along with capabilities reporting. * Implemented `zeroclaw-nucleo` firmware with similar functionality for STM32, ensuring compatibility with existing ZeroClaw protocols. * Updated `.gitignore` to include new firmware targets and added necessary dependencies in `Cargo.toml` for both platforms. * Created README files for both firmware projects detailing setup, build, and usage instructions. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> * feat: enhance hardware peripheral support and documentation - Added `Peripheral` trait implementation in `src/peripherals/` to manage hardware boards (STM32, RPi GPIO). - Updated `AGENTS.md` to include new extension points for peripherals and their configuration. - Introduced comprehensive documentation for adding boards and tools, including a quick start guide and supported boards. - Enhanced `Cargo.toml` to include optional dependencies for PDF extraction and peripheral support. - Created new datasheets for Arduino Uno, ESP32, and Nucleo-F401RE, detailing pin aliases and GPIO usage. - Implemented new tools for hardware memory reading and board information retrieval in the agent loop. This update significantly improves the integration and usability of hardware peripherals within the ZeroClaw framework. * feat: add ZeroClaw firmware for ESP32 and Nucleo * Introduced new firmware for ZeroClaw on ESP32 and Nucleo-F401RE, enabling JSON-over-serial communication for GPIO control. * Added `zeroclaw-esp32` with support for commands like `gpio_read` and `gpio_write`, along with capabilities reporting. * Implemented `zeroclaw-nucleo` firmware with similar functionality for STM32, ensuring compatibility with existing ZeroClaw protocols. * Updated `.gitignore` to include new firmware targets and added necessary dependencies in `Cargo.toml` for both platforms. * Created README files for both firmware projects detailing setup, build, and usage instructions. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> * feat: enhance hardware peripheral support and documentation - Added `Peripheral` trait implementation in `src/peripherals/` to manage hardware boards (STM32, RPi GPIO). - Updated `AGENTS.md` to include new extension points for peripherals and their configuration. - Introduced comprehensive documentation for adding boards and tools, including a quick start guide and supported boards. - Enhanced `Cargo.toml` to include optional dependencies for PDF extraction and peripheral support. - Created new datasheets for Arduino Uno, ESP32, and Nucleo-F401RE, detailing pin aliases and GPIO usage. - Implemented new tools for hardware memory reading and board information retrieval in the agent loop. This update significantly improves the integration and usability of hardware peripherals within the ZeroClaw framework. * feat: Introduce hardware auto-discovery and expanded configuration options for agents, hardware, and security. * chore: update dependencies and improve probe-rs integration - Updated `Cargo.lock` to remove specific version constraints for several dependencies, including `zerocopy`, `syn`, and `strsim`, allowing for more flexibility in version resolution. - Upgraded `bincode` and `bitfield` to their latest versions, enhancing serialization and memory management capabilities. - Updated `Cargo.toml` to reflect the new version of `probe-rs` from `0.24` to `0.30`, improving hardware probing functionality. - Refactored code in `src/hardware` and `src/tools` to utilize the new `SessionConfig` for session management in `probe-rs`, ensuring better compatibility and performance. - Cleaned up documentation in `docs/datasheets/nucleo-f401re.md` by removing unnecessary lines. * fix: apply cargo fmt * docs: add hardware architecture diagram. --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b36f23784a
commit
de3ec87d16
59 changed files with 9607 additions and 1885 deletions
9
firmware/zeroclaw-uno-q-bridge/app.yaml
Normal file
9
firmware/zeroclaw-uno-q-bridge/app.yaml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
name: ZeroClaw Bridge
|
||||
description: "GPIO bridge for ZeroClaw — exposes digitalWrite/digitalRead via socket for agent control"
|
||||
icon: 🦀
|
||||
version: "1.0.0"
|
||||
|
||||
ports:
|
||||
- 9999
|
||||
|
||||
bricks: []
|
||||
66
firmware/zeroclaw-uno-q-bridge/python/main.py
Normal file
66
firmware/zeroclaw-uno-q-bridge/python/main.py
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
# ZeroClaw Bridge — socket server for GPIO control from ZeroClaw agent
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
import socket
|
||||
import threading
|
||||
from arduino.app_utils import App, Bridge
|
||||
|
||||
ZEROCLAW_PORT = 9999
|
||||
|
||||
def handle_client(conn):
|
||||
try:
|
||||
data = conn.recv(256).decode().strip()
|
||||
if not data:
|
||||
conn.close()
|
||||
return
|
||||
parts = data.split()
|
||||
if len(parts) < 2:
|
||||
conn.sendall(b"error: invalid command\n")
|
||||
conn.close()
|
||||
return
|
||||
cmd = parts[0].lower()
|
||||
if cmd == "gpio_write" and len(parts) >= 3:
|
||||
pin = int(parts[1])
|
||||
value = int(parts[2])
|
||||
Bridge.call("digitalWrite", [pin, value])
|
||||
conn.sendall(b"ok\n")
|
||||
elif cmd == "gpio_read" and len(parts) >= 2:
|
||||
pin = int(parts[1])
|
||||
val = Bridge.call("digitalRead", [pin])
|
||||
conn.sendall(f"{val}\n".encode())
|
||||
else:
|
||||
conn.sendall(b"error: unknown command\n")
|
||||
except Exception as e:
|
||||
try:
|
||||
conn.sendall(f"error: {e}\n".encode())
|
||||
except Exception:
|
||||
pass
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
def accept_loop(server):
|
||||
while True:
|
||||
try:
|
||||
conn, _ = server.accept()
|
||||
t = threading.Thread(target=handle_client, args=(conn,))
|
||||
t.daemon = True
|
||||
t.start()
|
||||
except Exception:
|
||||
break
|
||||
|
||||
def loop():
|
||||
App.sleep(1)
|
||||
|
||||
def main():
|
||||
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
server.bind(("127.0.0.1", ZEROCLAW_PORT))
|
||||
server.listen(5)
|
||||
server.settimeout(1.0)
|
||||
t = threading.Thread(target=accept_loop, args=(server,))
|
||||
t.daemon = True
|
||||
t.start()
|
||||
App.run(user_loop=loop)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
1
firmware/zeroclaw-uno-q-bridge/python/requirements.txt
Normal file
1
firmware/zeroclaw-uno-q-bridge/python/requirements.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
# ZeroClaw Bridge — no extra deps (arduino.app_utils is preinstalled on Uno Q)
|
||||
24
firmware/zeroclaw-uno-q-bridge/sketch/sketch.ino
Normal file
24
firmware/zeroclaw-uno-q-bridge/sketch/sketch.ino
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
// ZeroClaw Bridge — expose digitalWrite/digitalRead for agent GPIO control
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
#include "Arduino_RouterBridge.h"
|
||||
|
||||
void gpio_write(int pin, int value) {
|
||||
pinMode(pin, OUTPUT);
|
||||
digitalWrite(pin, value ? HIGH : LOW);
|
||||
}
|
||||
|
||||
int gpio_read(int pin) {
|
||||
pinMode(pin, INPUT);
|
||||
return digitalRead(pin);
|
||||
}
|
||||
|
||||
void setup() {
|
||||
Bridge.begin();
|
||||
Bridge.provide("digitalWrite", gpio_write);
|
||||
Bridge.provide("digitalRead", gpio_read);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Bridge.update();
|
||||
}
|
||||
11
firmware/zeroclaw-uno-q-bridge/sketch/sketch.yaml
Normal file
11
firmware/zeroclaw-uno-q-bridge/sketch/sketch.yaml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
profiles:
|
||||
default:
|
||||
fqbn: arduino:zephyr:unoq
|
||||
platforms:
|
||||
- platform: arduino:zephyr
|
||||
libraries:
|
||||
- MsgPack (0.4.2)
|
||||
- DebugLog (0.8.4)
|
||||
- ArxContainer (0.7.0)
|
||||
- ArxTypeTraits (0.3.1)
|
||||
default_profile: default
|
||||
Loading…
Add table
Add a link
Reference in a new issue