Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getMode() gets the wrong bits #6

Open
marcobergman opened this issue Dec 11, 2023 · 1 comment
Open

getMode() gets the wrong bits #6

marcobergman opened this issue Dec 11, 2023 · 1 comment

Comments

@marcobergman
Copy link

marcobergman commented Dec 11, 2023

In the snipplet provided, the values to the Adafruit_I2CRegisterBits should be ADC_Config, 4, 12, just like in the setMode() function.

INA228_MeasurementMode Adafruit_INA228::getMode(void) {
  Adafruit_I2CRegisterBits mode = Adafruit_I2CRegisterBits(Config, 3, 0);
  return (INA228_MeasurementMode)mode.read();
}
@marcobergman marcobergman changed the title getMode gets the wrong bits getMode() gets the wrong bits Dec 11, 2023
@caternuson
Copy link
Contributor

Good catch. Just adding datasheet info for ref:

Register should be ADC_Config:
image

Bits should be 15-12 (4 bits total, shifted by 12):
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants