inky: improve godoc (#94)

Add godoc links to ease discovery.
pull/99/head
Olivier Mengué 1 year ago committed by GitHub
parent 5bcc204c9a
commit f007d15374
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -181,7 +181,7 @@ func (d *DevImpression) Saturation() uint {
return d.saturation return d.saturation
} }
// SetSaturaton changes the saturation level. This will not take effect until the next Draw(). // SetSaturaton changes the saturation level. This will take effect on the next call to [*DevImpression.Draw]().
func (d *DevImpression) SetSaturation(level uint) error { func (d *DevImpression) SetSaturation(level uint) error {
if level > 100 { if level > 100 {
return fmt.Errorf("saturation level needs to be between 0 and 100") return fmt.Errorf("saturation level needs to be between 0 and 100")
@ -193,12 +193,12 @@ func (d *DevImpression) SetSaturation(level uint) error {
return nil return nil
} }
// SetBorder changes the border color. This will not take effect until the next Draw(). // SetBorder changes the border color. This will take effect on the next call to [*DevImpression.Draw]().
func (d *DevImpression) SetBorder(c ImpressionColor) { func (d *DevImpression) SetBorder(c ImpressionColor) {
d.border = Color(c) d.border = Color(c)
} }
// Render renders the content of the Pix to the screen. // Render renders the content of the [*DevImpression.Pix] to the screen.
func (d *DevImpression) Render() error { func (d *DevImpression) Render() error {
if d.flipVertically { if d.flipVertically {
for w := 0; w < len(d.Pix)/2-1; w = w + d.width { for w := 0; w < len(d.Pix)/2-1; w = w + d.width {
@ -385,7 +385,7 @@ func (d *DevImpression) At(x, y int) color.Color {
return d.Palette[d.Pix[y*d.width+x]] return d.Palette[d.Pix[y*d.width+x]]
} }
// Set sets the pixel at (x, y) to the given color. This will not take effect until the next Draw(). // Set sets the pixel at (x, y) to the given color. This will take effect on the next [*DevImpression.Draw]().
func (d *DevImpression) Set(x, y int, c color.Color) { func (d *DevImpression) Set(x, y int, c color.Color) {
if d.Palette == nil { if d.Palette == nil {
d.Palette = d.blend() d.Palette = d.blend()

@ -123,12 +123,12 @@ func New(p spi.Port, dc gpio.PinOut, reset gpio.PinOut, busy gpio.PinIn, o *Opts
return d, nil return d, nil
} }
// SetBorder changes the border color. This will not take effect until the next Draw(). // SetBorder changes the border color. This will take effect on the next call to [*Dev.Draw]().
func (d *Dev) SetBorder(c Color) { func (d *Dev) SetBorder(c Color) {
d.border = c d.border = c
} }
// SetModelColor changes the model color. This will not take effect until the next Draw(). // SetModelColor changes the model color. This will take effect on the next call to [*Dev.Draw]().
// Useful if you want to switch between two-color and three-color drawing. // Useful if you want to switch between two-color and three-color drawing.
func (d *Dev) SetModelColor(c Color) error { func (d *Dev) SetModelColor(c Color) error {
if c != Black && c != Red && c != Yellow { if c != Black && c != Red && c != Yellow {
@ -138,7 +138,7 @@ func (d *Dev) SetModelColor(c Color) error {
return nil return nil
} }
// String implements conn.Resource. // String implements interface [conn.Resource].
func (d *Dev) String() string { func (d *Dev) String() string {
index := int(d.variant) index := int(d.variant)
if index < len(displayVariantMap) { if index < len(displayVariantMap) {
@ -165,12 +165,12 @@ func (d *Dev) SetFlipHorizontally(f bool) {
d.flipHorizontally = f d.flipHorizontally = f
} }
// Halt implements conn.Resource. // Halt implements interface [conn.Resource].
func (d *Dev) Halt() error { func (d *Dev) Halt() error {
return nil return nil
} }
// ColorModel implements display.Drawer // ColorModel implements interface [display.Drawer].
// Maps white to white, black to black and anything else as red. Red is used as // Maps white to white, black to black and anything else as red. Red is used as
// a placeholder for the display's third color, i.e., red or yellow. // a placeholder for the display's third color, i.e., red or yellow.
func (d *Dev) ColorModel() color.Model { func (d *Dev) ColorModel() color.Model {
@ -200,12 +200,12 @@ func (d *Dev) ColorModel() color.Model {
}) })
} }
// Bounds implements display.Drawer // Bounds implements interface [display.Drawer].
func (d *Dev) Bounds() image.Rectangle { func (d *Dev) Bounds() image.Rectangle {
return d.bounds return d.bounds
} }
// Draw implements display.Drawer // Draw implements interface [display.Drawer].
func (d *Dev) Draw(dstRect image.Rectangle, src image.Image, srcPtrs image.Point) error { func (d *Dev) Draw(dstRect image.Rectangle, src image.Image, srcPtrs image.Point) error {
if dstRect != d.Bounds() { if dstRect != d.Bounds() {
return fmt.Errorf("partial update not supported") return fmt.Errorf("partial update not supported")

@ -23,7 +23,7 @@ const (
IMPRESSION57 IMPRESSION57
) )
// Set sets the Model to a value represented by the string s. Set implements the flag.Value interface. // Set sets the Model to a value represented by the string s. Set implements the [flag.Value] interface.
func (m *Model) Set(s string) error { func (m *Model) Set(s string) error {
switch s { switch s {
case "PHAT": case "PHAT":
@ -55,7 +55,7 @@ const (
Multi Multi
) )
// Set sets the Color to a value represented by the string s. Set implements the flag.Value interface. // Set sets the [Color] to a value represented by the string s. Set implements the [flag.Value] interface.
func (c *Color) Set(s string) error { func (c *Color) Set(s string) error {
switch s { switch s {
case "black": case "black":
@ -86,7 +86,7 @@ const (
CleanImpression CleanImpression
) )
// Set sets the ImpressionColor to a value represented by the string s. Set implements the flag.Value interface. // Set sets the [ImpressionColor] to a value represented by the string s. Set implements the [flag.Value] interface.
func (c *ImpressionColor) Set(s string) error { func (c *ImpressionColor) Set(s string) error {
switch s { switch s {
case "black": case "black":

Loading…
Cancel
Save