From 041ba75d8a72a0989f7d671069b07b81defd463a Mon Sep 17 00:00:00 2001 From: Brian Rogers Date: Tue, 5 Apr 2022 09:09:50 -0600 Subject: [PATCH] removed references to json-c --- Makefile | 14 ++++++-------- src/main.c | 29 ----------------------------- 2 files changed, 6 insertions(+), 37 deletions(-) diff --git a/Makefile b/Makefile index a8db177..b5188d5 100644 --- a/Makefile +++ b/Makefile @@ -3,18 +3,16 @@ DEBUG_DIR := build/Debug BIN_DEBUG_DIR := bin/Debug RELEASE_DIR := build/Release BIN_RELEASE_DIR := bin/Release -CFLAGS += $(shell pkg-config --cflags json-c) -LDFLAGS += $(shell pkg-config --libs json-c) 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/main.c -o $(DEBUG_DIR)/main.o -std=${STANDARD} ${LDFLAGS} - 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 -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} + gcc -Wall -fPIC -pg -g -o $(BIN_DEBUG_DIR)/tempRecord $(DEBUG_DIR)/main.o $(DEBUG_DIR)/bme280.o -std=${STANDARD} release: - gcc -Wall -fPIC -O2 -c src/bme280/bme280.c -o $(RELEASE_DIR)/bme280.o -std=${STANDARD} ${LDFLAGS} - gcc -Wall -fPIC -O2 -c src/main.c -o $(RELEASE_DIR)/main.o -std=${STANDARD} ${LDFLAGS} - gcc -Wall -fPIC -O2 -o $(BIN_RELEASE_DIR)/tempRecord $(RELEASE_DIR)/main.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} + gcc -Wall -fPIC -O2 -o $(BIN_RELEASE_DIR)/tempRecord $(RELEASE_DIR)/main.o $(RELEASE_DIR)/bme280.o -std=${STANDARD} .PHONY clean: diff --git a/src/main.c b/src/main.c index e63ebd0..58f8ee8 100644 --- a/src/main.c +++ b/src/main.c @@ -13,8 +13,6 @@ #include #include #include -#include -#include #define IIC_Dev "/dev/i2c-1" @@ -48,33 +46,6 @@ double pascals_to_mbar(double pascals) 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) { write(file_descriptor, ®_addr, 1);