Commit 8ac359f3 authored by galberding's avatar galberding
Browse files

Add apalDbgPrintf to analyze api

parent 0d252f92
......@@ -37,7 +37,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* @details Cutsom values can be set via alldconf.h file.
*/
#if !defined(VL53L1X_LLD_I2C_TIMEOUT) || defined(__DOXYGEN__)
# define VL53L1X_LLD_I2C_TIMEOUT ((apalTime_t)1000)
# define VL53L1X_LLD_I2C_TIMEOUT ((apalTime_t)5000)
#endif
/******************************************************************************/
......@@ -297,6 +297,15 @@ VL53L1_Error VL53L1_RdWord(VL53L1_Dev_t *pdev,uint16_t index, uint16_t *pdata)
// fill return value
*pdata = (((uint16_t)rxbuf[0]) << 8) &
(((uint16_t)rxbuf[1]) << 0);
apalDbgPrintf("[└─>] Word: %i\n", *pdata);
apalDbgPrintf("[└─>] sizeof(uint16_t): %i\n", sizeof(uint16_t));
apalDbgPrintf("[└─>] Index: %i\n", index);
apalDbgPrintf("[└─>] txbuf[0]: %i\n", txbuf[0]);
apalDbgPrintf("[└─>] txbuf[1]: %i\n", txbuf[1]);
apalDbgPrintf("[└─>] rxbuf[0]: %i\n", rxbuf[0]);
apalDbgPrintf("[└─>] rxbuf[1]: %i\n", rxbuf[1]);
/* apalDbgPrintf("[└─>] rxbuf1: %i\n", index); */
apalDbgPrintf("[└─>] Status: %i\n", status);
return (status == APAL_STATUS_OK || status > 0) ? VL53L1_ERROR_NONE :
(status == APAL_STATUS_TIMEOUT) ? VL53L1_ERROR_TIME_OUT : VL53L1_ERROR_UNDEFINED;
......@@ -665,6 +674,7 @@ apalExitStatus_t vl53l1x_lld_getState(VL53L1XDriver* vl53l1x, vl53l1x_lld_state_
apalExitStatus_t vl53l1x_lld_init(VL53L1XDriver* vl53l1x)
{
apalDbgAssert(vl53l1x != NULL);
apalDbgPrintf("Hello Init-----\n");
// local variables
apalExitStatus_t status;
......
......@@ -44,4 +44,5 @@ AMIROLLD_CSRC += $(AMIROLLD_ST_VL53L1X)alld_VL53L1X.c \
$(AMIROLLD_ST_VL53L1X)api/core/vl53l1_error_strings.c \
$(AMIROLLD_ST_VL53L1X)api/core/vl53l1_register_funcs.c \
$(AMIROLLD_ST_VL53L1X)api/core/vl53l1_silicon_core.c \
$(AMIROLLD_ST_VL53L1X)api/core/vl53l1_wait.c
$(AMIROLLD_ST_VL53L1X)api/core/vl53l1_wait.c
# $(AMIROLLD_ST_VL53L1X)api/platform/vl53l1_platform_log.c
......@@ -764,16 +764,19 @@ VL53L1_Error VL53L1_DataInit(VL53L1_DEV Dev)
/* 2V8 power mode selection codex 447463 */
#ifdef USE_I2C_2V8
apalDbgPrintf("[VL53L1_DataInit]: USE_I2C_2V8\n");
Status = VL53L1_RdByte(Dev, VL53L1_PAD_I2C_HV__EXTSUP_CONFIG, &i);
if (Status == VL53L1_ERROR_NONE) {
i = (i & 0xfe) | 0x01;
Status = VL53L1_WrByte(Dev, VL53L1_PAD_I2C_HV__EXTSUP_CONFIG,
i);
apalDbgPrintf("[VL53L1_DataInit | VL53L1_RdByte]: status = %i\n", Status);
}
#endif
if (Status == VL53L1_ERROR_NONE)
Status = VL53L1_data_init(Dev, 1);
apalDbgPrintf("[VL53L1_DataInit | VL53L1_data_init]: status = %i\n", Status);
if (Status == VL53L1_ERROR_NONE) {
VL53L1DevDataSet(Dev, PalState, VL53L1_STATE_WAIT_STATICINIT);
......@@ -2906,4 +2909,3 @@ VL53L1_Error VL53L1_GetThresholdConfig(VL53L1_DEV Dev,
/* End Group PAL IRQ Triggered events Functions */
......@@ -149,6 +149,47 @@ VL53L1_Error VL53L1_get_device_firmware_version(
#endif
/* void _printDriver(VL53L1_LLDriverData_t *pdev){ */
/* /\* Prints out the initial calibration data for debug *\/ */
/* VL53L1_print_static_nvm_managed( */
/* &(pdev->stat_nvm), */
/* "data_init():pdev->lldata.stat_nvm.", */
/* VL53L1_TRACE_MODULE_DATA_INIT); */
/* /\* apalDbgPrintf("[VL53L1_data_init]: status = %i\n", Status); *\/ */
/* VL53L1_print_customer_nvm_managed( */
/* &(pdev->customer), */
/* "data_init():pdev->lldata.customer.", */
/* VL53L1_TRACE_MODULE_DATA_INIT); */
/* VL53L1_print_nvm_copy_data( */
/* &(pdev->nvm_copy_data), */
/* "data_init():pdev->lldata.nvm_copy_data.", */
/* VL53L1_TRACE_MODULE_DATA_INIT); */
/* VL53L1_print_additional_offset_cal_data( */
/* &(pdev->add_off_cal_data), */
/* "data_init():pdev->lldata.add_off_cal_data.", */
/* VL53L1_TRACE_MODULE_DATA_INIT); */
/* VL53L1_print_user_zone( */
/* &(pdev->mm_roi), */
/* "data_init():pdev->lldata.mm_roi.", */
/* VL53L1_TRACE_MODULE_DATA_INIT); */
/* VL53L1_print_optical_centre( */
/* &(pdev->optical_centre), */
/* "data_init():pdev->lldata.optical_centre.", */
/* VL53L1_TRACE_MODULE_DATA_INIT); */
/* VL53L1_print_cal_peak_rate_map( */
/* &(pdev->cal_peak_rate_map), */
/* "data_init():pdev->lldata.cal_peak_rate_map.", */
/* VL53L1_TRACE_MODULE_DATA_INIT); */
/* } */
VL53L1_Error VL53L1_data_init(
VL53L1_DEV Dev,
uint8_t read_p2p_data)
......@@ -201,12 +242,14 @@ VL53L1_Error VL53L1_data_init(
if (read_p2p_data > 0 && status == VL53L1_ERROR_NONE) /*lint !e774 always true*/
status = VL53L1_read_p2p_data(Dev);
apalDbgPrintf("[VL53L1_data_init|Breaks Here]: status = %i\n", status);
/* Initialise Ref SPAD Char configuration structure */
#ifndef VL53L1_NOCALIB
status =
VL53L1_init_refspadchar_config_struct(
&(pdev->refspadchar));
/* apalDbgPrintf("[VL53L1_data_init|VL53L1_NOCALIB-config]: status = %i\n", status); */
#endif
/* Initialise SPAD Self Check (SSC) configuration structure */
......@@ -214,6 +257,7 @@ VL53L1_Error VL53L1_data_init(
status =
VL53L1_init_ssc_config_struct(
&(pdev->ssc_cfg));
/* apalDbgPrintf("[VL53L1_data_init|VL53L1_NOCALIB-selfcheck]: status = %i\n", status); */
#endif
/* Initialise Private Xtalk configuration structure
......@@ -223,13 +267,14 @@ VL53L1_Error VL53L1_data_init(
VL53L1_init_xtalk_config_struct(
&(pdev->customer),
&(pdev->xtalk_cfg));
/* apalDbgPrintf("[VL53L1_data_init|init-crosstalk]: status = %i\n", status); */
/* Initialise Offset Calibration configuration structure
*/
#ifndef VL53L1_NOCALIB
status =
VL53L1_init_offset_cal_config_struct(
&(pdev->offsetcal_cfg));
/* apalDbgPrintf("[VL53L1_data_init|init-crosstalk-struct]: status = %i\n", status); */
#endif
/* Initialise Tuning Parameter structure
......@@ -238,10 +283,11 @@ VL53L1_Error VL53L1_data_init(
status =
VL53L1_init_tuning_parm_storage_struct(
&(pdev->tuning_parms));
/* apalDbgPrintf("[VL53L1_data_init|tuningParameter]: status = %i\n", status); */
status = VL53L1_set_vhv_loopbound(Dev,
VL53L1_TUNINGPARM_VHV_LOOPBOUND_DEFAULT);
/* apalDbgPrintf("[VL53L1_data_init|set-VHV-loop]: status = %i\n", status); */
/*
* Initialise default settings - much happen *after*
* reading /setting of static_nvm_managed
......@@ -256,6 +302,7 @@ VL53L1_Error VL53L1_data_init(
pdev->mm_config_timeout_us,
pdev->range_config_timeout_us,
pdev->inter_measurement_period_ms);
apalDbgPrintf("[VL53L1_data_init|set-Preset-Mode]: status = %i\n", status);
/* Initial Low Power Auto Mode data structures */
/* Added for Patch_LowPowerAutoMode */
......@@ -331,23 +378,27 @@ VL53L1_Error VL53L1_read_p2p_data(
status = VL53L1_get_static_nvm_managed(
Dev,
&(pdev->stat_nvm));
/* apalDbgPrintf("[VL53L1_read_p2p_data|get_static_nvm]: status = %i\n", status); */
if (status == VL53L1_ERROR_NONE)
status = VL53L1_get_customer_nvm_managed(
Dev,
&(pdev->customer));
/* apalDbgPrintf("[VL53L1_read_p2p_data|get_customer_nvm]: status = %i\n", status); */
if (status == VL53L1_ERROR_NONE) {
status = VL53L1_get_nvm_copy_data(
Dev,
&(pdev->nvm_copy_data));
apalDbgPrintf("[VL53L1_read_p2p_data|nvm_copy|Fails Here!]: status = %i\n", status);
/* copy Return Good SPADs to buffer */
if (status == VL53L1_ERROR_NONE)
VL53L1_copy_rtn_good_spads_to_buffer(
&(pdev->nvm_copy_data),
&(pdev->rtn_good_spads[0]));
apalDbgPrintf("[VL53L1_read_p2p_data|copy_rtn]: status = %i\n", status);
}
/*
......@@ -360,7 +411,7 @@ VL53L1_Error VL53L1_read_p2p_data(
Dev,
VL53L1_RESULT__OSC_CALIBRATE_VAL,
&(pdev->dbg_results.result__osc_calibrate_val));
apalDbgPrintf("[-->ReadOSCcalib_val]: status = %i\n", status);
/*
* Check if there a sensible value for osc_measured__fast_osc__frequency
*/
......@@ -1410,9 +1461,8 @@ VL53L1_Error VL53L1_set_preset_mode(
default:
status = VL53L1_ERROR_INVALID_PARAMS;
break;
}
apalDbgPrintf("[-->SetPresetMode]: status = %i\n", status);
/* update DSS target */
if (status == VL53L1_ERROR_NONE) {
......@@ -1436,12 +1486,14 @@ VL53L1_Error VL53L1_set_preset_mode(
phasecal_config_timeout_us,
mm_config_timeout_us,
range_config_timeout_us);
apalDbgPrintf("[-->setTimeout]: status = %i\n", status);
if (status == VL53L1_ERROR_NONE)
status =
VL53L1_set_inter_measurement_period_ms(
Dev,
inter_measurement_period_ms);
apalDbgPrintf("[-->setInterMeasure]: status = %i\n", status);
LOG_FUNCTION_END(status);
......
......@@ -2422,12 +2422,14 @@ VL53L1_Error VL53L1_get_nvm_copy_data(
VL53L1_IDENTIFICATION__MODEL_ID,
comms_buffer,
VL53L1_NVM_COPY_DATA_I2C_SIZE_BYTES);
apalDbgPrintf("[VL53L1_get_nvm_copy_data|VL53L1_ReadMulti]: status = %i\n", status);
if (status == VL53L1_ERROR_NONE)
status = VL53L1_i2c_decode_nvm_copy_data(
VL53L1_NVM_COPY_DATA_I2C_SIZE_BYTES,
comms_buffer,
pdata);
apalDbgPrintf("[VL53L1_get_nvm_copy_data|i2c_decode_nvm]: status = %i\n", status);
LOG_FUNCTION_END(status);
......
......@@ -70,7 +70,7 @@
#ifndef _VL53L1_PLATFORM_LOG_H_
#define _VL53L1_PLATFORM_LOG_H_
/* #define VL53L1_LOG_ENABLE true */
#ifdef VL53L1_LOG_ENABLE
#include "vl53l1_platform_user_config.h"
......@@ -213,7 +213,7 @@
*
*/
uint32_t VL53L1_clock(void);
uint32_t VL53L1_clock(void);
#define LOG_GET_TIME() \
((int)VL53L1_clock())
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment