-
Notifications
You must be signed in to change notification settings - Fork 1
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
Newnewfeat/pca #198
Newnewfeat/pca #198
Conversation
general/include/pca9539.h
Outdated
int pca9539_write_pin(pca9539_t *pca, uint8_t reg_type, uint8_t pin, | ||
uint8_t buf); | ||
|
||
/*IGNORE THIS CODE - SERVES AS A REFERENCE |
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.
Remove this code if its unused
uint16_t dev_addr; | ||
} pca9539_t; | ||
|
||
/// Init PCA9539, a 16 bit I2C GPIO expander | ||
void pca9539_init(pca9539_t *pca, I2C_HandleTypeDef *i2c_handle, | ||
void pca9539_init(pca9539_t *pca, WritePtr writeFunc, ReadPtr readFunc, |
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.
Doc comments are missing. Use doxygen, javadoc style comments seen in other repos.
general/src/pca9539.c
Outdated
@@ -4,30 +4,112 @@ | |||
|
|||
#define REG_SIZE_BITS 8 | |||
|
|||
HAL_StatusTypeDef pca_write_reg(pca9539_t *pca, uint16_t address, uint8_t *data) | |||
//RETURNS THE WRITE POINTER INSTEAD |
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 comment is confusing
general/src/pca9539.c
Outdated
pca->dev_addr = dev_addr << 1u; shifted one to the left cuz STM says so | ||
} | ||
*/ | ||
//Read PCA9539 Register |
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.
These comments aren't needed since they are already in the @brief section in the header file.
@@ -58,33 +51,30 @@ typedef struct { | |||
|
|||
void pca9539_init(pca9539_t *pca, WritePtr writeFunc, ReadPtr readFunc, | |||
uint8_t dev_addr); | |||
/** | |||
* @brief Initialize the PCA9539 Driver | |||
*/ |
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.
These also need to include definitions for parameters and return types. If you use VScode, you should get the doxygen extension. It autofills all that stuff for you.
general/include/pca9539.h
Outdated
* @param pca | ||
* @param writeFunc | ||
* @param readFunc | ||
* @param dev_addr |
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.
You should write what each of these mean, even if its completely obvious. Follow how doxygen comments are done in other codebases, like Cerb.
Changes
Added write and read function pointers, and made i2c_handler of unspecified void* pointer so that it may point to enum that is used in HAL. Experiencing issues in the pdu.c that doesnt reflect these changes, but outside of that it works.
Notes
Any other notes go here
Test Cases
To Do
Any remaining things that need to get done
Checklist
It can be helpful to check the
Checks
andFiles changed
tabs.Please reach out to your Project Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.
Closes #158 (issue #)