Skip to content

Commit

Permalink
set SPI speed and mode in spi smoketest (google#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
tve authored and maruel committed Dec 10, 2016
1 parent a69c1eb commit 0872fc6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion conn/spi/spismoketest/spismoketest.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,18 @@ func (s *SmokeTest) Run(args []string) error {
// Open the bus.
spiDev, err := spi.New(*busNum, *csNum)
if err != nil {
return fmt.Errorf("spi-smoke: %s", err)
return fmt.Errorf("spi-smoke: %v", err)
}
defer spiDev.Close()

// Set SPI parameters.
if err := spiDev.Speed(4 * 1000 * 1000 * 1000); err != nil {
return fmt.Errorf("spi-smoke: cannot set speed, %v", err)
}
if err := spiDev.Configure(spi.Mode0, 8); err != nil {
return fmt.Errorf("spi-smoke: cannot set mode, %v", err)
}

// Open the WC pin.
var wpPin gpio.PinIO
if *wp != "" {
Expand Down

0 comments on commit 0872fc6

Please sign in to comment.