-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Feature/rangefinder vl53l1x #6572
Feature/rangefinder vl53l1x #6572
Conversation
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.
I understand that this is a direct and trivial port of ST's library, but I would still suggest refactoring the code to at least the following:
- Remove functions that are never called
- Make all functions that are not intended to be called from outside this file
static
to make it easier for the linker
/** | ||
* @brief This function returns the SW driver version | ||
*/ | ||
VL53L1X_ERROR VL53L1X_GetSWVersion(VL53L1X_Version_t *pVersion); |
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 dead code, called from nowhere.
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 addressed in most recent commit
/** | ||
* @brief This function sets the sensor I2C address used in case multiple devices application, default address 0x52 | ||
*/ | ||
VL53L1X_ERROR VL53L1X_SetI2CAddress(busDevice_t * dev, uint8_t new_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.
Dead code
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 addressed in most recent commit
static void vl53l1x_Init(rangefinderDev_t * rangefinder) | ||
{ | ||
isInitialized = false; | ||
VL53L1X_SensorInit(rangefinder->busDev); |
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 don't we check thet VL53L1X_SensorInit
returned no error?
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 addressed in most recent commit
* @brief This function programs the interrupt polarity\n | ||
* 1=active high (default), 0=active low | ||
*/ | ||
VL53L1X_ERROR VL53L1X_SetInterruptPolarity(busDevice_t * dev, uint8_t IntPol); |
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.
Dead code
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 addressed in most recent commit
Hi, thanks for reply. I agree and will update the commit. |
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.
LGTM
I have ported the STM VL53L1X ULD API (STSW-IMG009) and tested on MATEK F722PX board successfully. I hope this is useful. I know VL53L0X is supported, but I had only the VL53L1X in my drawer.