mirror of
https://gitlab.com/manzerbredes/ina260-zmq-publisher.git
synced 2025-04-06 03:46:25 +02:00
Minor changes
This commit is contained in:
parent
31fd7f1f9b
commit
a049e4b17e
6 changed files with 35 additions and 13 deletions
4
Makefile
4
Makefile
|
@ -16,7 +16,7 @@ client:
|
|||
$(MAKE) -C src/client/ CC=$(CC) OUT=$(PWD) CONF=$(CONF)
|
||||
|
||||
logger:
|
||||
@echo "---------- Building client..."
|
||||
@echo "---------- Building logger..."
|
||||
CFLAGS=$(CFLAGS) \
|
||||
$(MAKE) -C src/logger/ CC=$(CC) OUT=$(PWD) CONF=$(CONF)
|
||||
|
||||
|
@ -26,4 +26,4 @@ clean:
|
|||
$(MAKE) clean -C src/client/
|
||||
$(MAKE) clean -C src/logger/
|
||||
|
||||
.PHONY: clean publisher client
|
||||
.PHONY: clean publisher client logger
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
PUBLISHER_PORT=5556
|
||||
PUBLISHER_ADDR=localhost
|
||||
PUBLISHER_ADDR=localhost
|
||||
LOGGER_DIR=./logs
|
BIN
logger
BIN
logger
Binary file not shown.
|
@ -1,8 +1,11 @@
|
|||
include $(CONF)
|
||||
EXEC=logger
|
||||
|
||||
DEFINES=\
|
||||
-DLOGGER_DIR=$(LOGGER_DIR)
|
||||
|
||||
all: main.c
|
||||
$(CC) $^ -o $(OUT)/$(EXEC) $(CFLAGS)
|
||||
$(CC) $^ -o $(OUT)/$(EXEC) $(CFLAGS) $(DEFINES)
|
||||
|
||||
clean:
|
||||
rm -f $(OUT)/$(EXEC)
|
||||
|
|
|
@ -4,10 +4,35 @@
|
|||
#include <zmq.h>
|
||||
#include <assert.h>
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <libgen.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
void start(char *power_path);
|
||||
|
||||
int main (int argc, char *argv [])
|
||||
{
|
||||
|
||||
return 0;
|
||||
if(argc != 2){
|
||||
printf("Usage: %s <sysfs-path>",argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Extract bus id and ina260 chip address
|
||||
char busid[10];
|
||||
char chipaddr[10];
|
||||
char *base=basename(argv[1]);
|
||||
sscanf(base,"%[^-]-%[^-]",busid,chipaddr);
|
||||
|
||||
start("/home/loic/out.txt");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void start(char *power_path){
|
||||
if (access(power_path, F_OK) != 0){
|
||||
printf("Could not read %s\n",power_path);
|
||||
exit(2);
|
||||
}
|
||||
}
|
|
@ -1,10 +1,3 @@
|
|||
#define STR(symbol) #symbol
|
||||
#define STRINGIFY(symbol) STR(symbol)
|
||||
|
||||
#ifndef PUBLISHER_PORT
|
||||
#error PUBLISHER_PORT undefined
|
||||
#endif
|
||||
|
||||
#ifndef PUBLISHER_ADDR
|
||||
#error PUBLISHER_ADDR undefined
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue