diff options
author | Theodore Ateba <tf.ateba@gmail.com> | 2017-09-20 22:23:24 +0000 |
---|---|---|
committer | Theodore Ateba <tf.ateba@gmail.com> | 2017-09-20 22:23:24 +0000 |
commit | 5cf8b8dadc1309960e5f0dfa5bd8cac176547416 (patch) | |
tree | 7a4241c511c341edf166ca0abe1c2750927189dd /os | |
parent | 41504f2f4adec1cef7db08293c616c6ace7f895f (diff) | |
download | ChibiOS-5cf8b8dadc1309960e5f0dfa5bd8cac176547416.tar.gz ChibiOS-5cf8b8dadc1309960e5f0dfa5bd8cac176547416.tar.bz2 ChibiOS-5cf8b8dadc1309960e5f0dfa5bd8cac176547416.zip |
Correct assertion string and code style.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10656 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r-- | os/ex/ST/hts221.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/os/ex/ST/hts221.c b/os/ex/ST/hts221.c index 23624d888..461541824 100644 --- a/os/ex/ST/hts221.c +++ b/os/ex/ST/hts221.c @@ -68,7 +68,7 @@ msg_t hts221I2CReadRegister(I2CDriver *i2cp, uint8_t reg, uint8_t* rxbuf,
size_t n) {
uint8_t txbuf = reg;
- if(n > 1)
+ if (n > 1)
txbuf |= HTS221_SUB_MS;
return i2cMasterTransmitTimeout(i2cp, HTS221_SAD, &txbuf, 1, rxbuf, n,
@@ -134,7 +134,7 @@ msg_t hts221Calibrate(HTS221Driver *devp, uint8_t flag) { T0_degC_x8 = calib[2];
/* Completing T0_degC_x8 value */
msb = (calib[5] & HTS221_SEL(0x03, 0));
- if(msb & HTS221_SEL(0x01, 1)) {
+ if (msb & HTS221_SEL(0x01, 1)) {
msb |= HTS221_SEL(0x3F, 2);
}
T0_degC_x8 += msb << 8;
@@ -142,7 +142,7 @@ msg_t hts221Calibrate(HTS221Driver *devp, uint8_t flag) { T1_degC_x8 = calib[3];
/* Completing T1_degC_x8 value */
msb = ((calib[5] & HTS221_SEL(0x03, 2)) >> 2);
- if(msb & HTS221_SEL(0x01, 1)) {
+ if (msb & HTS221_SEL(0x01, 1)) {
msb |= HTS221_SEL(0x3F, 2);
}
T1_degC_x8 += msb << 8;
@@ -155,20 +155,20 @@ msg_t hts221Calibrate(HTS221Driver *devp, uint8_t flag) { sens = ((float)H1_rH_x2 - (float)H0_rH_x2) /
(2.0f * ((float)H1_T0_OUT - (float)H0_T0_OUT));
- if(flag & HTS221_FLAG_HYGRO_SENS)
+ if (flag & HTS221_FLAG_HYGRO_SENS)
devp->sensitivity[0] = sens;
- if(flag & HTS221_FLAG_HYGRO_BIAS)
+ if (flag & HTS221_FLAG_HYGRO_BIAS)
devp->bias[0] = (sens * (float)H0_T0_OUT) -
((float)H0_rH_x2 / 2.0f);
sens = ((float)T1_degC_x8 - (float)T0_degC_x8) /
(8.0f * ((float)T1_OUT - (float)T0_OUT));
- if(flag & HTS221_FLAG_THERMO_SENS)
+ if (flag & HTS221_FLAG_THERMO_SENS)
devp->sensitivity[1] = sens;
- if(flag & HTS221_FLAG_THERMO_BIAS)
+ if (flag & HTS221_FLAG_THERMO_BIAS)
devp->bias[1] = (sens * (float)T0_OUT) -
((float)T0_degC_x8 / 8.0f);
@@ -224,7 +224,7 @@ static msg_t hygro_read_raw(void *ip, int32_t* axis) { #endif /* HTS221_SHARED_I2C */
#endif /* HTS221_USE_I2C */
- if(msg == MSG_OK) {
+ if (msg == MSG_OK) {
tmp = buff[0] + (buff[1] << 8);
*axis = (int32_t)tmp;
}
@@ -260,7 +260,7 @@ static msg_t thermo_read_raw(void *ip, int32_t axis[]) { #endif /* HTS221_SHARED_I2C */
#endif /* HTS221_USE_I2C */
- if(msg == MSG_OK) {
+ if (msg == MSG_OK) {
tmp = buff[0] + (buff[1] << 8);
*axis = (int32_t)tmp;
}
@@ -319,7 +319,7 @@ static msg_t sens_read_cooked(void *ip, float axes[]) { "sens_read_cooked(), invalid state");
msg = hygro_read_cooked(ip, dp);
- if(msg != MSG_OK)
+ if (msg != MSG_OK)
return msg;
dp += HTS221_THERMO_NUMBER_OF_AXES;
return thermo_read_cooked(ip, dp);
@@ -330,7 +330,7 @@ static msg_t hygro_set_bias(void *ip, float *bp) { osalDbgAssert((((HTS221Driver *)ip)->state == HTS221_READY) ||
(((HTS221Driver *)ip)->state == HTS221_STOP),
- "thermo_set_bias(), invalid state");
+ "hygro_set_bias(), invalid state");
((HTS221Driver *)ip)->bias[0] = *bp;
return MSG_OK;
@@ -372,7 +372,7 @@ static msg_t hygro_set_sensitivity(void *ip, float *sp) { osalDbgAssert((((HTS221Driver *)ip)->state == HTS221_READY) ||
(((HTS221Driver *)ip)->state == HTS221_STOP),
- "thermo_set_sensitivity(), invalid state");
+ "hygro_set_sensitivity(), invalid state");
((HTS221Driver *)ip)->sensitivity[0] = *sp;
return MSG_OK;
@@ -409,7 +409,6 @@ static msg_t thermo_reset_sensitivity(void *ip) { return MSG_OK;
}
-
static const struct BaseSensorVMT vmt_basesensor = {
sens_get_axes_number, sens_read_raw, sens_read_cooked
};
@@ -510,7 +509,7 @@ void hts221Start(HTS221Driver *devp, const HTS221Config *config) { }
#endif /* HTS221_USE_I2C */
- if(devp->config->sensitivity == NULL) {
+ if (devp->config->sensitivity == NULL) {
hts221Calibrate(devp, HTS221_FLAG_HYGRO_SENS | HTS221_FLAG_THERMO_SENS);
}
else{
@@ -519,7 +518,7 @@ void hts221Start(HTS221Driver *devp, const HTS221Config *config) { devp->sensitivity[1] = devp->config->sensitivity[1];
}
- if(devp->config->bias == NULL) {
+ if (devp->config->bias == NULL) {
hts221Calibrate(devp, HTS221_FLAG_HYGRO_BIAS | HTS221_FLAG_THERMO_BIAS);
}
else {
|