yelvlab f67baed8c5 Revert "test"
This reverts commit f8a41af34410a7205a9a910d4ee0b3ef5269754f.
2025-01-20 15:25:56 +08:00

59 lines
1.2 KiB
C

/*!
\file main.c
\brief led spark with systick, USART print and key example
\version 2024-02-22, V2.1.0, firmware for GD32E23x
*/
#include "main.h"
volatile uint8_t g_temperature_uint8[2] = {0};
volatile uint16_t g_capture_value;
/*!
\brief main function
\param[in] none
\param[out] none
\retval none
*/
int main(void)
{
setbuf(stdout, NULL);
/* configure systick */
systick_config();
/* configure USART */
rs485_config();
/* configure LED */
led_blink_config();
/* configure FWDGT */
watchdog_init();
#ifdef SOFTWARE_IIC
soft_i2c_config();
#else
i2c_config();
#endif
printf("system start!\r\n");
ultrasonic_config();
while(1){
gd60914_get_object_tempture();
delay_ms(50);
ultrasonic_pwm_out_cycles(ULTRASONIC_TX_CYCLES);
watchdog_reload();
}
}
/* retarget the C library printf function to the USART */
int _write(int fd, char *pBuffer, int size) {
for (int i = 0; i < size; i++) {
usart_data_transmit(USART0, (uint8_t) pBuffer[i]);
while (RESET == usart_flag_get(USART0, USART_FLAG_TBE));
}
return size;
}