// Package config contains the configuration structure and parser. package config import "image" // Config structure. type Config struct { Display Display `hcl:"display,block"` Input Input `hcl:"input,block"` Audio Audio `hcl:"audio,block"` Mixer Mixer `hcl:"mixer,block"` Player Player `hcl:"player,block"` Screen Screen `hcl:"screen,block"` } // Display configuration for OLED and TFT screens. type Display struct { FPS int `hcl:"fps,optional"` Main *DisplayConfig `hcl:"main,block"` Left *DisplayConfig `hcl:"left,block"` Right *DisplayConfig `hcl:"right,block"` Meta *DisplayConfig `hcl:"meta,block"` } // DisplayConfig is the configuration for one display. type DisplayConfig struct { Name string // Type of display. Type string `hcl:"type"` // Mode of operation; i2c or spi (defaults to i2c). Mode string `hcl:"mode,optional"` // Size of the display in pixels. Size string `hcl:"size"` // Bus is the I²C or SPI bus name. Bus string `hcl:"bus,optional"` // Address is the I²C address. Address string `hcl:"addr,optional"` // Frequency is the I²C or SPI bus frequency. Freq string `hcl:"frequency,optional"` // Reset is the reset pin. Reset string `hcl:"reset,optional"` // DC is the data/command pin. DC string `hcl:"dc,optional"` // CS is the chip select pin. CS string `hcl:"cs,optional"` // BL is the backlight pin. BL string `hcl:"bl,optional"` // Host name. Host string `hcl:"host,optional"` // Port name or number. Port string `hcl:"port,optional"` // Rotate the screen. Rotate string `hcl:"rotate,optional"` // Flip the screen vertically (if supported by hardware). Flip bool `hcl:"flip,optional"` // Mirror the screen horizontally (if supported by hardware). Mirror bool `hcl:"flip,optional"` } // Input peripherals. type Input struct { Encoder Encoder `hcl:"encoder,block"` } // Encoder is a rotary encoder. type Encoder struct { Type string `hcl:"type"` CW string `hcl:"cw,optional"` CCW string `hcl:"ccw,optional"` Switch string `hcl:"sw,optional"` } // Audio source provides PCM samples. type Audio struct { Output string `hcl:"output,optional"` Type string `hcl:"type"` Path string `hcl:"path,optional"` Host string `hcl:"host,optional"` Rate int `hcl:"rate,optional"` Channels int `hcl:"channels,optional"` Bits int `hcl:"bits,optional"` BigEndian bool `hcl:"be,optional"` Delay string `hcl:"delay,optional"` } type Mixer struct { Type string `hcl:"type"` Card int `hcl:"card,optional"` } // Player controls the audio. type Player struct { Type string `hcl:"type"` Host string `hcl:"host,optional"` Password string `hcl:"password,optional"` } type Screen struct { Playing *ScreenPlaying `hcl:"playing,block"` Spectrum *ScreenSpectrum `hcl:"spectrum,block"` VUMeter *ScreenVUMeter `hcl:"vumeter,block"` } type ScreenPlaying struct { Track *Style `hcl:"track,block"` Format *Style `hcl:"format,block"` Spectrum *ScreenSpectrum `hcl:"spectrum,block"` } type ScreenSpectrum struct { Style *Style `hcl:"style"` MinFrequency int `hcl:"min,optional"` MaxFrequency int `hcl:"max,optional"` Hold int `hcl:"hold,optional"` Window string `hcl:"window,optional"` Waterfall bool `hcl:"waterfall,optional"` Move image.Point } type ScreenVUMeter struct { Style *Style `hcl:"style"` }