@@ -85,7 +85,7 @@ int ads1115_init(ads1115_t *dev, const ads1115_params_t *params)
8585
8686 i2c_acquire (DEV );
8787
88- // Test communication
88+ /* Test communication */
8989 uint16_t test_conf = htons (ADS1115_CONF_TEST_VALUE );
9090 if (i2c_write_regs (DEV , ADDR , ADS1115_REG_CONFIG , & test_conf , sizeof (test_conf ), 0 ) < 0 ) {
9191 DEBUG ("[ads1115] init - error: write test failed\n" );
@@ -100,7 +100,7 @@ int ads1115_init(ads1115_t *dev, const ads1115_params_t *params)
100100 goto release ;
101101 }
102102
103- // Apply actual configuration
103+ /* Apply actual configuration */
104104 uint16_t conf = htons (_build_config_reg (& dev -> params ));
105105 if (i2c_write_regs (DEV , ADDR , ADS1115_REG_CONFIG , & conf , sizeof (conf ), 0 ) < 0 ) {
106106 DEBUG ("[ads1115] init - error: setting config failed\n" );
@@ -123,19 +123,19 @@ int ads1115_set_ain_ch_input(ads1115_t *dev, ads1115_mux_t mux)
123123
124124 i2c_acquire (DEV );
125125
126- // Read current configuration
126+ /* Read current configuration */
127127 uint16_t reg ;
128128 if (i2c_read_regs (DEV , ADDR , ADS1115_REG_CONFIG , & reg , sizeof (reg ), 0 ) < 0 ) {
129129 i2c_release (DEV );
130130 goto release ;
131131 }
132132
133- // Update MUX bits
133+ /* Update MUX bits */
134134 uint16_t conf = ntohs (reg );
135- conf &= ~(0x07 << ADS1115_CONF_MUX_BIT ); // Clear MUX bits
136- conf |= (mux << ADS1115_CONF_MUX_BIT ); // Set new MUX
135+ conf &= ~(0x07 << ADS1115_CONF_MUX_BIT ); /* Clear MUX bits */
136+ conf |= (mux << ADS1115_CONF_MUX_BIT ); /* Set new MUX */
137137
138- // Write back updated configuration
138+ /* Write back updated configuration */
139139 reg = htons (conf );
140140
141141 if (i2c_write_regs (DEV , ADDR , ADS1115_REG_CONFIG , & reg , sizeof (reg ), 0 ) < 0 ) {
@@ -160,12 +160,12 @@ int ads1115_read_conversion(ads1115_t *dev, uint16_t *value)
160160
161161 i2c_acquire (DEV );
162162
163- // Read conversion register
163+ /* Read conversion register */
164164 if (i2c_read_regs (DEV , ADDR , ADS1115_REG_CONVERSION , & buf , sizeof (buf ), 0 ) < 0 ) {
165165 goto release ;
166166 }
167167
168- // Combine bytes into a single value
168+ /* Combine bytes into a single value */
169169 * value = ntohs (buf );
170170 res = ADS1115_OK ;
171171
@@ -177,5 +177,5 @@ int ads1115_read_conversion(ads1115_t *dev, uint16_t *value)
177177int ads1115_convert_to_mv (ads1115_t * dev , uint16_t value )
178178{
179179 assert (dev );
180- return value * _ads1115_get_pga_voltage (dev -> params .pga ) / (1 << 15 ); // Msb is sign bit
180+ return value * _ads1115_get_pga_voltage (dev -> params .pga ) / (1 << 15 ); /* Msb is sign bit */
181181}
0 commit comments