Documentation ¶
Index ¶
- Constants
- Variables
- func Bootstrap(pi europi.Hardware, options ...BootstrapOption) error
- func DefaultBootstrapCompleted(e europi.Hardware)
- func DefaultMainLoop(e europi.Hardware, deltaTime time.Duration)
- func DefaultPostBootstrapInitialization(e europi.Hardware)
- func ForceRepaintUI(e europi.Hardware)
- func Shutdown(e europi.Hardware, reason any) error
- type AppEndFunc
- type AppMainLoopFunc
- type AppStartFunc
- type ApplicationEnd
- type ApplicationMainLoop
- type ApplicationStart
- type BeginDestroyFunc
- type BootstrapAppOption
- type BootstrapCompletedFunc
- type BootstrapOption
- func App(app any, opts ...BootstrapAppOption) BootstrapOption
- func AppEnd(fn AppEndFunc) BootstrapOption
- func AppMainLoop(fn AppMainLoopFunc) BootstrapOption
- func AppOptions(option BootstrapAppOption, opts ...BootstrapAppOption) BootstrapOption
- func AppStart(fn AppStartFunc) BootstrapOption
- func AttachNonPicoWS(enabled bool) BootstrapOption
- func BeginDestroy(fn BeginDestroyFunc) BootstrapOption
- func BootstrapCompleted(fn BootstrapCompletedFunc) BootstrapOption
- func EnableDisplayLogger(enabled bool) BootstrapOption
- func FinishDestroy(fn FinishDestroyFunc) BootstrapOption
- func InitRandom(enabled bool) BootstrapOption
- func PostBootstrapConstruction(fn PostBootstrapConstructionFunc) BootstrapOption
- func PostInitializeComponents(fn PostInitializeComponentsFunc) BootstrapOption
- func PreInitializeComponents(fn PreInitializeComponentsFunc) BootstrapOption
- func UI(ui UserInterface[europi.Hardware], opts ...BootstrapUIOption) BootstrapOption
- func UIOptions(option BootstrapUIOption, opts ...BootstrapUIOption) BootstrapOption
- type BootstrapUIOption
- type FinishDestroyFunc
- type PostBootstrapConstructionFunc
- type PostInitializeComponentsFunc
- type PreInitializeComponentsFunc
- type UserInterface
- type UserInterfaceButton1
- type UserInterfaceButton1Debounce
- type UserInterfaceButton1Ex
- type UserInterfaceButton1Long
- type UserInterfaceButton2
- type UserInterfaceButton2Debounce
- type UserInterfaceButton2Ex
- type UserInterfaceButton2Long
- type UserInterfaceLogoPainter
Constants ¶
const (
DefaultAppMainLoopInterval time.Duration = time.Millisecond * 100
)
const (
DefaultEnableDisplayLogger bool = false
)
const (
DefaultInitRandom bool = true
)
const (
DefaultUIRefreshRate time.Duration = time.Millisecond * 100
)
const LongPressDuration = time.Millisecond * 650
LongPressDuration is the amount of time a button is in a held/pressed state before it is considered to be a 'long' press. TODO: This is eventually intended to be a persisted setting, configurable by the user.
Variables ¶
var DefaultPanicHandler func(e europi.Hardware, reason any)
DefaultPanicHandler is the default handler for panics This will be set by the build flag `onscreenpanic` to `handlePanicOnScreenLog` Not setting the build flag will set it to `handlePanicDisplayCrash`
Functions ¶
func Bootstrap ¶
func Bootstrap(pi europi.Hardware, options ...BootstrapOption) error
Bootstrap will set up a global runtime environment (see europi.Pi)
func DefaultMainLoop ¶
DefaultMainLoop is the default main loop used if a new one is not specified to Bootstrap()
func ForceRepaintUI ¶
ForceRepaintUI schedules a forced repaint of the UI (if it is configured and running)
Types ¶
type AppEndFunc ¶
type AppStartFunc ¶
type ApplicationEnd ¶
type ApplicationMainLoop ¶
type ApplicationStart ¶
type BeginDestroyFunc ¶
type BootstrapAppOption ¶
type BootstrapAppOption func(o *bootstrapAppConfig) error
BootstrapAppOption is a single configuration parameter passed to the App() or AppOption() functions
func AppMainLoopInterval ¶
func AppMainLoopInterval(interval time.Duration) BootstrapAppOption
AppMainLoopInterval sets the interval between calls to the configured app main loop function
type BootstrapCompletedFunc ¶
type BootstrapOption ¶
type BootstrapOption func(o *bootstrapConfig) error
BootstrapOption is a single configuration parameter passed to the Bootstrap() function
func App ¶
func App(app any, opts ...BootstrapAppOption) BootstrapOption
App sets the application handler interface with optional parameters
func AppEnd ¶
func AppEnd(fn AppEndFunc) BootstrapOption
AppEnd sets the application function that's called right before the bootstrap destruction processing is performed.
func AppMainLoop ¶
func AppMainLoop(fn AppMainLoopFunc) BootstrapOption
AppMainLoop sets the application main loop function to be called on interval. nil is not allowed - if you want to set the default, either do not specify a AppMainLoop() option or specify europi.DefaultMainLoop
func AppOptions ¶
func AppOptions(option BootstrapAppOption, opts ...BootstrapAppOption) BootstrapOption
AppOptions adds optional parameters for setting up the application interface
func AppStart ¶
func AppStart(fn AppStartFunc) BootstrapOption
AppStart sets the application function to be called before the main operating loop processing begins. At this point, the bootstrap configuration has completed and all bootstrap functionality may be used without fear of there being an incomplete operating state.
func AttachNonPicoWS ¶
func AttachNonPicoWS(enabled bool) BootstrapOption
AttachNonPicoWS (if enabled and on non-Pico builds with build flags of `-tags=revision1` set) starts up a websocket interface and system debugger on port 8080
func BeginDestroy ¶
func BeginDestroy(fn BeginDestroyFunc) BootstrapOption
BeginDestroy sets the function that receives the notification of shutdown of the bootstrap and is also the first stop within the `panic()` handler functionality. If the `reason` parameter is non-nil, then a critical failure has been detected and the bootstrap is in the last stages of complete destruction. If it is nil, then it can be assumed that proper functionality of the bootstrap is still available, but heading towards the last steps of unavailability once the function exits.
func BootstrapCompleted ¶
func BootstrapCompleted(fn BootstrapCompletedFunc) BootstrapOption
BootstrapCompleted sets the function that receives notification of critical bootstrap operations being complete - this is the first point where functions within the bootstrap may be used without fear of there being an incomplete operating state.
func EnableDisplayLogger ¶
func EnableDisplayLogger(enabled bool) BootstrapOption
EnableDisplayLogger enables (or disables) the logging of `log.Printf` (and similar) messages to the EuroPi's display. Enabling this will likely be undesirable except in cases where on-screen debugging is absoluely necessary.
func FinishDestroy ¶
func FinishDestroy(fn FinishDestroyFunc) BootstrapOption
FinishDestroy sets the function that receives the final notification of shutdown of the bootstrap. The entire bootstrap is disabled, all timers, queues, and components are considered deactivated.
func InitRandom ¶
func InitRandom(enabled bool) BootstrapOption
InitRandom enables (or disables) the initialization of the Go standard library's `rand` package Seed value. Disabling this will likely be undesirable except in cases where deterministic 'random' number generation is required, as the standard library `rand` package defaults to a seed of 1 instead of some pseudo-random number, like current time or thermal values. To generate a pseudo-random number for the random seed, the `machine.GetRNG` function is used.
func PostBootstrapConstruction ¶
func PostBootstrapConstruction(fn PostBootstrapConstructionFunc) BootstrapOption
PostBootstrapConstruction sets the function that runs immediately after primary EuroPi bootstrap has finished, but before components have been initialized. Nearly none of the functionality of the bootstrap is ready or configured at this point.
func PostInitializeComponents ¶
func PostInitializeComponents(fn PostInitializeComponentsFunc) BootstrapOption
PostInitializeComponents sets the function that recevies notification of when components of the bootstrap have completed their initialization phase and the bootstrap is nearly ready for full operation. Some operational functionality of the bootstrap might not be configured at this point.
func PreInitializeComponents ¶
func PreInitializeComponents(fn PreInitializeComponentsFunc) BootstrapOption
PreInitializeComponents sets the function that recevies notification of when components of the bootstrap are about to start their initialization phase and the bootstrap is getting ready. Most operational functionality of the bootstrap is definitely not configured at this point.
func UI ¶
func UI(ui UserInterface[europi.Hardware], opts ...BootstrapUIOption) BootstrapOption
UI sets the user interface handler interface
func UIOptions ¶
func UIOptions(option BootstrapUIOption, opts ...BootstrapUIOption) BootstrapOption
UIOptions adds optional parameters for setting up the user interface
type BootstrapUIOption ¶
type BootstrapUIOption func(o *bootstrapUIConfig) error
BootstrapOption is a single configuration parameter passed to the Bootstrap() function
func UIRefreshRate ¶
func UIRefreshRate(interval time.Duration) BootstrapUIOption
UIRefreshRate sets the interval of refreshes of the user interface