| 123456789101112131415161718192021222324252627282930313233343536 |
- /*!
- \file main.c
- \brief USART printf
- */
- /*
- Copyright (C) 2017 GigaDevice
- 2017-06-06, V1.0.0, firmware for GD32F3x0
- */
- #include "gd32f3x0.h"
- #include <stdio.h>
- #include "gd32f3x0_eval.h"
- /*!
- \brief main function
- \param[in] none
- \param[out] none
- \retval none
- */
- int main(void)
- {
- gd_eval_com_init(EVAL_COM1);
-
- printf("a usart transmit test example!");
- while (1);
- }
- /* retarget the C library printf function to the USART */
- int fputc(int ch, FILE *f)
- {
- usart_data_transmit(EVAL_COM1, (uint8_t) ch);
- while(RESET == usart_flag_get(EVAL_COM1, USART_FLAG_TBE));
- return ch;
- }
|