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.
Dependencies: X_NUCLEO_COMMON ST_INTERFACES
Dependents: VL53L1CB_noshield_1sensor_polls_auton VL53L1CB_noshield_1sensor_interrupt_auton X_NUCLEO_53L1A2
src/spi_interface.cpp@18:0696efe39d08, 2021-07-21 (annotated)
- Committer:
- lugandc
- Date:
- Wed Jul 21 17:06:38 2021 +0200
- Revision:
- 18:0696efe39d08
- Parent:
- 0:3ac96e360672
Cleanup i2c functions, removed all bad references to L1X
Cleanup VL53L1CB class:
- i2c device object is passed in a consistent way in MyDevice structure
- removed useless functions
Updated VL53L1CB component driver with bare driver release 6.6.7 content
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| charlesmn | 0:3ac96e360672 | 1 | #include "ToF_I2C.h" |
| charlesmn | 0:3ac96e360672 | 2 | #include "spi_interface.h" |
| charlesmn | 0:3ac96e360672 | 3 | |
| charlesmn | 0:3ac96e360672 | 4 | |
| lugandc | 18:0696efe39d08 | 5 | /* This file is an interface between the c platform file and the mbed cpp files. */ |
| lugandc | 18:0696efe39d08 | 6 | |
| lugandc | 18:0696efe39d08 | 7 | int v53l1cb_i2c_write_if(void *dev_I2C, uint8_t* pBuffer, uint8_t DeviceAddr, uint16_t RegisterAddr, |
| charlesmn | 0:3ac96e360672 | 8 | uint16_t NumByteToWrite) |
| charlesmn | 0:3ac96e360672 | 9 | { |
| lugandc | 18:0696efe39d08 | 10 | int status = 0; |
| lugandc | 18:0696efe39d08 | 11 | ToF_DevI2C *I2C= (ToF_DevI2C*)dev_I2C; |
| lugandc | 18:0696efe39d08 | 12 | //I2C->frequency(400000); |
| lugandc | 18:0696efe39d08 | 13 | status = I2C->ToF_i2c_write(pBuffer, DeviceAddr, RegisterAddr, NumByteToWrite); |
| lugandc | 18:0696efe39d08 | 14 | return status; |
| charlesmn | 0:3ac96e360672 | 15 | } |
| charlesmn | 0:3ac96e360672 | 16 | |
| charlesmn | 0:3ac96e360672 | 17 | |
| charlesmn | 0:3ac96e360672 | 18 | |
| lugandc | 18:0696efe39d08 | 19 | int v53l1cb_i2c_read_if(void *dev_I2C, uint8_t* pBuffer, uint8_t DeviceAddr, uint16_t RegisterAddr, |
| charlesmn | 0:3ac96e360672 | 20 | uint16_t NumByteToRead) |
| charlesmn | 0:3ac96e360672 | 21 | { |
| lugandc | 18:0696efe39d08 | 22 | int status = 0; |
| lugandc | 18:0696efe39d08 | 23 | ToF_DevI2C *I2C= (ToF_DevI2C*)dev_I2C; |
| lugandc | 18:0696efe39d08 | 24 | // I2C->frequency(400000); |
| lugandc | 18:0696efe39d08 | 25 | status = I2C->ToF_i2c_read(pBuffer, DeviceAddr, RegisterAddr, NumByteToRead); |
| lugandc | 18:0696efe39d08 | 26 | return status; |
| charlesmn | 0:3ac96e360672 | 27 | } |
| charlesmn | 0:3ac96e360672 | 28 | |
| charlesmn | 0:3ac96e360672 | 29 | |
| charlesmn | 0:3ac96e360672 | 30 | int GetTickCount( |
| charlesmn | 0:3ac96e360672 | 31 | uint32_t *ptick_count_ms) |
| charlesmn | 0:3ac96e360672 | 32 | { |
| charlesmn | 0:3ac96e360672 | 33 | /* Returns current tick count in [ms] */ |
| charlesmn | 0:3ac96e360672 | 34 | int status = 0; |
| charlesmn | 0:3ac96e360672 | 35 | //*ptick_count_ms = timeGetTime(); |
| charlesmn | 0:3ac96e360672 | 36 | *ptick_count_ms = us_ticker_read() / 1000; |
| charlesmn | 0:3ac96e360672 | 37 | return status; |
| charlesmn | 0:3ac96e360672 | 38 | } |