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 11:43:41 +02:00
|
|
|
#define TIMESTAMP() (time(NULL))
|
2023-07-15 10:11:50 +02:00
|
|
|
|
2023-07-15 11:43:41 +02:00
|
|
|
#define INTERVAL(duration)\
|
|
|
|
((TIMESTAMP()) - ((TIMESTAMP())%(duration)))
|
2023-07-15 10:11:50 +02:00
|
|
|
|
2023-07-15 12:14:22 +02:00
|
|
|
#define INTERVAL_NEXT(duration)\
|
|
|
|
((INTERVAL(duration))+(duration))
|
|
|
|
|
2023-07-15 11:43:41 +02:00
|
|
|
#define INTERVAL_LAST(duration)\
|
|
|
|
(INTERVAL(INTERVAL((TIMESTAMP()),(duration))-1,(duration)))
|
2023-07-15 10:31:36 +02:00
|
|
|
|
|
|
|
#define FILE_EXISTS(path) (access((path), F_OK) == 0)
|
|
|
|
|
|
|
|
void mkdirp(char *path);
|