PCB抄板主程序,功能不多但程序却写的很臃肿,其内容如下:
- int main(void)
- {
- /* initialize the LEDs */
- led_init();
- /* configure systick */
- systick_config();
- /* flash the LEDs for 1 time */
- led_flash(1);
- /* configure EVAL_COM1 */
- gd_eval_com_init(EVAL_COM1);
- /* configure TAMPER key */
- gd_eval_key_init(KEY_WAKEUP, KEY_MODE_GPIO);
- /* output a message on hyperterminal using printf function */
- printf("\r\n USART printf example: please press the User key \r\n");
- /* wait for completion of USART transmission */
- while(RESET == usart_flag_get(EVAL_COM1, USART_FLAG_TC)){
- }
- while(1)
- {
- /* check if the user key is pressed */
- if(RESET == gd_eval_key_state_get(KEY_WAKEUP))
- {
- delay_1ms(50);
- if(RESET == gd_eval_key_state_get(KEY_WAKEUP))
- {
- delay_1ms(50);
- if(RESET == gd_eval_key_state_get(KEY_WAKEUP))
- {
- /* turn on LED1 */
- gd_eval_led_on(LED1);
- /* output a message on hyperterminal using printf function */
- printf("\r\n USART printf example \r\n");
- /* wait for completion of USART transmission */
- while(RESET == usart_flag_get(EVAL_COM1, USART_FLAG_TC)){
- }
- }
- else
- {
- /* turn off LED1 */
- gd_eval_led_off(LED1);
- }
- }
- else
- {
- /* turn off LED1 */
- gd_eval_led_off(LED1);
- }
- }
- else
- {
- /* turn off LED1 */
- gd_eval_led_off(LED1);
- }
- }