Uncrustify changes
This commit is contained in:
parent
d53a62187d
commit
48eb2a4fe2
|
@ -62,7 +62,7 @@ PROCESS_THREAD(remote_sht25_process, ev, data)
|
|||
|
||||
/* Check if the sensor voltage operation is over 2.25V */
|
||||
if(sht25.value(SHT25_VOLTAGE_ALARM)) {
|
||||
printf("Voltage is lower than recommended for the sensor operation\n");
|
||||
printf("Voltage is lower than recommended for the sensor operation\n");
|
||||
PROCESS_EXIT();
|
||||
}
|
||||
|
||||
|
|
|
@ -163,14 +163,14 @@ value(int type)
|
|||
}
|
||||
|
||||
if((type != SHT25_VAL_TEMP) && (type != SHT25_VAL_HUM) &&
|
||||
(type != SHT25_VOLTAGE_ALARM)) {
|
||||
(type != SHT25_VOLTAGE_ALARM)) {
|
||||
PRINTF("SHT25: invalid value requested\n");
|
||||
return SHT25_ERROR;
|
||||
}
|
||||
|
||||
if(type == SHT25_VOLTAGE_ALARM) {
|
||||
if(sht25_read_user_register() == SHT25_SUCCESS) {
|
||||
return ((user_reg & SHT2x_LOW_VOLTAGE_MASK) >> SHT2x_LOW_VOLTAGE_SHIFT);
|
||||
return (user_reg & SHT2x_LOW_VOLTAGE_MASK) >> SHT2x_LOW_VOLTAGE_SHIFT;
|
||||
}
|
||||
} else {
|
||||
if(sht25_read(type, &val) == SHT25_SUCCESS) {
|
||||
|
@ -186,52 +186,52 @@ configure(int type, int value)
|
|||
uint8_t buf[2];
|
||||
|
||||
if((type != SHT25_ACTIVE) && (type != SHT25_SOFT_RESET) &&
|
||||
(type != SHT25_RESOLUTION)) {
|
||||
(type != SHT25_RESOLUTION)) {
|
||||
PRINTF("SHT25: option not supported\n");
|
||||
return SHT25_ERROR;
|
||||
}
|
||||
|
||||
switch(type) {
|
||||
case SHT25_ACTIVE:
|
||||
if(value) {
|
||||
i2c_init(I2C_SDA_PORT, I2C_SDA_PIN, I2C_SCL_PORT, I2C_SCL_PIN,
|
||||
I2C_SCL_NORMAL_BUS_SPEED);
|
||||
case SHT25_ACTIVE:
|
||||
if(value) {
|
||||
i2c_init(I2C_SDA_PORT, I2C_SDA_PIN, I2C_SCL_PORT, I2C_SCL_PIN,
|
||||
I2C_SCL_NORMAL_BUS_SPEED);
|
||||
|
||||
/* Read the user config register */
|
||||
if(sht25_read_user_register() == SHT25_SUCCESS) {
|
||||
enabled = value;
|
||||
return SHT25_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
case SHT25_SOFT_RESET:
|
||||
buf[0] = SHT2X_SOFT_RESET;
|
||||
if(sht25_write_reg(&buf[0], 1) != SHT25_SUCCESS) {
|
||||
PRINTF("SHT25: failed to reset the sensor\n");
|
||||
return SHT25_ERROR;
|
||||
}
|
||||
clock_delay_usec(SHT25_RESET_DELAY);
|
||||
return SHT25_SUCCESS;
|
||||
|
||||
case SHT25_RESOLUTION:
|
||||
if((value != SHT2X_RES_14T_12RH) && (value != SHT2X_RES_12T_08RH) &&
|
||||
(value != SHT2X_RES_13T_10RH) && (value != SHT2X_RES_11T_11RH)) {
|
||||
PRINTF("SHT25: invalid resolution value\n");
|
||||
return SHT25_ERROR;
|
||||
}
|
||||
|
||||
user_reg &= ~SHT2X_RES_11T_11RH;
|
||||
user_reg |= value;
|
||||
buf[0] = SHT2X_UREG_WRITE;
|
||||
buf[1] = user_reg;
|
||||
|
||||
if(sht25_write_reg(buf, 2) == SHT25_SUCCESS) {
|
||||
PRINTF("SHT25: new user register value 0x%02X\n", user_reg);
|
||||
/* Read the user config register */
|
||||
if(sht25_read_user_register() == SHT25_SUCCESS) {
|
||||
enabled = value;
|
||||
return SHT25_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
case SHT25_SOFT_RESET:
|
||||
buf[0] = SHT2X_SOFT_RESET;
|
||||
if(sht25_write_reg(&buf[0], 1) != SHT25_SUCCESS) {
|
||||
PRINTF("SHT25: failed to reset the sensor\n");
|
||||
return SHT25_ERROR;
|
||||
}
|
||||
clock_delay_usec(SHT25_RESET_DELAY);
|
||||
return SHT25_SUCCESS;
|
||||
|
||||
case SHT25_RESOLUTION:
|
||||
if((value != SHT2X_RES_14T_12RH) && (value != SHT2X_RES_12T_08RH) &&
|
||||
(value != SHT2X_RES_13T_10RH) && (value != SHT2X_RES_11T_11RH)) {
|
||||
PRINTF("SHT25: invalid resolution value\n");
|
||||
return SHT25_ERROR;
|
||||
}
|
||||
|
||||
user_reg &= ~SHT2X_RES_11T_11RH;
|
||||
user_reg |= value;
|
||||
buf[0] = SHT2X_UREG_WRITE;
|
||||
buf[1] = user_reg;
|
||||
|
||||
if(sht25_write_reg(buf, 2) == SHT25_SUCCESS) {
|
||||
PRINTF("SHT25: new user register value 0x%02X\n", user_reg);
|
||||
return SHT25_SUCCESS;
|
||||
}
|
||||
|
||||
default:
|
||||
return SHT25_ERROR;
|
||||
}
|
||||
|
||||
return SHT25_ERROR;
|
||||
|
|
Loading…
Reference in a new issue