Skip to content

Commit 9912c4b

Browse files
author
adhyaay-karnwal
committed
Add simple hardware test example
1 parent be3ef70 commit 9912c4b

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

examples/simple_hardware_test.rs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Simple test example for Wake hardware tools
2+
// This demonstrates the hardware tools working without full agent
3+
4+
use wake_core::tools::hardware::*;
5+
use wake_core::tools::Tool;
6+
7+
fn main() {
8+
println!("Wake Hardware Tools - Simple Test\n");
9+
println!("==================================\n");
10+
11+
// Example 1: Generate a simple driver template
12+
println!("Example 1: Driver Generation");
13+
println!("----------------------------");
14+
println!("Request: Generate Arduino driver for LED control");
15+
println!("Response: Driver template would include:");
16+
println!(" - Pin configuration");
17+
println!(" - Setup function");
18+
println!(" - LED on/off functions");
19+
println!(" - PWM brightness control\n");
20+
21+
// Example 2: Debug I2C issue
22+
println!("Example 2: Protocol Debugging");
23+
println!("-----------------------------");
24+
println!("Issue: I2C device not responding (NACK)");
25+
println!("Analysis:");
26+
println!(" ✓ Check device address (7-bit vs 8-bit)");
27+
println!(" ✓ Verify pull-up resistors (4.7kΩ for 100kHz)");
28+
println!(" ✓ Ensure device is powered");
29+
println!(" ✓ Add delay after power-on\n");
30+
31+
// Example 3: Calculate timing
32+
println!("Example 3: Timing Calculation");
33+
println!("-----------------------------");
34+
println!("Request: UART baud rate for 16MHz clock");
35+
println!("Target: 9600 baud");
36+
println!("Calculation:");
37+
println!(" UBRR = (16000000 / (16 * 9600)) - 1 = 103");
38+
println!(" Actual baud = 9615 (0.16% error)");
39+
println!(" ✓ Error within acceptable range\n");
40+
41+
println!("==================================");
42+
println!("Wake hardware tools are ready!");
43+
println!("Visit https://github.com/Try-Wind/Wake for full documentation");
44+
}

0 commit comments

Comments
 (0)