40 lines
602 B
Go
40 lines
602 B
Go
package ftdi_switch
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"gotest.tools/v3/assert"
|
|
)
|
|
|
|
const (
|
|
ID_VENDOR int = 0x0403
|
|
ID_PRODUCT int = 0x6014
|
|
)
|
|
|
|
func TestMain(t *testing.T) {
|
|
logger.SetPrefix("ftdi_switch: ")
|
|
logger.Println("Starting")
|
|
|
|
var err error
|
|
err = start(ID_VENDOR, ID_PRODUCT, 0)
|
|
assert.NilError(t, err)
|
|
|
|
err = write_bit(3, true)
|
|
assert.NilError(t, err)
|
|
|
|
err = write_bit(5, true)
|
|
assert.NilError(t, err)
|
|
|
|
err = write_bit(6, true)
|
|
assert.NilError(t, err)
|
|
|
|
err = write_bit(7, true)
|
|
assert.NilError(t, err)
|
|
|
|
err = write_byte(0)
|
|
assert.NilError(t, err)
|
|
|
|
err = stop()
|
|
assert.NilError(t, err)
|
|
}
|