generated from hulk/gd32e23x_template_cmake_vscode
Simplify the use of timers, timer13 sends ultrasonic waves, timer16 counts (debounce time and flight time)
The ultrasonic transducer is driven only after each command is issued.
This commit is contained in:
11
Src/main.c
11
Src/main.c
@@ -38,10 +38,11 @@ OF SUCH DAMAGE.
|
||||
#include "led.h"
|
||||
#include "command.h"
|
||||
#include <stdio.h>
|
||||
#include "i2c.h"
|
||||
#include "board_config.h"
|
||||
#include "ultrasonic_analog.h"
|
||||
|
||||
// #define FLASH_SIZE_ADDR (*(const uint16_t *)0x1FFFF7E0)
|
||||
|
||||
/*!
|
||||
\brief main function
|
||||
\param[in] none
|
||||
@@ -58,6 +59,7 @@ int main(void)
|
||||
|
||||
led_init();
|
||||
ultrasonic_config();
|
||||
ultrasonic_pwm_out_cycles();
|
||||
|
||||
#ifdef DEBUG_VERBOSE
|
||||
char hello_world[] = {"Hello World!\r\n"};
|
||||
@@ -73,14 +75,7 @@ int main(void)
|
||||
|
||||
|
||||
while(1){
|
||||
|
||||
// ultrasonic_pwm_out_cycles();
|
||||
|
||||
// delay_ms(10);
|
||||
command_process();
|
||||
delay_ms(10);
|
||||
// uint16_t ultrasonic_value = ultrasonic_calc_distance();
|
||||
// printf("ultrasonic value: %d", ultrasonic_value);
|
||||
// delay_ms(10);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user