Vl53L1x code (not enabled yet)

This commit is contained in:
whowechina 2024-09-22 10:50:57 +08:00
parent 226d517cc3
commit d366918aa0
8 changed files with 2130 additions and 6 deletions

View File

@ -18,7 +18,7 @@ Special thanks to community projects and developers.
* Robin Grosset (https://github.com/rgrosset/pico-pwm-audio)
* GEEKiDoS (https://github.com/GEEKiDoS/ongeeki-firmware)
* Pololu (https://github.com/pololu/vl53l0x-arduino)
* Pololu (https://github.com/pololu/vl53l0x-arduino, https://github.com/pololu/vl53l1x-arduino)
* RP_Silicon_KiCad: https://github.com/HeadBoffin/RP_Silicon_KiCad
* Type-C: https://github.com/ai03-2725/Type-C.pretty

View File

@ -17,7 +17,7 @@
特别感谢社区项目和开发者的帮助。
* Robin Grosset (https://github.com/rgrosset/pico-pwm-audio)
* GEEKiDoS (https://github.com/GEEKiDoS/ongeeki-firmware)
* Pololu (https://github.com/pololu/vl53l0x-arduino)
* Pololu (https://github.com/pololu/vl53l0x-arduino, https://github.com/pololu/vl53l1x-arduino)
* RP_Silicon_KiCad: https://github.com/HeadBoffin/RP_Silicon_KiCad
* Type-C: https://github.com/ai03-2725/Type-C.pretty

View File

@ -1,8 +1,8 @@
function(make_firmware board board_def)
pico_sdk_init()
add_executable(${board}
main.c light.c button.c lever.c sound.c airkey.c vl53l0x.c save.c config.c
commands.c cli.c hid.c usb_descriptors.c)
main.c light.c button.c lever.c sound.c airkey.c vl53l0x.c vl53l1x.c
save.c config.c commands.c cli.c hid.c usb_descriptors.c)
target_compile_definitions(${board} PUBLIC ${board_def})
pico_enable_stdio_usb(${board} 1)
pico_enable_stdio_uart(${board} 0)

View File

@ -16,6 +16,8 @@
#include "hardware/i2c.h"
#include "vl53l0x.h"
#include "vl53l1x.h"
#include "config.h"
#include "board_defs.h"

View File

@ -2,7 +2,7 @@
* VL53L0X Distance measurement sensor
* WHowe <github.com/whowechina>
*
* Most of this VL53L0X code is from https://github.com/pololu/vl53l0x-arduino
* Most of this code is from https://github.com/pololu/vl53l0x-arduino
*/
#include <stdint.h>

View File

@ -2,7 +2,7 @@
* VL53L0X Distance measurement sensor
* WHowe <github.com/whowechina>
*
* Most of this VL53L0X code is from https://github.com/pololu/vl53l0x-arduino
* Most of this code is from https://github.com/pololu/vl53l0x-arduino
*/
#ifndef VL53L0X_H

2084
firmware/src/vl53l1x.c Normal file

File diff suppressed because it is too large Load Diff

38
firmware/src/vl53l1x.h Normal file
View File

@ -0,0 +1,38 @@
/*
* VL53L1X Distance measurement sensor
* WHowe <github.com/whowechina>
*
* Most of this code is from https://github.com/pololu/vl53l0x-arduino
*/
#ifndef VL53L1X_H
#define VL53L1X_H
#include <stdint.h>
#include <stdbool.h>
#include "hardware/i2c.h"
void vl53l1x_init(unsigned index, i2c_inst_t *i2c_port, uint8_t i2c_addr);
void vl53l1x_use(unsigned index);
bool vl53l1x_is_present();
bool vl53l1x_init_tof();
typedef enum { Short, Medium, Long, Unknown } DistanceMode;
bool vl53l1x_setDistanceMode(DistanceMode mode);
DistanceMode vl53l1x_getDistanceMode();
bool vl53l1x_setMeasurementTimingBudget(uint32_t budget_us);
uint32_t vl53l1x_getMeasurementTimingBudget();
void vl53l1x_setROISize(uint8_t width, uint8_t height);
void vl53l1x_getROISize(uint8_t * width, uint8_t * height);
void vl53l1x_setROICenter(uint8_t spadNum);
uint8_t vl53l1x_getROICenter();
void vl53l1x_startContinuous(uint32_t period_ms);
void vl53l1x_stopContinuous();
uint16_t vl53l1x_readContinuousMillimeters();
//bool dataReady(); { return (readReg(GPIO__TIO_HV_STATUS) & 0x01) == 0; }
#endif