MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / setBusADC

Method setBusADC

libraries/INA219/INA219.cpp:179–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177
178
179bool INA219::setBusADC(uint8_t mask)
180{
181 if (mask > 0x000F) return false;
182
183 // TODO improve this one. datasheet.
184 // two functions
185 // setBusResolution + setBusSamples()
186 uint16_t config = _readRegister(INA219_CONFIGURATION);
187 config &= ~INA219_CONF_BUS_ADC;
188 config |= (mask << 7);
189 // if (bits == 10) config |= (1 << 7);
190 // else if (bits == 11) config |= (2 << 7);
191 // else if (bits == 12) config |= (3 << 7);
192 _writeRegister(INA219_CONFIGURATION, config);
193 return true;
194}
195
196
197uint8_t INA219::getBusADC()

Callers 1

unittestFunction · 0.80

Calls

no outgoing calls

Tested by 1

unittestFunction · 0.64