Documentation ¶
Overview ¶
Package gpio provides interface to configure and control GPIO ports, pins and alternate functions.
This package handles the whole STM32 family in uniform way, even though the GPIO design used in STM32F1xx series is significantly different than the one used in newer series.
Index ¶
- Constants
- type Config
- type Driver
- type Mode
- type Pin
- type Pins
- type Port
- func (p *Port) Bus() bus.Bus
- func (p *Port) ClearAndSet(clear, set Pins)
- func (p *Port) ClearPins(pins Pins)
- func (p *Port) DisableClock()
- func (p *Port) EnableClock(lp bool)
- func (p *Port) Load() Pins
- func (p *Port) LoadOut() Pins
- func (p *Port) Lock(pins Pins)
- func (p *Port) Num() int
- func (p *Port) Pin(id int) Pin
- func (p *Port) Pins(pins Pins) Pins
- func (p *Port) PinsOut(pins Pins) Pins
- func (p *Port) Reset()
- func (p *Port) SetPins(pins Pins)
- func (p *Port) Setup(pins Pins, cfg *Config)
- func (p *Port) SetupPin(index int, cfg *Config)
- func (p *Port) Store(val Pins)
- func (p *Port) StorePins(pins, val Pins)
- type Pull
- type Speed
Constants ¶
const Pnum = pnum
Pnum is the number of available GPIO ports.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Mode Mode // Mode: input, output, analog, alternate function. Driver Driver // Output driver type: push-pull or open-drain. Speed Speed // Output speed. Pull Pull // Pull-up/pull-down resistors. }
Config contains parameters used to setup GPIO pin.
type Pin ¶
type Pin struct {
// contains filtered or unexported fields
}
Pin represents one phisical pin (specific pin in specific port).
func (Pin) Clear ¶
func (p Pin) Clear()
Clear sets output value of the pin to 0 in one atomic operation.
type Port ¶
type Port struct {
// contains filtered or unexported fields
}
Port represents a GPIO port.
func (*Port) ClearAndSet ¶
ClearAndSet clears and sets output value of all pins in one atomic operation. Setting pins has priority above clearing bits.
func (*Port) EnableClock ¶
EnableClock enables clock for port p. lp determines whether the clock remains on in low power (sleep) mode.
func (*Port) Lock ¶
Lock locks configuration of specified pins. Locked configuration can not be modified until reset.