mirror of
https://github.com/stianeikeland/go-rpio.git
synced 2025-01-23 10:41:03 +01:00
Fix spelling mistakes
This commit is contained in:
parent
d8d85b3536
commit
2cc020450c
|
@ -12,9 +12,10 @@ package main
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/stianeikeland/go-rpio/v4"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/stianeikeland/go-rpio/v4"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -39,7 +39,7 @@ func main() {
|
|||
fmt.Println("press a button")
|
||||
|
||||
for i := 0; i < 2; {
|
||||
if pin.EdgeDetected() { // check if event occured
|
||||
if pin.EdgeDetected() { // check if event occurred
|
||||
fmt.Println("button pressed")
|
||||
i++
|
||||
}
|
||||
|
|
8
rpio.go
8
rpio.go
|
@ -8,11 +8,11 @@ Supports simple operations such as:
|
|||
- Pin read (high/low)
|
||||
- Pin edge detection (no/rise/fall/any)
|
||||
- Pull up/down/off
|
||||
Also clock/pwm related oparations:
|
||||
Also clock/pwm related operations:
|
||||
- Set Clock frequency
|
||||
- Set Duty cycle
|
||||
And SPI oparations:
|
||||
- SPI transmit/recieve/exchange bytes
|
||||
And SPI operations:
|
||||
- SPI transmit/receive/exchange bytes
|
||||
- Set speed
|
||||
- Chip select
|
||||
|
||||
|
@ -264,7 +264,7 @@ func (pin Pin) PullDown() {
|
|||
PullMode(pin, PullDown)
|
||||
}
|
||||
|
||||
// PullOff: Disable pullup/down on pin
|
||||
// PullOff: Disable pullup or pulldown on pin
|
||||
func (pin Pin) PullOff() {
|
||||
PullMode(pin, PullOff)
|
||||
}
|
||||
|
|
5
spi.go
5
spi.go
|
@ -21,6 +21,7 @@ const (
|
|||
)
|
||||
|
||||
var (
|
||||
// Will not fix this error's naming (would be a breaking change)
|
||||
SpiMapError = errors.New("SPI registers not mapped correctly - are you root?")
|
||||
)
|
||||
|
||||
|
@ -118,7 +119,7 @@ func SpiMode(polarity uint8, phase uint8) {
|
|||
// Data received from slave are ignored.
|
||||
// Use spread operator to send slice of bytes.
|
||||
func SpiTransmit(data ...byte) {
|
||||
SpiExchange(append(data[:0:0], data...)) // clone data because it will be rewriten by received bytes
|
||||
SpiExchange(append(data[:0:0], data...)) // clone data because it will be rewritten by received bytes
|
||||
}
|
||||
|
||||
// SpiReceive receives n bytes from slave.
|
||||
|
@ -183,7 +184,7 @@ func getSpiPins(dev SpiDev) []Pin {
|
|||
switch dev {
|
||||
case Spi0:
|
||||
return []Pin{7, 8, 9, 10, 11}
|
||||
// ommit 35, 36, 37, 38, 39 - only one set of SPI0 can be set in Spi mode at a time
|
||||
// omit 35, 36, 37, 38, 39 - only one set of SPI0 can be set in Spi mode at a time
|
||||
case Spi1:
|
||||
return []Pin{16, 17, 18, 19, 20, 21}
|
||||
case Spi2:
|
||||
|
|
Loading…
Reference in New Issue
Block a user