pull/16/merge
Alex Güthner 1 year ago committed by GitHub
commit cc389665b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -40,6 +40,7 @@ var DefaultOpts = Opts{
Intensity: 255, // Full blinding power.
Temperature: 5000, // More pleasing white balance than NeutralTemp.
DisableGlobalPWM: false, // Use full 13 bits range.
SpiMode: spi.Mode3, // SPI Mode3 works on most devices.
}
// PassThruOpts makes the driver draw RGB pixels exactly as specified.
@ -51,6 +52,7 @@ var PassThruOpts = Opts{
Intensity: 255,
Temperature: NeutralTemp,
DisableGlobalPWM: true,
SpiMode: spi.Mode3,
}
// Opts defines the options for the device.
@ -81,6 +83,12 @@ type Opts struct {
// to 8 bits, this also disables the dynamic perceptual mapping of intensity
// since there is not enough bits of resolution to do it effectively.
DisableGlobalPWM bool
// SpiMode sets the clock polarity and phase as one of the 4 possible SPI Modes.
//
// Most devices can use spi.Mode3, but the Raspberry Pi 3 secondary SPI port
// for example does not support this Mode. You may need to use spi.Mode0
// in this and similar cases.
SpiMode spi.Mode
}
// New returns a strip that communicates over SPI to APA102 LEDs.
@ -93,7 +101,7 @@ type Opts struct {
// https://en.wikipedia.org/wiki/Flicker_fusion_threshold is a recommended
// reading.
func New(p spi.Port, o *Opts) (*Dev, error) {
c, err := p.Connect(20*physic.MegaHertz, spi.Mode3, 8)
c, err := p.Connect(20*physic.MegaHertz, o.SpiMode, 8)
if err != nil {
return nil, err
}

Loading…
Cancel
Save