Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Check_VL6180XA1_ToF
Fork of X_NUCLEO_6180XA1 by
Diff: Components/VL6180X/vl6180x_class.cpp
- Revision:
- 15:454710d17358
- Parent:
- 14:0effa0bbf192
- Child:
- 16:0d4776564733
diff -r 0effa0bbf192 -r 454710d17358 Components/VL6180X/vl6180x_class.cpp
--- a/Components/VL6180X/vl6180x_class.cpp Mon Oct 19 13:54:17 2015 +0200
+++ b/Components/VL6180X/vl6180x_class.cpp Tue Oct 20 16:44:28 2015 +0200
@@ -2657,9 +2657,9 @@
int VL6180X::ReadID()
{
int status;
- uint8_t rl_id;
+ uint8_t rl_id=0;
- status=VL6180x_RdByte( Device, IDENTIFICATION_MODEL_ID, &rl_id);
+ status=VL6180x_RdByte(Device, IDENTIFICATION_MODEL_ID, &rl_id);
if((status==0)&&(rl_id==0xB4))
return status;
else
@@ -2670,11 +2670,12 @@
int VL6180X::InitSensor(uint8_t NewAddr) //FIXME printf da sostituire con VL6180x_ErrLog e poi specificare il contenuto di questa funzione
{
int status;
- uint16_t buf;
- uint8_t buffer;
VL6180x_Off();
VL6180x_On();
+ /*status=VL6180x_WaitDeviceBooted(Device);
+ if(status)
+ printf("WaitDeviceBooted fail\n\r");*/
status=IsPresent();
if(!status)
{
@@ -2682,32 +2683,32 @@
status=Init();
if(status)
{
- printf("Failed to init VL6180X sensor!\n");
+ printf("Failed to init VL6180X sensor!\n\r");
return status;
}
status=Prepare();
if(status)
{
- printf("Failed to prepare VL6180X!\n");
+ printf("Failed to prepare VL6180X!\n\r");
return status;
}
if(NewAddr!=DEFAULT_DEVICE_ADDRESS)
{
- //status=SetI2CAddress(NewAddr); //if new_addr!=addr_default else errore
+ status=SetI2CAddress(NewAddr);
if(status)
{
- printf("Failed to change I2C address!\n");
+ printf("Failed to change I2C address!\n\r");
return status;
}
}
else
{
- printf("Invalid new address!");
+ printf("Invalid new address!\n\r");
return INVALID_PARAMS;
}
Device->Ready=1;
}
- return status;
+ return status;
}
@@ -2758,8 +2759,8 @@
return (r_status|l_status);
case(als_continuous_interrupt):
- status=VL6180x_AlsConfigInterrupt(Device, CONFIG_GPIO_INTERRUPT_NEW_SAMPLE_READY);
- status=VL6180x_RangeConfigInterrupt(Device, CONFIG_GPIO_INTERRUPT_DISABLED);
+ l_status=VL6180x_AlsConfigInterrupt(Device, CONFIG_GPIO_INTERRUPT_NEW_SAMPLE_READY);
+ r_status=VL6180x_RangeConfigInterrupt(Device, CONFIG_GPIO_INTERRUPT_DISABLED);
if((!r_status)&&(!l_status))
return AlsMeasIntContinuousMode(fptr);
else
@@ -3069,7 +3070,7 @@
status=NOT_READY;
}
else
- VL6180x_ErrLog("Fail to get interrupt status");
+ VL6180x_ErrLog("Failed to get interrupt status");
return status;
}
@@ -3292,7 +3293,7 @@
}
else
{
- VL6180x_ErrLog("Fail to read RESULT_INTERRUPT_STATUS_GPIO");
+ VL6180x_ErrLog("Failed to read RESULT_INTERRUPT_STATUS_GPIO");
return status;
}
if((operating_mode==range_continuous_polling)||(operating_mode==range_continuous_interrupt))
@@ -3356,7 +3357,7 @@
status=VL6180x_AlsGetInterruptStatus(Device, &IntStatus);
if(status)
{
- VL6180x_ErrLog("Fail to read RESULT_INTERRUPT_STATUS_GPIO");
+ VL6180x_ErrLog("Failed to read RESULT_INTERRUPT_STATUS_GPIO");
return status;
}
if((operating_mode==als_continuous_polling)||(operating_mode==als_continuous_interrupt))
@@ -3424,7 +3425,7 @@
}
else
{
- VL6180x_ErrLog("Fail to read RESULT_INTERRUPT_STATUS_GPIO");
+ VL6180x_ErrLog("Failed to read RESULT_INTERRUPT_STATUS_GPIO");
return status;
}
