-
Notifications
You must be signed in to change notification settings - Fork 8
/
fan-daemon.h
31 lines (25 loc) · 848 Bytes
/
fan-daemon.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef FAN_CONTROL_H_INCLUDED
#define FAN_CONTROL_H_INCLUDED
#include <iostream>
#include <algorithm>
#include <fstream>
#include <chrono>
#include <thread>
#include <signal.h>
#include <glob.h>
// the following three defines can be modified to change the daemon behaviour
#define FAN_OFF_TEMP 45
#define FAN_MAX_TEMP 60
#define UPDATE_INTERVAL 2
// end of modifiable code
#define MICRO_SECONDS 1000
#define JETSON_CLOCKS "/usr/bin/jetson_clocks"
#define THERMAL_ZONE_GLOB "/sys/devices/virtual/thermal/thermal_zone*/temp"
#define PWM_CAP "/sys/devices/pwm-fan/pwm_cap"
#define TARGET_PWM "/sys/devices/pwm-fan/target_pwm"
unsigned readAverageTemp();
unsigned adjustFanSpeed(unsigned, unsigned);
unsigned getPwmCap();
unsigned readIntSysFs(std::string);
void writeIntSysFs(std::string path, unsigned value);
#endif // FAN_CONTROL_H_INCLUDED