mirror of
https://gitlab.com/manzerbredes/ina260-zmq-publisher.git
synced 2025-04-07 04:16:26 +02:00
29 lines
No EOL
637 B
C
29 lines
No EOL
637 B
C
#pragma once
|
|
|
|
#include <time.h>
|
|
#include <unistd.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#define MIN_INTERVAL 30
|
|
|
|
#define INA260_SYSFS "/sys/kernel/ina260"
|
|
#define INA260_POWER_REGISTER "registers/power"
|
|
|
|
#define STR(symbol) #symbol
|
|
#define STRINGIFY(symbol) STR(symbol)
|
|
|
|
#define TIMESTAMP() (time(NULL))
|
|
|
|
#define INTERVAL(duration)\
|
|
((TIMESTAMP()) - ((TIMESTAMP())%(duration)))
|
|
|
|
#define INTERVAL_NEXT(duration)\
|
|
((INTERVAL(duration))+(duration))
|
|
|
|
#define INTERVAL_LAST(duration)\
|
|
(INTERVAL(INTERVAL((TIMESTAMP()),(duration))-1,(duration)))
|
|
|
|
#define FILE_EXISTS(path) (access((path), F_OK) == 0)
|
|
|
|
void mkdirp(char *path); |