Exemplo n.º 1
0
// SdFromFile creates a new SdCardPeripheral based on the contents of a file.
func NewSdCardPeripheral(pm spi.PinMap) (sd *SdCardPeripheral, err error) {
	sd = &SdCardPeripheral{
		card: newSdCard(),
		spi:  spi.NewSlave(pm),
	}

	// two busy bytes, then ready.
	sd.card.queueMisoBytes(0x00, 0x00, 0xFF)

	return
}
Exemplo n.º 2
0
func NewDisplay(pm spi.PinMap) (display *Display, err error) {
	img := createImage()
	display = &Display{
		spi:      spi.NewSlave(pm),
		img:      img,
		startCol: 0,
		endCol:   width - 1,
		startRow: 0,
		endRow:   height - 1,
	}
	return
}