Commit 7cc3816
committed
feat(cdc): add a 1200 bps touch hook
The Arduino convention for asking a board to reboot into its bootloader is
for the host to set the CDC line coding to 1200 bps and then close the port.
The core tracks both halves already, in linecoding.bitrate and dtrState, but
nothing acts on the combination, so a sketch has to poll Serial.baud() and
Serial.dtr() from loop() and misses the event whenever loop() is busy.
Add cdc_1200bps_touchHook(), a weak no-op alongside yield() and
dtr_togglingHook(), called from CDC_SET_CONTROL_LINE_STATE when the port is
closed at 1200 bps. dtr_togglingHook() cannot serve here because it is
invoked from USBD_CDC_Receive and so requires the host to send data, which a
1200 bps touch does not.
The hook only reports the event. It adds no series specific code, no backup
register use and no policy about which bootloader to enter, so boards and
sketches remain free to decide that.
Refs #706, #7101 parent 4ee32c3 commit 7cc3816
2 files changed
Lines changed: 30 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
| |||
195 | 197 | | |
196 | 198 | | |
197 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
198 | 205 | | |
199 | 206 | | |
200 | 207 | | |
| |||
0 commit comments