generated from hulk/gd32e23x_template
delete IR Temperature sensor
This commit is contained in:
parent
5714a10061
commit
385b6fda17
@ -12,6 +12,8 @@
|
|||||||
// #define POWER_SUPPLY_12V
|
// #define POWER_SUPPLY_12V
|
||||||
#define POWER_SUPPLY_24V
|
#define POWER_SUPPLY_24V
|
||||||
|
|
||||||
|
// #define DEBUG_VOFA_TOOL
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
#ifdef POWER_SUPPLY_12V
|
#ifdef POWER_SUPPLY_12V
|
||||||
|
@ -35,5 +35,5 @@ void led_blink_config(void)
|
|||||||
|
|
||||||
timer_enable(LED_BLINK_TIMER);
|
timer_enable(LED_BLINK_TIMER);
|
||||||
|
|
||||||
nvic_irq_enable(LED_BLINK_IRQ, 2);
|
nvic_irq_enable(LED_BLINK_IRQ, 3U);
|
||||||
}
|
}
|
17
src/main.c
17
src/main.c
@ -25,26 +25,25 @@ int main(void)
|
|||||||
/* configure LED */
|
/* configure LED */
|
||||||
led_blink_config();
|
led_blink_config();
|
||||||
/* configure FWDGT */
|
/* configure FWDGT */
|
||||||
watchdog_init();
|
// watchdog_init();
|
||||||
|
|
||||||
#ifdef SOFTWARE_IIC
|
// #ifdef SOFTWARE_IIC
|
||||||
soft_i2c_config();
|
// soft_i2c_config();
|
||||||
#else
|
// #else
|
||||||
i2c_config();
|
// i2c_config();
|
||||||
#endif
|
// #endif
|
||||||
|
|
||||||
printf("system start!\r\n");
|
printf("system start!\r\n");
|
||||||
|
|
||||||
ultrasonic_config();
|
ultrasonic_config();
|
||||||
|
|
||||||
while(1){
|
while(1){
|
||||||
gd60914_get_object_tempture();
|
// gd60914_get_object_tempture();
|
||||||
|
|
||||||
delay_ms(50);
|
delay_ms(50);
|
||||||
|
|
||||||
ultrasonic_pwm_out_cycles(ULTRASONIC_TX_CYCLES);
|
ultrasonic_pwm_out_cycles(ULTRASONIC_TX_CYCLES);
|
||||||
|
|
||||||
watchdog_reload();
|
// watchdog_reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,6 +110,9 @@ void ultrasonic_distance_report(void) {
|
|||||||
|
|
||||||
distance_uint16 = ultrasonic_calc_distance();
|
distance_uint16 = ultrasonic_calc_distance();
|
||||||
|
|
||||||
|
#ifdef DEBUG_VOFA_TOOL
|
||||||
|
printf("%d\n", distance_uint16)
|
||||||
|
#else
|
||||||
package_data[0] = (distance_uint16 >> 8) & 0xFF;
|
package_data[0] = (distance_uint16 >> 8) & 0xFF;
|
||||||
package_data[1] = distance_uint16 & 0xFF;
|
package_data[1] = distance_uint16 & 0xFF;
|
||||||
|
|
||||||
@ -120,4 +123,5 @@ void ultrasonic_distance_report(void) {
|
|||||||
printf("%c%c%c", package_header[0], package_header[1], package_header[2]);
|
printf("%c%c%c", package_header[0], package_header[1], package_header[2]);
|
||||||
printf("%c%c", package_data[0], package_data[1]);
|
printf("%c%c", package_data[0], package_data[1]);
|
||||||
printf("%c", calculate_crc(combined_data, 6));
|
printf("%c", calculate_crc(combined_data, 6));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ void ultrasonic_config(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint16_t ultrasonic_calc_distance(void) {
|
uint16_t ultrasonic_calc_distance(void) {
|
||||||
while (!ultrasonicMeasurementDone);
|
// while (!ultrasonicMeasurementDone);
|
||||||
// uint32_t us_value = timer_channel_capture_value_register_read(US_ECHO_TIMER, US_ECHO_CH);
|
// uint32_t us_value = timer_channel_capture_value_register_read(US_ECHO_TIMER, US_ECHO_CH);
|
||||||
uint16_t distance = (TIME_CORRECTION_US + g_capture_value) * 17;
|
uint16_t distance = (TIME_CORRECTION_US + g_capture_value) * 17;
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user