Skip to content

Commit 9d7167f

Browse files
committed
refactor: move a private inline static function to .c file
1 parent b94464d commit 9d7167f

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

drivers/ads1115/ads1115.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,22 @@
3333

3434
#define ADS1115_CONF_TEST_VALUE (1)
3535

36+
static inline int _ads1115_get_pga_voltage(ads1115_pga_t pga)
37+
{
38+
switch (pga) {
39+
case ADS1115_PGA_6_144V: return 6144;
40+
case ADS1115_PGA_4_096V: return 4096;
41+
case ADS1115_PGA_2_048V: return 2048;
42+
case ADS1115_PGA_1_024V: return 1024;
43+
case ADS1115_PGA_0_512V: return 512;
44+
case ADS1115_PGA_0_256V:
45+
case ADS1115_PGA_0_256V_B:
46+
case ADS1115_PGA_0_256V_C:
47+
return 256;
48+
default:
49+
return 0;
50+
}
51+
}
3652

3753
/**
3854
* @brief Builds the configuration register value from the parameters

drivers/include/ads1115.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -198,22 +198,6 @@ int ads1115_set_ain_ch_input(ads1115_t *dev, ads1115_mux_t mux);
198198
*/
199199
int ads1115_read_conversion(ads1115_t *dev, uint16_t *value);
200200

201-
static inline int _ads1115_get_pga_voltage(ads1115_pga_t pga)
202-
{
203-
switch (pga) {
204-
case ADS1115_PGA_6_144V: return 6144;
205-
case ADS1115_PGA_4_096V: return 4096;
206-
case ADS1115_PGA_2_048V: return 2048;
207-
case ADS1115_PGA_1_024V: return 1024;
208-
case ADS1115_PGA_0_512V: return 512;
209-
case ADS1115_PGA_0_256V:
210-
case ADS1115_PGA_0_256V_B:
211-
case ADS1115_PGA_0_256V_C:
212-
return 256;
213-
default:
214-
return 0;
215-
}
216-
}
217201

218202
/**
219203
* @brief Converts the digital value from the ADS1115 device to millivolts.

0 commit comments

Comments
 (0)