mirror of
https://github.com/stianeikeland/go-rpio.git
synced 2025-01-23 02:31:05 +01:00
go fmt
This commit is contained in:
parent
b604d03178
commit
cdcd97f287
8
rpio.go
8
rpio.go
|
@ -294,7 +294,6 @@ func PullMode(pin Pin, pull Pull) {
|
|||
|
||||
}
|
||||
|
||||
|
||||
// Set clock speed for given pin
|
||||
//
|
||||
// freq should be in range 4688Hz - 19.2MHz to prevent unexpected behavior
|
||||
|
@ -338,7 +337,8 @@ func SetClock(pin Pin, freq int) {
|
|||
const src = 0x01 // oscilator
|
||||
|
||||
clkMem[clkCtlReg] = PASSWORD | src // stop gpio clock
|
||||
for clkMem[clkCtlReg] & busy != 0 {} // ... and wait
|
||||
for clkMem[clkCtlReg]&busy != 0 {
|
||||
} // ... and wait
|
||||
|
||||
clkMem[clkDivReg] = PASSWORD | (divi << 12) | divf // set dividers
|
||||
clkMem[clkCtlReg] = PASSWORD | enab | src // start clock
|
||||
|
@ -402,10 +402,10 @@ func memMap (fd uintptr, offset int64) (mem []uint32, mem8 []byte, err error) {
|
|||
func Close() error {
|
||||
memlock.Lock()
|
||||
defer memlock.Unlock()
|
||||
if err := syscall.Munmap(gpioMem8) {
|
||||
if err := syscall.Munmap(gpioMem8); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := syscall.Munmap(clkMem8) {
|
||||
if err := syscall.Munmap(clkMem8); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue
Block a user