예제 #1
0
파일: filter.go 프로젝트: postfix/gocomm
func (m *Filter) InitPins() {
	totalpins := m.InPinCount() + m.OutPinCount()
	m.Pins = make(map[string]chipset.PinInfo, totalpins)
	m.PinNames = make(map[int]string, totalpins)
	strlist := [2]string{"inputPin0", "outputPin0"}
	for cnt := 0; cnt < len(strlist); cnt++ {
		m.PinNames[cnt] = strlist[cnt]
	}

	/// something try begins
	var pinfo chipset.PinInfo

	pinfo.Name = "inputPin0"
	pinfo.Id = 0
	pinfo.InputPin = true
	pinfo.DataType = reflect.TypeOf((*gocomm.Complex128Channel)(nil)).Elem()

	m.Pins["inputPin0"] = pinfo

	pinfo.Name = "outputPin0"
	pinfo.Id = 1
	pinfo.InputPin = false
	pinfo.DataType = reflect.TypeOf((*gocomm.Complex128Channel)(nil)).Elem()

	pinfo.CreateChannel()

	m.Pins["outputPin0"] = pinfo

	/// something try ends

}
예제 #2
0
파일: awgn.go 프로젝트: postfix/gocomm
func (m *ChannelEmulator) 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 := [4]string{"symbolIn", "symbolOut"}
	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

	}

	testcch := gocomm.NewComplex128Channel()

	var dummypin chipset.PinInfo

	/// all Input Pins
	dummypin = m.Pins["symbolIn"]
	dummypin.Id = 0
	dummypin.DataType = reflect.TypeOf(testcch)
	m.Pins["symbolIn"] = dummypin

	/// All output pins
	dummypin = m.Pins["symbolOut"]
	dummypin.Id = 1
	dummypin.SourceName = "fadingchannel/awgn"
	dummypin.DataType = reflect.TypeOf(testcch)
	dummypin.CreateComplex128Channel()
	m.Pins["symbolOut"] = dummypin

}
예제 #3
0
파일: bitsource.go 프로젝트: postfix/gocomm
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

}
예제 #4
0
파일: mpchannel.go 프로젝트: postfix/gocomm
func (m *MPChannel) InitPins() {
	totalpins := m.InPinCount() + m.OutPinCount()
	m.Pins = make(map[string]chipset.PinInfo, totalpins)
	m.PinNames = make(map[int]string, totalpins)
	strlist := [6]string{"inputPin1", "outputPin0", "outputPin1", "inputPin0", "inputPin2", "outputPin2"}
	for cnt := 0; cnt < len(strlist); cnt++ {
		m.PinNames[cnt] = strlist[cnt]
	}

	/// something try begins
	var pinfo chipset.PinInfo

	pinfo.Name = "inputPin0"
	pinfo.Id = 0
	pinfo.InputPin = true
	pinfo.DataType = reflect.TypeOf((*gocomm.FloatChannel)(nil)).Elem()

	m.Pins["inputPin0"] = pinfo

	pinfo.Name = "inputPin1"
	pinfo.Id = 1
	pinfo.InputPin = true
	pinfo.DataType = reflect.TypeOf((*gocomm.Complex128AChannel)(nil)).Elem()

	m.Pins["inputPin1"] = pinfo

	pinfo.Name = "outputPin0"
	pinfo.Id = 2
	pinfo.InputPin = false
	pinfo.DataType = reflect.TypeOf((*gocomm.Complex128Channel)(nil)).Elem()

	pinfo.CreateChannel()

	m.Pins["outputPin0"] = pinfo

	pinfo.Name = "outputPin1"
	pinfo.Id = 3
	pinfo.InputPin = false
	pinfo.DataType = reflect.TypeOf((*gocomm.FloatChannel)(nil)).Elem()
	pinfo.CreateChannel()

	m.Pins["outputPin1"] = pinfo

	pinfo.Name = "inputPin2"
	pinfo.Id = 4
	pinfo.InputPin = true
	pinfo.DataType = reflect.TypeOf((*gocomm.FloatChannel)(nil)).Elem()

	pinfo.CreateChannel()

	m.Pins["inputPin2"] = pinfo

	pinfo.Name = "outputPin2"
	pinfo.Id = 5
	pinfo.InputPin = false
	pinfo.DataType = reflect.TypeOf((*gocomm.Complex128AChannel)(nil)).Elem()

	pinfo.CreateChannel()

	m.Pins["outputPin2"] = pinfo

	// pinfo.Name = "coeffPin"
	// pinfo.Id = 6
	// pinfo.InputPin = false
	// pinfo.DataType = reflect.TypeOf((*gocomm.Complex128AChannel)(nil)).Elem()
	// pinfo.Channel = make(gocomm.Complex128AChannel, 20) /// Last 20 samples will be queued

	// m.Pins["coeffPin"] = pinfo

	/// something try ends

}
예제 #5
0
파일: modem.go 프로젝트: postfix/gocomm
func (m *Modem) 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 := [4]string{"bitIn", "symbolIn", "symbolOut", "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]
		pinfo.Id = i
		if i < m.InPinCount() {
			pinfo.InputPin = true
		} else {
			pinfo.InputPin = false
		}
		m.Pins[m.PinNames[i]] = pinfo

	}

	// testcch := gocomm.NewComplex128Channel()
	// testch := gocomm.NewBitChannel()

	var dummypin chipset.PinInfo

	/// all Input Pins
	dummypin = m.Pins["symbolIn"]
	dummypin.Id = 1
	// dummypin.DataType = reflect.TypeOf(testcch)
	dummypin.DataType = reflect.TypeOf((*gocomm.Complex128Channel)(nil)).Elem()

	m.Pins["symbolIn"] = dummypin

	dummypin = m.Pins["bitIn"]
	dummypin.Id = 0
	// dummypin.DataType = reflect.TypeOf(testch)
	dummypin.DataType = reflect.TypeOf((*gocomm.BitChannel)(nil)).Elem()
	m.Pins["bitIn"] = dummypin

	///
	/// All output pins
	dummypin = m.Pins["symbolOut"]
	dummypin.Id = 2
	// dummypin.DataType = reflect.TypeOf(testcch)
	dummypin.DataType = reflect.TypeOf((*gocomm.Complex128Channel)(nil)).Elem()
	dummypin.CreateChannel()
	dummypin.SourceName = "modulate"
	m.Pins["symbolOut"] = dummypin

	// fmt.Printf("\n %v : PinO : %v , Channel : %v", m.modetype(), m.Pins["symbolOut"].Name, m.Pins["symbolOut"].Channel)
	dummypin = m.Pins["bitOut"]
	dummypin.Id = 3
	dummypin.SourceName = "demodulate"
	dummypin.DataType = reflect.TypeOf((*gocomm.Complex128Channel)(nil)).Elem()

	// dummypin.DataType = reflect.TypeOf(testcch)
	// dummypin.CreateComplex128Channel()
	dummypin.CreateChannel()

	m.Pins["bitOut"] = dummypin
	// fmt.Printf("\n %v : PinO : %v , Channel : %v", m.modetype(), m.Pins["bitOut"].Name, m.Pins["bitOut"].Channel)

}