cleanup and gitignore

This commit is contained in:
William Clark 2024-04-25 22:19:47 +01:00
parent 743e3adf17
commit 66e6e1e7b0
4 changed files with 23 additions and 21 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.o
bme680

View File

@ -1,6 +1,5 @@
CC=gcc
OPT=-O2 -std=c99 -Wall -Wextra
# OPT=-O0 -g3 -std=c99 -Wall -Wextra -pedantic
OPT=-O2 -std=c99 -Wall -Wextra -W -pedantic
CFLAGS=-I. $(OPT)
CFILES=$(wildcard ./*.c)
OBJECTS=$(patsubst %.c,%.o, $(CFILES))

View File

@ -299,6 +299,7 @@ static int const_array1_int[16] = {
2147483647
};
/* long int maybe */
static int const_array2_int[16] = {
4096000000, 2048000000, 1024000000, 512000000, 255744255,
127110228, 64000000, 32258064, 16016016, 8000000, 4000000,
@ -529,7 +530,7 @@ int bme680_calibrate(bme680_t *bme680) {
bme680->cal.range_switching_error = buffer[0];
err |= read_dev(bme680, 0x02, buffer, 1);
bme680->cal.res_heat_range = (buffer[0] >> 4) & 0b11;
bme680->cal.res_heat_range = (buffer[0] >> 4) & 3;
err |= read_dev(bme680, 0x00, buffer, 1);
bme680->cal.res_heat_val = buffer[0];

View File

@ -8,7 +8,7 @@
#define BME680_GAS_ENABLED(m) (((m >> 2) & 1) == 1)
#define BME680_IDAC(c) (c << 1)
#define BME680_GAS_WAIT(val, scal) ((uint8_t)(((scal & 0b11) << 6) | (val & 0b111111)))
#define BME680_GAS_WAIT(val, scal) ((uint8_t)(((scal & 3) << 6) | (val & 63)))
/* connection modes */
#define BME680_SPI 1
@ -22,27 +22,27 @@
#define BME680_ENABLE_GAS 4
/* config values */
#define BME680_OVERSAMPLE_X1 0b001
#define BME680_OVERSAMPLE_X2 0b010
#define BME680_OVERSAMPLE_X4 0b011
#define BME680_OVERSAMPLE_X8 0b100
#define BME680_OVERSAMPLE_X16 0b101
#define BME680_OVERSAMPLE_X1 1
#define BME680_OVERSAMPLE_X2 2
#define BME680_OVERSAMPLE_X4 3
#define BME680_OVERSAMPLE_X8 4
#define BME680_OVERSAMPLE_X16 5
/* IIR filter */
#define BME680_IIR_COEFF_0 0b000
#define BME680_IIR_COEFF_1 0b001
#define BME680_IIR_COEFF_3 0b010
#define BME680_IIR_COEFF_7 0b011
#define BME680_IIR_COEFF_15 0b100
#define BME680_IIR_COEFF_31 0b101
#define BME680_IIR_COEFF_63 0b110
#define BME680_IIR_COEFF_127 0b111
#define BME680_IIR_COEFF_0 0
#define BME680_IIR_COEFF_1 1
#define BME680_IIR_COEFF_3 2
#define BME680_IIR_COEFF_7 3
#define BME680_IIR_COEFF_15 4
#define BME680_IIR_COEFF_31 5
#define BME680_IIR_COEFF_63 6
#define BME680_IIR_COEFF_127 7
/* gas related values */
#define BME680_GAS_WAIT_X1 0b00
#define BME680_GAS_WAIT_X4 0b01
#define BME680_GAS_WAIT_X16 0b10
#define BME680_GAS_WAIT_X64 0b11
#define BME680_GAS_WAIT_X1 0
#define BME680_GAS_WAIT_X4 1
#define BME680_GAS_WAIT_X16 2
#define BME680_GAS_WAIT_X64 3
/* user supplied spi/i2c functions */