Documentation
¶
Overview ¶
Package pwmfan is a set of toolkits to build a pwm fan control program
Index ¶
- func LinearClampRemap(input float64, opt ...float64) (output float64)
- func LinearRemap(input float64, opt ...float64) (output float64)
- func PullCPUTemp(CPUTempPath string, Divider float64, Temp chan<- float64)
- func ReadCPUTemperature(CPUTempPath string, Divider float64) (Temperature float64)
- func SignalProcess(Process *os.Process, SigChan <-chan os.Signal, Action func())
- func TriangularWave(small float64, big float64, step float64, ch chan<- float64)
- type Config
- type Fan
- func (fan Fan) GetCfg() (cfg Config)
- func (fan Fan) GetCycle() (cycle uint)
- func (fan Fan) GetStartCounter() (num uint)
- func (fan Fan) GetState() (state FanState)
- func (fan Fan) GetStopCounter() (num uint)
- func (fan Fan) GetTemp() (temp float64)
- func (fan *Fan) Monitor()
- func (fan *Fan) SetCfg(cfg Config)
- func (fan *Fan) SetCycle(cycle uint)
- func (fan *Fan) SetStartCounter(num uint)
- func (fan *Fan) SetState(state FanState)
- func (fan *Fan) SetStopCounter(num uint)
- func (fan *Fan) SetTemp(temp float64)
- func (fan *Fan) UpdateCycleFromState(remapper RemapFunc)
- type FanState
- type RemapFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LinearClampRemap ¶
LinearClampRemap is a linear remap function that will clamp output in between opt[2] and opt[3]
func LinearRemap ¶
LinearRemap is a linear remap function
func PullCPUTemp ¶
PullCPUTemp read from a system file constantanious and put temperature into a predifined channel
Note: As for raspberry Pi, CPUTempPath is /sys/class/thermal/thermal_zone0/temp Divider should be set to 1000
func ReadCPUTemperature ¶
ReadCPUTemperature read temprature once from a file and divie raw data by a divider
Note: As for raspberry Pi, CPUTempPath is /sys/class/thermal/thermal_zone0/temp Divider should be set to 1000
func SignalProcess ¶
SignalProcess listen from a os.Notify function's output, when catch signal, Process the Action, then send original to the Process
Types ¶
type Config ¶
type Config struct {
Pin uint
CPUTempPath string
StartCount uint
StopCount uint
StartTemp float64
LowTemp float64
HighTemp float64
PwmFreq uint
StopCycle uint
StartCycle uint
LowCycle uint
HighCycle uint
FullCycle uint
SampleRate uint
}
Config contain all information that define a PWM fan's user configuration
type Fan ¶
type Fan struct {
State FanState
Cycle uint
Temp float64
Cfg Config
Pin rpio.Pin
StopCounter uint
StartCounter uint
}
Fan represent a Fan
State, Cycle, Temp should be updated 'in realtime' Pin better not be modified after call NewFan()
func (Fan) GetStartCounter ¶
GetStartCounter get fan's current start counter
func (Fan) GetStopCounter ¶
GetStopCounter get fan's current stop counter
func (*Fan) SetStartCounter ¶
SetStartCounter set fan's current start counter
func (*Fan) SetStopCounter ¶
SetStopCounter set fan's current stop counter
func (*Fan) UpdateCycleFromState ¶
UpdateCycleFromState update pwm fan's Cycle information from State information