Reformat with bcpp

Used commandline: bcpp -i 2 -yq -ya -s -bcl -tbcl $i
This commit is contained in:
Pim van Pelt
2018-04-09 18:30:46 +02:00
parent 0337487a0c
commit d2e64c0f45
16 changed files with 310 additions and 243 deletions

View File

@ -40,6 +40,7 @@ void i2c_scanner(struct mgos_i2c *i2c) {
}
}
bool i2c_dumpregs(struct mgos_i2c *i2c, uint8_t i2caddr) {
uint16_t reg;
int value;
@ -48,7 +49,8 @@ bool i2c_dumpregs(struct mgos_i2c *i2c, uint8_t i2caddr) {
value=mgos_i2c_read_reg_b(i2c, i2caddr, reg);
if (value<0) {
printf(" XX");
} else {
}
else {
printf(" %02x", value);
}
if (reg%16==15) printf("\n");
@ -57,6 +59,7 @@ bool i2c_dumpregs(struct mgos_i2c *i2c, uint8_t i2caddr) {
return true;
}
bool do_sht31(struct mgos_sht31 *sensor) {
float temp, humid;
@ -69,6 +72,7 @@ bool do_sht31(struct mgos_sht31 *sensor) {
return true;
}
bool do_si7021(struct mgos_si7021 *sensor) {
float temp, humid;
@ -81,6 +85,7 @@ bool do_si7021(struct mgos_si7021 *sensor) {
return true;
}
bool do_htu21df(struct mgos_htu21df *sensor) {
float temp, humid;
@ -93,6 +98,7 @@ bool do_htu21df(struct mgos_htu21df *sensor) {
return true;
}
bool do_mcp9808(struct mgos_mcp9808 *sensor) {
float temp;
@ -104,6 +110,7 @@ bool do_mcp9808(struct mgos_mcp9808 *sensor) {
return true;
}
int main() {
struct mgos_i2c *i2c;
struct mgos_si7021 *si7021;
@ -125,13 +132,13 @@ int main() {
if (!(sht31 = mgos_sht31_create(i2c, 0x44)))
LOG(LL_ERROR, ("Cannot create SHT31 device"));
if (!(si7021 = mgos_si7021_create(i2c, 0x40)))
if (!(si7021 = mgos_si7021_create(i2c, 0x40)))
LOG(LL_ERROR, ("Cannot create SI7021 device"));
if (!(htu21df = mgos_htu21df_create(i2c, 0x40)))
if (!(htu21df = mgos_htu21df_create(i2c, 0x40)))
LOG(LL_ERROR, ("Cannot create HTU21DF device"));
if (!(mcp9808 = mgos_mcp9808_create(i2c, 0x18)))
if (!(mcp9808 = mgos_mcp9808_create(i2c, 0x18)))
LOG(LL_ERROR, ("Cannot create MCP9808 device"));
for (;;) {