Updates to follow mbed SDK coding style guidelines.
Dependencies: ST_INTERFACES X_NUCLEO_COMMON
Dependents: 53L0A1_Satellites_with_Interrupts_OS5 Display_53L0A1_OS5
Fork of X_NUCLEO_53L0A1 by
Revision 21:627b65069e6d, committed 2017-06-28
- Comitter:
- JerrySzczurak
- Date:
- Wed Jun 28 12:23:03 2017 +0000
- Parent:
- 20:cf211a3b3d9e
- Commit message:
- Cosmetic changes to v53l0x class; wrWord and rdWord calls changed to write_word and read_word
Changed in this revision
Components/VL53L0X/vl53l0x_class.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Components/VL53L0X/vl53l0x_class.cpp Wed Jun 28 12:07:45 2017 +0000 +++ b/Components/VL53L0X/vl53l0x_class.cpp Wed Jun 28 12:23:03 2017 +0000 @@ -1547,7 +1547,7 @@ /* by default the I2C is running at 1V8 if you want to change it you * need to include this define at compilation level. */ #ifdef USE_I2C_2V8 - Status = VL53L0X_UpdateByte( Dev, + Status = vl53l0x_update_word( Dev, VL53L0X_REG_VHV_CONFIG_PAD_SCL_SDA__EXTSUP_HV, 0xFE, 0x01 ); @@ -2168,7 +2168,7 @@ // uint8_t count=0; // for (count = 0; count < 6; count++) -// status = VL53L0X_RdByte(Dev, (VL53L0X_REG_GLOBAL_CONFIG_SPAD_ENABLES_REF_0 + count), &refSpadArray[count]); +// status = vl53l0x_read_byte(Dev, (VL53L0X_REG_GLOBAL_CONFIG_SPAD_ENABLES_REF_0 + count), &refSpadArray[count]); return status; } @@ -5962,7 +5962,7 @@ LOG_FUNCTION_START( "" ); - status = VL53L0X_RdByte( dev, VL53L0X_REG_RESULT_RANGE_STATUS, + status = vl53l0x_read_byte( dev, VL53L0X_REG_RESULT_RANGE_STATUS, &range_status ); *p_device_error_status = ( VL53L0X_DeviceError )( ( range_status & 0x78 ) >> 3 ); @@ -6051,31 +6051,31 @@ else data = 1; - status = VL53L0X_WrByte( dev, + status = vl53l0x_write_byte( dev, VL53L0X_REG_GPIO_HV_MUX_ACTIVE_HIGH, data ); } else if ( device_mode == VL53L0X_DEVICEMODE_GPIO_OSC ) { - status |= VL53L0X_WrByte( dev, 0xff, 0x01 ); - status |= VL53L0X_WrByte( dev, 0x00, 0x00 ); - - status |= VL53L0X_WrByte( dev, 0xff, 0x00 ); - status |= VL53L0X_WrByte( dev, 0x80, 0x01 ); - status |= VL53L0X_WrByte( dev, 0x85, 0x02 ); - - status |= VL53L0X_WrByte( dev, 0xff, 0x04 ); - status |= VL53L0X_WrByte( dev, 0xcd, 0x00 ); - status |= VL53L0X_WrByte( dev, 0xcc, 0x11 ); - - status |= VL53L0X_WrByte( dev, 0xff, 0x07 ); - status |= VL53L0X_WrByte( dev, 0xbe, 0x00 ); - - status |= VL53L0X_WrByte( dev, 0xff, 0x06 ); - status |= VL53L0X_WrByte( dev, 0xcc, 0x09 ); - - status |= VL53L0X_WrByte( dev, 0xff, 0x00 ); - status |= VL53L0X_WrByte( dev, 0xff, 0x01 ); - status |= VL53L0X_WrByte( dev, 0x00, 0x00 ); + status |= vl53l0x_write_byte( dev, 0xff, 0x01 ); + status |= vl53l0x_write_byte( dev, 0x00, 0x00 ); + + status |= vl53l0x_write_byte( dev, 0xff, 0x00 ); + status |= vl53l0x_write_byte( dev, 0x80, 0x01 ); + status |= vl53l0x_write_byte( dev, 0x85, 0x02 ); + + status |= vl53l0x_write_byte( dev, 0xff, 0x04 ); + status |= vl53l0x_write_byte( dev, 0xcd, 0x00 ); + status |= vl53l0x_write_byte( dev, 0xcc, 0x11 ); + + status |= vl53l0x_write_byte( dev, 0xff, 0x07 ); + status |= vl53l0x_write_byte( dev, 0xbe, 0x00 ); + + status |= vl53l0x_write_byte( dev, 0xff, 0x06 ); + status |= vl53l0x_write_byte( dev, 0xcc, 0x09 ); + + status |= vl53l0x_write_byte( dev, 0xff, 0x00 ); + status |= vl53l0x_write_byte( dev, 0xff, 0x01 ); + status |= vl53l0x_write_byte( dev, 0x00, 0x00 ); } else { @@ -6103,7 +6103,7 @@ } if ( status == VL53L0X_ERROR_NONE ) - status = VL53L0X_WrByte( dev, + status = vl53l0x_write_byte( dev, VL53L0X_REG_SYSTEM_INTERRUPT_CONFIG_GPIO, data ); if ( status == VL53L0X_ERROR_NONE ) { @@ -6112,7 +6112,7 @@ else data = ( uint8_t )( 1 << 4 ); - status = VL53L0X_UpdateByte( dev, + status = vl53l0x_update_byte( dev, VL53L0X_REG_GPIO_HV_MUX_ACTIVE_HIGH, 0xEF, data ); } @@ -6149,7 +6149,7 @@ if ( pin != 0 ) { status = VL53L0X_ERROR_GPIO_NOT_EXISTING; } else { - status = VL53L0X_RdByte( dev, + status = vl53l0x_read_byte( dev, VL53L0X_REG_SYSTEM_INTERRUPT_CONFIG_GPIO, &data ); } } @@ -6181,7 +6181,7 @@ } if ( status == VL53L0X_ERROR_NONE ) - status = VL53L0X_RdByte( dev, VL53L0X_REG_GPIO_HV_MUX_ACTIVE_HIGH, + status = vl53l0x_read_byte( dev, VL53L0X_REG_GPIO_HV_MUX_ACTIVE_HIGH, &data ); if ( status == VL53L0X_ERROR_NONE ) { @@ -6357,7 +6357,7 @@ if ( linearity_corrective_gain != 1000 ) { /* Disable FW Xtalk */ - status = VL53L0X_WrWord( dev, + status = vl53l0x_write_word( dev, VL53L0X_REG_CROSSTALK_COMPENSATION_PEAK_RATE_MCPS, 0 ); } } @@ -6521,7 +6521,7 @@ LOG_FUNCTION_START( "" ); /* Only level1 of Power mode exists */ - status = VL53L0X_RdByte( dev, 0x80, &byte ); + status = vl53l0x_read_byte( dev, 0x80, &byte ); if ( status == VL53L0X_ERROR_NONE ) { if ( byte == 1 ) { @@ -6548,7 +6548,7 @@ status = VL53L0X_ERROR_MODE_NOT_SUPPORTED; } else if ( power_mode == VL53L0X_POWERMODE_STANDBY_LEVEL1 ) { /* set the standby level1 of power mode */ - status = VL53L0X_WrByte( dev, 0x80, 0x00 ); + status = vl53l0x_write_byte( dev, 0x80, 0x00 ); if ( status == VL53L0X_ERROR_NONE ) { /* Set PAL State to standby */ PALDevDataSet( dev, PalState, VL53L0X_STATE_STANDBY ); @@ -6558,7 +6558,7 @@ } else { /* VL53L0X_POWERMODE_IDLE_LEVEL1 */ - status = VL53L0X_WrByte( dev, 0x80, 0x00 ); + status = vl53l0x_write_byte( dev, 0x80, 0x00 ); if ( status == VL53L0X_ERROR_NONE ) status = vl53l0x_static_init( dev ); @@ -6580,7 +6580,7 @@ LOG_FUNCTION_START( "" ); - status = VL53L0X_RdByte( dev, VL53L0X_REG_IDENTIFICATION_REVISION_ID, + status = vl53l0x_read_byte( dev, VL53L0X_REG_IDENTIFICATION_REVISION_ID, &revision_id ); *p_product_revision_major = 1; *p_product_revision_minor = ( revision_id & 0xF0 ) >> 4; @@ -6622,7 +6622,7 @@ uint8_t SequenceConfig = 0; LOG_FUNCTION_START( "" ); - status = VL53L0X_RdByte( dev, VL53L0X_REG_SYSTEM_SEQUENCE_CONFIG, + status = vl53l0x_read_byte( dev, VL53L0X_REG_SYSTEM_SEQUENCE_CONFIG, &SequenceConfig ); if ( status == VL53L0X_ERROR_NONE ) { @@ -6716,9 +6716,9 @@ byte = ( uint8_t )( spad_ambient_damper_factor & 0x00FF ); - status = VL53L0X_WrByte( dev, 0xFF, 0x01 ); - status |= VL53L0X_WrByte( dev, 0x42, byte ); - status |= VL53L0X_WrByte( dev, 0xFF, 0x00 ); + status = vl53l0x_write_byte( dev, 0xFF, 0x01 ); + status |= vl53l0x_write_byte( dev, 0x42, byte ); + status |= vl53l0x_write_byte( dev, 0xFF, 0x00 ); LOG_FUNCTION_END( status ); return status; @@ -6732,9 +6732,9 @@ uint8_t Byte; LOG_FUNCTION_START( "" ); - status = VL53L0X_WrByte( dev, 0xFF, 0x01 ); - status |= VL53L0X_RdByte( dev, 0x42, &Byte ); - status |= VL53L0X_WrByte( dev, 0xFF, 0x00 ); + status = vl53l0x_write_byte( dev, 0xFF, 0x01 ); + status |= vl53l0x_read_byte( dev, 0x42, &Byte ); + status |= vl53l0x_write_byte( dev, 0xFF, 0x00 ); *p_spad_ambient_damper_factor = ( uint16_t )Byte; LOG_FUNCTION_END( status ); @@ -6747,9 +6747,9 @@ VL53L0X_Error status = VL53L0X_ERROR_NONE; LOG_FUNCTION_START( "" ); - status = VL53L0X_WrByte( dev, 0xFF, 0x01 ); - status |= VL53L0X_WrWord( dev, 0x40, spad_ambient_damper_threshold ); - status |= VL53L0X_WrByte( dev, 0xFF, 0x00 ); + status = vl53l0x_write_byte( dev, 0xFF, 0x01 ); + status |= vl53l0x_write_word( dev, 0x40, spad_ambient_damper_threshold ); + status |= vl53l0x_write_byte( dev, 0xFF, 0x00 ); LOG_FUNCTION_END( status ); return status; @@ -6761,9 +6761,9 @@ VL53L0X_Error status = VL53L0X_ERROR_NONE; LOG_FUNCTION_START( "" ); - status = VL53L0X_WrByte( dev, 0xFF, 0x01 ); - status |= VL53L0X_RdWord( dev, 0x40, p_spad_ambient_damper_threshold ); - status |= VL53L0X_WrByte( dev, 0xFF, 0x00 ); + status = vl53l0x_write_byte( dev, 0xFF, 0x01 ); + status |= vl53l0x_read_word( dev, 0x40, p_spad_ambient_damper_threshold ); + status |= vl53l0x_write_byte( dev, 0xFF, 0x00 ); LOG_FUNCTION_END( status ); return status; @@ -6970,7 +6970,7 @@ } /* the following register has a format 3.13 */ - status = VL53L0X_WrWord( dev, + status = vl53l0x_write_word( dev, VL53L0X_REG_CROSSTALK_COMPENSATION_PEAK_RATE_MCPS, VL53L0X_FIXPOINT1616TOFIXPOINT313( temp_fix1616 ) ); @@ -7152,7 +7152,7 @@ data = 0; } - status = VL53L0X_WrWord( dev, + status = vl53l0x_write_word( dev, VL53L0X_REG_CROSSTALK_COMPENSATION_PEAK_RATE_MCPS, data ); if ( status == VL53L0X_ERROR_NONE ) { @@ -7186,32 +7186,32 @@ LOG_FUNCTION_START( "" ); /* Set reset bit */ - status = VL53L0X_WrByte( dev, VL53L0X_REG_SOFT_RESET_GO2_SOFT_RESET_N, + status = vl53l0x_write_byte( dev, VL53L0X_REG_SOFT_RESET_GO2_SOFT_RESET_N, 0x00 ); /* Wait for some time */ if ( status == VL53L0X_ERROR_NONE ) { do { - status = VL53L0X_RdByte( dev, + status = vl53l0x_read_byte( dev, VL53L0X_REG_IDENTIFICATION_MODEL_ID, &byte ); } while ( byte != 0x00 ); } - VL53L0X_PollingDelay( dev ); + vl53l0x_polling_delay( dev ); /* Release reset */ - status = VL53L0X_WrByte( dev, VL53L0X_REG_SOFT_RESET_GO2_SOFT_RESET_N, + status = vl53l0x_write_byte( dev, VL53L0X_REG_SOFT_RESET_GO2_SOFT_RESET_N, 0x01 ); /* Wait until correct boot-up of the device */ if ( status == VL53L0X_ERROR_NONE ) { do { - status = VL53L0X_RdByte( dev, + status = vl53l0x_read_byte( dev, VL53L0X_REG_IDENTIFICATION_MODEL_ID, &byte ); } while ( byte == 0x00 ); } - VL53L0X_PollingDelay( dev ); + vl53l0x_polling_delay( dev ); /* Set PAL State to VL53L0X_STATE_POWERDOWN */ if ( status == VL53L0X_ERROR_NONE ) @@ -7314,7 +7314,7 @@ LOG_FUNCTION_START( "" ); - status = VL53L0X_RdWord( dev, VL53L0X_REG_OSC_CALIBRATE_VAL, + status = vl53l0x_read_word( dev, VL53L0X_REG_OSC_CALIBRATE_VAL, &osc_calibrate_val ); if ( status == VL53L0X_ERROR_NONE ) { @@ -7326,7 +7326,7 @@ im_period_milli_seconds = inter_measurement_period_milli_seconds; } - status = VL53L0X_WrDWord( dev, + status = vl53l0x_write_dword( dev, VL53L0X_REG_SYSTEM_INTERMEASUREMENT_PERIOD, im_period_milli_seconds ); } @@ -7350,7 +7350,7 @@ LOG_FUNCTION_START( "" ); - status = VL53L0X_RdByte( dev, VL53L0X_REG_SYSTEM_SEQUENCE_CONFIG, &data ); + status = vl53l0x_read_byte( dev, VL53L0X_REG_SYSTEM_SEQUENCE_CONFIG, &data ); if ( wrap_around_check_enable == 0 ) { /* Disable wraparound */ data = data & 0x7F; @@ -7361,7 +7361,7 @@ wrap_around_check_enable_int = 1; } - status = VL53L0X_WrByte( dev, VL53L0X_REG_SYSTEM_SEQUENCE_CONFIG, data ); + status = vl53l0x_write_byte( dev, VL53L0X_REG_SYSTEM_SEQUENCE_CONFIG, data ); if ( status == VL53L0X_ERROR_NONE ) { PALDevDataSet( dev, SequenceConfig, data ); @@ -7390,7 +7390,7 @@ LOG_FUNCTION_START( "%d", ( int )Enable ); - status = VL53L0X_WrByte( dev, VL53L0X_REG_SYSTEM_RANGE_CONFIG, enable ); + status = vl53l0x_write_byte( dev, VL53L0X_REG_SYSTEM_RANGE_CONFIG, enable ); if ( status == VL53L0X_ERROR_NONE ) PALDevDataSet( dev, RangeFractionalEnable, enable );