We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ebace0b commit 6378baaCopy full SHA for 6378baa
ili9341/spi_atsamd51.go renamed to ili9341/spi.go
@@ -1,11 +1,11 @@
1
-// +build atsamd51
2
-
3
package ili9341
4
5
import (
6
"machine"
7
)
8
+var buf [64]byte
+
9
type spiDriver struct {
10
bus machine.SPI
11
}
@@ -44,9 +44,16 @@ func (pd *spiDriver) write16(data uint16) {
44
45
46
func (pd *spiDriver) write16n(data uint16, n int) {
47
- for i := 0; i < n; i++ {
48
- pd.bus.Tx([]byte{uint8(data >> 8), uint8(data)}, nil)
+ for i := 0; i < len(buf); i += 2 {
+ buf[i] = uint8(data >> 8)
49
+ buf[i+1] = uint8(data)
50
51
52
+ for i := 0; i < (n >> 5); i++ {
53
+ pd.bus.Tx(buf[:], nil)
54
+ }
55
56
+ pd.bus.Tx(buf[:n%64], nil)
57
58
59
func (pd *spiDriver) write16sl(data []uint16) {
ili9341/spi_atsamd21.go
0 commit comments