feat: 增加vl53l0x驱动
This commit is contained in:
@@ -1,27 +1,27 @@
|
||||
/* add user code begin Header */
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file main.c
|
||||
* @brief main program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
* Artery authorizes customers to use, copy, and distribute the BSP
|
||||
* software and its related documentation for the purpose of design and
|
||||
* development in conjunction with Artery microcontrollers. Use of the
|
||||
* software is governed by this copyright notice and the following disclaimer.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
|
||||
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
|
||||
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
|
||||
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
|
||||
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
**************************************************************************
|
||||
* @file main.c
|
||||
* @brief main program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
* Artery authorizes customers to use, copy, and distribute the BSP
|
||||
* software and its related documentation for the purpose of design and
|
||||
* development in conjunction with Artery microcontrollers. Use of the
|
||||
* software is governed by this copyright notice and the following disclaimer.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
|
||||
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
|
||||
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
|
||||
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
|
||||
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
/* add user code end Header */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
@@ -29,7 +29,9 @@
|
||||
|
||||
/* private includes ----------------------------------------------------------*/
|
||||
/* add user code begin private includes */
|
||||
|
||||
#include "vl53l0x_wmd_api.h"
|
||||
#include "by_debug.h"
|
||||
#include "by_led.h"
|
||||
/* add user code end private includes */
|
||||
|
||||
/* private typedef -----------------------------------------------------------*/
|
||||
@@ -63,14 +65,14 @@
|
||||
/* add user code end 0 */
|
||||
|
||||
/**
|
||||
* @brief main function.
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
* @brief main function.
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
int main(void)
|
||||
{
|
||||
/* add user code begin 1 */
|
||||
|
||||
by_debug_init();
|
||||
/* add user code end 1 */
|
||||
|
||||
/* system clock config. */
|
||||
@@ -88,9 +90,6 @@ int main(void)
|
||||
/* init usart2 function. */
|
||||
wk_usart2_init();
|
||||
|
||||
/* init i2c1 function. */
|
||||
wk_i2c1_init();
|
||||
|
||||
/* init tmr4 function. */
|
||||
wk_tmr4_init();
|
||||
|
||||
@@ -104,13 +103,27 @@ int main(void)
|
||||
wk_gpio_config();
|
||||
|
||||
/* add user code begin 2 */
|
||||
delay_init();
|
||||
by_led_set(10);
|
||||
delay_ms(1000);
|
||||
VL53L0X_Init();
|
||||
delay_ms(1000);
|
||||
|
||||
by_led_set(0);
|
||||
/* add user code end 2 */
|
||||
|
||||
while(1)
|
||||
{
|
||||
while (1) {
|
||||
/* add user code begin 3 */
|
||||
|
||||
// gpio_bits_write(GPIOB, GPIO_PINS_8, !gpio_output_data_bit_read(GPIOB, GPIO_PINS_8));
|
||||
// gpio_bits_set(GPIOA, GPIO_PINS_4);
|
||||
// delay_ms(250);
|
||||
// gpio_bits_reset(GPIOA, GPIO_PINS_4);
|
||||
// delay_ms(250);
|
||||
by_led_set(40);
|
||||
delay_ms(10);
|
||||
LOGI("distance:%d", VL53L0X_GetValue());
|
||||
by_led_set(0);
|
||||
delay_ms(10);
|
||||
/* add user code end 3 */
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user