mirror of
https://github.com/kidoman/embd
synced 2025-07-04 12:27:45 +02:00
go fmt
This commit is contained in:
parent
9a25ce11c3
commit
ec92ed848c
21 changed files with 60 additions and 24 deletions
|
@ -1,13 +1,31 @@
|
|||
// PCAL953A, low volage GPIO expander as found in the Raspberry
|
||||
/*
|
||||
* Copyright (c) Clinton Freeman 2016
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
* associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
||||
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
// Package pcal9535a adds support for the low volage GPIO expander as found in the Raspberry
|
||||
// Pi Relay board by Seeed Studio.
|
||||
//
|
||||
// http://wiki.seeedstudio.com/wiki/Raspberry_Pi_Relay_Board_v1.0
|
||||
package pcal9535a
|
||||
|
||||
import (
|
||||
"github.com/cfreeman/embd"
|
||||
)
|
||||
|
||||
// More details at - http://wiki.seeedstudio.com/wiki/Raspberry_Pi_Relay_Board_v1.0
|
||||
const (
|
||||
REG_MODE = 0x06
|
||||
)
|
||||
|
@ -38,6 +56,7 @@ func (c *PCAL9535A) SetPin(pin uint, on bool) error {
|
|||
return c.Bus.WriteByteToReg(c.Addr, REG_MODE, c.D)
|
||||
}
|
||||
|
||||
// Gets the state of supplied pin true = high or on, while false = low or off.
|
||||
func (c *PCAL9535A) GetPin(pin uint) bool {
|
||||
return (((c.D >> pin) & 1) == 0)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue