Compare commits

..

1 Commits

Author SHA1 Message Date
e50eea2c6b ADS1115: skip negative values. 2019-07-29 15:57:28 +02:00
3 changed files with 9 additions and 2 deletions

View File

@ -51,7 +51,7 @@ UNIT_TEST_TARGET = $(BIN_DIR)/$(UNIT_TEST_SRC_DIR)/$(TARGET_FILE)
THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST)) THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
.PHONY: all install uninstall clean .PHONY: all install uninstall clean distclean
all: $(STATIC_LIB) $(DYNAMIC_LIB) all: $(STATIC_LIB) $(DYNAMIC_LIB)
install: all install: all
@ -76,6 +76,9 @@ clean:
rm -f $(OBJ_DIR)/*.gcda $(OBJ_DIR)/*.gcno rm -f $(OBJ_DIR)/*.gcda $(OBJ_DIR)/*.gcno
rm -fr $(COVERAGE_DIR) rm -fr $(COVERAGE_DIR)
distclean:
rm -fr $(BIN_DIR) $(OBJ_DIR) $(LIB_DIR) $(COVERAGE_DIR)
.PHONY: coverage .PHONY: coverage
coverage: _cov_genhtml coverage: _cov_genhtml
$(eval COVERAGE:=$(shell grep 'lines' .coverage.tmp | egrep -o '[0-9]+.[0-9]+%')) $(eval COVERAGE:=$(shell grep 'lines' .coverage.tmp | egrep -o '[0-9]+.[0-9]+%'))

View File

@ -2,7 +2,7 @@
#define __ADS1115__ #define __ADS1115__
#include <stdint.h> #include <stdint.h>
#include <libi2c_bb/i2c_bb.h> #include <libi2c_bb/i2c.h>
struct ads1115_dev { struct ads1115_dev {
struct i2c_bb *i2c_dev; struct i2c_bb *i2c_dev;

View File

@ -11,6 +11,7 @@
#define BUF_SIZE 3 #define BUF_SIZE 3
#define VPS 6.144 / 32768.0 #define VPS 6.144 / 32768.0
// cppcheck-suppress unusedFunction
int ads1115_open(const struct ads1115_dev *ads1115) int ads1115_open(const struct ads1115_dev *ads1115)
{ {
int res; int res;
@ -28,6 +29,7 @@ int ads1115_open(const struct ads1115_dev *ads1115)
return 0; return 0;
} }
// cppcheck-suppress unusedFunction
int ads1115_close(const struct ads1115_dev *ads1115) int ads1115_close(const struct ads1115_dev *ads1115)
{ {
assert(NULL != ads1115); assert(NULL != ads1115);
@ -35,6 +37,7 @@ int ads1115_close(const struct ads1115_dev *ads1115)
return i2c_close(ads1115->i2c_dev); return i2c_close(ads1115->i2c_dev);
} }
// cppcheck-suppress unusedFunction
int ads1115_start_conversation(const struct ads1115_dev *ads1115) int ads1115_start_conversation(const struct ads1115_dev *ads1115)
{ {
int res; int res;
@ -61,6 +64,7 @@ int ads1115_start_conversation(const struct ads1115_dev *ads1115)
return 0; return 0;
} }
// cppcheck-suppress unusedFunction
int ads1115_read_conversation_result(const struct ads1115_dev *ads1115, int ads1115_read_conversation_result(const struct ads1115_dev *ads1115,
struct ads1115_conversation_result *result) struct ads1115_conversation_result *result)
{ {