diff --git a/c/common/i2cdriver.c b/c/common/i2cdriver.c index 318cc99..417f0f9 100644 --- a/c/common/i2cdriver.c +++ b/c/common/i2cdriver.c @@ -323,7 +323,7 @@ uint8_t i2c_reset(I2CDriver *sd) int i2c_start(I2CDriver *sd, uint8_t dev, uint8_t op) { - uint8_t start[2] = {'s', (dev << 1) | op}; + uint8_t start[2] = {'s', (uint8_t)((dev << 1) | op)}; writeToSerialPort(sd->port, start, sizeof(start)); return i2c_ack(sd); } diff --git a/c/linux/Makefile.clang b/c/linux/Makefile.clang new file mode 100644 index 0000000..18cceec --- /dev/null +++ b/c/linux/Makefile.clang @@ -0,0 +1,11 @@ +CC=clang +CFLAGS += -I common -Wall -Wpointer-sign -xc++ -std=c++17 # -Werror + +all: build/i2ccl + +install: all + cp build/i2ccl /usr/local/bin + +build/i2ccl: linux/i2c.c common/i2cdriver.c + mkdir -p build/ + $(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $^ diff --git a/testall b/testall index 43cd463..ce9b195 100755 --- a/testall +++ b/testall @@ -14,3 +14,4 @@ python -c 'from i2cdriver import I2CDriver' cd c make -f linux/Makefile +make -f linux/Makefile.clang