Exemple #1
0
func NewADC(name, serial string, tx int) *ADC {
	return &ADC{
		Base:   ncs.NewBase(name),
		serial: serial,
		tx:     tx,
	}
}
Exemple #2
0
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
}
Exemple #3
0
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
}
Exemple #4
0
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
}
Exemple #5
0
func NewDAC(name, serial string) *DAC {
	return &DAC{
		Base:   ncs.NewBase(name),
		serial: serial,
	}
}
Exemple #6
0
func New(name, addr string) ncs.Module {
	return &sysbus{
		Base: ncs.NewBase(name),
		addr: addr,
	}
}