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

Constructor is wrong #6

Open
danny-miller opened this issue Apr 30, 2024 · 0 comments
Open

Constructor is wrong #6

danny-miller opened this issue Apr 30, 2024 · 0 comments

Comments

@danny-miller
Copy link

danny-miller commented Apr 30, 2024

Constructor:
INA3221(ina3221_addr_t addr) : _i2c_addr(addr){};

_i2c_addr is just a variable with a typedef for an integer, but () is initializing it like a class. I don't know what the compiler would do with () on a variable, it's not an array index This caused runtime memory errors for me so it may be trying to access it as a class with an undefined pointer?

Should be:
INA3221(ina3221_addr_t addr) {i2c_addr=addr};

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

1 participant