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

create getLEDCurrent() method #26

Merged
merged 2 commits into from
Jun 23, 2023
Merged

create getLEDCurrent() method #26

merged 2 commits into from
Jun 23, 2023

Conversation

jrw429
Copy link
Contributor

@jrw429 jrw429 commented Jun 22, 2023

fixes issue 25, create getLEDCurrent()


led_raw = led_current_bits.read();

led_current_ma = (uint16_t)(led_raw * 2) + 4;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could just return right hand side here instead of creating led_current_ma and returning that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I tend to create "unnecessary" variables for the sake of being clear and documenting what the code does.

@caternuson
Copy link
Contributor

Looks good. Added a review comment.

Were you able to test this? Good test would be to set LED current, then read back and make sure it reports back as expected.

@jrw429
Copy link
Contributor Author

jrw429 commented Jun 23, 2023

Yes, tested and working.

@caternuson caternuson merged commit 90523fd into adafruit:master Jun 23, 2023
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

Successfully merging this pull request may close these issues.

2 participants