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

Akward return values from opt3001::readRegister #961

Open
CCommander opened this issue Mar 2, 2017 · 2 comments
Open

Akward return values from opt3001::readRegister #961

CCommander opened this issue Mar 2, 2017 · 2 comments

Comments

@CCommander
Copy link

CCommander commented Mar 2, 2017

On the MSP-EXP430FR4133, I get strange return values from opt3001::readRegister, if I do not mask the msb and lsb after reading through wire.read.

My workaround:

msb = Wire.read();
lsb = Wire.read();
result = ((msb&0xFF) << 8) | (lsb&0xFF);
@rei-vilo
Copy link
Member

rei-vilo commented Mar 9, 2017

How msb and lsb have been declared? They should be uint8_t.

@CCommander
Copy link
Author

msb and lsb are int8_t

They were not declared by me. OPT3001.cpp as a library is part of Energia.

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

No branches or pull requests

2 participants