rakyll / experimental Goto Github PK
View Code? Open in Web Editor NEWExperimental Go packages
Experimental Go packages
Sorry for lack of proper fix and pull request, but so I don't forget this:
diff --git a/spi/spi.go b/spi/spi.go
index 3eca73e..69d165d 100644
--- a/spi/spi.go
+++ b/spi/spi.go
@@ -109,10 +109,12 @@ func (d *Device) Sync() error {
return d.f.Sync()
}
+var used *payload
+
// Do does a duplex transmission to write to the SPI device and read
// len(buf) numbers of bytes.
func (d *Device) Do(buf []byte, delay time.Duration) error {
- p := payload{
+ p := &payload{
tx: uint64(uintptr(unsafe.Pointer(&buf[0]))),
rx: uint64(uintptr(unsafe.Pointer(&buf[0]))),
length: uint32(len(buf)),
@@ -120,7 +122,8 @@ func (d *Device) Do(buf []byte, delay time.Duration) error {
delay: uint16(delay.Nanoseconds() / 1000),
bitsPerWord: d.bitsPerWord,
}
- return d.ioctl(msgArg(1), uintptr(unsafe.Pointer(&p)))
+ used = p // force escape
+ return d.ioctl(msgArg(1), uintptr(unsafe.Pointer(p)))
}
// Close closes the SPI device and releases related resources.
Totally the wrong way to fix it. I was lazy and impatient.
See the protocol explained at https://cpldcpu.wordpress.com/2014/11/30/understanding-the-apa102-superled/.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.