Exemplo n.º 1
0
func (m *BitSource) InitPins() {
	m.isInitialized = true

	totalpins := m.InPinCount() + m.OutPinCount()
	m.Pins = make(map[string]chipset.PinInfo, totalpins)
	m.PinNames = make(map[int]string, totalpins)
	// b := [...]string{"Penn", "Teller"}
	strlist := [1]string{"bitOut"}
	for i := 0; i < totalpins; i++ {
		m.PinNames[i] = strlist[i]
	}

	for i := 0; i < totalpins; i++ {
		var pinfo chipset.PinInfo
		// pinfo.CreateComplex128Channel()
		pinfo.Name = m.PinNames[i]
		if i < m.InPinCount() {
			pinfo.InputPin = true
		} else {
			pinfo.InputPin = false
		}
		m.Pins[m.PinNames[i]] = pinfo

	}

	testch := gocomm.NewBitChannel()
	var dummypin chipset.PinInfo
	/// All output pins
	dummypin = m.Pins["bitOut"]
	dummypin.Id = 0
	dummypin.SourceName = "genbit"
	dummypin.Desc = "Output Pin where bits are written"
	dummypin.DataType = reflect.TypeOf(testch)
	dummypin.CreateBitChannel()
	m.Pins["bitOut"] = dummypin

}