-
Notifications
You must be signed in to change notification settings - Fork 5
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
tla2528 driver #12
tla2528 driver #12
Conversation
void application(application_framework& p_framework) | ||
{ | ||
|
||
hal::byte i2c_address = 0x10; // 0x10 is the tla address for no resistors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why must the user pass this in if this is the default? Why not make the constructor have a default parameter that sets the address to 0x10 and the dev can change this if they need to change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0x10 is a default parameter. For the demos, I put the address at the top for ease of access, as that way, people aren't wondering how to change the address if they just want to test their TLA and they have it wired to a different address.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably best to remove. If the constructor doesn't describe in detail how the i2c address works, it should so anyone reading the header can see exactly when they'd need to use a differnt address.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated documentation & removed address from demos, look it over
drivers/src/tla2528.cpp
Outdated
uint16_t data = 0; | ||
hal::bit_modify(data).insert<hal::bit_mask::from(4, 11)>(data_buffer[0]); | ||
hal::bit_modify(data).insert<hal::bit_mask::from(0, 3)>( | ||
hal::bit_extract(hal::bit_mask::from(4, 7), data_buffer[1])); | ||
return data / 4095.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Give the bit masks names so its easier to understand what they are.
Split up the bit_extract into its own named variable so its easier to distinguish against the rest of the code here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated according to the conversation we had, using manual bit op and added a comment pointing to the datasheet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. The last comments are for docs and TODO comments. After those are fixed up, this should be merged 😄
Great work @MichaelYKersey ! I know this took a very long time and a lot of effort!
d038b36
to
2b074b8
Compare
tla2528 driver and wrappers are working and tested only a few features are still to implemented:
CRC for data validationchannel id confirmation