Documentation ¶
Overview ¶
Package buspirate interfaces with the binary mode of the BusPirate. http://dangerousprototypes.com/docs/Bus_Pirate
Index ¶
- type BusPirate
- func (bp *BusPirate) PowerOff()
- func (bp *BusPirate) PowerOn()
- func (bp *BusPirate) SetPWM(duty float64)
- func (bp *BusPirate) SpiConfigure(power, pullups, aux, cs bool) error
- func (bp *BusPirate) SpiConfigure2(output33v, idle, edge, sample bool) error
- func (bp *BusPirate) SpiCs(high bool) error
- func (bp *BusPirate) SpiEnter() error
- func (bp *BusPirate) SpiLeave() error
- func (bp *BusPirate) SpiSpeed(speed SpiSpeed) error
- func (bp *BusPirate) SpiTransfer(send []byte) (*[]byte, error)
- type SpiSpeed
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BusPirate ¶
type BusPirate struct {
// contains filtered or unexported fields
}
BusPirate represents a connection to a remote BusPirate device.
func (*BusPirate) PowerOff ¶
func (bp *BusPirate) PowerOff()
PowerOff turns off the 5v and 3v3 regulators.
func (*BusPirate) PowerOn ¶
func (bp *BusPirate) PowerOn()
PowerOn turns on the 5v and 3v3 regulators.
func (*BusPirate) SetPWM ¶
SetPWM enables PWM output on the AUX pin with the specified duty cycle. duty is clamped between [0, 1].
Example ¶
Pulse a LED connected to the AUX pin.
bp, err := buspirate.Open("/dev/ttyACM0") if err != nil { panic(err) } duty := 0.1 delta := 0.1 for { bp.SetPWM(duty) time.Sleep(50 * time.Millisecond) duty += delta if duty > 1.0 { duty = 1.0 delta = -delta } if duty < 0 { duty = 0.0 delta = -delta } }
Output:
func (*BusPirate) SpiConfigure ¶
0100wxyz – Configure peripherals, w=power, x=pullups, y=AUX, z=CS
func (*BusPirate) SpiConfigure2 ¶
1000wxyz – SPI config, w=output type, x=idle, y=clock edge, z=sample
Click to show internal directories.
Click to hide internal directories.