src/vl53l1x.cpp
uint32_t Vl53l1x::calcMacroPeriod(uint8_t vcsel_period)
{
  // from VL53L1_calc_pll_period_us()
  // fast osc frequency in 4.12 format; PLL period in 0.24 format
  uint32_t pll_period_us = ((uint32_t)0x01 << 30) / fast_osc_frequency;

  // from VL53L1_decode_vcsel_period()
  uint8_t vcsel_period_pclks = (vcsel_period + 1) << 1;

  // VL53L1_MACRO_PERIOD_VCSEL_PERIODS = 2304
  uint32_t macro_period_us = (uint32_t)2304 * pll_period_us;
  macro_period_us >>= 6;
  macro_period_us *= vcsel_period_pclks;
  macro_period_us >>= 6;

  return macro_period_us;
}
// Calculate macro period in microseconds (12.12 format) with given VCSEL period
// assumes fast_osc_frequency has been read and stored
// based on VL53L1_calc_macro_period_us()
Calculate macro period in microseconds (12.12 format) with given VCSEL period
assumes fast_osc_frequency has been read and stored
based on VL53L1_calc_macro_period_us()
Calculate macro period in microseconds ( 12 . 12 format ) with given VCSEL period assumes fast_osc_frequency has been read and stored based on VL53L1_calc_macro_period_us ()
uint32_t Vl53l1x::calcMacroPeriod(uint8_t vcsel_period)
{
  uint32_t pll_period_us = ((uint32_t)0x01 << 30) / fast_osc_frequency;
  uint8_t vcsel_period_pclks = (vcsel_period + 1) << 1;
  uint32_t macro_period_us = (uint32_t)2304 * pll_period_us;
  macro_period_us >>= 6;
  macro_period_us *= vcsel_period_pclks;
  macro_period_us >>= 6;
  return macro_period_us;
}
uint32_t Vl53l1x :: calcMacroPeriod ( uint8_t vcsel_period ) { uint32_t pll_period_us = ( ( uint32_t ) 0x01 << 30 ) / fast_osc_frequency ; uint8_t vcsel_period_pclks = ( vcsel_period + 1 ) << 1 ; uint32_t macro_period_us = ( uint32_t ) 2304 * pll_period_us ; macro_period_us >>= 6 ; macro_period_us *= vcsel_period_pclks ; macro_period_us >>= 6 ; return macro_period_us ; }
Calculate macro period in microseconds (12.12 format) with given VCSEL period
assumes fast_osc_frequency has been read and stored
based on VL53L1_calc_macro_period_us()
Calculate macro period in microseconds ( 12 . 12 format ) with given VCSEL period assumes fast_osc_frequency has been read and stored based on VL53L1_calc_macro_period_us ()
// from VL53L1_calc_pll_period_us() // fast osc frequency in 4.12 format; PLL period in 0.24 format // from VL53L1_decode_vcsel_period() // VL53L1_MACRO_PERIOD_VCSEL_PERIODS = 2304