mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-12 02:43:42 +00:00
st7789: correct errors on various godoc comments
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
+11
-9
@@ -16,8 +16,10 @@ import (
|
|||||||
"tinygo.org/x/drivers"
|
"tinygo.org/x/drivers"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Rotation controls the rotation used by the display.
|
||||||
type Rotation uint8
|
type Rotation uint8
|
||||||
|
|
||||||
|
// FrameRate controls the frame rate used by the display.
|
||||||
type FrameRate uint8
|
type FrameRate uint8
|
||||||
|
|
||||||
// Device wraps an SPI connection.
|
// Device wraps an SPI connection.
|
||||||
@@ -278,7 +280,7 @@ func (d *Device) FillRectangle(x, y, width, height int16, c color.RGBA) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// FillRectangle fills a rectangle at a given coordinates with a buffer
|
// FillRectangleWithBuffer fills buffer with a rectangle at a given coordinates.
|
||||||
func (d *Device) FillRectangleWithBuffer(x, y, width, height int16, buffer []color.RGBA) error {
|
func (d *Device) FillRectangleWithBuffer(x, y, width, height int16, buffer []color.RGBA) error {
|
||||||
i, j := d.Size()
|
i, j := d.Size()
|
||||||
if x < 0 || y < 0 || width <= 0 || height <= 0 ||
|
if x < 0 || y < 0 || width <= 0 || height <= 0 ||
|
||||||
@@ -370,12 +372,12 @@ func (d *Device) SetRotation(rotation Rotation) {
|
|||||||
d.Data(madctl)
|
d.Data(madctl)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Command sends a command to the display
|
// Command sends a command to the display.
|
||||||
func (d *Device) Command(command uint8) {
|
func (d *Device) Command(command uint8) {
|
||||||
d.Tx([]byte{command}, true)
|
d.Tx([]byte{command}, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Command sends a data to the display
|
// Data sends data to the display.
|
||||||
func (d *Device) Data(data uint8) {
|
func (d *Device) Data(data uint8) {
|
||||||
d.Tx([]byte{data}, false)
|
d.Tx([]byte{data}, false)
|
||||||
}
|
}
|
||||||
@@ -393,13 +395,13 @@ func (d *Device) Tx(data []byte, isCommand bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Rx reads data from the display
|
// Rx reads data from the display
|
||||||
func (d *Device) Rx(command uint8, read_bytes []byte) {
|
func (d *Device) Rx(command uint8, data []byte) {
|
||||||
d.dcPin.Low()
|
d.dcPin.Low()
|
||||||
d.csPin.Low()
|
d.csPin.Low()
|
||||||
d.bus.Transfer(command)
|
d.bus.Transfer(command)
|
||||||
d.dcPin.High()
|
d.dcPin.High()
|
||||||
for i := range read_bytes {
|
for i := range data {
|
||||||
read_bytes[i], _ = d.bus.Transfer(0xFF)
|
data[i], _ = d.bus.Transfer(0xFF)
|
||||||
}
|
}
|
||||||
d.csPin.High()
|
d.csPin.High()
|
||||||
}
|
}
|
||||||
@@ -421,7 +423,7 @@ func (d *Device) EnableBacklight(enable bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// InverColors inverts the colors of the screen
|
// InvertColors inverts the colors of the screen
|
||||||
func (d *Device) InvertColors(invert bool) {
|
func (d *Device) InvertColors(invert bool) {
|
||||||
if invert {
|
if invert {
|
||||||
d.Command(INVON)
|
d.Command(INVON)
|
||||||
@@ -435,7 +437,7 @@ func (d *Device) IsBGR(bgr bool) {
|
|||||||
d.isBGR = bgr
|
d.isBGR = bgr
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetScrollWindow sets an area to scroll with fixed top and bottom parts of the display
|
// SetScrollArea sets an area to scroll with fixed top and bottom parts of the display.
|
||||||
func (d *Device) SetScrollArea(topFixedArea, bottomFixedArea int16) {
|
func (d *Device) SetScrollArea(topFixedArea, bottomFixedArea int16) {
|
||||||
d.Command(VSCRDEF)
|
d.Command(VSCRDEF)
|
||||||
d.Tx([]uint8{
|
d.Tx([]uint8{
|
||||||
@@ -451,7 +453,7 @@ func (d *Device) SetScroll(line int16) {
|
|||||||
d.Tx([]uint8{uint8(line >> 8), uint8(line)}, false)
|
d.Tx([]uint8{uint8(line >> 8), uint8(line)}, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SpotScroll returns the display to its normal state
|
// StopScroll returns the display to its normal state.
|
||||||
func (d *Device) StopScroll() {
|
func (d *Device) StopScroll() {
|
||||||
d.Command(NORON)
|
d.Command(NORON)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user