gonashi

package module
v0.0.0-...-7cb84b5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2015 License: MIT Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

gonashi

Control Konashi from Go

Documentation

Index

Constants

View Source
const (
	KonashiServiceUUID = "229bff0003fb40da98a7b0def65c2d4b"

	// PIO
	KonashiPioSettingUUID              = "229b300003fb40da98a7b0def65c2d4b"
	KonashiPioPullUpUUID               = "229b300103fb40da98a7b0def65c2d4b"
	KonashiPioOutputUUID               = "229b300203fb40da98a7b0def65c2d4b"
	KonashiPioInputNotificationUUID    = "229b300303fb40da98a7b0def65c2d4b"
	KonashiPioInputNotificationReadLen = 1

	// PWM
	KonashiPWmConfigUUID = 0x3004
	KonashiPWmParamUUID  = 0x3005
	KonashiPWmDutyUUID   = 0x3006

	// Analog
	KonashiAnalogDriveUUID = 0x3007
	KonashiAnalogRead0UUID = 0x3008
	KonashiAnalogRead1UUID = 0x3009
	KonashiAnalogRead2UUID = 0x300A
	KonashiAnalogReadLen   = 2

	// I2C
	KonashiI2cConfigUUID    = 0x300B
	KonashiI2cStartStopUUID = 0x300C
	KonashiI2cWriteUUID     = 0x300D
	KonashiI2cReadParamUIUD = 0x300E
	KonashiI2cReadUUID      = 0x300F

	// Uart
	KonashiUartConfigUUID            = 0x3010
	KonashiUartBaudrateUUID          = 0x3011
	KonashiUartTxUUID                = 0x3012
	KonashiUartRXNotificationUUID    = 0x3013
	KonashiUartRXNotificationReadLen = 1

	// Hardware
	KonashiHardwareResetUUID                 = 0x3014
	KonashiHardwareLowBATNotificationUUID    = 0x3015
	KonashiHardwareLowBATNotificationReadLen = 1
)
View Source
const (
	KonashiUartModeDisable UartMode = iota
	KonashiUartModeEnable
	KonashiUartBaudrateRate2K4   = 0x000a // 2400bps
	KonashiUartBaudrateRate9K6   = 0x0028 // 9600bps
	KonashiUartBaudrateRate19K2  = 0x0050 // 19200bps
	KonashiUartBaudrateRate38K4  = 0x00a0 // 38400pbs
	KonashiUartBaudrateRate57K6  = 0x00f0 // 57600pbs
	KonashiUartBaudrateRate76K8  = 0x0140 // 76800pbs
	KonashiUartBaudrateRate115K2 = 0x01e0 // 115200pbs
)
View Source
const (
	KonashiResultSuccess = iota
	KonashiResultFailure
)

Variables

Functions

This section is empty.

Types

type AioPin

type AioPin int
const (
	KonashiAnalogIO0 AioPin = iota
	KonashiAnalogIO1
	KonashiAnalogIO2
)

type DioPin

type DioPin uint8
const (
	KonashiDigitalIO0 DioPin = iota
	KonashiDigitalIO1
	KonashiDigitalIO2
	KonashiDigitalIO3
	KonashiDigitalIO4
	KonashiDigitalIO5
	KonashiDigitalIO6
	KonashiDigitalIO7
)

type Gonashi

type Gonashi struct {
	// contains filtered or unexported fields
}

func NewGonashi

func NewGonashi() (Gonashi, error)

func (*Gonashi) Discovered

func (g *Gonashi) Discovered() <-chan map[string]*Konashi

func (*Gonashi) GetDiscovered

func (g *Gonashi) GetDiscovered() map[string]*Konashi

func (*Gonashi) Scan

func (g *Gonashi) Scan()

func (*Gonashi) StopScanning

func (g *Gonashi) StopScanning()

type I2CCondition

type I2CCondition int
const (
	KonashiI2CConditionStop I2CCondition = iota
	KonashiI2CConditionStart
	KonashiI2CConditionRestart
)

type I2CMode

type I2CMode int
const (
	KonashiI2CModeDisable I2CMode = iota
	KonashiI2CModeEnable
)

type I2CPin

type I2CPin int
const (
	KonashiI2C_SDA I2CPin = 6 + iota
	KonashiI2C_SCL
)

type Konashi

type Konashi struct {
	Peripheral    gatt.Peripheral
	Advertisement *gatt.Advertisement
	Rssi          int
	T             time.Time
	Connected     chan struct{}
	Disconnected  chan struct{}
	// contains filtered or unexported fields
}

func NewKonashi

func NewKonashi(p gatt.Peripheral, a *gatt.Advertisement, rssi int) *Konashi

func (*Konashi) Connect

func (k *Konashi) Connect()

func (*Konashi) DisConnect

func (k *Konashi) DisConnect()

func (*Konashi) DiscoverCharacteristics

func (k *Konashi) DiscoverCharacteristics() []*gatt.Characteristic

func (*Konashi) PinMode

func (k *Konashi) PinMode(pin DioPin, mode PinIOMode) error

func (*Konashi) ReadCharacteristic

func (k *Konashi) ReadCharacteristic(c *gatt.Characteristic) ([]byte, error)

func (*Konashi) SetMTU

func (k *Konashi) SetMTU(mtu uint16) error

func (*Konashi) SetNotifyValue

func (k *Konashi) SetNotifyValue(c *gatt.Characteristic) error

func (*Konashi) SetPeripheral

func (k *Konashi) SetPeripheral(p gatt.Peripheral)

func (*Konashi) Update

func (k *Konashi) Update(a *gatt.Advertisement, rssi int)

func (*Konashi) WriteCharacteristic

func (k *Konashi) WriteCharacteristic(c *gatt.Characteristic, b []byte, noRsp bool) error

type LED

type LED int
const (
	KonashiLED2 LED = 1 + iota
	KonashiLED3
	KonashiLED4
	KonashiLED5
)

type PinIOMode

type PinIOMode uint8
const (
	KonashiPinModeOutput PinIOMode = iota
	KonashiPinModeInput
)

type PinLevel

type PinLevel int
const (
	KonashiLevelHigh PinLevel = iota
	KonashiLevelLow
)

type PinPullupMode

type PinPullupMode int
const (
	KonashiPinModePullup PinPullupMode = iota
	KonashiPinModeNoPulls
)

type PwmMode

type PwmMode int
const (
	KonashiPWMModeDisable PwmMode = iota
	KonashiPWMModeEnable
	KonashiPWMModeEnableLED
	KonashiLEDPeriod = 10000
)

type TactSwitch

type TactSwitch int
const (
	KonashiS1 TactSwitch = iota
)

type UartMode

type UartMode int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址