This commit is contained in:
clinton 2017-05-21 20:47:53 +10:00
parent 9a25ce11c3
commit ec92ed848c
21 changed files with 60 additions and 24 deletions

View File

@ -15,8 +15,8 @@ package hd44780
import ( import (
"time" "time"
"github.com/golang/glog"
"github.com/cfreeman/embd" "github.com/cfreeman/embd"
"github.com/golang/glog"
) )
type entryMode byte type entryMode byte

View File

@ -4,8 +4,8 @@ package mcp4725
import ( import (
"sync" "sync"
"github.com/golang/glog"
"github.com/cfreeman/embd" "github.com/cfreeman/embd"
"github.com/golang/glog"
) )
const ( const (

View File

@ -6,9 +6,9 @@ import (
"sync" "sync"
"time" "time"
"github.com/golang/glog"
"github.com/cfreeman/embd" "github.com/cfreeman/embd"
"github.com/cfreeman/embd/util" "github.com/cfreeman/embd/util"
"github.com/golang/glog"
) )
const ( const (

View File

@ -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. // Pi Relay board by Seeed Studio.
//
// http://wiki.seeedstudio.com/wiki/Raspberry_Pi_Relay_Board_v1.0
package pcal9535a package pcal9535a
import ( import (
"github.com/cfreeman/embd" "github.com/cfreeman/embd"
) )
// More details at - http://wiki.seeedstudio.com/wiki/Raspberry_Pi_Relay_Board_v1.0
const ( const (
REG_MODE = 0x06 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) 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 { func (c *PCAL9535A) GetPin(pin uint) bool {
return (((c.D >> pin) & 1) == 0) return (((c.D >> pin) & 1) == 0)
} }

View File

@ -2,8 +2,8 @@
package mcp3008 package mcp3008
import ( import (
"github.com/golang/glog"
"github.com/cfreeman/embd" "github.com/cfreeman/embd"
"github.com/golang/glog"
) )
// MCP3008 represents a mcp3008 8bit DAC. // MCP3008 represents a mcp3008 8bit DAC.

View File

@ -4,8 +4,8 @@ import (
"fmt" "fmt"
"os" "os"
"github.com/codegangsta/cli"
"github.com/cfreeman/embd" "github.com/cfreeman/embd"
"github.com/codegangsta/cli"
) )
func detect(c *cli.Context) { func detect(c *cli.Context) {

View File

@ -3,8 +3,8 @@ package main
import ( import (
"os" "os"
"github.com/codegangsta/cli"
_ "github.com/cfreeman/embd/host/all" _ "github.com/cfreeman/embd/host/all"
"github.com/codegangsta/cli"
) )
var version = "0.1.0" var version = "0.1.0"

View File

@ -15,9 +15,9 @@ import (
"os" "os"
"strings" "strings"
"github.com/golang/glog"
"github.com/cfreeman/embd" "github.com/cfreeman/embd"
"github.com/cfreeman/embd/host/generic" "github.com/cfreeman/embd/host/generic"
"github.com/golang/glog"
) )
var pins = embd.PinMap{ var pins = embd.PinMap{

View File

@ -10,9 +10,9 @@ import (
"strconv" "strconv"
"time" "time"
"github.com/golang/glog"
"github.com/cfreeman/embd" "github.com/cfreeman/embd"
"github.com/cfreeman/embd/util" "github.com/cfreeman/embd/util"
"github.com/golang/glog"
) )
const ( const (

View File

@ -1,6 +1,23 @@
/* /*
Package edison provides Intel Edison support. * 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 edison Provides Intel Edison support.
package edison package edison
import ( import (

View File

@ -11,8 +11,8 @@ import (
"time" "time"
"unsafe" "unsafe"
"github.com/golang/glog"
"github.com/cfreeman/embd" "github.com/cfreeman/embd"
"github.com/golang/glog"
) )
const ( const (

View File

@ -7,8 +7,8 @@ import (
"syscall" "syscall"
"unsafe" "unsafe"
"github.com/golang/glog"
"github.com/cfreeman/embd" "github.com/cfreeman/embd"
"github.com/golang/glog"
) )
const ( const (

View File

@ -2,8 +2,8 @@
package servo package servo
import ( import (
"github.com/golang/glog"
"github.com/cfreeman/embd/util" "github.com/cfreeman/embd/util"
"github.com/golang/glog"
) )
const ( const (

View File

@ -6,9 +6,9 @@ import (
"flag" "flag"
"time" "time"
"github.com/golang/glog"
"github.com/cfreeman/embd" "github.com/cfreeman/embd"
"github.com/cfreeman/embd/sensor/watersensor" "github.com/cfreeman/embd/sensor/watersensor"
"github.com/golang/glog"
_ "github.com/cfreeman/embd/host/all" _ "github.com/cfreeman/embd/host/all"
) )

View File

@ -7,8 +7,8 @@ import (
"sync" "sync"
"time" "time"
"github.com/golang/glog"
"github.com/cfreeman/embd" "github.com/cfreeman/embd"
"github.com/golang/glog"
) )
const ( const (

View File

@ -7,8 +7,8 @@ import (
"sync" "sync"
"time" "time"
"github.com/golang/glog"
"github.com/cfreeman/embd" "github.com/cfreeman/embd"
"github.com/golang/glog"
) )
const ( const (

View File

@ -7,8 +7,8 @@ import (
"sync" "sync"
"time" "time"
"github.com/golang/glog"
"github.com/cfreeman/embd" "github.com/cfreeman/embd"
"github.com/golang/glog"
) )
const ( const (

View File

@ -6,8 +6,8 @@ import (
"sync" "sync"
"time" "time"
"github.com/golang/glog"
"github.com/cfreeman/embd" "github.com/cfreeman/embd"
"github.com/golang/glog"
) )
const ( const (

View File

@ -8,8 +8,8 @@ import (
"sync" "sync"
"time" "time"
"github.com/golang/glog"
"github.com/cfreeman/embd" "github.com/cfreeman/embd"
"github.com/golang/glog"
) )
const ( const (

View File

@ -5,8 +5,8 @@ import (
"sync" "sync"
"time" "time"
"github.com/golang/glog"
"github.com/cfreeman/embd" "github.com/cfreeman/embd"
"github.com/golang/glog"
) )
const ( const (

View File

@ -4,8 +4,8 @@ package watersensor
import ( import (
"sync" "sync"
"github.com/golang/glog"
"github.com/cfreeman/embd" "github.com/cfreeman/embd"
"github.com/golang/glog"
) )
// WaterSensor represents a water sensor. // WaterSensor represents a water sensor.