Added basic test for CHIP PWM functions
Signed-off-by: Erik Agsjö <erik.agsjo@gmail.com>
This commit is contained in:
parent
5593924945
commit
e125805554
|
@ -15,6 +15,7 @@ import (
|
|||
var _ gobot.Adaptor = (*Adaptor)(nil)
|
||||
var _ gpio.DigitalReader = (*Adaptor)(nil)
|
||||
var _ gpio.DigitalWriter = (*Adaptor)(nil)
|
||||
var _ gpio.ServoWriter = (*Adaptor)(nil)
|
||||
var _ i2c.Connector = (*Adaptor)(nil)
|
||||
|
||||
type NullReadWriteCloser struct {
|
||||
|
@ -90,3 +91,13 @@ func TestChipAdaptorI2c(t *testing.T) {
|
|||
|
||||
gobottest.Assert(t, a.Finalize(), nil)
|
||||
}
|
||||
|
||||
func TestChipAdaptorInvalidPWMPin(t *testing.T) {
|
||||
a := initTestChipAdaptor()
|
||||
|
||||
err := a.PwmWrite("LCD-D2", 42)
|
||||
gobottest.Refute(t, err, nil)
|
||||
|
||||
err = a.ServoWrite("LCD-D2", 120)
|
||||
gobottest.Refute(t, err, nil)
|
||||
}
|
||||
|
|
|
@ -37,8 +37,6 @@ func unexportPWM() (err error) {
|
|||
return err
|
||||
}
|
||||
|
||||
// return fmt.Errorf("PWM is not available, check device tree setup")
|
||||
|
||||
func (c *Adaptor) initPWM(pwmFrequency float64) (err error) {
|
||||
const basePath = pwmSysfsPath + "/pwm0"
|
||||
|
||||
|
|
Loading…
Reference in New Issue