Skip to content

Commit bb01833

Browse files
reformat example readmes
1 parent d8aa288 commit bb01833

3 files changed

Lines changed: 33 additions & 38 deletions

File tree

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
1-
Arduino peripheral examples
2-
==========================
1+
# Arduino peripheral examples
2+
3+
## Purpose
34

4-
Purpose
5-
-------
65
These sketches turn an Arduino (or compatible MCU board) into a simple I2C peripheral so the `examples/*` programs can be tested using real hardware.
76

8-
What’s here
9-
-----------
7+
## What’s here
8+
109
- `arduino_simple_peripheral/` — maintains a single byte register that can be written/read via I2C.
11-
- `arduino_multiplier_peripheral/` — simple demo: writes an input X, stores R = X*5, serves R on request.
10+
- `arduino_multiplier_peripheral/` — simple demo: writes an input X, stores R = X\*5, serves R on request.
11+
12+
## Safety & wiring
1213

13-
Safety & wiring
14-
---------------
1514
- Connect SDA, SCL and GND between your host SBC (Raspberry Pi etc.) and the Arduino board. DO NOT connect 3.3V <-> 5V without level shifting if your host uses 3.3V.
1615
- Sketches use `Wire` library and expect slave address `0x40` by default — adjust as needed.
1716

18-
How to use
19-
----------
17+
## How to use
18+
2019
1. Flash one of the sketches to your Arduino.
2120
2. Wire: connect GND to GND, SDA to SDA, SCL to SCL on the host.
2221
3. Run the host-side example that matches the sketch (e.g. `master_multiplier_*`) and set the bus path if necessary: e.g. `Wire.begin("/dev/i2c-1")` in the example binaries.
2322

24-
Notes
25-
-----
23+
## Notes
24+
2625
- These sketches are examples only — use real device datasheets and level-shifting practices in production setups.

examples/c/README.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
1-
Examples — C
2-
===============
1+
# Examples — C
2+
3+
## Purpose
34

4-
Purpose
5-
-------
65
This folder contains small C example programs that exercise the linux-wire C API (examples/cpp are the C++ equivalents).
76

8-
Safety first — read before running
9-
-------------------------------
10-
- These examples talk to /dev/i2c-* devices. That is literal hardware (buses and devices).
7+
## Safety first — read before running
8+
9+
- These examples talk to /dev/i2c-\* devices. That is literal hardware (buses and devices).
1110
- Scanning and writing may change device state and can harm peripherals. Do NOT run write examples against hardware you don't own/understand.
1211

13-
Permissions and access
14-
----------------------
12+
## Permissions and access
13+
1514
- Prefer running as an unprivileged user that belongs to the `i2c` group. If you need elevated permissions, use sudo.
1615
- Example device path: `/dev/i2c-1`. Adjust to your platform (e.g. `/dev/i2c-0` or other bus numbers).
1716

18-
How to build and run
19-
--------------------
17+
## How to build and run
18+
2019
1. From the project root:
2120

2221
```sh
@@ -31,12 +30,12 @@ How to build and run
3130
- `master_reader_c` — read a register (repeated-start)
3231
- `master_multiplier_c` — demo request/response
3332

34-
Quick safety checklist
35-
---------------------
33+
## Quick safety checklist
34+
3635
- Confirm the correct bus file exists (e.g., `ls /dev/i2c-*`).
3736
- Prefer the strict scanner if you need to avoid false positives, but be aware it performs writes.
3837
- Never run write examples unless you know the target device address and register behavior.
3938

40-
Questions/Problems
41-
-----------------
39+
## Questions/Problems
40+
4241
If you hit permission or device-not-found errors, check group membership, device path, and that the I2C kernel driver is loaded.

examples/cpp/README.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
1-
Examples — C++
2-
================
1+
# Examples — C++
2+
3+
## Purpose
34

4-
Purpose
5-
-------
65
Small C++ example programs that use the TwoWire (Wire) interface provided by linux-wire.
76

8-
Quick safety checklist
9-
---------------------
7+
## Quick safety checklist
108

119
- These examples operate on `/dev/i2c-*` devices. Scanning and writes talk to real hardware.
1210
- Do not run write examples against unknown devices — they may change configuration or damage hardware.
1311
- Prefer running as a user in the `i2c` group; use sudo only when necessary.
1412

15-
Common build/run
16-
----------------
13+
## Common build/run
1714

1815
Build from the repo root:
1916

@@ -30,7 +27,7 @@ Representative binary names (in `build/`):
3027
- `master_reader_cpp`
3128
- `master_multiplier_cpp`
3229

33-
Notes
34-
-----
30+
## Notes
31+
3532
- Use the strict scanner if you need to force a data-phase ACK (it performs a write probe).
3633
- Examples are tiny demos; they are not production-grade I2C tools — use with caution.

0 commit comments

Comments
 (0)