示例#1
0
文件: adc.go 项目: go-lsst/ncs
func NewADC(name, serial string, tx int) *ADC {
	return &ADC{
		Base:   ncs.NewBase(name),
		serial: serial,
		tx:     tx,
	}
}
示例#2
0
文件: led.go 项目: go-lsst/ncs
func NewLED(name string, bus string) *LED {
	busdev := ncs.System.Device(bus)
	led := &LED{
		Base: ncs.NewBase(name),
		bus:  busdev.(Bus),
		cid:  0x1,
	}
	return led
}
示例#3
0
文件: device.go 项目: go-lsst/ncs
func New(name string, bus string) *Device {
	busdev := ncs.System.Device(bus)
	dev := &Device{
		Base: ncs.NewBase(name),
		bus:  busdev.(canbus.Bus),
	}
	dev.offsets.H = 0.0
	dev.offsets.P = 600.0
	dev.offsets.T = -20.0

	dev.chans.H = 0x3
	dev.chans.P = 0x2
	dev.chans.T = 0x4
	return dev
}
示例#4
0
文件: canbus.go 项目: go-lsst/ncs
func New(name string, port int, adc *ADC, dac *DAC, devices ...ncs.Device) ncs.Module {
	devs := append([]ncs.Device{adc, dac}, devices...)
	bus := &busImpl{
		Base:    ncs.NewBase(name),
		conn:    newCwrapperImpl(port),
		quit:    make(chan struct{}),
		nodes:   make([]int, 0, 2),
		adc:     adc,
		dac:     dac,
		devices: devs,
		queue:   make(chan *Message),
	}
	ncs.System.Register(bus)
	for _, dev := range bus.devices {
		ncs.System.Register(dev)
	}

	return bus
}
示例#5
0
文件: dac.go 项目: go-lsst/ncs
func NewDAC(name, serial string) *DAC {
	return &DAC{
		Base:   ncs.NewBase(name),
		serial: serial,
	}
}
示例#6
0
文件: bus.go 项目: go-lsst/ncs
func New(name, addr string) ncs.Module {
	return &sysbus{
		Base: ncs.NewBase(name),
		addr: addr,
	}
}