From 8bd1a8681ad55aa209c1fa28e3be4f7dbd77800c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Mengu=C3=A9?= Date: Fri, 14 Feb 2025 15:42:10 +0100 Subject: [PATCH] inky: improve godoc Add godoc links to ease discovery. --- inky/impression.go | 8 ++++---- inky/inky.go | 14 +++++++------- inky/types.go | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/inky/impression.go b/inky/impression.go index a24f918..63ee7a8 100644 --- a/inky/impression.go +++ b/inky/impression.go @@ -181,7 +181,7 @@ func (d *DevImpression) Saturation() uint { 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 { if level > 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 } -// 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) { 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 { if d.flipVertically { 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]] } -// 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) { if d.Palette == nil { d.Palette = d.blend() diff --git a/inky/inky.go b/inky/inky.go index 9fcd60c..4012017 100644 --- a/inky/inky.go +++ b/inky/inky.go @@ -123,12 +123,12 @@ func New(p spi.Port, dc gpio.PinOut, reset gpio.PinOut, busy gpio.PinIn, o *Opts 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) { 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. func (d *Dev) SetModelColor(c Color) error { if c != Black && c != Red && c != Yellow { @@ -138,7 +138,7 @@ func (d *Dev) SetModelColor(c Color) error { return nil } -// String implements conn.Resource. +// String implements interface [conn.Resource]. func (d *Dev) String() string { index := int(d.variant) if index < len(displayVariantMap) { @@ -165,12 +165,12 @@ func (d *Dev) SetFlipHorizontally(f bool) { d.flipHorizontally = f } -// Halt implements conn.Resource. +// Halt implements interface [conn.Resource]. func (d *Dev) Halt() error { 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 // a placeholder for the display's third color, i.e., red or yellow. 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 { 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 { if dstRect != d.Bounds() { return fmt.Errorf("partial update not supported") diff --git a/inky/types.go b/inky/types.go index 82744a7..a1f8467 100644 --- a/inky/types.go +++ b/inky/types.go @@ -23,7 +23,7 @@ const ( 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 { switch s { case "PHAT": @@ -55,7 +55,7 @@ const ( 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 { switch s { case "black": @@ -86,7 +86,7 @@ const ( 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 { switch s { case "black":