// SetMotorPower sets a motor's power from -128 to 127.
3482
func (g *Driver) SetMotorPower(motor Motor, power int8) error {
	return g.writeBytes([]byte{
		goPiGo3Address,
		SET_MOTOR_PWM,
		byte(motor),
		byte(power),
	})
}
549816
func (p *V2) SetPower(state bool) error {
	p.RLock()
	defer p.RUnlock()
	for _, dev := range p.devices {
		if err := dev.SetPower(state); err != nil {
			common.Log.Warnf("Failed setting power on %d: %+v", dev.ID(), err)
			continue
		}
	}
	return nil
}
1197203
func (s *CreateUsagePlanInput) SetThrottle(v *ThrottleSettings) *CreateUsagePlanInput {
	s.Throttle = v
	return s
}
181972
func (b *Driver) SetTXPower(level int) (err error) {
	buf := []byte{byte(level)}

	err = b.adaptor().WriteCharacteristic(txPowerCharacteristic, buf)
	if err != nil {
		fmt.Println("SetTXLevel error:", err)
		return err
	}

	return
}
524492
func (s *StepperDriver) SetSpeed(rpm uint) error {
	if rpm <= 0 {
		return errors.New("RPM cannot be a zero or negative value")
	}

	m := s.GetMaxSpeed()
	if rpm > m {
		rpm = m
	}

	s.speed = rpm
	return nil
}
928272
func (s *DBClusterSnapshot) SetEngine(v string) *DBClusterSnapshot {
	s.Engine = &v
	return s
}
504786
func (s *RelationalDatabase) SetEngine(v string) *RelationalDatabase {
	s.Engine = &v
	return s
}
263453
func (p *PCA9685Driver) SetPWMFreq(freq float32) error {
	// IC oscillator frequency is 25 MHz
	var prescalevel float32 = 25000000
	// Find frequency of PWM waveform
	prescalevel /= 4096
	// Ratio between desired frequency and maximum
	prescalevel /= freq
	prescalevel -= 1
	// Round value to nearest whole
	prescale := byte(prescalevel + 0.5)

	if _, err := p.connection.Write([]byte{byte(PCA9685_MODE1)}); err != nil {
		return err
	}
	data := make([]byte, 1)
	oldmode, err := p.connection.Read(data)
	if err != nil {
		return err
	}

	// Put oscillator in sleep mode, clear bit 7 here to avoid overwriting
	// previous setting
	newmode := (oldmode & 0x7F) | 0x10
	if _, err := p.connection.Write([]byte{byte(PCA9685_MODE1), byte(newmode)}); err != nil {
		return err
	}
	// Write prescaler value
	if _, err := p.connection.Write([]byte{byte(PCA9685_PRESCALE), prescale}); err != nil {
		return err
	}
	// Put back to old settings
	if _, err := p.connection.Write([]byte{byte(PCA9685_MODE1), byte(oldmode)}); err != nil {
		return err
	}

	time.Sleep(100 * time.Millisecond)
	// Enable response to All Call address, enable auto-increment, clear restart
	if _, err := p.connection.Write([]byte{byte(PCA9685_MODE1), byte(oldmode | 0xa1)}); err != nil {
		return err
	}

	return nil
}
169721
func (s *Snapshot) SetEngine(v string) *Snapshot {
	s.Engine = &v
	return s
}
38763
func (s *Server) SetEngine(v string) *Server {
	s.Engine = &v
	return s
}
415799
func (b *Driver) SetRawMotorValues(lmode MotorModes, lpower uint8, rmode MotorModes, rpower uint8) {
	b.packetChannel <- b.craftPacket([]uint8{uint8(lmode), lpower, uint8(rmode), rpower}, 0x02, 0x33)
}
673958
func (s *DescribeCacheEngineVersionsInput) SetEngine(v string) *DescribeCacheEngineVersionsInput {
	s.Engine = &v
	return s
}
1014659
func (s *DBInstance) SetEngine(v string) *DBInstance {
	s.Engine = &v
	return s
}
318697
func (s *CreateDBClusterInput) SetEngine(v string) *CreateDBClusterInput {
	s.Engine = &v
	return s
}
992554
func (tr *TaskRunner) setDriverHandle(handle *DriverHandle) {
	tr.handleLock.Lock()
	defer tr.handleLock.Unlock()
	tr.handle = handle

	// Update the environment's driver network
	tr.envBuilder.SetDriverNetwork(handle.net)
}
1048886
func (a *AdafruitMotorHatDriver) SetStepperMotorSpeed(stepperMotor int, rpm int) (err error) {
	revSteps := a.stepperMotors[stepperMotor].revSteps
	a.stepperMotors[stepperMotor].secPerStep = 60.0 / float64(revSteps*rpm)
	a.stepperMotors[stepperMotor].stepCounter = 0
	return
}
660891
func (g *Driver) SetMotorDps(motor Motor, dps int) error {
	d := dps * MOTOR_TICKS_PER_DEGREE
	return g.writeBytes([]byte{
		goPiGo3Address,
		SET_MOTOR_DPS,
		byte(motor),
		byte((d >> 8) & 0xFF),
		byte(d & 0xFF),
	})
}