Пример #1
0
func constant(e *evdev.Effect) {
	e.Type = evdev.FFConstant
	e.Direction = 0x6000 // 135 degrees

	var c evdev.ConstantEffect
	c.Level = 0x2000 // Strength : 25 %
	c.Envelope.AttackLength = 0x100
	c.Envelope.AttackLevel = 0
	c.Envelope.FadeLength = 0x100
	c.Envelope.FadeLevel = 0
	e.SetData(c)
}
Пример #2
0
func spring(e *evdev.Effect) {
	e.Type = evdev.FFSpring
	e.Direction = 0x6000 // 135 degrees

	var c [2]evdev.ConditionEffect
	c[0].RightSaturation = 0x7fff
	c[0].LeftSaturation = 0x7fff
	c[0].RightCoeff = 0x2000
	c[0].LeftCoeff = 0x2000
	c[0].Deadband = 0x0
	c[0].Center = 0x0
	c[1] = c[0]
	e.SetData(c)
}
Пример #3
0
func periodic(e *evdev.Effect) {
	e.Type = evdev.FFPeriodic
	e.Direction = evdev.DirLeft // Along X axis

	var p evdev.PeriodicEffect
	p.Waveform = evdev.FFSine
	p.Period = 26        // 0.1*0x100 = 0.1 second
	p.Magnitude = 0x4000 // 0.5 * Maximum magnitude
	p.Offset = 0
	p.Phase = 0
	p.Envelope.AttackLength = 0x100
	p.Envelope.AttackLevel = 0
	p.Envelope.FadeLength = 0x100
	p.Envelope.FadeLevel = 0

	e.SetData(p)
}