Documentation
¶
Index ¶
- Constants
- type ActionItem
- type Blinker
- type Display
- type Driver
- type Gotogen
- func (g *Gotogen) Busy(f func(buffer *textbuf.Buffer))
- func (g *Gotogen) Display() error
- func (g *Gotogen) Init() error
- func (g *Gotogen) Run()
- func (g *Gotogen) RunTick() error
- func (g *Gotogen) SetPixel(x, y int16, c color.RGBA)
- func (g *Gotogen) Size() (x, y int16)
- func (g *Gotogen) Talking() bool
- type Item
- type Menu
- type MenuButton
- type MenuProvider
- type Menuable
- type SensorStatus
- type SettingItem
- func (si *SettingItem) Len() uint8
- func (si *SettingItem) Prev() Menuable
- func (si *SettingItem) Render(buf *textbuf.Buffer)
- func (si *SettingItem) Selected() uint8
- func (si *SettingItem) SetPrev(p Menuable)
- func (si *SettingItem) SetSelected(s uint8)
- func (si *SettingItem) SetTop(t uint8)
- func (si *SettingItem) Top() uint8
Constants ¶
View Source
const ( SensorStatusUnavailable = iota // SensorStatusAvailable indicates that the returned value(s) is/are accurate. SensorStatusAvailable // SensorStatusBusy indicates that the sensor is temporarily unavailable e.g. due to bus contention. SensorStatusBusy )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionItem ¶
type ActionItem struct {
Name string
Invoke func()
}
type Display ¶
type Display interface {
drivers.Displayer
// CanUpdateNow indicates that the device is able to take a new frame right now. This is useful if the device is
// driven by a DMA transfer, and the previous transfer has not yet completed. Displays should still support Display
// being called before they are ready to update; in this case, they should block until the next update is possible.
CanUpdateNow() bool
}
type Driver ¶
type Driver interface {
// EarlyInit initializes secondary devices after the primary menu display has been initialized for boot
// messages. Hardware drivers shall configure any buses (SPI, etc.) that are required to communicate with these
// devices at this point, and should only configure the bare minimum to call New.
EarlyInit() (faceDisplay Display, err error)
// LateInit performs any late initialization (e.g. connecting to wifi to set the clock). The failure of anything in
// LateInit should not cause the failure of the entire process. Boot messages may be freely logged.
//
// TODO interface
LateInit(buffer *textbuf.Buffer)
// PressedButton returns the currently-pressed menu button. The implementation is responsible for prioritizing
// multiple buttons being pressed at the same time however it sees fit (or implement some buttons as a chord of
// multiple physical buttons), as well as handling debouncing (if needed) and button repeating. Basically, this
// should only return a value when that value should be acted upon.
//
// This function should expect to be called at the main loop framerate.
PressedButton() MenuButton
// MenuItems is invoked every time the menu is displayed to retrieve the current menu items for the driver.
// The driver may return different menu items depending on current state.
MenuItems() []Item
// BoopDistance is a normalized value for the closeness of a boop. TODO define the normalization
// The second return value indicates the status of the boop sensor: does not exist, valid data, or busy.
BoopDistance() (uint8, SensorStatus)
// Accelerometer is a normalized value for accelerometer values. TODO define the scale of the normalized values
// When not in motion, all values should be approximately zero. TODO actually implement that
// Drivers should provide a calibration option to zero out the sensor.
// The second return value indicates the status of the accelerometer: does not exist, valid data, or busy.
Accelerometer() (x, y, z int32, status SensorStatus)
// Talking indicates if the driver has detected speech and the face should animate talking.
Talking() bool
// StatusLine returns a textual status indicator that the driver may use for whatever it wishes.
//
// For the current hardware implementation of a 128x64 OLED display with the 6x8 font, this cannot be more than 21
// characters. Other hardware implementations may have different limits, but since the hardware implementation is
// what is returning this line, it should know better.
StatusLine() string
}
type Gotogen ¶
type Gotogen struct {
// contains filtered or unexported fields
}
func (*Gotogen) Run ¶
func (g *Gotogen) Run()
Run does not return. It attempts to run the main loop at the framerate specified in New.
type Menu ¶
func (*Menu) SetSelected ¶
type MenuButton ¶
type MenuButton uint8
const ( MenuButtonNone MenuButton = iota MenuButtonMenu MenuButtonBack MenuButtonUp MenuButtonDown // MenuButtonDefault is for resetting a specific setting to its default value. Drivers may wish to require this // button to be held down for a second before triggering it, or perhaps make it be a chord of up and down. MenuButtonDefault )
func (MenuButton) String ¶
func (b MenuButton) String() string
type MenuProvider ¶
type MenuProvider interface {
GetMenu() Menu
}
type SensorStatus ¶
type SensorStatus uint8
type SettingItem ¶
type SettingItem struct {
Name string
Options []string
Default uint8
Active uint8
Apply func(selected uint8)
// contains filtered or unexported fields
}
func (*SettingItem) Len ¶
func (si *SettingItem) Len() uint8
func (*SettingItem) Prev ¶
func (si *SettingItem) Prev() Menuable
func (*SettingItem) Render ¶
func (si *SettingItem) Render(buf *textbuf.Buffer)
func (*SettingItem) Selected ¶
func (si *SettingItem) Selected() uint8
func (*SettingItem) SetPrev ¶
func (si *SettingItem) SetPrev(p Menuable)
func (*SettingItem) SetSelected ¶
func (si *SettingItem) SetSelected(s uint8)
func (*SettingItem) SetTop ¶
func (si *SettingItem) SetTop(t uint8)
func (*SettingItem) Top ¶
func (si *SettingItem) Top() uint8
Click to show internal directories.
Click to hide internal directories.