| 1 |
# go-serial-utils: a golang library with a bunch of procedures to handle serial ports on Arduino (and compatible) boards |
| 2 |
|
| 3 |
## Board reset |
| 4 |
|
| 5 |
To reset a board you must use the `Reset` method. |
| 6 |
|
| 7 |
```go |
| 8 |
Reset(portToTouch string, wait bool, dryRun bool, portsMapper PortsMapper, cb *ResetProgressCallbacks) (string, error) |
| 9 |
``` |
| 10 |
|
| 11 |
`Reset` will reset a board using the 1200 bps port-touch and waits for the bootloader port that is returned. |
| 12 |
Both reset and wait are optional: |
| 13 |
|
| 14 |
- if `portToTouch` is the empty string "" the reset will be skipped |
| 15 |
- if `wait` is false waiting will be skipped |
| 16 |
|
| 17 |
If `wait` is true, this function will wait for a new port to appear after the reset and returns it. If a new port can not be detected or if the `wait` parameter is `false`, then the empty string is returned. |
| 18 |
|
| 19 |
If `dryRun` is set to `true` this function will only emulate the port reset without actually performing it, this is useful to mockup for unit-testing and CI. In dryRun mode if the `portToTouch` ends with `"999"` and `wait` is `true`, the function will return a new "mocked" bootloader port as `portToTouch+"0"`. |
| 20 |
|
| 21 |
`portMapper` is a method called to obtain the current serial port list. If `portMapper` is `nil` the default internal port mapper will be used. |
| 22 |
|
| 23 |
`cb` is a struct defining a bunch of callback functions called during the reset operation to provide progress feedback to the caller. |
| 24 |
|
| 25 |
## License |
| 26 |
|
| 27 |
```txt |
| 28 |
SPDX-FileCopyrightText: Arduino s.r.l. and/or its affiliated companies |
| 29 |
SPDX-License-Identifier: GPL-3.0-or-later |
| 30 |
``` |
| 31 |
|
| 32 |
## Security |
| 33 |
|
| 34 |
If you think you found a vulnerability or other security-related bug in this project, please read our |
| 35 |
[security policy](https://github.com/arduino/go-paths-helper/security/policy) and report the bug to our Security Team 🛡️ |
| 36 |
Thank you! |
| 37 |
|
| 38 |
e-mail contact: <[email protected]> |