removed references to json-c
This commit is contained in:
14
Makefile
14
Makefile
@ -3,18 +3,16 @@ DEBUG_DIR := build/Debug
|
|||||||
BIN_DEBUG_DIR := bin/Debug
|
BIN_DEBUG_DIR := bin/Debug
|
||||||
RELEASE_DIR := build/Release
|
RELEASE_DIR := build/Release
|
||||||
BIN_RELEASE_DIR := bin/Release
|
BIN_RELEASE_DIR := bin/Release
|
||||||
CFLAGS += $(shell pkg-config --cflags json-c)
|
|
||||||
LDFLAGS += $(shell pkg-config --libs json-c)
|
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
gcc -Wall -fPIC -pg -g -c src/bme280/bme280.c -o $(DEBUG_DIR)/bme280.o -std=${STANDARD} ${LDFLAGS}
|
gcc -Wall -fPIC -pg -g -c src/bme280/bme280.c -o $(DEBUG_DIR)/bme280.o -std=${STANDARD}
|
||||||
gcc -Wall -fPIC -pg -g -c src/main.c -o $(DEBUG_DIR)/main.o -std=${STANDARD} ${LDFLAGS}
|
gcc -Wall -fPIC -pg -g -c src/main.c -o $(DEBUG_DIR)/main.o -std=${STANDARD}
|
||||||
gcc -Wall -fPIC -pg -g -o $(BIN_DEBUG_DIR)/tempRecord $(DEBUG_DIR)/main.o $(DEBUG_DIR)/bme280.o -std=${STANDARD} ${LDFLAGS}
|
gcc -Wall -fPIC -pg -g -o $(BIN_DEBUG_DIR)/tempRecord $(DEBUG_DIR)/main.o $(DEBUG_DIR)/bme280.o -std=${STANDARD}
|
||||||
|
|
||||||
release:
|
release:
|
||||||
gcc -Wall -fPIC -O2 -c src/bme280/bme280.c -o $(RELEASE_DIR)/bme280.o -std=${STANDARD} ${LDFLAGS}
|
gcc -Wall -fPIC -O2 -c src/bme280/bme280.c -o $(RELEASE_DIR)/bme280.o -std=${STANDARD}
|
||||||
gcc -Wall -fPIC -O2 -c src/main.c -o $(RELEASE_DIR)/main.o -std=${STANDARD} ${LDFLAGS}
|
gcc -Wall -fPIC -O2 -c src/main.c -o $(RELEASE_DIR)/main.o -std=${STANDARD}
|
||||||
gcc -Wall -fPIC -O2 -o $(BIN_RELEASE_DIR)/tempRecord $(RELEASE_DIR)/main.o $(RELEASE_DIR)/bme280.o -std=${STANDARD} ${LDFLAGS}
|
gcc -Wall -fPIC -O2 -o $(BIN_RELEASE_DIR)/tempRecord $(RELEASE_DIR)/main.o $(RELEASE_DIR)/bme280.o -std=${STANDARD}
|
||||||
|
|
||||||
|
|
||||||
.PHONY clean:
|
.PHONY clean:
|
||||||
|
29
src/main.c
29
src/main.c
@ -13,8 +13,6 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <json-c/json_object.h>
|
|
||||||
#include <json-c/json_tokener.h>
|
|
||||||
|
|
||||||
#define IIC_Dev "/dev/i2c-1"
|
#define IIC_Dev "/dev/i2c-1"
|
||||||
|
|
||||||
@ -48,33 +46,6 @@ double pascals_to_mbar(double pascals)
|
|||||||
return pascals / 100;
|
return pascals / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *parse_json_contents(FILE* filePtr, size_t size)
|
|
||||||
{
|
|
||||||
char *str;
|
|
||||||
int ch;
|
|
||||||
size_t len = 0;
|
|
||||||
|
|
||||||
str = realloc(NULL, sizeof(*str)*size);
|
|
||||||
if (!str) {
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
while (EOF != (ch = fgetc(filePtr)) && ch != '\n')
|
|
||||||
{
|
|
||||||
str[len++] = ch;
|
|
||||||
if (len == size)
|
|
||||||
{
|
|
||||||
str = realloc(str, sizeof(*str)*(size += 16)); // not sure why 16, was in example
|
|
||||||
if (!str) {
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
str[len++] = '\0'; // ??? append a null character?
|
|
||||||
|
|
||||||
return realloc(str, sizeof(*str)*len);
|
|
||||||
}
|
|
||||||
|
|
||||||
int8_t user_i2c_read(uint8_t id, uint8_t reg_addr, uint8_t *data, uint16_t len)
|
int8_t user_i2c_read(uint8_t id, uint8_t reg_addr, uint8_t *data, uint16_t len)
|
||||||
{
|
{
|
||||||
write(file_descriptor, ®_addr, 1);
|
write(file_descriptor, ®_addr, 1);
|
||||||
|
Reference in New Issue
Block a user