coding style modification

This commit is contained in:
bboulet 2019-07-22 16:50:17 +02:00
commit d43bd8fe8e
2 changed files with 19 additions and 19 deletions

View file

@ -564,7 +564,7 @@ int lgw_debug_setconf(struct lgw_conf_debug_s * conf) {
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
int lgw_start(void) {
int i, err, err_ID1,err_ID2;
int i, err, err_id_1,err_id_2;
int reg_stat;
if (CONTEXT_STARTED == true) {
@ -714,9 +714,9 @@ int lgw_start(void) {
#endif
/* Open I2C */
err_ID1 = i2c_linuxdev_open(I2C_DEVICE, I2C_PORT_TEMP_SENSOR_1, &lgw_i2c_target);
err_ID2 = i2c_linuxdev_open(I2C_DEVICE, I2C_PORT_TEMP_SENSOR_2, &lgw_i2c_target);
if (((err_ID1 != 0) || (lgw_i2c_target <= 0)) && ((err_ID2 != 0) || (lgw_i2c_target <= 0))) {
err_id_1 = i2c_linuxdev_open(I2C_DEVICE, I2C_PORT_TEMP_SENSOR_1, &lgw_i2c_target);
err_id_2 = i2c_linuxdev_open(I2C_DEVICE, I2C_PORT_TEMP_SENSOR_2, &lgw_i2c_target);
if (((err_id_1 != 0) || (lgw_i2c_target <= 0)) && ((err_id_2 != 0) || (lgw_i2c_target <= 0))) {
printf("ERROR: failed to open I2C device %s (err=%i)\n", I2C_DEVICE, err);
return LGW_HAL_ERROR;
}

View file

@ -75,7 +75,7 @@ License: Revised BSD License, see LICENSE.TXT file include in the project
/* --- INTERNAL SHARED VARIABLES -------------------------------------------- */
extern int lgw_i2c_target;
uint8_t SlaveAddr;
uint8_t slave_addr;
/* -------------------------------------------------------------------------- */
/* --- PRIVATE FUNCTIONS ---------------------------------------------------- */
@ -107,11 +107,11 @@ int stts751_configure( int i2c_fd )
{
if ( err_1 == 0 )
{
SlaveAddr = I2C_PORT_TEMP_SENSOR_1;
slave_addr = I2C_PORT_TEMP_SENSOR_1;
}
if( err_2 == 0 )
{
SlaveAddr = I2C_PORT_TEMP_SENSOR_2;
slave_addr = I2C_PORT_TEMP_SENSOR_2;
}
}
@ -129,10 +129,10 @@ int stts751_configure( int i2c_fd )
}
/* Get Manufacturer ID */
err = i2c_linuxdev_read( i2c_fd, SlaveAddr, STTS751_REG_MAN_ID, &val );
err = i2c_linuxdev_read( i2c_fd, slave_addr, STTS751_REG_MAN_ID, &val );
if ( err != 0 )
{
printf( "ERROR: failed to read I2C device 0x%02X (err=%i)\n", SlaveAddr, err );
printf( "ERROR: failed to read I2C device 0x%02X (err=%i)\n", slave_addr, err );
return LGW_I2C_ERROR;
}
if ( val != ST_MAN_ID )
@ -146,27 +146,27 @@ int stts751_configure( int i2c_fd )
}
/* Get revision number */
err = i2c_linuxdev_read( i2c_fd, SlaveAddr, STTS751_REG_REV_ID, &val );
err = i2c_linuxdev_read( i2c_fd, slave_addr, STTS751_REG_REV_ID, &val );
if ( err != 0 )
{
printf( "ERROR: failed to read I2C device 0x%02X (err=%i)\n", SlaveAddr, err );
printf( "ERROR: failed to read I2C device 0x%02X (err=%i)\n", slave_addr, err );
return LGW_I2C_ERROR;
}
DEBUG_PRINTF("INFO: Revision number: 0x%02X\n", val);
/* Set conversion resolution to 12 bits */
err = i2c_linuxdev_write( i2c_fd, SlaveAddr, STTS751_REG_CONF, 0x8C ); /* TODO: do not hardcode the whole byte */
err = i2c_linuxdev_write( i2c_fd, slave_addr, STTS751_REG_CONF, 0x8C ); /* TODO: do not hardcode the whole byte */
if ( err != 0 )
{
printf( "ERROR: failed to write I2C device 0x%02X (err=%i)\n", SlaveAddr, err );
printf( "ERROR: failed to write I2C device 0x%02X (err=%i)\n", slave_addr, err );
return LGW_I2C_ERROR;
}
/* Set conversion rate to 1 / second */
err = i2c_linuxdev_write( i2c_fd, SlaveAddr, STTS751_REG_RATE, 0x04 );
err = i2c_linuxdev_write( i2c_fd, slave_addr, STTS751_REG_RATE, 0x04 );
if ( err != 0 )
{
printf( "ERROR: failed to write I2C device 0x%02X (err=%i)\n", SlaveAddr, err );
printf( "ERROR: failed to write I2C device 0x%02X (err=%i)\n", slave_addr, err );
return LGW_I2C_ERROR;
}
@ -189,18 +189,18 @@ int stts751_get_temperature( int i2c_fd, float * temperature)
}
/* Read Temperature LSB */
err = i2c_linuxdev_read( i2c_fd, SlaveAddr, STTS751_REG_TEMP_L, &low_byte );
err = i2c_linuxdev_read( i2c_fd, slave_addr, STTS751_REG_TEMP_L, &low_byte );
if ( err != 0 )
{
printf( "ERROR: failed to read I2C device 0x%02X (err=%i)\n", SlaveAddr, err );
printf( "ERROR: failed to read I2C device 0x%02X (err=%i)\n", slave_addr, err );
return LGW_I2C_ERROR;
}
/* Read Temperature MSB */
err = i2c_linuxdev_read( i2c_fd, SlaveAddr, STTS751_REG_TEMP_H, &high_byte );
err = i2c_linuxdev_read( i2c_fd, slave_addr, STTS751_REG_TEMP_H, &high_byte );
if ( err != 0 )
{
printf( "ERROR: failed to read I2C device 0x%02X (err=%i)\n", SlaveAddr, err );
printf( "ERROR: failed to read I2C device 0x%02X (err=%i)\n", slave_addr, err );
return LGW_I2C_ERROR;
}