2021-09-23 10:56:13 +00:00
|
|
|
# Go-LogAdapter
|
2021-09-22 17:01:27 +00:00
|
|
|
|
2021-10-01 17:02:15 +00:00
|
|
|
[](https://codecov.io/gh/Fishwaldo/go-dcdc200)
|
|
|
|
[](http://pkg.go.dev/github.com/Fishwaldo/go-dcdc200)
|
2021-09-22 17:01:27 +00:00
|
|
|
|
|
|
|
Package go-dcdcusb interfaces with the DCDCUSB power supply from mini-box ([https://www.mini-box.com/DCDC-USB](https://www.mini-box.com/DCDC-USB))
|
|
|
|
via USB port and allows you to retrive the status of the power supply
|
|
|
|
|
|
|
|
it depends upon GoUSB which in turn depends upon the libusb C library, thus CGO is required for this module
|
|
|
|
|
2021-10-01 17:02:15 +00:00
|
|
|
## Please see the GoUSB pages for hints on compiling for platforms other than linux
|
|
|
|
|
|
|
|
Building
|
|
|
|
|
|
|
|
Compile with the tag nogousb to disable compiling with USB Support. Then the only option available
|
|
|
|
is a Simulator Mode that replays a previously captured session.
|
2021-09-22 17:01:27 +00:00
|
|
|
|
|
|
|
## Sub Packages
|
|
|
|
|
|
|
|
* [cmd](./cmd)
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
```golang
|
|
|
|
|
|
|
|
dc := dcdcusb.DcDcUSB{}
|
2022-02-19 07:15:25 +00:00
|
|
|
logsink := log.New(os.Stdout, "", 0)
|
|
|
|
log := stdr.New(logsink)
|
|
|
|
|
|
|
|
dc.Init(log, false)
|
2021-09-22 17:01:27 +00:00
|
|
|
if ok, err := dc.Scan(); !ok {
|
2022-02-19 07:15:25 +00:00
|
|
|
log.Error(err, "Scan Failed")
|
2021-09-22 17:01:27 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
defer dc.Close()
|
|
|
|
for i := 0; i < 100; i++ {
|
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), (1 * time.Second))
|
|
|
|
dc.GetAllParam(ctx)
|
|
|
|
cancel()
|
|
|
|
time.Sleep(1 * time.Second)
|
|
|
|
}
|
|
|
|
dc.Close()
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
---
|
|
|
|
Readme created from Go doc with [goreadme](https://github.com/posener/goreadme)
|