@@ -16,8 +16,10 @@ import (
1616 "tinygo.org/x/drivers"
1717)
1818
19+ // Rotation controls the rotation used by the display.
1920type Rotation uint8
2021
22+ // FrameRate controls the frame rate used by the display.
2123type FrameRate uint8
2224
2325// Device wraps an SPI connection.
@@ -278,7 +280,7 @@ func (d *Device) FillRectangle(x, y, width, height int16, c color.RGBA) error {
278280 return nil
279281}
280282
281- // FillRectangle fills a rectangle at a given coordinates with a buffer
283+ // FillRectangleWithBuffer fills buffer with a rectangle at a given coordinates.
282284func (d * Device ) FillRectangleWithBuffer (x , y , width , height int16 , buffer []color.RGBA ) error {
283285 i , j := d .Size ()
284286 if x < 0 || y < 0 || width <= 0 || height <= 0 ||
@@ -370,12 +372,12 @@ func (d *Device) SetRotation(rotation Rotation) {
370372 d .Data (madctl )
371373}
372374
373- // Command sends a command to the display
375+ // Command sends a command to the display.
374376func (d * Device ) Command (command uint8 ) {
375377 d .Tx ([]byte {command }, true )
376378}
377379
378- // Command sends a data to the display
380+ // Data sends data to the display.
379381func (d * Device ) Data (data uint8 ) {
380382 d .Tx ([]byte {data }, false )
381383}
@@ -393,13 +395,13 @@ func (d *Device) Tx(data []byte, isCommand bool) {
393395}
394396
395397// Rx reads data from the display
396- func (d * Device ) Rx (command uint8 , read_bytes []byte ) {
398+ func (d * Device ) Rx (command uint8 , data []byte ) {
397399 d .dcPin .Low ()
398400 d .csPin .Low ()
399401 d .bus .Transfer (command )
400402 d .dcPin .High ()
401- for i := range read_bytes {
402- read_bytes [i ], _ = d .bus .Transfer (0xFF )
403+ for i := range data {
404+ data [i ], _ = d .bus .Transfer (0xFF )
403405 }
404406 d .csPin .High ()
405407}
@@ -421,7 +423,7 @@ func (d *Device) EnableBacklight(enable bool) {
421423 }
422424}
423425
424- // InverColors inverts the colors of the screen
426+ // InvertColors inverts the colors of the screen
425427func (d * Device ) InvertColors (invert bool ) {
426428 if invert {
427429 d .Command (INVON )
@@ -435,7 +437,7 @@ func (d *Device) IsBGR(bgr bool) {
435437 d .isBGR = bgr
436438}
437439
438- // SetScrollWindow sets an area to scroll with fixed top and bottom parts of the display
440+ // SetScrollArea sets an area to scroll with fixed top and bottom parts of the display.
439441func (d * Device ) SetScrollArea (topFixedArea , bottomFixedArea int16 ) {
440442 d .Command (VSCRDEF )
441443 d .Tx ([]uint8 {
@@ -451,7 +453,7 @@ func (d *Device) SetScroll(line int16) {
451453 d .Tx ([]uint8 {uint8 (line >> 8 ), uint8 (line )}, false )
452454}
453455
454- // SpotScroll returns the display to its normal state
456+ // StopScroll returns the display to its normal state.
455457func (d * Device ) StopScroll () {
456458 d .Command (NORON )
457459}
0 commit comments