2023-07-15 10:31:36 +02:00
|
|
|
#pragma once
|
|
|
|
|
2023-07-15 10:11:50 +02:00
|
|
|
#include <time.h>
|
2023-07-15 10:31:36 +02:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2023-07-15 10:11:50 +02:00
|
|
|
|
2023-07-15 10:34:20 +02:00
|
|
|
#define MIN_INTERVAL 30
|
2023-07-14 20:08:36 +02:00
|
|
|
|
2023-07-15 09:25:30 +02:00
|
|
|
#define INA260_SYSFS "/sys/kernel/ina260"
|
|
|
|
#define INA260_POWER_REGISTER "registers/power"
|
2023-07-15 10:11:50 +02:00
|
|
|
|
2023-07-15 10:34:20 +02:00
|
|
|
#define STR(symbol) #symbol
|
|
|
|
#define STRINGIFY(symbol) STR(symbol)
|
|
|
|
|
2023-07-15 10:11:50 +02:00
|
|
|
#define INTERVAL(timestamp,duration)\
|
|
|
|
((timestamp) - ((timestamp)%(duration)))
|
|
|
|
|
|
|
|
#define INTERVAL_LAST(timestamp,duration)\
|
|
|
|
(INTERVAL(INTERVAL((timestamp),(duration))-1,(duration)))
|
|
|
|
|
|
|
|
#define TIMESTAMP() (time(NULL))
|
2023-07-15 10:31:36 +02:00
|
|
|
|
|
|
|
#define FILE_EXISTS(path) (access((path), F_OK) == 0)
|
|
|
|
|
|
|
|
void mkdirp(char *path);
|