rotary working

This commit is contained in:
Nathan Rashleigh committed 2026-06-30 11:32:12 +10:00
1 parent 5386699f7b
commit 143f524f2a
4 files changed
+63 -37

No files matched your search

+37 -32
View File
@@ -29,33 +29,32 @@ Target board: **STM32F4-Discovery (STM32F411VE)**. Firmware: `src/main.rs`
## 2. Schematic
```
STM32F4-Discovery Rotary encoder (EC11, 7-leg)
STM32F4-Discovery Rotary encoder (EC11, 7-leg)
┌──────────────┐
│ 3V ●───────────┬───────────┬──────────────┐
│ 3V ●───────────┬────────────┬──────────────┐
│ │ │ │ │
│ │ ┌┴┐ ┌┴┐ │
│ │ 10k │ │ 10k │ │ │ (pull-ups
│ │ 10k │ │ 10k │ │ │ (pull-ups
│ │ └┬┘ └┬┘ │ to 3V)
│ │ │ │ │
│ PE9 (CH1) ●─┼───────────┼────────────● A (CLK) │
│ PE9 (CH1) ●───────────┼────────────● A (CLK) │
│ │ │ │ │
│ │ 100n═╪═ 100n═╪═ │
│ │ 100n ═╪═ 100n ═╪═ │
│ │ │ │ │
│ PE11 (CH2) ●─┼───────────●────────────┼──● B (DT) │
│ │ │ │
│ PE11 (CH2) ●───────────●────────────┼──● B (DT) │
│ │ │
│ │ ● C (common)──┼──┐
│ │ │ │
│ │ SW1 ●────────────────┘ │
│ PA0 ●───────────────────┐ │ (push-switch) │
│ │ │ ● SW2 ─────────────┼──┐
│ GND ●──────┬─────────────┼─────────────────────┘ │
│ │ │ │ mount legs ●●─────────┘
└──────────────┘ │ │ (to GND, shield)
│ │
┌──────┴──────┐ │ B1 (on-board) also sits
│ both 100n │ │ 3V ↔ PA0 — encoder SW is
│ caps → GND │ └─ in PARALLEL with it.
└─────────────┘
│ │ SW1 ●────┘ │
│ PA0 ●──────────────────────────────────● SW2 │ (push-switch, ‖ B1)
│ GND ●──────┬───────────────────────────────────┘
│ │ │ mount legs ●● → GND (shield)
└──────────────┘ │
│ B1 (on-board) also sits 3V ↔ PA0 —
┌─────┴──────┐ the encoder push-switch is in
│ both 100n │ PARALLEL with it.
│ caps → GND │
└────────────┘
```
---
@@ -63,20 +62,26 @@ Target board: **STM32F4-Discovery (STM32F411VE)**. Firmware: `src/main.rs`
## 3. Breadboard view
```
3V rail ●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━● ← jumper from Discovery 3V
GND rail ●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━● ← jumper from Discovery GND
┌──────────────────────────────────────────────────┐
│ [10k] [10k] encoder straddles trench │
│ │ │ │ │ ┌──────────────────────┐ │
3V ──┴─┘ └──┬──┘ └──┬──────┤ A C B │ SW1 SW2 ├─┐ │
│ │ │ └──┼────┼────┼───┼────┼──┘ │ │
│ [100n] [100n] │ GND │ 3V PA0 │ │
│ │ │ │ │ │ │
GND ─┴─────┴───────┴───────────┘ │ │ │
│ │ │ │
│ A → PE9 B → PE11 SW2 → PA0 │ │
└──────────────────────────────────────────────────┘
(jumper) (jumper) (jumper, ‖ B1)
RC filter — repeat for each channel (A, B):
3V rail ●━━━┯━━━━━━━━━━━┯━━━━● ← from Discovery 3V
│ │
[10k] [10k]
A node ┼───→ PE9 │
B node │ ┼───→ PE11
[100n] [100n]
│ │
GND rail ●━━━┷━━━━━━━━━━━┷━━━━● ← from Discovery GND
EC11 encoder — straddles the centre trench (┊):
┌─────────────────────────────┐
│ A C B ┊ SW1 SW2 │
└──┬────┬────┬───────┬─────┬──┘
│ │ │ │ └───────→ PA0 (SW2 ‖ on-board B1 button)
│ │ │ └─────────────→ 3V rail (SW1)
│ │ └─────────────────────→ B node (DT, channel B → PE11)
│ └──────────────────────────→ GND rail (C = common)
└───────────────────────────────→ A node (CLK, channel A → PE9)
```
Power both breadboard rails from the Discovery's **3V** and **GND** pins; tap