vl53l1.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef VL53L1_H
  2. #define VL53L1_H
  3. #include "vl53l1_api.h"
  4. #include "SEGGER_RTT.h"
  5. #define printf(...) SEGGER_RTT_printf(0, __VA_ARGS__)
  6. //detection mode
  7. #define DEFAULT_MODE 0 //default,see manul 5.3.1
  8. #define HIGH_ACCURACY 1
  9. #define LONG_RANGE 2
  10. #define HIGH_SPEED 3
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. //param struct for vl53l1x mode option, in manual 6.2
  15. typedef __packed struct
  16. {
  17. FixPoint1616_t signalLimit; //Signal,related to reflected amplitude
  18. FixPoint1616_t sigmaLimit; //Sigmal, related to distance mm
  19. // FixPoint1616_t ignoreThres; //ignore threshold
  20. uint32_t timingBudget; //When the ranging mode is set to timed ranging, user has to define the period of time
  21. //between two consecutive measurements.
  22. uint8_t preRangeVcselPeriod ; //VCSEL pulse cycle
  23. uint8_t finalRangeVcselPeriod ;//VCSEL pulse cycle period
  24. }mode_data;
  25. VL53L1_Error VL53L1Init(VL53L1_Dev_t* pDev);
  26. VL53L1_Error VL53InitParam(VL53L1_Dev_t* pDev,uint8_t mode);
  27. VL53L1_Error VL53Cali(VL53L1_Dev_t* pDev,void * save);
  28. VL53L1_Error getDistance(VL53L1_Dev_t* pDev);
  29. //add by lwy
  30. VL53L1_Error VL53L1Init_Roi(VL53L1_Dev_t* pDev,VL53L1_DistanceModes ROI_DistanceMode);
  31. VL53L1_Error VL53InitParam_Roi(VL53L1_Dev_t* pDev,uint32_t ROI_TimingBudgetMicroSeconds, uint32_t ROI_InterMeasurementPeriodMilliSeconds, VL53L1_UserRoi_t *roi_zone);
  32. VL53L1_Error getDistanceByRoi(VL53L1_Dev_t* pDev, VL53L1_UserRoi_t *roi_zone, int32_t *return_distance);
  33. extern VL53L1_Dev_t VL53;
  34. extern int32_t distance;
  35. #ifdef __cplusplus
  36. }
  37. #endif
  38. #endif