8x8 data @15Hz + sketch for processing
This commit is contained in:
1 parent
19d50b56fa
commit
06e6ec14b3
6 files changed
+220
-99
No files matched your search
@@ -12,7 +12,6 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "vl53l8cx_api.h"
|
||||
#include "vl53l8cx_buffers.h"
|
||||
|
||||
@@ -224,15 +223,10 @@ uint8_t vl53l8cx_is_alive(
|
||||
uint8_t status = VL53L8CX_STATUS_OK;
|
||||
uint8_t device_id, revision_id;
|
||||
|
||||
printf("Alive 1\n");
|
||||
status |= WrByte(&(p_dev->platform), 0x7fff, 0x00);
|
||||
printf("Alive 2\n");
|
||||
status |= RdByte(&(p_dev->platform), 0, &device_id);
|
||||
printf("Alive 3\n");
|
||||
status |= RdByte(&(p_dev->platform), 1, &revision_id);
|
||||
printf("Alive 4\n");
|
||||
status |= WrByte(&(p_dev->platform), 0x7fff, 0x02);
|
||||
printf("Alive 5\n");
|
||||
|
||||
if (!status) return status;
|
||||
|
||||
@@ -261,7 +255,6 @@ uint8_t vl53l8cx_init(
|
||||
p_dev->is_auto_stop_enabled = (uint8_t)0x0;
|
||||
|
||||
/* SW reboot sequence */
|
||||
printf("Init 0\n");
|
||||
status |= WrByte(&(p_dev->platform), 0x7fff, 0x00);
|
||||
status |= WrByte(&(p_dev->platform), 0x0009, 0x04);
|
||||
status |= WrByte(&(p_dev->platform), 0x000F, 0x40);
|
||||
@@ -269,8 +262,6 @@ uint8_t vl53l8cx_init(
|
||||
status |= RdByte(&(p_dev->platform), 0x7FFF, &tmp);
|
||||
status |= WrByte(&(p_dev->platform), 0x000C, 0x01);
|
||||
|
||||
printf("Init 1, %d\n", status);
|
||||
|
||||
status |= WrByte(&(p_dev->platform), 0x0101, 0x00);
|
||||
status |= WrByte(&(p_dev->platform), 0x0102, 0x00);
|
||||
status |= WrByte(&(p_dev->platform), 0x010A, 0x01);
|
||||
@@ -282,22 +273,17 @@ uint8_t vl53l8cx_init(
|
||||
status |= WrByte(&(p_dev->platform), 0x000F, 0x43);
|
||||
status |= WaitMs(&(p_dev->platform), 1);
|
||||
|
||||
printf("Init 2, %d\n", status);
|
||||
|
||||
status |= WrByte(&(p_dev->platform), 0x000F, 0x40);
|
||||
status |= WrByte(&(p_dev->platform), 0x000A, 0x01);
|
||||
status |= WaitMs(&(p_dev->platform), 100);
|
||||
|
||||
printf("Init 3, %d\n", status);
|
||||
|
||||
/* Wait for sensor booted (several ms required to get sensor ready ) */
|
||||
status |= WrByte(&(p_dev->platform), 0x7fff, 0x00);
|
||||
status |= _vl53l8cx_poll_for_answer(p_dev, 1, 0, 0x06, 0xff, 1);
|
||||
if(status != (uint8_t)0){
|
||||
goto exit;
|
||||
}
|
||||
printf("Init 4, %d\n", status);
|
||||
|
||||
|
||||
status |= WrByte(&(p_dev->platform), 0x000E, 0x01);
|
||||
status |= WrByte(&(p_dev->platform), 0x7fff, 0x02);
|
||||
|
||||
@@ -308,14 +294,10 @@ uint8_t vl53l8cx_init(
|
||||
|
||||
status |= WrByte(&(p_dev->platform), 0x7fff, 0x00);
|
||||
|
||||
printf("Init 5, %d\n", status);
|
||||
|
||||
/* Enable host access to GO1 */
|
||||
status |= RdByte(&(p_dev->platform), 0x7fff, &tmp);
|
||||
status |= WrByte(&(p_dev->platform), 0x0C, 0x01);
|
||||
|
||||
printf("Init 6, %d\n", status);
|
||||
|
||||
/* Power ON status */
|
||||
status |= WrByte(&(p_dev->platform), 0x7fff, 0x00);
|
||||
status |= WrByte(&(p_dev->platform), 0x101, 0x00);
|
||||
@@ -333,8 +315,6 @@ uint8_t vl53l8cx_init(
|
||||
status |= WrByte(&(p_dev->platform), 0x219, 0x00);
|
||||
status |= WrByte(&(p_dev->platform), 0x21B, 0x00);
|
||||
|
||||
printf("Init 7, %d\n", status);
|
||||
|
||||
/* Wake up MCU */
|
||||
status |= WrByte(&(p_dev->platform), 0x7fff, 0x00);
|
||||
status |= RdByte(&(p_dev->platform), 0x7fff, &tmp);
|
||||
@@ -342,28 +322,18 @@ uint8_t vl53l8cx_init(
|
||||
status |= WrByte(&(p_dev->platform), 0x20, 0x07);
|
||||
status |= WrByte(&(p_dev->platform), 0x20, 0x06);
|
||||
|
||||
printf("Init 8, %d\n", status);
|
||||
|
||||
/* Download FW into VL53L8CX */
|
||||
status |= WrByte(&(p_dev->platform), 0x7fff, 0x09);
|
||||
printf("Init 9, %d\n", status);
|
||||
status |= WrMulti(&(p_dev->platform),0,
|
||||
(uint8_t*)&VL53L8CX_FIRMWARE[0],0x8000);
|
||||
printf("Init 10, %d\n", status);
|
||||
status |= WrByte(&(p_dev->platform), 0x7fff, 0x0a);
|
||||
printf("Init 11, %d\n", status);
|
||||
status |= WrMulti(&(p_dev->platform),0,
|
||||
(uint8_t*)&VL53L8CX_FIRMWARE[0x8000],0x8000);
|
||||
printf("Init 12, %d\n", status);
|
||||
status |= WrByte(&(p_dev->platform), 0x7fff, 0x0b);
|
||||
printf("Init 13, %d\n", status);
|
||||
status |= WrMulti(&(p_dev->platform),0,
|
||||
(uint8_t*)&VL53L8CX_FIRMWARE[0x10000],0x5000);
|
||||
printf("Init 14, %d\n", status);
|
||||
status |= WrByte(&(p_dev->platform), 0x7fff, 0x01);
|
||||
|
||||
printf("Init 15, %d\n", status);
|
||||
|
||||
/* Check if FW correctly downloaded */
|
||||
status |= WrByte(&(p_dev->platform), 0x7fff, 0x01);
|
||||
status |= WrByte(&(p_dev->platform), 0x06, 0x03);
|
||||
@@ -373,8 +343,6 @@ uint8_t vl53l8cx_init(
|
||||
status |= RdByte(&(p_dev->platform), 0x7fff, &tmp);
|
||||
status |= WrByte(&(p_dev->platform), 0x0C, 0x01);
|
||||
|
||||
printf("Init 16, %d\n", status);
|
||||
|
||||
/* Reset MCU and wait boot */
|
||||
status |= WrByte(&(p_dev->platform), 0x7FFF, 0x00);
|
||||
status |= WrByte(&(p_dev->platform), 0x114, 0x00);
|
||||
@@ -386,8 +354,6 @@ uint8_t vl53l8cx_init(
|
||||
status |= WrByte(&(p_dev->platform), 0x0C, 0x00);
|
||||
status |= WrByte(&(p_dev->platform), 0x0B, 0x01);
|
||||
|
||||
printf("Init 1, %d\n", status);
|
||||
|
||||
status |= _vl53l8cx_poll_for_mcu_boot(p_dev);
|
||||
if(status != (uint8_t)0){
|
||||
goto exit;
|
||||
@@ -432,7 +398,6 @@ uint8_t vl53l8cx_init(
|
||||
status |= vl53l8cx_dci_write_data(p_dev, (uint8_t*)&pipe_ctrl,
|
||||
VL53L8CX_DCI_PIPE_CONTROL, (uint16_t)sizeof(pipe_ctrl));
|
||||
|
||||
printf("Init 1, %d\n", status);
|
||||
#if VL53L8CX_NB_TARGET_PER_ZONE != 1
|
||||
tmp = VL53L8CX_NB_TARGET_PER_ZONE;
|
||||
status |= vl53l8cx_dci_replace_data(p_dev, p_dev->temp_buffer,
|
||||
@@ -444,8 +409,6 @@ uint8_t vl53l8cx_init(
|
||||
VL53L8CX_DCI_SINGLE_RANGE,
|
||||
(uint16_t)sizeof(single_range));
|
||||
|
||||
printf("Init 1, %d\n", status);
|
||||
|
||||
exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user