config

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BMP280

type BMP280 struct {
	Enabled    bool   `yaml:"enabled,omitempty"`
	Bmp280Addr uint16 `yaml:"addr,omitempty"`
}

to find out address of the device, use i2cdetect with -y option with the bus number $ i2cdetect -y 4

type Fan

type Fan struct {
	// GPIO Fan tachymeter connected to
	// Tachymeter usually is a yellow wire in 3-pin fan connector
	TachPin string `yaml:"tachPin"`
	// GPIO Fan control connected to (base of transistor)
	ControlPin string `yaml:"controlPin"`
	High       int    `yaml:"high"` // Fan activation temperature ˚C
	Low        int    `yaml:"low"`  // Fan deactivation temperature ˚C
}

type HTU21

type HTU21 struct {
	Enabled   bool   `yaml:"enabled,omitempty"`
	Htu21Addr uint16 `yaml:"addr,omitempty"`
}

type Modules

type Modules struct {
	BMP280 BMP280 `yaml:"bmp280"`
	HTU21  HTU21  `yaml:"htu21"`
	System System `yaml:"system"`
	// to scan for i2c interfaces:
	// $ i2cdetect -l
	// i2c-4	i2c	400000002.i2c	I²C adapter
	I2C string `yaml:"i2c"`
}

type Parameters

type Parameters struct {
	Server  Server  `yaml:"server"`
	Fan     Fan     `yaml:"fan"`
	Modules Modules `yaml:"modules"`
	Storage Storage `yaml:"storage"`
}

Parameters is the main configuration struct

func NewConfig

func NewConfig(fname string) (*Parameters, error)

New creates a new Parameters from the given file

type Server

type Server struct {
	Listen string `yaml:"listen"` // Address or/and Port for http server to listen to
	Dbg    bool   `yaml:"-"`
}

type Storage added in v0.2.0

type Storage struct {
	// Type of storage to use
	// Currently supported: sqlite, memory
	Type string `yaml:"type"`
	// Path to the database file
	// Used only with sqlite storage
	Path string `yaml:"path"`
}

type System

type System struct {
	Enabled bool `yaml:"enabled,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL