| 177 | |
| 178 | |
| 179 | bool 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 | |
| 197 | uint8_t INA219::getBusADC() |