Versions in this module Expand all Collapse all v0 v0.1.3 Nov 3, 2022 v0.1.2 Nov 3, 2022 Changes in this version + type BCM uint32 + const Bcm00 + const Bcm01 + const Bcm02 + const Bcm03 + const Bcm04 + const Bcm05 + const Bcm06 + const Bcm07 + const Bcm08 + const Bcm09 + const Bcm10 + const Bcm11 + const Bcm12 + const Bcm13 + const Bcm14 + const Bcm15 + const Bcm16 + const Bcm17 + const Bcm18 + const Bcm19 + const Bcm20 + const Bcm21 + const Bcm22 + const Bcm23 + const Bcm24 + const Bcm25 + const Bcm26 + const Bcm27 + const Bcm28 + const Bcm29 + const Bcm30 + const Bcm31 + type Callback struct + func (c *Callback) Bit() int + func (c *Callback) Edge() Edge + func (c *Callback) Handle() int + type CallbackFunc func(*GpioPin, uint) + type Command int + type Edge int8 + const EdgeEither + const EdgeFalling + const EdgeRising + type File struct + func (f *File) Close() error + func (f *File) Filename() string + func (f *File) Handle() int + func (f *File) Mode() FileMode + func (f *File) Read(count int) ([]byte, error) + func (f *File) Seek(offset int, from FileSeekFrom) (int, error) + func (f *File) Write(data []byte) error + type FileMode int + const FileAppend + const FileCreate + const FileRead + const FileReadWrite + const FileTrunc + const FileWrite + type FileSeekFrom int + const FromCurrent + const FromEnd + const FromStart + type GenericPulse struct + Delay int + GpioOff *GpioPin + GpioOn *GpioPin + func CreatePulse(gpioOn *GpioPin, gpioOff *GpioPin, delay int) GenericPulse + type GpioLevel int + const Clear + const High + const Low + const Off + const On + const Set + type GpioMode int + const ModeAlt0 + const ModeAlt1 + const ModeAlt2 + const ModeAlt3 + const ModeAlt4 + const ModeAlt5 + const ModeInput + const ModeOutput + type GpioPin struct + func (gp *GpioPin) AddCallback(edge Edge, fn CallbackFunc) Callback + func (gp *GpioPin) GetMode() (GpioMode, error) + func (gp *GpioPin) Pwm() *GpioPwm + func (gp *GpioPin) Read() (GpioLevel, error) + func (gp *GpioPin) RemoveCallback(cb Callback) + func (gp *GpioPin) Servo() *GpioServo + func (gp *GpioPin) SetGlitchFilter(steady int) error + func (gp *GpioPin) SetMode(mode GpioMode) error + func (gp *GpioPin) SetNoiseFilter(steady int, active int) error + func (gp *GpioPin) SetPullMode(mode PullUpDownMode) error + func (gp *GpioPin) Trigger(pulseLen int, level GpioLevel) error + func (gp *GpioPin) Write(level GpioLevel) error + type GpioPwm struct + func (pwm *GpioPwm) GetDutyCycle() (int, error) + func (pwm *GpioPwm) GetFrequency() (int, error) + func (pwm *GpioPwm) GetRange() (int, error) + func (pwm *GpioPwm) GetRealRange() (int, error) + func (pwm *GpioPwm) Gpio() *GpioPin + func (pwm *GpioPwm) SetDutyCycle(dutyCycle int) (int, error) + func (pwm *GpioPwm) SetFrequency(freq int) error + func (pwm *GpioPwm) SetRange(max int) error + type GpioServo struct + func (s *GpioServo) GetPulseWidth() (int, error) + func (s *GpioServo) Gpio() *GpioPin + func (s *GpioServo) SetPulseWidth(width int) error + type I2C struct + func (i *I2C) Address() int + func (i *I2C) BlockProcessCall(register int, data []byte) ([]byte, error) + func (i *I2C) Bus() int + func (i *I2C) Close() error + func (i *I2C) Flags() I2CFlags + func (i *I2C) Handle() int + func (i *I2C) ProcessCall(register int, val int16) (int16, error) + func (i *I2C) ReadByte() (byte, error) + func (i *I2C) ReadDevice(count int) ([]byte, error) + func (i *I2C) ReadRegisterBlock(register int) ([]byte, error) + func (i *I2C) ReadRegisterByte(register int) (byte, error) + func (i *I2C) ReadRegisterWord(register int) (int, error) + func (i *I2C) WriteByte(val byte) error + func (i *I2C) WriteDevice(data []byte) error + func (i *I2C) WriteQuick(bit GpioLevel) error + func (i *I2C) WriteRegisterBlock(register int, data []byte) error + func (i *I2C) WriteRegisterByte(register int, val byte) error + func (i *I2C) WriteRegisterWord(register int, val int16) error + type I2CCommand byte + const I2CCmdAddress + const I2CCmdCombinedOff + const I2CCmdCombinedOn + const I2CCmdEnd + const I2CCmdEsc + const I2CCmdFlags + const I2CCmdRead + const I2CCmdStart + const I2CCmdStop + const I2CCmdWrite + type I2CFlags uint16 + const I2CIgnoreNak + const I2CNoReadAck + const I2CNoStart + const I2CRead + const I2CReceiveLen + const I2CRevDirAddr + const I2CTen + const I2CWrite + type Pi struct + func Initialize(host string, port int) (*Pi, error) + func (p *Pi) ClearBank(bank PiBank, mask int) (int, error) + func (p *Pi) ClearWaves() error + func (p *Pi) Close() error + func (p *Pi) CreateSerialWave(padPercent int, pulses ...SerialPulse) (*Wave, error) + func (p *Pi) CreateWave(padPercent int, pulses ...GenericPulse) (*Wave, error) + func (p *Pi) CreateWaveChain() *WaveChain + func (p *Pi) CurrentTick() (uint, error) + func (p *Pi) Gpio(bcm BCM) *GpioPin + func (p *Pi) HwReversion() uint + func (p *Pi) ListFiles(pattern string) ([]string, error) + func (p *Pi) MaxCBS() (int, error) + func (p *Pi) MaxMicros() (int, error) + func (p *Pi) MaxPulses() (int, error) + func (p *Pi) OpenFile(filename string, mode FileMode) (*File, error) + func (p *Pi) OpenI2C(bus int, address int, flags I2CFlags) (*I2C, error) + func (p *Pi) OpenSPI(channel int, baud int, flags int) (*SPI, error) + func (p *Pi) OpenSerial(tty string, baud int) (*Serial, error) + func (p *Pi) ReadBank(bank PiBank) (int, error) + func (p *Pi) SetBank(bank PiBank, mask int) (int, error) + func (p *Pi) Socket() *Socket + func (p *Pi) StoreScript(code string) (*Script, error) + type PiBank byte + const Bank1 + const Bank2 + type PiError struct + func (pe *PiError) Code() int + func (pe *PiError) CodeMessage() string + func (pe *PiError) Error() string + func (pe *PiError) InnerError() error + func (pe *PiError) Message() string + type PullUpDownMode int + const PudDown + const PudOff + const PudUp + type SPI struct + func (s *SPI) Close() error + func (s *SPI) Read(count int) ([]byte, error) + func (s *SPI) Write(data []byte) error + func (s *SPI) Xfer(data []byte) ([]byte, error) + type Script struct + func (s *Script) Code() string + func (s *Script) Delete() error + func (s *Script) Handle() int + func (s *Script) Run(params ...int) error + func (s *Script) Status() (ScriptStatus, []int, error) + func (s *Script) Stop() error + func (s *Script) Update(params ...int) error + type ScriptBuilder struct + func (sc *ScriptBuilder) Add(x int) *ScriptBuilder + func (sc *ScriptBuilder) And(x int) *ScriptBuilder + func (sc *ScriptBuilder) Call(tag int) *ScriptBuilder + func (sc *ScriptBuilder) Cmp(x int) *ScriptBuilder + func (sc *ScriptBuilder) Code() string + func (sc *ScriptBuilder) Dcr(y int) *ScriptBuilder + func (sc *ScriptBuilder) Dcra() *ScriptBuilder + func (sc *ScriptBuilder) Div(x int) *ScriptBuilder + func (sc *ScriptBuilder) Evtwt() *ScriptBuilder + func (sc *ScriptBuilder) Halt() *ScriptBuilder + func (sc *ScriptBuilder) Inr(y int) *ScriptBuilder + func (sc *ScriptBuilder) Inra() *ScriptBuilder + func (sc *ScriptBuilder) Jm(tag int) *ScriptBuilder + func (sc *ScriptBuilder) Jmp(tag int) *ScriptBuilder + func (sc *ScriptBuilder) Jnz(tag int) *ScriptBuilder + func (sc *ScriptBuilder) Jp(tag int) *ScriptBuilder + func (sc *ScriptBuilder) Jz(tag int) *ScriptBuilder + func (sc *ScriptBuilder) Ld(y int, x int) *ScriptBuilder + func (sc *ScriptBuilder) Lda(x int) *ScriptBuilder + func (sc *ScriptBuilder) Mlt(x int) *ScriptBuilder + func (sc *ScriptBuilder) Mod(x int) *ScriptBuilder + func (sc *ScriptBuilder) Or(x int) *ScriptBuilder + func (sc *ScriptBuilder) Pop(y int) *ScriptBuilder + func (sc *ScriptBuilder) Popa() *ScriptBuilder + func (sc *ScriptBuilder) Push(y int) *ScriptBuilder + func (sc *ScriptBuilder) Pusha() *ScriptBuilder + func (sc *ScriptBuilder) Ret() *ScriptBuilder + func (sc *ScriptBuilder) Rl(y int, x int) *ScriptBuilder + func (sc *ScriptBuilder) Rla(x int) *ScriptBuilder + func (sc *ScriptBuilder) Rr(y int, x int) *ScriptBuilder + func (sc *ScriptBuilder) Rra(x int) *ScriptBuilder + func (sc *ScriptBuilder) Sta(y int) *ScriptBuilder + func (sc *ScriptBuilder) Sub(x int) *ScriptBuilder + func (sc *ScriptBuilder) Sys(str string) *ScriptBuilder + func (sc *ScriptBuilder) Tag(tag int) *ScriptBuilder + func (sc *ScriptBuilder) Wait(x int) *ScriptBuilder + func (sc *ScriptBuilder) Write(gpio *GpioPin, level GpioLevel) *ScriptBuilder + func (sc *ScriptBuilder) X(y1 int, y2 int) *ScriptBuilder + func (sc *ScriptBuilder) Xa(y int) *ScriptBuilder + func (sc *ScriptBuilder) Xor(x int) *ScriptBuilder + type ScriptStatus int + const Failed + const Halted + const Initiating + const Running + const Unknown + const Waiting + type Serial struct + func (s *Serial) Baud() int + func (s *Serial) Close() error + func (s *Serial) DataAvailable() (bool, error) + func (s *Serial) Handle() int + func (s *Serial) Read(count int) ([]byte, error) + func (s *Serial) ReadByte() (byte, error) + func (s *Serial) TTY() string + func (s *Serial) Write(data []byte) error + func (s *Serial) WriteByte(data byte) error + type SerialPulse struct + Baud int + Data []byte + DataBits int + Gpio *GpioPin + Offset int + StopBits int + func CreateSerialPulse(gpio *GpioPin, baud int, data []byte) SerialPulse + func CreateSerialPulseEx(gpio *GpioPin, baud int, data []byte, offset int, dataBits int, stopBits int) SerialPulse + type Socket struct + Connection net.Conn + func NewSocket(host string, port int) (*Socket, error) + func (s *Socket) Address() *net.TCPAddr + func (s *Socket) Close() error + func (s *Socket) Host() string + func (s *Socket) Port() int + func (s *Socket) Read(len int) ([]byte, error) + func (s *Socket) SendCommand(command Command, p1 int, p2 int, extData []byte) (int, error) + type Wave struct + func (w *Wave) Delete() error + func (w *Wave) Handle() int + func (w *Wave) IsBusy() bool + func (w *Wave) Once() (int, error) + func (w *Wave) Repeat() (int, error) + func (w *Wave) Stop() error + type WaveChain struct + func (wc *WaveChain) Bytes() []byte + func (wc *WaveChain) Delay(us int) *WaveChain + func (wc *WaveChain) LoopBegin() *WaveChain + func (wc *WaveChain) LoopEnd(repeat int) *WaveChain + func (wc *WaveChain) LoopForever() *WaveChain + func (wc *WaveChain) Run() error + func (wc *WaveChain) Wave(w *Wave) *WaveChain